ports/137999: [PATCH] emulators/wine: fix winebuild

Gerald Pfeifer gerald at pfeifer.com
Sat Aug 22 22:05:50 UTC 2009


Thanks for the report and suggested patch.  I'm afraid this is a bit 
hackish and not acceptable upstream, and I think it's important to
resolve this properly together with upstream, both for the sake of
users building outside of the realm of the ports tree and for longer
term maintainability.

So, given that your proposed patch already highlighted the issue very
nicely and suggested a fix for FreeBSD, I gave it a try to generalize
this in a way that hopefully will be acceptable upstream.

Would you mind giving the patch below a try and let me know the outcome?

Thanks,
Gerald



diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 7ca10c1..96d7493 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -124,7 +124,11 @@ enum target_cpu
 
 enum target_platform
 {
-    PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SOLARIS, PLATFORM_WINDOWS
+    PLATFORM_UNSPECIFIED,
+    PLATFORM_APPLE,
+    PLATFORM_FREEBSD,
+    PLATFORM_SOLARIS,
+    PLATFORM_WINDOWS
 };
 
 extern char *target_alias;
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index bebb37b..3c80ea3 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -64,6 +64,8 @@ enum target_cpu target_cpu = CPU_POWERPC;
 
 #ifdef __APPLE__
 enum target_platform target_platform = PLATFORM_APPLE;
+#elif defined(__FreeBSD__)
+enum target_platform target_platform = PLATFORM_FREEBSD;
 #elif defined(__sun)
 enum target_platform target_platform = PLATFORM_SOLARIS;
 #elif defined(_WINDOWS)
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index d11bd32..bf414fb 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -296,9 +296,18 @@ const char *get_ld_command(void)
 
         if (force_pointer_size)
         {
-            const char *args = (target_platform == PLATFORM_APPLE) ?
-                ((force_pointer_size == 8) ? " -arch x86_64" : " -arch i386") :
-                ((force_pointer_size == 8) ? " -m elf_x86_64" : " -m elf_i386");
+            const char *args;
+
+            if (target_platform == PLATFORM_APPLE)
+                args = (force_pointer_size == 8) ? " -arch x86_64"
+                                                 : " -arch i386";
+            else if (target_platform == PLATFORM_FREEBSD)
+                args = (force_pointer_size == 8) ? " -m elf_x86_64"
+                                                 : " -m elf_i386_fbsd";
+            else
+                args = (force_pointer_size == 8) ? " -m elf_x86_64"
+                                                 : " -m elf_i386";
+
             ld_command = xrealloc( ld_command, strlen(ld_command) + strlen(args) + 1 );
             strcat( ld_command, args );
         }



More information about the freebsd-ports-bugs mailing list