GNOME Bugzilla – Bug 768540
Add support for MS Windows on libraries and projects
Last modified: 2016-07-12 15:45:12 UTC
Adding support for templates allow compilation under MSYS2, is good for any one, while showcase their project and GLIB/GTK+ is multiplatform. I'll add this in my next iteration, but propose first in order to discuss what is the better way to do so. I have my own, gotten by GDA, hope it is OK.
As for which "windows portability system" to support, my preference these days is mingw over msys/cygwin. Especially since we are going to be compiling on Linux (and I'd like to be able to produce windows binaries from Builder on Linux).
Well, I have support for windows on GXml with following code at configure.ac: dnl Check Cross Compile dnl ****************************** dnl Check for Operating System dnl ****************************** dnl linklibext is the shared link library extension, which varies by platform #EXPORT_SYM_REGEX='-export-symbols-regex "^(gxml_|fnYM49765777344607__gxml).*"' #AC_MSG_CHECKING([for platform]) #platform_win32=no #linklibext=".so" case "$host" in *-mingw*) # AC_MSG_RESULT([Win32 - MinGW]) platform_win32=yes # AC_DEFINE([USING_MINGW],[],[Using MinGW]) # NO_UNDEFINED='-no-undefined' # LIBTOOL_EXPORT_OPTIONS= # linklibext=".dll" # AC_CHECK_TOOL(WINDRES, windres, windres) # AC_SUBST(WINDRES) # AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool) # AC_SUBST(DLLTOOL) ;; *) # AC_MSG_RESULT([Unix]) # NO_UNDEFINED='' # LIBTOOL_EXPORT_OPTIONS=$EXPORT_SYM_REGEX # ;; esac Now I'm trying to make it a m4 macro, but my skills are not enough, I have this code but doesn't work, any advise should be great! m4_define([_PLATFORM_WIN_CHECK_INTERNAL],[ AC_MSG_CHECKING([for windows platform]) AS_CASE([$host], [*mingw*],[ platform_win=yes ],[]) AC_MSG_RESULT([platform_win]) AM_CONDITIONAL(PLATFORM_WIN, [test x$platform_win = xyes]) ])
I've made it: m4_define([_PLATFORM_WIN_CHECK_INTERNAL],[ AC_MSG_CHECKING([for windows platform]) AS_CASE([$host], [*mingw*],[ platform_win=yes ], [ platform_win=no ] ) AC_MSG_RESULT([$platform_win]) AM_CONDITIONAL(PLATFORM_WIN, [test x$platform_win = xyes]) ]) Just need to check it on Windows and MSYS2.
I've finished to add Windows/MSYS2 support to Vala library projects. This is easy to be ported to C library projects, because I've added a m4 macro and make file mk to be imported to Makefile.am, making easy even for other projects to add support for Windows/MSYS2 to their own projects. In order to show you a clean patch, I've added dependence to bug #766621. Once fixed, I've merge this work with that bug work, to provide an straight forward experience on Vala libraries build.