[geany/geany] c5b864: Merge pull request #539 from kugel-/win32-fix

Colomban Wendling git-noreply at xxxxx
Tue Jul 7 15:34:43 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Tue, 07 Jul 2015 15:34:43 UTC
Commit:      c5b86474adccb2dbcbf4631e96631bb653dae759
             https://github.com/geany/geany/commit/c5b86474adccb2dbcbf4631e96631bb653dae759

Log Message:
-----------
Merge pull request #539 from kugel-/win32-fix

Win32 Autotools build and installer fixes.


Modified Paths:
--------------
    .gitignore
    Makefile.am
    configure.ac
    geany.nsi.in
    scripts/gtk-bundle-from-msys2.sh
    src/Makefile.am
    src/socket.c
    src/spawn.c
    src/win32.c
    src/win32defines.h
    win32-config.h
    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: Makefile.am
9 lines changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -44,6 +44,15 @@ uninstall-local:
 install-data-local:
 	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
 	$(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(pkgdatadir)/GPL-2
+if MINGW
+	$(INSTALL_DATA) $(srcdir)/AUTHORS $(DESTDIR)$(prefix)/Authors.txt
+	$(INSTALL_DATA) $(srcdir)/ChangeLog $(DESTDIR)$(prefix)/Changelog.txt
+	$(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(prefix)/Copying.txt
+	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(prefix)/Readme.txt
+	$(INSTALL_DATA) $(srcdir)/NEWS $(DESTDIR)$(prefix)/News.txt
+	$(INSTALL_DATA) $(srcdir)/THANKS $(DESTDIR)$(prefix)/Thanks.txt
+	$(INSTALL_DATA) $(srcdir)/TODO $(DESTDIR)$(prefix)/Todo.txt
+endif
 
 dist-hook:
 	@if test -d "$(top_srcdir)/.git"; then \


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: src/Makefile.am
8 lines changed, 5 insertions(+), 3 deletions(-)
===================================================================
@@ -26,9 +26,10 @@ lib_LTLIBRARIES = libgeany.la
 
 geany_SOURCES = main.c
 geany_LDADD = libgeany.la $(GTK_LIBS) $(GTHREAD_LIBS) $(INTLLIBS)
+geany_LDFLAGS =
 
 if ENABLE_BINRELOC
-geany_LDFLAGS = -Wl,-rpath='$$ORIGIN/../lib'
+geany_LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib'
 endif
 
 geany_includedir = $(includedir)/geany
@@ -147,11 +148,12 @@ WINDRES = $(host_alias)-windres
 geany_private.res: $(top_srcdir)/geany_private.rc
 	$(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff
 
-libgeany_la_SOURCES += win32.c win32.h
+libgeany_la_SOURCES += win32.c win32.h win32defines.h
 libgeany_la_LIBADD  += -lole32 -lwsock32 -lcomdlg32
 libgeany_la_LDFLAGS += -Wl,-luuid -mwindows -mms-bitfields -no-undefined
+geany_LDFLAGS       += -mwindows -mms-bitfields
 
-CLEANFILES += geany_private.res
+CLEANFILES          += geany_private.res
 
 else
 # build Geany for all other platforms


Modified: src/socket.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -79,6 +79,7 @@
 # include <netinet/in.h>
 # include <glib/gstdio.h>
 #else
+# include "win32defines.h"
 # include <winsock2.h>
 # include <windows.h>
 # include <gdk/gdkwin32.h>


Modified: src/spawn.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -49,6 +49,7 @@
 #include "spawn.h"
 
 #ifdef G_OS_WIN32
+# include "win32defines.h"
 # include <ctype.h>    /* isspace() */
 # include <fcntl.h>    /* _O_RDONLY, _O_WRONLY */
 # include <io.h>       /* _open_osfhandle, _close */


Modified: src/win32.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -31,6 +31,8 @@
 
 #ifdef G_OS_WIN32
 
+#include "win32defines.h"
+
 #include "dialogs.h"
 #include "document.h"
 #include "editor.h"
@@ -47,8 +49,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define VC_EXTRALEAN
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <commdlg.h>
 #include <shellapi.h>


Modified: src/win32defines.h
31 lines changed, 31 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,31 @@
+/*
+ *      win32defines.h - this file is part of Geany, a fast and lightweight IDE
+ *
+ *      This program is free software; you can redistribute it and/or modify
+ *      it under the terms of the GNU General Public License as published by
+ *      the Free Software Foundation; either version 2 of the License, or
+ *      (at your option) any later version.
+ *
+ *      This program is distributed in the hope that it will be useful,
+ *      but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *      GNU General Public License for more details.
+ *
+ *      You should have received a copy of the GNU General Public License along
+ *      with this program; if not, write to the Free Software Foundation, Inc.,
+ *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef WIN32DEFINES_H
+#define WIN32DEFINES_H 1
+
+/* These defines are necessary defines *before* windows.h is included */
+
+#define VC_EXTRALEAN
+#define WIN32_LEAN_AND_MEAN
+/* Need Windows XP for SHGetFolderPathAndSubDirW */
+#define WINVER 0x0501
+/* Needed for SHGFP_TYPE */
+#define _WIN32_IE 0x0500
+
+#endif /* WIN32DEFINES_H */


Modified: win32-config.h
6 lines changed, 0 insertions(+), 6 deletions(-)
===================================================================
@@ -317,9 +317,3 @@
 
 /* Define if you want to detect a running instance */
 #define HAVE_SOCKET 1
-
-// Need Windows XP for SHGetFolderPathAndSubDirW
-#define WINVER 0x0501
-
-// Needed for SHGFP_TYPE
-#define _WIN32_IE 0x0500


Modified: wscript
13 lines changed, 10 insertions(+), 3 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
 
@@ -274,9 +275,6 @@ but you then may not have a local copy of the HTML manual.'''
             '-static-libgcc',
             '-static-libstdc++'])
         conf.env.append_value('LIB_WIN32', ['wsock32', 'uuid', 'ole32', 'comdlg32'])
-        # explicitly define Windows version for older Mingw environments
-        conf.define('WINVER', '0x0501', quote=False)  # for SHGetFolderPathAndSubDirW
-        conf.define('_WIN32_IE', '0x0500', quote=False)  # for SHGFP_TYPE
     else:
         conf.env['cshlib_PATTERN'] = '%s.so'
         # DATADIR and LOCALEDIR are defined by the intltool tool
@@ -570,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