2012-11-26	Nicolas Roche	<roche@adacore.com>

	* giscanner/scannerlexer.l: Add support for __inline__,
	__asm__ __volatile__, __volatile__, and __restrict__,
	present in mingw64 headers.

2012-11-22	Nicolas Setton	<setton@adacore.com>

	* giscanner/dumper.py: Fix use of "export all symbols" mode
	under Windows.

2012-05-29	Nicolas Setton  <setton@adacore.com>

	* giscanner/utils.py: Port to Windows a local hack.

	* giscanner/dumper.py: The extension is '.exe', not 'exe'.
	Add workaround against wrong library additions on the link
	line.

	* giscanner/giscannermodule.c: our base python is 2.7, which
	uses msvcr90.dll rather than msvcr71.dll.

	* giscanner/shlibs.py: os.uname does not exist in Python 2.7,
	do not use it, deactivate FreeBSD.

	* giscanner/scannermain.py: Fix detection of Windows.

--- giscanner/utils.py.orig	2012-05-28 12:24:25.395400000 +0200
+++ giscanner/utils.py	2012-05-28 12:24:48.171400000 +0200
@@ -99,6 +99,7 @@
     #        in a way which is compatible with both libtool 2.2
     #        and pre-2.2. Johan 2008-10-21
     libname = libname.replace('.libs/.libs', '.libs')
+    libname = libname.replace('.libs\.libs', '.libs')
     return libname
 
 # Returns arguments for invoking libtool, if applicable, otherwise None
--- ../gobject-introspection-1.36.0-orig/giscanner/dumper.py	2013-02-23 11:40:08.000000000 +0100
+++ giscanner/dumper.py	2013-05-15 19:14:08.425700049 +0200
@@ -158,7 +158,7 @@
             o_path = self._generate_tempfile(tmpdir, '.o')
 
         if os.name == 'nt':
-            ext = 'exe'
+            ext = '.exe'
         else:
             ext = ''
 
@@ -258,7 +258,7 @@
             args.extend(['-o', output])
         if libtool:
             if os.name == 'nt':
-                args.append('-export-all-symbols')
+                args.append('-Wl,--export-all-symbols')
             else:
                 args.append('-export-dynamic')
 
@@ -289,6 +289,7 @@
                 subprocess.list2cmdline(args), )
             sys.stdout.flush()
         try:
+            args = [a.replace('\\', '/').replace('/bin/bash', 'c:/cygwin/bin/bash') for a in args]
             subprocess.check_call(args)
         except subprocess.CalledProcessError, e:
             raise LinkerError(e)
@@ -326,7 +327,8 @@
                 if library.endswith(".la"): # explicitly specified libtool library
                     args.append(library)
                 else:
-                    args.append('-l' + library)
+                    if not library.startswith('lib'):
+                        args.append('-l' + library)
 
         for library_path in self._options.library_paths:
             # Not used/needed on Visual C++, and -Wl,-rpath options
@@ -355,7 +357,8 @@
                 if library.endswith(".la"): # explicitly specified libtool library
                     args.append(library)
                 else:
-                    args.append('-l' + library)
+                    if not library.startswith('lib'):
+                        args.append('-l' + library)
 
 def compile_introspection_binary(options, get_type_functions,
                                  error_quark_functions):
--- giscanner/scannermain.py.orig	2012-05-29 13:58:49.301800000 +0200
+++ giscanner/scannermain.py	2012-05-29 13:59:07.616200000 +0200
@@ -162,7 +162,7 @@
     group = get_preprocessor_option_group(parser)
     parser.add_option_group(group)
 
-    if os.environ.get('MSYSTEM') == 'MINGW32':
+    if True:
         group = get_windows_option_group(parser)
         parser.add_option_group(group)
 
--- giscanner/scannerlexer.l	2012-04-17 20:24:58.000000000 +0200
+++ ../gobject-introspection-1.32.1-good/giscanner/scannerlexer.l	2012-11-23 15:34:48.774600000 +0100
@@ -135,16 +135,21 @@
 "->"					{ return ARROW; }
 
 "__asm" 	        	        { if (!parse_ignored_macro()) REJECT; }
+"__asm__ __volatile__" 	        	        { if (!parse_ignored_macro()) REJECT; }
 "__asm__" 	        	        { if (!parse_ignored_macro()) REJECT; }
 "__attribute__" 		        { if (!parse_ignored_macro()) REJECT; }
 "__attribute" 		                { if (!parse_ignored_macro()) REJECT; }
 "__const"                               { return CONST; }
 "__extension__"                         { return EXTENSION; }
 "__inline"				{ return INLINE; }
+"__inline__"                            { return INLINE; }
 "__nonnull" 			        { if (!parse_ignored_macro()) REJECT; }
 "__signed__"				{ return SIGNED; }
 "__restrict"				{ return RESTRICT; }
+"__restrict__"                          { return RESTRICT; }
 "__typeof"				{ if (!parse_ignored_macro()) REJECT; }
+
+"__volatile__"                          { return VOLATILE; }
 "_Bool"					{ return BOOL; }
 
 [a-zA-Z_][a-zA-Z_0-9]*			{ if (scanner->macro_scan) return IDENTIFIER; else REJECT; }
