[geany/geany] 9224c3: win32: run geany.nsi.in through automake to replace @GTK_VERSION@ variable

Thomas Martitz git-noreply at xxxxx
Sun Jul 5 16:28:09 UTC 2015


Branch:      refs/heads/master
Author:      Thomas Martitz <kugel at rockbox.org>
Committer:   Thomas Martitz <kugel at rockbox.org>
Date:        Sun, 05 Jul 2015 16:28:09 UTC
Commit:      9224c3c3912960e321d29875353cb166427060e6
             https://github.com/geany/geany/commit/9224c3c3912960e321d29875353cb166427060e6

Log Message:
-----------
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.


Modified Paths:
--------------
    .gitignore
    configure.ac
    geany.nsi.in
    scripts/gtk-bundle-from-msys2.sh
    wscript

Modified: .gitignore
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -39,6 +39,7 @@ Makefile.in
 /geany.glade.bak
 /geany.gladep.bak
 /geany.pc
+/geany.nsi
 /geany.spec
 /geany_private.res
 /global.tags.old


Modified: configure.ac
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -81,6 +81,7 @@ AC_SUBST([DEPENDENCIES], [$gtk_modules])
 AC_SUBST([GTK_CFLAGS])
 AC_SUBST([GTK_LIBS])
 GTK_VERSION=`$PKG_CONFIG --modversion $gtk_package`
+AC_SUBST([GTK_VERSION])
 GEANY_STATUS_ADD([Using GTK version], [${GTK_VERSION}])
 # GTHREAD checks
 gthread_modules="gthread-2.0"
@@ -155,6 +156,7 @@ AC_CONFIG_FILES([
 		doc/geany.1
 		geany.spec
 		geany.pc
+		geany.nsi
 		doc/Doxyfile
 		tests/Makefile
 		tests/ctags/Makefile


Modified: geany.nsi.in
23 lines changed, 18 insertions(+), 5 deletions(-)
===================================================================
@@ -32,8 +32,8 @@ RequestExecutionLevel highest ; set execution level for Windows Vista
 ; helper defines  ;
 ;;;;;;;;;;;;;;;;;;;
 !define PRODUCT_NAME "Geany"
-!define PRODUCT_VERSION "1.25"
-!define PRODUCT_VERSION_ID "1.25.0.0"
+!define PRODUCT_VERSION "@VERSION@"
+!define PRODUCT_VERSION_ID "@VERSION at .0.0"
 !define PRODUCT_PUBLISHER "The Geany developer team"
 !define PRODUCT_WEB_SITE "http://www.geany.org/"
 !define PRODUCT_DIR_REGKEY "Software\Geany"
@@ -42,6 +42,7 @@ RequestExecutionLevel highest ; set execution level for Windows Vista
 !define PRODUCT_REGNAME "Geany.ProjectFile"
 !define PRODUCT_EXT ".geany"
 !define RESOURCEDIR "geany-${PRODUCT_VERSION}"
+!define GTK_VERSION @GTK_VERSION@
 
 ;;;;;;;;;;;;;;;;;;;;;
 ; Version resource  ;
@@ -124,13 +125,17 @@ Section "!Program Files" SEC01
 
 	SetOutPath "$INSTDIR\bin"
 	File "${RESOURCEDIR}\bin\Geany.exe"
-	File "${RESOURCEDIR}\bin\Geany*.dll"
+	File "${RESOURCEDIR}\bin\*Geany*.dll"
 
 	SetOutPath "$INSTDIR\data"
 	File "${RESOURCEDIR}\data\GPL-2"
 	File "${RESOURCEDIR}\data\file*"
 	File "${RESOURCEDIR}\data\geany.glade"
+!if ${GTK_VERSION} >= 3
+	File "${RESOURCEDIR}\data\geany.css"
+!else
 	File "${RESOURCEDIR}\data\geany.gtkrc"
+!endif
 	File "${RESOURCEDIR}\data\snippets.conf"
 	File "${RESOURCEDIR}\data\ui_toolbar.xml"
 
@@ -205,7 +210,7 @@ SectionEnd
 
 ; Include GTK runtime library but only if desired from command line
 !ifdef INCLUDE_GTK
-Section "GTK 2.24 Runtime Environment" SEC06
+Section "GTK ${GTK_VERSION} Runtime Environment" SEC06
 	SectionIn 1
 	SetOverwrite ifnewer
 	SetOutPath "$INSTDIR\bin"
@@ -216,6 +221,14 @@ Section "GTK 2.24 Runtime Environment" SEC06
 	File /r "gtk\lib\*"
 	SetOutPath "$INSTDIR\share\themes"
 	File /r "gtk\share\themes\*"
+!if ${GTK_VERSION} >= 3
+	SetOutPath "$INSTDIR\share\icons"
+	File /r "gtk\share\icons\*"
+	SetOutPath "$INSTDIR\share\glib-2.0"
+	File /r "gtk\share\glib-2.0\*"
+	SetOutPath "$INSTDIR\share\gtk-3.0"
+	File /r "gtk\share\gtk-3.0\*"
+!endif
 SectionEnd
 !endif
 
@@ -326,7 +339,7 @@ SectionEnd
 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Manual in Text and HTML format."
 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Symbol lists necessary for auto completion of symbols."
 !ifdef INCLUDE_GTK
-!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "You need these files to run Geany. If you have already installed a GTK Runtime Environment (2.24 or higher), you can skip it."
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "You need these files to run Geany. If you have already installed a GTK Runtime Environment (${GTK_VERSION} or higher), you can skip it."
 !endif
 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "Add context menu item 'Open With Geany'"
 !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} "Create shortcuts for Geany on the desktop and in the Quicklaunch Bar"


Modified: scripts/gtk-bundle-from-msys2.sh
109 lines changed, 109 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,109 @@
+#!/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


Modified: wscript
10 lines changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -239,6 +239,7 @@ def configure(conf):
             mandatory=True, args='--cflags --libs')
     # remember GTK version for the build step
     conf.env['gtk_package_name'] = gtk_package_name
+    conf.env['gtk_version'] = gtk_version
     conf.env['minimum_gtk_version'] = minimum_gtk_version
     conf.env['use_gtk3'] = conf.options.use_gtk3
 
@@ -567,6 +568,15 @@ def build(bld):
                            'datadir': '${datarootdir}',
                            'localedir': '${datarootdir}/locale'})
 
+    # geany.nsi
+    bld(
+        features        = 'subst',
+        source          = 'geany.nsi.in',
+        target          = 'geany.nsi',
+        dct             = {'VERSION': VERSION,
+                           'GTK_VERSION': bld.env['gtk_version']},
+        install_path    = None)
+
     if not is_win32:
         # geany.desktop
         if bld.env['INTLTOOL']:



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list