2011-04-26 23:42:47 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# Copyright (C) 2010-2011 Peter de Ridder <peter@xfce.org>
|
2012-02-09 00:12:11 +00:00
|
|
|
# Copyright (C) 2012 Paweł Forysiuk <tuxator@o2.pl>
|
2011-04-26 23:42:47 +00:00
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# See the file COPYING for the full license text.
|
|
|
|
|
2011-07-17 16:14:43 +00:00
|
|
|
# script: makedist.midori [version tag]
|
|
|
|
#
|
|
|
|
# This script creates an archive containing all required files for
|
|
|
|
# midori on windows. The midori version is inserted in the name of
|
|
|
|
# the archive and appended to the name of the root directory in the
|
|
|
|
# archive.
|
|
|
|
# The name of the archive is contructed as follows:
|
|
|
|
# midori<version tag>-<timestamp>.extension
|
|
|
|
# The archive contains a root directory named:
|
|
|
|
# midori<version tag>
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
# a bit of configuration
|
|
|
|
root_dir=$MINGW_PREFIX
|
|
|
|
|
2012-02-08 23:14:16 +00:00
|
|
|
if [ "$MINGW_PREFIX" == "" ]; then
|
2012-02-10 23:23:58 +00:00
|
|
|
echo "Warning! MINGW_PREFIX variable is empty!"
|
2012-02-08 23:14:16 +00:00
|
|
|
sleep 5s
|
|
|
|
fi
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
# create temporary working directory
|
|
|
|
temp_dir=`mktemp -d`
|
|
|
|
|
2011-07-17 16:14:43 +00:00
|
|
|
# check if we can use 7zip
|
|
|
|
have_7zip=`which 7za`
|
|
|
|
|
2012-06-26 16:56:06 +00:00
|
|
|
grep -q gtk-3.0 _build/config.log && GTK3_BUILD=1
|
2012-06-26 17:01:33 +00:00
|
|
|
version=`grep PACKAGE_VERSION _build/default/config.h | awk '{ print $3 $4; }' | sed 's@(debug)@-debug@g'|sed 's@"@@g'`
|
|
|
|
|
2012-02-08 23:31:13 +00:00
|
|
|
if [ "$1" != "" ]; then
|
2012-02-22 23:15:39 +00:00
|
|
|
if [ "$1" == "debug" ]; then
|
|
|
|
DEBUG_BUILD=1
|
2012-06-26 17:01:33 +00:00
|
|
|
shift
|
2012-02-22 23:15:39 +00:00
|
|
|
fi
|
2012-06-26 17:01:33 +00:00
|
|
|
version_tag="$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $version_tag != "" ]; then
|
|
|
|
version_tag=$version_tag-$version
|
|
|
|
else
|
|
|
|
version_tag=$version
|
2012-02-08 23:31:13 +00:00
|
|
|
fi
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
# generate unique filename
|
2011-07-17 16:14:43 +00:00
|
|
|
if [ "$have_7zip" != "" ]; then
|
2012-06-26 17:01:33 +00:00
|
|
|
ARCHIVE=midori-$version_tag-`date +%Y%m%d%H%M`.7z
|
2011-07-17 16:14:43 +00:00
|
|
|
else
|
2012-06-26 17:01:33 +00:00
|
|
|
ARCHIVE=midori-$version_tag-`date +%Y%m%d%H%M`.zip
|
2011-07-17 16:14:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# function: dll-recursive <list of exe and dll files ...>
|
|
|
|
#
|
|
|
|
# recursively search all dll dependencies of the input files.
|
|
|
|
# The resulting list of dll files including the input files is
|
|
|
|
# printed to stdout.
|
|
|
|
dll_recursive ()
|
|
|
|
{
|
|
|
|
temp_file_new=`mktemp`
|
|
|
|
temp_file_old=`mktemp`
|
|
|
|
|
|
|
|
while [ "$1" ]
|
|
|
|
do
|
|
|
|
echo $1 >> $temp_file_new
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
while [ "x`sha1sum - < $temp_file_new`" != "x`sha1sum - < $temp_file_old`" ]
|
|
|
|
do
|
|
|
|
files=`cat $temp_file_new $temp_file_old | sort | uniq -u`
|
2012-02-11 21:33:49 +00:00
|
|
|
cp -L $temp_file_new $temp_file_old
|
2011-07-17 16:14:43 +00:00
|
|
|
strings $files 2> /dev/null | grep \\.dll | cat - $temp_file_old | sort | uniq > $temp_file_new
|
|
|
|
done
|
|
|
|
|
|
|
|
cat $temp_file_new
|
|
|
|
|
|
|
|
rm $temp_file_new $temp_file_old
|
|
|
|
}
|
2011-04-26 23:42:47 +00:00
|
|
|
|
2012-02-09 00:12:11 +00:00
|
|
|
grab_files ()
|
|
|
|
{
|
|
|
|
local dir="$1"
|
|
|
|
pushd $root_dir > /dev/null
|
|
|
|
shift
|
|
|
|
while [ "$1" ]; do
|
2012-02-11 21:33:49 +00:00
|
|
|
find $dir "(" -name "$1" ")" -prune -exec mkdir -p $workdir/{} ";" -exec rmdir --ignore-fail-on-non-empty $workdir/{} ";" -exec cp -Lr {} $workdir/{} ";"
|
2012-02-09 00:12:11 +00:00
|
|
|
shift
|
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
echo -n "Creating $ARCHIVE ."
|
|
|
|
|
|
|
|
# create destination folder
|
2012-06-26 17:01:33 +00:00
|
|
|
workdir=$temp_dir/midori-$version_tag
|
2012-02-08 23:31:13 +00:00
|
|
|
mkdir $workdir
|
2011-04-26 23:42:47 +00:00
|
|
|
|
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# auto generate dll list, only of existing files
|
|
|
|
pushd $root_dir/bin > /dev/null
|
2011-07-17 16:14:43 +00:00
|
|
|
dll_recursive midori*.exe gspawn-*-helper*.exe libhunspell*.dll > $temp_dir/midori.exe.lst
|
2012-02-09 00:28:45 +00:00
|
|
|
dll_recursive ../lib/gio/modules/*.dll >> $temp_dir/midori.exe.lst
|
2012-02-27 00:13:58 +00:00
|
|
|
dll_recursive iconv.dll >> $temp_dir/midori.exe.lst
|
2012-04-14 21:58:05 +00:00
|
|
|
dll_recursive ../lib/gstreamer-0.10/*.dll >> $temp_dir/midori.exe.lst
|
2012-02-22 23:15:39 +00:00
|
|
|
|
|
|
|
if [ "$DEBUG_BUILD" != "" ]; then
|
|
|
|
dll_recursive gdb.exe GtkLauncher.exe >> $temp_dir/midori.exe.lst
|
|
|
|
fi
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
files=`ls | cat - $temp_dir/midori.exe.lst | sort | uniq -d`
|
|
|
|
rm $temp_dir/midori.exe.lst
|
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# copy auto generate dll list
|
|
|
|
pushd $root_dir/bin > /dev/null
|
2012-02-08 23:31:13 +00:00
|
|
|
mkdir $workdir/bin
|
2012-02-11 21:33:49 +00:00
|
|
|
cp -L $files $workdir/bin
|
2011-04-26 23:42:47 +00:00
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# copy etc
|
2012-02-09 00:12:11 +00:00
|
|
|
grab_files etc midori
|
|
|
|
grab_files etc gtkrc
|
2011-04-26 23:42:47 +00:00
|
|
|
|
2012-02-11 18:51:01 +00:00
|
|
|
# If modules are not compiled we need a list of them
|
|
|
|
grab_files etc pango
|
|
|
|
# Freetype is preferred font backend
|
|
|
|
# copy configuration, otherwise webkit will crash
|
|
|
|
grab_files etc fonts
|
|
|
|
|
2012-07-12 19:34:12 +00:00
|
|
|
# We need to ship our CA bundle for now
|
|
|
|
cp /etc/pki/tls/certs/ca-bundle.crt $workdir/share/midori/res/
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# copy lib
|
2012-06-26 16:56:06 +00:00
|
|
|
if [ "$GTK3_BUILD" == "1" ]; then
|
|
|
|
grab_files lib gtk-3.0
|
|
|
|
else
|
|
|
|
grab_files lib gtk-2.0
|
|
|
|
fi
|
|
|
|
|
2012-02-09 00:12:11 +00:00
|
|
|
grab_files lib midori
|
2012-02-26 22:52:43 +00:00
|
|
|
grab_files lib/engines "*"
|
2012-02-11 18:52:47 +00:00
|
|
|
grab_files lib gdk-pixbuf-2.0
|
2012-02-09 00:12:11 +00:00
|
|
|
|
|
|
|
grab_files lib enchant
|
2012-02-09 00:28:45 +00:00
|
|
|
grab_files lib gio
|
2011-04-26 23:42:47 +00:00
|
|
|
|
2012-02-11 01:59:20 +00:00
|
|
|
# Fedora ships on-demand pango modules, check just in case
|
|
|
|
grab_files lib pango
|
|
|
|
|
2012-04-14 21:58:05 +00:00
|
|
|
grab_files lib gstreamer-0.10
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# copy share
|
2012-02-09 00:12:11 +00:00
|
|
|
grab_files share midori
|
|
|
|
grab_files share icons
|
|
|
|
grab_files share MS-Windows
|
|
|
|
grab_files share mime
|
2012-02-26 23:34:26 +00:00
|
|
|
grab_files share midori.mo
|
2011-04-26 23:42:47 +00:00
|
|
|
|
2012-06-26 16:56:06 +00:00
|
|
|
if [ "$GTK3_BUILD" == "1" ]; then
|
|
|
|
grab_files share webkitgtk-3.0
|
|
|
|
grab_files share schemas
|
|
|
|
MO_VER=30
|
|
|
|
else
|
|
|
|
grab_files share webkitgtk-1.0
|
|
|
|
MO_VER=20
|
|
|
|
fi
|
2012-02-09 00:15:25 +00:00
|
|
|
|
2012-02-26 23:36:24 +00:00
|
|
|
if [ "$DEBUG_BUILD" == "" ];then
|
|
|
|
pushd $workdir > /dev/null
|
|
|
|
find -iname *.debug -exec rm {} \;
|
|
|
|
popd > /dev/null
|
2012-08-13 17:58:54 +00:00
|
|
|
else
|
|
|
|
#add some gdb helper scripts
|
|
|
|
cat > $workdir/bin/backtrace.gdb << _EOF
|
|
|
|
set logging on
|
|
|
|
set logging file debug.log
|
|
|
|
run
|
|
|
|
thread apply all bt
|
|
|
|
quit
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
echo 'gdb.exe --command=backtrace.gdb midori.exe' > $workdir/bin/debug.bat
|
|
|
|
|
2012-02-26 23:36:24 +00:00
|
|
|
fi
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
# copy locales for gtk
|
|
|
|
# so we have translated stock items, file dialogs
|
|
|
|
|
2012-02-26 23:34:26 +00:00
|
|
|
pushd $root_dir > /dev/null
|
2012-02-08 23:52:38 +00:00
|
|
|
find share "(" -name "midori.mo" ")" > $temp_dir/locale.list
|
2012-02-08 23:31:13 +00:00
|
|
|
mkdir -p $workdir/share/locale/
|
2012-02-26 23:34:26 +00:00
|
|
|
for LOCALE in $(cat $temp_dir/locale.list); do
|
2011-04-26 23:42:47 +00:00
|
|
|
LOCALE=$(echo $LOCALE|awk -F/ '{print $3}')
|
2012-06-26 16:56:06 +00:00
|
|
|
cp /usr/share/locale/$LOCALE/LC_MESSAGES/gtk$MO_VER.mo $workdir/share/locale/$LOCALE/LC_MESSAGES/
|
2011-04-26 23:42:47 +00:00
|
|
|
done
|
2012-02-08 23:52:38 +00:00
|
|
|
rm $temp_dir/locale.list
|
2012-02-26 23:30:49 +00:00
|
|
|
|
2012-06-26 16:56:06 +00:00
|
|
|
# we want to override default gtk settings
|
|
|
|
if [ "$GTK3_BUILD" == "1" ]; then
|
|
|
|
gtk_etc_dir="$workdir/etc/gtk-3.0/"
|
|
|
|
gtk_rc_file="$gtk_etc_dir/settings.ini"
|
|
|
|
else
|
|
|
|
gtk_etc_dir="$workdir/etc/gtk-2.0/"
|
|
|
|
gtk_rc_file="$gtk_etc_dir/gtkrc"
|
|
|
|
fi
|
|
|
|
|
2012-02-26 23:30:49 +00:00
|
|
|
mkdir -p $gtk_etc_dir
|
2012-06-26 16:56:06 +00:00
|
|
|
rm $gtk_rc_file
|
|
|
|
|
|
|
|
|
|
|
|
# Use small icons by default and Tango theme
|
|
|
|
if [ "$GTK3_BUILD" == "1" ]; then
|
|
|
|
|
|
|
|
cat > $gtk_rc_file << _EOF
|
|
|
|
[Settings]
|
2012-07-12 19:30:11 +00:00
|
|
|
gtk-icon-theme-name = Faenza
|
2012-06-26 16:56:06 +00:00
|
|
|
_EOF
|
|
|
|
|
|
|
|
else
|
|
|
|
cat > $gtk_rc_file << _EOF
|
2012-02-26 23:30:49 +00:00
|
|
|
gtk-theme-name = "MS-Windows"
|
2012-07-12 19:30:11 +00:00
|
|
|
gtk-icon-theme-name = "Faenza"
|
2012-06-26 16:56:06 +00:00
|
|
|
_EOF
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat >> $gtk_rc_file << _EOF
|
2012-02-26 23:30:49 +00:00
|
|
|
gtk-toolbar-style = GTK_TOOLBAR_ICONS
|
2012-06-26 16:56:06 +00:00
|
|
|
gtk-toolbar-icon-size = GTK_ICON_SIZE_MENU
|
2012-02-26 23:30:49 +00:00
|
|
|
_EOF
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# copy doc files to root
|
2012-02-11 21:33:49 +00:00
|
|
|
cp -L $workdir/share/doc/midori/{COPYING,AUTHORS} $workdir
|
2011-04-26 23:42:47 +00:00
|
|
|
|
|
|
|
echo -n .
|
|
|
|
|
2012-05-16 15:00:21 +00:00
|
|
|
#drop a/la files, we don't do static builds anyway
|
|
|
|
find $workdir -iname *.*a -exec rm {} \;
|
|
|
|
|
2011-04-26 23:42:47 +00:00
|
|
|
ARCHIVE=`pwd`/$ARCHIVE
|
|
|
|
|
2011-07-17 16:14:43 +00:00
|
|
|
# store as zip/7z file
|
2011-04-26 23:42:47 +00:00
|
|
|
pushd $temp_dir > /dev/null
|
2011-07-17 16:14:43 +00:00
|
|
|
if [ "$have_7zip" != "" ]; then
|
2012-06-26 17:01:33 +00:00
|
|
|
7za a -m0=lzma $ARCHIVE midori-$version_tag
|
2011-07-17 16:14:43 +00:00
|
|
|
else
|
2012-06-26 17:01:33 +00:00
|
|
|
zip -rq $ARCHIVE midori-$version_tag
|
2011-07-17 16:14:43 +00:00
|
|
|
fi
|
2011-04-26 23:42:47 +00:00
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
echo -n .
|
|
|
|
|
|
|
|
# remove working directory
|
|
|
|
rm -r $temp_dir
|
|
|
|
|
|
|
|
echo " ready"
|
|
|
|
|