rockstar ate my cross-build

Paul Millar paulm at astro.gla.ac.uk
Fri Dec 3 14:04:43 CST 2004


Hi,

The following patch:
  http://cvs.winehq.org/patch.py?id=14651
broke cross-compilation.

(For the sake of clarity, I check out the source and make two other 
directories: wine-cross-pe and wine-cross-native.  Native tools are 
build under wine-cross-native, whilst the Windows binaries are built 
under wine-cross-pe)

Turns out that "make depend" (when actually cross-building) always 
builds things under the tools subdirectory (which thankfully it then 
ignores).  Hither to, this caused no problems, but it turns out that 
mingw environment doesn't have SIGHUP, nor a sigprocmask().  These 
deficiencies causes winebuild and winegcc to fail, causing "make 
depend" to fail.

Below is a patch that fixes this by wrappering some of the added 
functionality with suitable autoconf-ed tests (what the hell, I 
needed an excuse to play with autoconf).  With the patch, native 
builds should go ahead unfettered, but mingw build degrades slightly 
(no SIGHUP support).  I've tried to implement the missing 
functionality by doing signal( x, SIG_IGN), rather than masking them 
(is this the same?) but the result looks ugly as sin.

Alternatively, the build could be altered and the erroneous dependency 
on the tools removed (when cross-building, from separate 
directories).  But I'm guessing that's tricky to implement whilst 
keeping the crosstest target working.

Cheers,

Paul.

PS.
  Its pretty obvious, but configure will need to be rebuilt after the 
patch.

ChangeLog:
  Test and wrapper features missing in mingw environment, allowing 
tools subdirectory to be cross-built again.

Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.328
diff -u -r1.328 configure.ac
--- configure.ac 23 Nov 2004 17:33:56 -0000 1.328
+++ configure.ac 3 Dec 2004 20:37:06 -0000
@@ -1162,6 +1162,10 @@
   WINE_GET_SONAME(lcms,cmsOpenProfileFromFile)
 fi
 
+dnl **** Check for declarations ***
+
+AC_CHECK_DECLS([sigprocmask,sigaddset],,,[#include <signal.h>])
+
 
 dnl **** Check for functions ****
 
Index: tools/winebuild/main.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/main.c,v
retrieving revision 1.58
diff -u -r1.58 main.c
--- tools/winebuild/main.c 2 Dec 2004 18:22:48 -0000 1.58
+++ tools/winebuild/main.c 3 Dec 2004 20:37:06 -0000
@@ -421,7 +421,9 @@
 {
     DLLSPEC *spec = alloc_dll_spec();
 
+#ifdef SIGHUP
     signal( SIGHUP, exit_on_signal );
+#endif
     signal( SIGTERM, exit_on_signal );
     signal( SIGINT, exit_on_signal );
 
Index: tools/winegcc/winegcc.c
===================================================================
RCS file: /home/wine/wine/tools/winegcc/winegcc.c,v
retrieving revision 1.32
diff -u -r1.32 winegcc.c
--- tools/winegcc/winegcc.c 2 Dec 2004 18:22:48 -0000 1.32
+++ tools/winegcc/winegcc.c 3 Dec 2004 20:37:06 -0000
@@ -138,7 +138,9 @@
 
 static int keep_generated = 0;
 static strarray* tmp_files;
+#ifdef HAVE_DECL_SIGPROCMASK
 static sigset_t signal_mask;
+#endif
 
 struct options 
 {
@@ -180,11 +182,21 @@
 char* get_temp_file(const char* prefix, const char* suffix)
 {
     int fd;
-    sigset_t old_set;
     char* tmp = strmake("%s-XXXXXX%s", prefix, suffix);
+#ifdef HAVE_DECL_SIGPROCMASK
+    sigset_t old_set;
+#endif
 
+#ifdef HAVE_DECL_SIGPROCMASK
     /* block signals while manipulating the temp files list */
     sigprocmask( SIG_BLOCK, &signal_mask, &old_set );
+#else
+  #ifdef SIGHUP
+    signal( SIGHUP, SIG_IGN );
+  #endif
+    signal( SIGTERM, SIG_IGN );
+    signal( SIGINT, SIG_IGN );
+#endif
     fd = mkstemps( tmp, strlen(suffix) );
     if (fd == -1)
     {
@@ -196,7 +208,15 @@
     }
     close( fd );
     strarray_add(tmp_files, tmp);
+#ifdef HAVE_DECL_SIGPROCMASK
     sigprocmask( SIG_SETMASK, &old_set, NULL );
+#else
+  #ifdef SIGHUP
+    signal( SIGHUP, exit_on_signal);
+  #endif
+    signal( SIGTERM, exit_on_signal);
+    signal( SIGINT, exit_on_signal);
+#endif
     return tmp;
 }
 
@@ -700,13 +720,17 @@
     char* lang = 0;
     char* str;
 
+#ifdef SIGHUP
     signal( SIGHUP, exit_on_signal );
+#endif
     signal( SIGTERM, exit_on_signal );
     signal( SIGINT, exit_on_signal );
+#ifdef HAVE_DECL_SIGADDSET
     sigemptyset( &signal_mask );
     sigaddset( &signal_mask, SIGHUP );
     sigaddset( &signal_mask, SIGTERM );
     sigaddset( &signal_mask, SIGINT );
+#endif
 
     /* setup tmp file removal at exit */
     tmp_files = strarray_alloc();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20041203/9ba36f10/attachment.pgp


More information about the wine-patches mailing list