--- ../gobject-introspection-1.36.0-orig/configure	2013-03-26 02:45:30.000000000 +0100
+++ configure	2013-05-15 19:05:16.778292860 +0200
@@ -14599,7 +14599,10 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for headers required to compile python extensions" >&5
 $as_echo_n "checking for headers required to compile python extensions... " >&6; }
-PYTHON_INCLUDES=`$PYTHON-config --includes`
+
+g_python_executable=` which python `
+g_dirname=` dirname $g_python_executable `
+PYTHON_INCLUDES=" -I$g_dirname/include "
 
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
@@ -14624,7 +14627,9 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries required to link against libpython" >&5
 $as_echo_n "checking for libraries required to link against libpython... " >&6; }
 if test "x$PYTHON_LIBS" == x; then
-	PYTHON_LIBS=`$PYTHON-config --ldflags --libs`
+   g_python_executable=` which python `
+   g_dirname=` dirname $g_python_executable `
+   PYTHON_LIBS=" -L$g_dirname/libs -lpython27 "
 fi
 
 save_LIBS="$LIBS"
*** Makefile.in.orig	2013-11-05 11:29:41.744506700 +0100
--- Makefile.in	2013-11-05 11:30:36.667648100 +0100
***************
*** 2951,2967 ****
  	< $< > $@.tmp && mv $@.tmp $@
  
  # 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
  
  GLib-2.0.gir: g-ir-scanner g-ir-compiler$(EXEEXT)
  
--- 2951,2967 ----
  	< $< > $@.tmp && mv $@.tmp $@
  
  # Doesn't seem to work to do gir/%.typelib =(
! 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-2.0.gir: g-ir-scanner g-ir-compiler$(EXEEXT)
  
*** Makefile.in.orig	2013-11-05 11:53:39.556744800 +0100
--- Makefile.in	2013-11-05 11:57:14.856059300 +0100
***************
*** 696,702 ****
  bin_SCRIPTS = g-ir-scanner g-ir-annotation-tool $(am__append_5)
  GTESTER_PROGS = cmph-bdz-test gthash-test
  INTROSPECTION_SCANNER = \
!     env PATH=.libs:$(PATH) \
          LPATH=.libs \
          CC="$(CC)" \
          PYTHONPATH=$(top_builddir):$(top_srcdir) \
--- 696,702 ----
  bin_SCRIPTS = g-ir-scanner g-ir-annotation-tool $(am__append_5)
  GTESTER_PROGS = cmph-bdz-test gthash-test
  INTROSPECTION_SCANNER = \
!         PATH=.libs:$$$${PATH} \
          LPATH=.libs \
          CC="$(CC)" \
          PYTHONPATH=$(top_builddir):$(top_srcdir) \
***************
*** 713,719 ****
      --add-include-path=$(top_builddir)
  
  INTROSPECTION_COMPILER = \
!     env PATH=.libs:$(PATH) \
          $(top_builddir)/g-ir-compiler$(EXEEXT)
  
  INTROSPECTION_COMPILER_ARGS = \
--- 713,719 ----
      --add-include-path=$(top_builddir)
  
  INTROSPECTION_COMPILER = \
!         PATH=.libs:$${PATH} \
          $(top_builddir)/g-ir-compiler$(EXEEXT)
  
  INTROSPECTION_COMPILER_ARGS = \
***************
*** 723,729 ****
      --includedir=$(top_builddir)
  
  INTROSPECTION_DOCTOOL = \
!     env PATH=.libs:$(PATH) \
          LPATH=.libs \
          PYTHONPATH=$(top_builddir):$(top_srcdir) \
          UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
--- 723,729 ----
      --includedir=$(top_builddir)
  
  INTROSPECTION_DOCTOOL = \
!         PATH=.libs:$${PATH} \
          LPATH=.libs \
          PYTHONPATH=$(top_builddir):$(top_srcdir) \
          UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
*** Makefile.in.orig	2013-11-05 15:01:47.783394500 +0100
--- Makefile.in	2013-11-05 15:02:00.187103900 +0100
***************
*** 1211,1217 ****
  	config.h.win32
  
  ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
! SUBDIRS = . docs tests build
  DIST_SUBDIRS = m4 $(SUBDIRS)
  DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
  pkgconfigdir = $(libdir)/pkgconfig
--- 1211,1217 ----
  	config.h.win32
  
  ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
! SUBDIRS = . docs build
  DIST_SUBDIRS = m4 $(SUBDIRS)
  DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
  pkgconfigdir = $(libdir)/pkgconfig
*** giscanner/gdumpparser.py.orig	2013-11-08 18:05:54.577023100 +0100
--- giscanner/gdumpparser.py	2013-11-08 18:05:07.257316600 +0100
***************
*** 22,27 ****
--- 22,28 ----
  import sys
  import tempfile
  import shutil
+ import time
  import subprocess
  from xml.etree.cElementTree import parse
  
***************
*** 171,177 ****
              return parse(out_path)
          finally:
              if not utils.have_debug_flag('save-temps'):
!                 shutil.rmtree(self._binary.tmpdir)
  
      # Parser
  
--- 172,186 ----
              return parse(out_path)
          finally:
              if not utils.have_debug_flag('save-temps'):
!                 try:
!                     shutil.rmtree(self._binary.tmpdir)
!                 except OSError:
!                     time.sleep(1.0)
!                     try:
!                         shutil.rmtree(self._binary.tmpdir)
!                     except OSError:
!                         # Don't crash if we cannot clean the tmpdir
!                         pass
  
      # Parser
  
