Improve API docs related to keybindings configuration file
[geany-mirror.git] / scripts / gtk-bundle-from-msys2.sh
blobb6a586e08f78da3ca0d1dec1b306b3eacf8e8427
1 #!/bin/sh
3 ABI=i686
5 GLIB=
6 ADW=
7 GTK=
9 use_cache="no"
10 make_zip="no"
11 gtkv="3"
13 for opt in "$@"; do
14 case "$opt" in
15 "-c"|"--cache")
16 use_cache="yes"
18 "-z"|"--zip")
19 make_zip="yes"
21 "-2")
22 gtkv="2"
24 "-3")
25 gtkv="3"
27 "-h"|"--help")
28 echo "gtk-bundle-from-msys2.sh [-c] [-z] [-2 | -3]"
29 echo " -c Use pacman cache. Otherwise pacman will download"
30 echo " archive files"
31 echo " -z Create a zip afterwards"
32 echo " -2 Prefer gtk2"
33 echo " -3 Prefer gtk3"
34 exit 1
37 cachedir="$opt"
39 esac
40 done
42 if [ -z "$cachedir" ]; then
43 cachedir="/var/cache/pacman/pkg"
46 if [ "$use_cache" = "yes" ] && ! [ -d "$cachedir" ]; then
47 echo "Cache dir \"$cachedir\" not a directory"
48 exit 1
51 gtk="gtk$gtkv"
53 getpkg() {
54 if [ "$use_cache" = "yes" ]; then
55 ls $cachedir/mingw-w64-$ABI-$1-* | sort -V | tail -n 1
56 else
57 pacman -Sp mingw-w64-$ABI-$1
61 GLIB=$(getpkg glib2)
62 ATK=$(getpkg atk)
63 PANGO=$(getpkg pango)
64 CAIRO=$(getpkg cairo)
65 ADW=$(getpkg adwaita-icon-theme)
66 GTK=$(getpkg $gtk)
68 cat <<EOF
69 Using:
70 glib: $GLIB
71 atk: $ATK
72 pango: $PANGO
73 cairo: $CAIRO
74 adwaita $ADW
75 $gtk: $GTK
76 EOF
79 for i in $GLIB $ATK $PANGO $CAURIO $ADW $GTK; do
80 if [ "$use_cache" = "yes" -a -e "$i" ]; then
81 echo "Extracting $i from cache"
82 tar xaf $i
83 else
84 echo "Download $i using curl"
85 curl -L "$i" | tar -x --xz
87 echo "Running post_install script"
88 test -f .INSTALL && /bin/bash -c ". .INSTALL; post_install"
89 if [ "$make_zip" = "yes" -a "$i" = "$GTK" ]; then
90 VERSION=$(grep ^pkgver .PKGINFO | sed -e 's,^pkgver = ,,' -e 's,-.*$,,')
92 rm -f .INSTALL .MTREE .PKGINFO
93 done
95 if [ -d mingw32 ]; then
96 for d in bin etc include lib locale share; do
97 rm -rf $d
98 mv mingw32/$d .
99 done
100 rmdir mingw32
103 if [ "$make_zip" = "yes" ]; then
104 if [ -z "$VERSION" ]; then
105 VERSION="unknown-version"
107 echo "Packing the bundle"
108 zip -r gtk-$VERSION.zip bin etc include lib locale share