From 4da6fe08c79abd2ec8a87b9c871c7e1119e0fb08 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Sat, 23 Mar 2013 22:16:05 +0100 Subject: mingw: Add support for mingw build Based on a patch from Nerijus Baliunas --- SpiceXPI/src/plugin/Makefile.am | 23 ++++++++++++++++++++--- SpiceXPI/src/plugin/resource.rc | 34 ++++++++++++++++++++++++++++++++++ configure.ac | 19 ++++++++++++++++++- 3 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 SpiceXPI/src/plugin/resource.rc diff --git a/SpiceXPI/src/plugin/Makefile.am b/SpiceXPI/src/plugin/Makefile.am index 2db218e..9116ba7 100644 --- a/SpiceXPI/src/plugin/Makefile.am +++ b/SpiceXPI/src/plugin/Makefile.am @@ -8,7 +8,7 @@ plugindir=$(extensiondir)/plugins plugin_LTLIBRARIES = libnsISpicec.la -libnsISpicec_la_LDFLAGS = -avoid-version -module +libnsISpicec_la_LDFLAGS = -avoid-version -module -no-undefined libnsISpicec_la_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(srcdir)/npapi \ @@ -28,8 +28,6 @@ libnsISpicec_la_SOURCES = \ glib-compat.h \ controller.cpp \ controller.h \ - controller-unix.cpp \ - controller-unix.h \ npapi/npapi.h \ npapi/npfunctions.h \ npapi/npruntime.h \ @@ -49,6 +47,25 @@ libnsISpicec_la_SOURCES = \ pluginbase.h \ $(NULL) +if OS_LINUX +libnsISpicec_la_SOURCES += \ + controller-unix.cpp \ + controller-unix.h \ + $(NULL) +endif + +if OS_WINDOWS +.rc.lo: + $(LIBTOOL) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(WINDRES) $(RCFLAGS) -i $< -o $@ + +libnsISpicec_la_SOURCES += \ + resource.rc \ + $(NULL) + +.rc.$(OBJEXT): + $(AM_V_GEN)$(WINDRES) $(RCFLAGS) -i $< -o $@ +endif + if BUILD_XPI libnsISpicec_la_SOURCES += \ nsISpicec.h \ diff --git a/SpiceXPI/src/plugin/resource.rc b/SpiceXPI/src/plugin/resource.rc new file mode 100644 index 0000000..8892b0a --- /dev/null +++ b/SpiceXPI/src/plugin/resource.rc @@ -0,0 +1,34 @@ +1 VERSIONINFO + FILEVERSION 2,8,0,0 + PRODUCTVERSION 2,8,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "Fedora" + VALUE "FileDescription", "Spice XPI Plugin" + VALUE "FileVersion", "2, 8, 0, 0" + VALUE "InternalName", "SpiceXPI" + VALUE "LegalCopyright", "Fedora" + VALUE "OriginalFilename", "nsISpicec.dll" + VALUE "ProductName", "Spice XPI" + VALUE "ProductVersion", "2, 8, 0, 0" + VALUE "MIMEType", "application/x-spice" + VALUE "FileExtents", "qsc" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1200 + END +END diff --git a/configure.ac b/configure.ac index 3ed0cfc..7f401ab 100644 --- a/configure.ac +++ b/configure.ac @@ -13,9 +13,26 @@ AC_PROG_CXX AC_PROG_INSTALL AC_CANONICAL_HOST AC_PROG_LIBTOOL +LT_LANG([Windows Resource]) AM_PROG_CC_C_O -AC_DEFINE([XP_UNIX], 1, [Building Linux plugin]) +AC_MSG_CHECKING([operating system]) +case $host in +*-linux*) + AC_MSG_RESULT([Linux]) + backend="linux" + AC_DEFINE([XP_UNIX], 1, [Building Linux plugin]) + ;; +*-mingw*) + AC_MSG_RESULT([Windows]) + backend="windows" + AC_CHECK_TOOL([WINDRES], [windres], [no]) + AC_DEFINE([XP_WIN], 1, [Building Windows plugin]) + ;; +esac + +AM_CONDITIONAL([OS_LINUX], [test "x$backend" = xlinux]) +AM_CONDITIONAL([OS_WINDOWS], [test "x$backend" = xwindows]) dnl ========================================================================= dnl Check deps -- cgit v1.2.3