geany/scripts/gtk-bundle-from-msys2.sh
Thomas Martitz 9224c3c391 win32: run geany.nsi.in through automake to replace @GTK_VERSION@ variable
This automatically keeps the installer's idea of Gtk version with the one
used to compile geany in sync.

Traditionally we use the bundles from gtk.org to compile geany, and this
is also used for the installer. With msys2, we can use precompiled
msys2 binaries. These exist for GTK3 as well so we can actually provide a
GTK3 based installer. The installer naturually should reflect this.
Msys2's GTK2 is also newer.

Use the new script gtk-bundle-from-msys2.sh to extract the precompiled
GTK binaries from msys2 / pacman for packing the installer (can also be
used to make a zip for sharing).

mkdir gtk; cd gtk; ../scripts/gtk-bundle-from-msys.sh [-c] [-z] [-2 | -3]

waf is also adapted to process geany.nsi.in. This implies geany.nsi is now
under _build_, not in the root anymore.
2015-07-05 18:28:09 +02:00

110 lines
1.9 KiB
Bash

#!/bin/sh
ABI=i686
GLIB=
ADW=
GTK=
use_cache="no"
make_zip="no"
gtkv="3"
for opt in "$@"; do
case "$opt" in
"-c"|"--cache")
use_cache="yes"
;;
"-z"|"--zip")
make_zip="yes"
;;
"-2")
gtkv="2"
;;
"-3")
gtkv="3"
;;
"-h"|"--help")
echo "gtk-bundle-from-msys2.sh [-c] [-z] [-2 | -3]"
echo " -c Use pacman cache. Otherwise pacman will download"
echo " archive files"
echo " -z Create a zip afterwards"
echo " -2 Prefer gtk2"
echo " -3 Prefer gtk3"
exit 1
;;
*)
cachedir="$opt"
;;
esac
done
if [ -z "$cachedir" ]; then
cachedir="/var/cache/pacman/pkg"
fi
if [ "$use_cache" = "yes" ] && ! [ -d "$cachedir" ]; then
echo "Cache dir \"$cachedir\" not a directory"
exit 1
fi
gtk="gtk$gtkv"
getpkg() {
if [ "$use_cache" = "yes" ]; then
ls $cachedir/mingw-w64-$ABI-$1-* | sort -V | tail -n 1
else
pacman -Sp mingw-w64-$ABI-$1
fi
}
GLIB=$(getpkg glib2)
ATK=$(getpkg atk)
PANGO=$(getpkg pango)
CAIRO=$(getpkg cairo)
ADW=$(getpkg adwaita-icon-theme)
GTK=$(getpkg $gtk)
cat <<EOF
Using:
glib: $GLIB
atk: $ATK
pango: $PANGO
cairo: $CAIRO
adwaita $ADW
$gtk: $GTK
EOF
for i in $GLIB $ATK $PANGO $CAURIO $ADW $GTK; do
if [ "$use_cache" = "yes" -a -e "$i" ]; then
echo "Extracting $i from cache"
tar xaf $i
else
echo "Download $i using curl"
curl -L "$i" | tar -x --xz
fi
echo "Running post_install script"
test -f .INSTALL && /bin/bash -c ". .INSTALL; post_install"
if [ "$make_zip" = "yes" -a "$i" = "$GTK" ]; then
VERSION=$(grep ^pkgver .PKGINFO | sed -e 's,^pkgver = ,,' -e 's,-.*$,,')
fi
rm -f .INSTALL .MTREE .PKGINFO
done
if [ -d mingw32 ]; then
for d in bin etc include lib locale share; do
rm -rf $d
mv mingw32/$d .
done
rmdir mingw32
fi
if [ "$make_zip" = "yes" ]; then
if [ -z "$VERSION" ]; then
VERSION="unknown-version"
fi
echo "Packing the bundle"
zip -r gtk-$VERSION.zip bin etc include lib locale share
fi