From 9224c3c3912960e321d29875353cb166427060e6 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 23 Jun 2015 07:11:08 +0200 Subject: [PATCH] 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. --- .gitignore | 1 + configure.ac | 2 + geany.nsi => geany.nsi.in | 23 +++++++-- scripts/gtk-bundle-from-msys2.sh | 109 +++++++++++++++++++++++++++++++++++++++ wscript | 10 ++++ 5 files changed, 140 insertions(+), 5 deletions(-) rename geany.nsi => geany.nsi.in (96%) create mode 100644 scripts/gtk-bundle-from-msys2.sh diff --git a/.gitignore b/.gitignore index a664e0cec..0d579ae75 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ Makefile.in /geany.glade.bak /geany.gladep.bak /geany.pc +/geany.nsi /geany.spec /geany_private.res /global.tags.old diff --git a/configure.ac b/configure.ac index edf70ef69..73799d05a 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/geany.nsi b/geany.nsi.in similarity index 96% rename from geany.nsi rename to geany.nsi.in index ce5b171b0..4846c7794 100644 --- a/geany.nsi +++ b/geany.nsi.in @@ -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@.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" diff --git a/scripts/gtk-bundle-from-msys2.sh b/scripts/gtk-bundle-from-msys2.sh new file mode 100644 index 000000000..b6a586e08 --- /dev/null +++ b/scripts/gtk-bundle-from-msys2.sh @@ -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 <