]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix build for Windows
authorArnel A. Borja <kyoushuu@yahoo.com>
Sun, 30 Sep 2012 10:33:56 +0000 (18:33 +0800)
committerJürg Billeter <j@bitron.ch>
Sun, 11 Nov 2012 13:05:37 +0000 (14:05 +0100)
- Replace POSIX calls for spawning process with functions from Windows
  API when compiling for Windows
- Add EXEEXT to valac and vapigen paths
- Remove EXEEXT from scripts

Fixes bug 685180.

Makefile.am
gobject-introspection/scanner.c
tests/testrunner.sh
vapi/Makefile.am
vapigen/Makefile.am
vapigen/vala-gen-introspect/Makefile.am

index 3a8fc6c842454842574c927b2229ceb48caa3069..12e50df5b9a0cf268f7cd4c18bca74b2ab303288 100644 (file)
@@ -47,7 +47,7 @@ libvala@PACKAGE_SUFFIX@.pc: libvala.pc
 .PHONY: bootstrap
 bootstrap: all
        find $(top_srcdir) -name "*.vala.stamp" | xargs rm -f
-       $(MAKE) $(AM_MAKEFLAGS) all VALAC=$(abs_top_builddir)/compiler/valac V=$V
+       $(MAKE) $(AM_MAKEFLAGS) all VALAC=$(abs_top_builddir)/compiler/valac$(EXEEXT) V=$V
 
 .PHONY: test
 test:
index dcaa01c1ba4c6b3ee748f347df80d62e58910013..ced13f4a6ab494c9de62f6f7236ba503c026bf89 100644 (file)
@@ -31,7 +31,6 @@
 #include <glib/gstdio.h>
 #include <glib-object.h>
 #include <signal.h>
-#include <sys/wait.h> /* waitpid */
 #include <gmodule.h>
 #include "scanner.h"
 #include "gidlparser.h"
 #include "gidlwriter.h"
 #include "grealpath.h"
 
+#ifndef _WIN32
+#include <sys/wait.h> /* waitpid */
+#endif
+
 
 typedef GType (*TypeFunction) (void);
 
@@ -1600,12 +1603,28 @@ g_igenerator_start_preprocessor (GIGenerator *igenerator,
 
   close (cpp_out);
 
+#ifndef _WIN32
   if (waitpid (pid, &status, 0) > 0)
+#else
+  /* We don't want to include <windows.h> as it clashes horribly
+   * with token names from scannerparser.h. So just declare
+   * WaitForSingleObject, GetExitCodeProcess and INFINITE here.
+   */
+  extern unsigned long __stdcall WaitForSingleObject(void*, int);
+  extern int __stdcall GetExitCodeProcess(void*, int*);
+#define INFINITE 0xffffffff
+
+  WaitForSingleObject (pid, INFINITE);
+
+  if (GetExitCodeProcess (pid, &status))
+#endif
     {
       if (status != 0)
        {
          g_spawn_close_pid (pid);
+#ifndef _WIN32
          kill (pid, SIGKILL);
+#endif
 
          g_error ("cpp returned error code: %d\n", status);
          unlink (tmpname);
index 02948c1a835806c2c186ae568d12d06cb80b70ea..8d4780846feaccd6986353890bad177a55e20ec8 100755 (executable)
@@ -28,9 +28,9 @@ vapidir=$topsrcdir/vapi
 
 export G_DEBUG=fatal_warnings
 
-VALAC=$topbuilddir/compiler/valac
+VALAC=$topbuilddir/compiler/valac$EXEEXT
 VALAFLAGS="--vapidir $vapidir --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast"
-VAPIGEN=$topbuilddir/vapigen/vapigen
+VAPIGEN=$topbuilddir/vapigen/vapigen$EXEEXT
 VAPIGENFLAGS="--vapidir $vapidir"
 
 # Incorporate the user's CFLAGS. Matters if the user decided to insert
index 8c09365d6858c4155ec5419e55ce2d01d0b49fd7..d474ac3740d8c09eef3f7795404ebe12ce44ac9e 100644 (file)
@@ -394,7 +394,7 @@ GIR_BINDINGS = \
 
 BINDINGS = $(GIR_BINDINGS) $(GIDL_BINDINGS)
 
-VAPIGEN = $(top_builddir)/vapigen/vapigen
+VAPIGEN = $(top_builddir)/vapigen/vapigen$(EXEEXT)
 VAPIGENFLAGS = --vapidir $(srcdir)
 GENVAPI = $(VAPIGEN) $(VAPIGENFLAGS)
 METADATADIR = $(srcdir)/metadata
index 8460a5e4d6641a1ec32ff86ef31233be8096cb98..bc8539ae5c8584f78118ec3806f364217c298bb2 100644 (file)
@@ -1,6 +1,6 @@
 NULL =
 
-VALAC = $(top_builddir)/compiler/valac
+VALAC = $(top_builddir)/compiler/valac$(EXEEXT)
 
 SUBDIRS = \
        vala-gen-introspect \
index 4f0c47186a998b0106fe08787a712bf81abf78d5..854cb9d9b397552111218d2f53b4501cf37c03b8 100644 (file)
@@ -10,5 +10,5 @@ EXTRA_DIST = \
 
 if ENABLE_UNVERSIONED
 install-exec-hook:
-       cd $(DESTDIR)$(bindir) && $(LN_S) -f vala-gen-introspect@PACKAGE_SUFFIX@$(EXEEXT) vala-gen-introspect$(EXEEXT)
+       cd $(DESTDIR)$(bindir) && $(LN_S) -f vala-gen-introspect@PACKAGE_SUFFIX@ vala-gen-introspect
 endif