Commit fd2b222a authored by Arnel A. Borja's avatar Arnel A. Borja Committed by Jürg Billeter

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.
parent 3efecce2
......@@ -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:
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
NULL =
VALAC = $(top_builddir)/compiler/valac
VALAC = $(top_builddir)/compiler/valac$(EXEEXT)
SUBDIRS = \
vala-gen-introspect \
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment