diff --git a/mingw-w64-gobject-introspection/0001-Revert-Windows-port-Work-arount-MSYS-weirdness-where.patch b/mingw-w64-gobject-introspection/0001-Revert-Windows-port-Work-arount-MSYS-weirdness-where.patch new file mode 100644 index 0000000000..e125c405de --- /dev/null +++ b/mingw-w64-gobject-introspection/0001-Revert-Windows-port-Work-arount-MSYS-weirdness-where.patch @@ -0,0 +1,74 @@ +From 142020d1728dec78a0ffb97b636f459d3184a796 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Wed, 30 Dec 2015 17:28:58 +0000 +Subject: [PATCH] Revert "Windows port: Work arount MSYS weirdness where it + changes --libtool= command line arguments." + +A very old version of MSYS performed path normalization during conversion +so "/bin/sh ../../libtool" became "c:/opt/msys/1.0/bin/libtool" ("sh .." +was considered a single folder), it doesn't do this any more; nor does +MSYS2. + +Also, the old comment was incorrect. It claimed: +"This continues to reuse the LIBTOOL variable from automake if it's set, +but works around some MSYS weirdness: When running g-ir-scanner, MSYS +changes a command-line argument --libtool="/bin/sh ../../libtool" into +--libtool=c:/opt/msys/1.0/bin/libtool. So just use sh.exe without path +because we already "know" where the libtool configure produced is." + +.. yet the actual code was changed to: +_gir_libtool = $(if $(findstring MINGW,$(shell uname -s)),--libtool="$(top_builddir)/libtool",$(if $(LIBTOOL),--libtool="$(LIBTOOL)")) + +.. so in fact, if $(uname -s) contained "MINGW", then --libtool ignored +the LIBTOOL variable from automake and used $(top_builddir)/libtool +instead, at the very least, removing all trace of $(SHELL) from it. + +Now that $(SHELL) has been re-introduced into libtool, it must not +doubly appear in resolve_windows_libs in ccompiler.py, as otherwise +sh.exe will try to execute sh.exe and that clearly will not work. + +I've left some MSYS-specific hacks in dumper.py, some of which could +be removed (execution through a temporary shell script), but I've +opted to leave this, if only while I figure out why it currently +doesn't work on MSYS2. + +This reverts commit 33bbdce144d275b693752f0bc2c2f292deda854e. +--- + Makefile.introspection | 8 ++------ + giscanner/ccompiler.py | 1 - + 2 files changed, 2 insertions(+), 7 deletions(-) + +diff --git a/Makefile.introspection b/Makefile.introspection +index cd7bd1b..c28d734 100644 +--- a/Makefile.introspection ++++ b/Makefile.introspection +@@ -63,12 +63,8 @@ _gir_packages = $(foreach pkg,$($(_gir_name)_PACKAGES),--pkg=$(pkg)) + _gir_includes = $(foreach include,$($(_gir_name)_INCLUDES),--include=$(include)) + _gir_export_packages = $(foreach pkg,$($(_gir_name)_EXPORT_PACKAGES),--pkg-export=$(pkg)) + +-# Reuse the LIBTOOL variable from automake if it's set, but +-# work around MSYS weirdness: When running g-ir-scanner, MSYS changes +-# a command-line argument --libtool="/bin/sh ../../libtool" into +-# --libtool=c:/opt/msys/1.0/bin/libtool. So just use sh.exe without path +-# because we already "know" where the libtool configure produced is. +-_gir_libtool = $(if $(findstring MINGW,$(shell uname -s)),--libtool="$(top_builddir)/libtool",$(if $(LIBTOOL),--libtool="$(LIBTOOL)")) ++# Reuse the LIBTOOL variable from by automake if it's set ++_gir_libtool = $(if $(LIBTOOL),--libtool="$(LIBTOOL)") + + # Macros for AM_SILENT_RULES prettiness + _gir_verbosity = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1) +diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py +index 9b27f0e..f9b0b27 100644 +--- a/giscanner/ccompiler.py ++++ b/giscanner/ccompiler.py +@@ -277,7 +277,6 @@ class CCompiler(object): + else: + libtool = utils.get_libtool_command(options) + if libtool: +- args.append(utils.which(os.environ.get('SHELL', 'sh.exe'))) + args.extend(libtool) + args.append('--mode=execute') + # FIXME: it could have prefix (i686-w64-mingw32-dlltool.exe) +-- +2.6.3 + diff --git a/mingw-w64-gobject-introspection/PKGBUILD b/mingw-w64-gobject-introspection/PKGBUILD index 584cc209f9..26353dbca4 100644 --- a/mingw-w64-gobject-introspection/PKGBUILD +++ b/mingw-w64-gobject-introspection/PKGBUILD @@ -1,10 +1,58 @@ # Maintainer: Alexey Pavlov +# Maintainer: Ray Donnelly + +# How this works / currently doesn't work: +# Generally speaking, gobject-introspection creates a program that links to the +# library that's to be introspected then calling get_type(). +# This is done lib/gobject-introspection/giscanner/dumper.py +# .. with 'special' behaviour if MSYSTEM is set (may be why it succeeds from cmd.exe +# and when debugging it from QtCreator outside of launching it from an MSYS2 shell) +# +# It appears that '/usr/bin/sed' is getting called by mingw-w64-python, possibly via +# sh.exe (which should be fine) but possibly not (which would not be fine) ... +# +# arg E:/msys64/usr/bin/bash.exe File "E:/msys64/mingw64/bin/g-ir-scanner", line 58, in +# sys.exit(scanner_main(sys.argv)) +# File "E:/msys64/mingw64/bin/../lib/gobject-introspection/giscanner/scannermain.py", line 531, in scanner_main +# shlibs = create_binary(transformer, options, args) +# File "E:/msys64/mingw64/bin/../lib/gobject-introspection/giscanner/scannermain.py", line 412, in create_binary +# gdump_parser.get_error_quark_functions()) +# File "E:/msys64/mingw64/bin/../lib/gobject-introspection/giscanner/dumper.py", line 321, in compile_introspection_binary +# return dc.run() +# File "E:/msys64/mingw64/bin/../lib/gobject-introspection/giscanner/dumper.py", line 169, in run +# self._link(bin_path, introspection_obj) +# File "E:/msys64/mingw64/bin/../lib/gobject-introspection/giscanner/dumper.py", line 310, in _link +# subprocess.check_call(args) +# File "E:/msys64/mingw64/lib/python2.7/subprocess.py", line 535, in check_call +# retcode = call(*popenargs, **kwargs) +# File "E:/msys64/mingw64/lib/python2.7/subprocess.py", line 522, +# /usr/bin/sed +# : +# read error on +# stdin +# : +# Bad file descriptor +# 1 [main] sh 9004 child_info::sync: wait failed, pid 8772, Win32 error 0 +# 740 [main] sh 9004 fork: child -1 - forked process 8772 died unexpectedly, retry 0, exit code 0x1, errno 11 +# ../libtool: fork: retry: No child processes +# 1 [main] sh 8772 E:\msys64\usr\bin\sh.exe: *** fatal error in forked process - WFSO timed out after longjmp +# 824 [main] sh 8772 cygwin_exception::open_stackdumpfile: Dumping stack trace to sh.exe.stackdump +# 301000443 [main] sh 9004 child_info::sync: wait failed, pid 9188, Win32 error 0 +# 301001268 [main] sh 9004 fork: child -1 - forked process 9188 died unexpectedly, retry 0, exit code 0x1, errno 11 +# ../libtool: fork: retry: No child processes +# 301025432 [main] sh 9188 E:\msys64\usr\bin\sh.exe: *** fatal error in forked process - WFSO timed out after longjmp +# 301026255 [main] sh 9188 cygwin_exception::open_stackdumpfile: Dumping stack trace to sh.exe.stackdump +# 1 [main] sh 9720 child_info::sync: wait failed, pid 7896, Win32 error 0 + +# E:/msys64/usr/bin/bash.exe -c "cmd //C echo ../../gegl-0.3.4/gegl/gegl.h" +# _realname=gobject-introspection pkgbase=mingw-w64-${_realname} -pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}" "${MINGW_PACKAGE_PREFIX}-${_realname}-runtime") +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}" + "${MINGW_PACKAGE_PREFIX}-${_realname}-runtime") pkgver=1.46.0 -pkgrel=1 +pkgrel=2 arch=('any') url="https://live.gnome.org/GObjectIntrospection" license=("LGPL") @@ -14,9 +62,10 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-python2" "${MINGW_PACKAGE_PREFIX}-python2-mako") -options=('strip' 'staticlibs') - +# Building this in debug invokes pdb when things go wrong. +# options=('!strip' 'debug') source=(http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/${pkgver%.*}/${_realname}-${pkgver}.tar.xz + 0001-Revert-Windows-port-Work-arount-MSYS-weirdness-where.patch 0018-debug-rmtree-errors.mingw.patch 0021-tests-no-undefined.patch 0022-change-pkg-config-invocations.mingw.patch @@ -25,6 +74,7 @@ source=(http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/${pkgver%.* 0055-fix-python-detection.patch) md5sums=('adb40a31c7c80b65b0f4c8fd71b493dc' + '7e1e31fc1a3339bc2d45d4bdcee851fe' 'f0ecde986ebf1f0e28b752f9c36fb6c1' '69ef34e2f57abc8afe1b9f6fa3786e97' '8d3589fb959a0a68ce7ce9051fa441fe' @@ -34,12 +84,17 @@ md5sums=('adb40a31c7c80b65b0f4c8fd71b493dc' prepare() { cd ${srcdir}/${_realname}-${pkgver} - patch -p1 -i ${srcdir}/0018-debug-rmtree-errors.mingw.patch - patch -p1 -i ${srcdir}/0021-tests-no-undefined.patch - patch -p1 -i ${srcdir}/0022-change-pkg-config-invocations.mingw.patch - patch -p1 -i ${srcdir}/0024-Support-passing-arguments-to-g-ir-scanner-through-a-.all.patch - patch -p1 -i ${srcdir}/0050-dont-load-msvcrt.patch - patch -p1 -i ${srcdir}/0055-fix-python-detection.patch + patch -p1 -i "${srcdir}"/0001-Revert-Windows-port-Work-arount-MSYS-weirdness-where.patch + patch -p1 -i "${srcdir}"/0018-debug-rmtree-errors.mingw.patch + patch -p1 -i "${srcdir}"/0021-tests-no-undefined.patch + patch -p1 -i "${srcdir}"/0022-change-pkg-config-invocations.mingw.patch +# I assume this patch exists to prevent MSYS2 argument conversion from happening? I've disabled +# it for now as it's getting in the way of investigating other problems (it renames files I've +# changed in 0001-Revert.. so my changes there get lost. It would be nice to know the real goal +# of this patch. It could be commandline length. I think it's from LRN?) +# patch -p1 -i "${srcdir}"/0024-Support-passing-arguments-to-g-ir-scanner-through-a-.all.patch + patch -p1 -i "${srcdir}"/0050-dont-load-msvcrt.patch + patch -p1 -i "${srcdir}"/0055-fix-python-detection.patch autoreconf -fi } @@ -68,6 +123,25 @@ package_gobject-introspection() { cd "${srcdir}/build-${MINGW_CHOST}" make -j1 DESTDIR="${pkgdir}" install make -j1 DESTDIR="${pkgdir}" uninstall-libLTLIBRARIES uninstall-typelibsDATA + + # I've spent too long debugging gobject-introspection and it's too painful each + # time. Therefore, I've taken the decision to copy the .pyd also as a _d.pyd + # in-case I happen to be investigating it with a debug version of Python which + # only loads _d.pyd extensions. + # You will still have to rebuild this package after having built and installed + # the debug mingw-w64-python2 of course .. still one less thing to forget to + # remember. + # There will be a way to communicate the nature of the Python through to Autoconf + # and that would be better, but this will have to do for now. + # (see: + # @OS_WIN32_TRUE@ -shrext ".pyd" + # in gobject-introspection/Makefile.in) + PYDS=$(find "${pkgdir}" -name "*.pyd") + for PYD in "${PYDS}"; do + pushd $(dirname "${PYD}") + cp $(basename "${PYD}") $(basename "${PYD}" .pyd)_d.pyd + popd + done } package_gobject-introspection-runtime() {