MinGW/MSYS patches for gobject-introspection (dieterv's branch)



Hi,

I am a bit unsure of protocol, so correct me if needed.

Attached are three patches that I used to get g-i to work in my MinGW/MSYS setup without apparent problems.
I have added Subjects to each - let me know if more information are needed.

Comments/feedback are welcome.


Regards,
Martin



Vrywaringsklousule / Disclaimer:  http://www.nwu.ac.za/it/gov-man/disclaimer.html 

>From a30e66099fb3abe2807c23a2006532acaca270d5 Mon Sep 17 00:00:00 2001
From: Martin Schlemmer <Martin Schlemmer nwu ac za>
Date: Thu, 12 Jul 2012 11:27:06 +0200
Subject: [PATCH 1/3] Windows port: add $(EXEEXT) fixing parallel builds

---
 Makefile-gir.am | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile-gir.am b/Makefile-gir.am
index 364d5ec..2afdc62 100644
--- a/Makefile-gir.am
+++ b/Makefile-gir.am
@@ -26,17 +26,17 @@ CLEANFILES += gir/cairo-1.0.gir
 EXTRA_DIST += gir/cairo-1.0.gir.in
 
 # Doesn't seem to work to do gir/%.typelib =(
-gir/cairo-1.0.typelib: g-ir-compiler
-gir/DBus-1.0.typelib: g-ir-compiler
-gir/DBusGLib-1.0.typelib: g-ir-compiler
-gir/fontconfig-2.0.typelib: g-ir-compiler
-gir/freetype2-2.0.typelib: g-ir-compiler
-gir/GL-1.0.typelib: g-ir-compiler
-gir/libxml2-2.0.typelib: g-ir-compiler
-gir/xft-2.0.typelib: g-ir-compiler
-gir/xlib-2.0.typelib: g-ir-compiler
-gir/xfixes-4.0.typelib: g-ir-compiler
-gir/xrandr-1.3.typelib: g-ir-compiler
+gir/cairo-1.0.typelib: g-ir-compiler$(EXEEXT)
+gir/DBus-1.0.typelib: g-ir-compiler$(EXEEXT)
+gir/DBusGLib-1.0.typelib: g-ir-compiler$(EXEEXT)
+gir/fontconfig-2.0.typelib: g-ir-compiler$(EXEEXT)
+gir/freetype2-2.0.typelib: g-ir-compiler$(EXEEXT)
+gir/GL-1.0.typelib: g-ir-compiler$(EXEEXT)
+gir/libxml2-2.0.typelib: g-ir-compiler$(EXEEXT)
+gir/xft-2.0.typelib: g-ir-compiler$(EXEEXT)
+gir/xlib-2.0.typelib: g-ir-compiler$(EXEEXT)
+gir/xfixes-4.0.typelib: g-ir-compiler$(EXEEXT)
+gir/xrandr-1.3.typelib: g-ir-compiler$(EXEEXT)
 
 # glib with source (to enable documentation)
 if WITH_GLIBSRC
-- 
1.7.11.msysgit.1

>From d45038b15921774b304d8ba64f2e71f88ba709d7 Mon Sep 17 00:00:00 2001
From: Martin Schlemmer <Martin Schlemmer nwu ac za>
Date: Thu, 12 Jul 2012 11:34:02 +0200
Subject: [PATCH 2/3] Add support for GI_SCANNER_INCLUDES

On MinGW/MSYS with a custom prefix, headers like libintl.h installed
to the prefix are not found even with CPPFLAGS set, so add support for
an additional environment variable GI_SCANNER_INCLUDES that are added
to cpp_args.
---
 giscanner/sourcescanner.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index db282f8..c9dc193 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -275,6 +275,8 @@ class SourceScanner(object):
         defines = ['__GI_SCANNER__']
         undefs = []
         cpp_args = os.environ.get('CC', 'cc').split()
+        # On MINGW32 with a custom prefix, headers like libintl.h are not found
+        cpp_args += os.environ.get('GI_SCANNER_INCLUDES', '').split()
         cpp_args += ['-E', '-C', '-I.', '-']
 
         cpp_args += self._cpp_options
-- 
1.7.11.msysgit.1

>From 0c9f764be019d25a7ac1274abd16ea05767c3d2a Mon Sep 17 00:00:00 2001
From: Martin Schlemmer <Martin Schlemmer nwu ac za>
Date: Thu, 12 Jul 2012 12:44:10 +0200
Subject: [PATCH 3/3] Windows port: handle failure to unlink the temporary
 directory more gracefully

On MinGW/MSYS unlinking the temporary directory the first time do not always
succeed the first time because of what seems to be AV-scanner activity on
the created executable. This causes Python to throw an exception, and due to
some strange interaction between MSYS and Python, an artificial lockup is
caused. Pressing return in mintty prints the exception and continues.

This is with Python 2.7 from www.python.org.
---
 giscanner/gdumpparser.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index c0b13f4..ae30e57 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -23,6 +23,7 @@ import sys
 import tempfile
 import shutil
 import subprocess
+import time
 from xml.etree.cElementTree import parse
 
 from . import ast
@@ -171,7 +172,14 @@ blob containing data gleaned from GObject's primitive introspection."""
             return parse(out_path)
         finally:
             if not utils.have_debug_flag('save-temps'):
-                shutil.rmtree(self._binary.tmpdir)
+                # FIXME: MinGW/MSYS do not always remove the directory the first time,
+                #        causing lockups due to what seems to be interaction between
+                #        MSYS and python when an exception is caught ...
+                try:
+                    shutil.rmtree(self._binary.tmpdir)
+                except Exception, e:
+                    time.sleep(0.5)
+                    shutil.rmtree(self._binary.tmpdir, True)
 
     # Parser
 
-- 
1.7.11.msysgit.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]