summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnel A. Borja <kyoushuu@yahoo.com>2012-09-30 18:33:56 +0800
committerJürg Billeter <j@bitron.ch>2012-11-03 07:37:02 +0100
commitfd2b222a9ad7382bf0f802d50a9702d455195ef3 (patch)
treea7bc28bbdd0bd1f6b4268f71fe3899473d70a89b
parent3efecce2f21e0cdc97f4633cfda52eb0d9ea1ab8 (diff)
downloadvala-fd2b222a9ad7382bf0f802d50a9702d455195ef3.tar.gz
Fix build for Windows
- 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.
-rw-r--r--Makefile.am2
-rw-r--r--gobject-introspection/scanner.c21
-rwxr-xr-xtests/testrunner.sh4
-rw-r--r--vapi/Makefile.am2
-rw-r--r--vapigen/Makefile.am2
-rw-r--r--vapigen/vala-gen-introspect/Makefile.am2
6 files changed, 26 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index 3a8fc6c84..12e50df5b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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:
diff --git a/gobject-introspection/scanner.c b/gobject-introspection/scanner.c
index dcaa01c1b..ced13f4a6 100644
--- a/gobject-introspection/scanner.c
+++ b/gobject-introspection/scanner.c
@@ -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"
@@ -40,6 +39,10 @@
#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);
diff --git a/tests/testrunner.sh b/tests/testrunner.sh
index 02948c1a8..8d4780846 100755
--- a/tests/testrunner.sh
+++ b/tests/testrunner.sh
@@ -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
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index 8c09365d6..d474ac374 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -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
diff --git a/vapigen/Makefile.am b/vapigen/Makefile.am
index 8460a5e4d..bc8539ae5 100644
--- a/vapigen/Makefile.am
+++ b/vapigen/Makefile.am
@@ -1,6 +1,6 @@
NULL =
-VALAC = $(top_builddir)/compiler/valac
+VALAC = $(top_builddir)/compiler/valac$(EXEEXT)
SUBDIRS = \
vala-gen-introspect \
diff --git a/vapigen/vala-gen-introspect/Makefile.am b/vapigen/vala-gen-introspect/Makefile.am
index 4f0c47186..854cb9d9b 100644
--- a/vapigen/vala-gen-introspect/Makefile.am
+++ b/vapigen/vala-gen-introspect/Makefile.am
@@ -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