Mac OS X and Wine Build System

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Here are modifications to the wine build system to add better support Mac OS X.
Basically it includes
- Mach-O support : detection and dynamic library building
- Different Stripflags support
- Winemaker update
Tell me if there is anything you would like to be changed. Note that I am waiting for this patch to be commited (or rejected ;) ) to send the next part of the patch, which will fully enables Mac OS X support.


Thanks,

Pierre

ChangeLog:
Add Darwin/Mac OS X support in the Wine Build System.

Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.210
diff -u -r1.210 configure.ac
--- configure.ac	22 Nov 2003 00:08:26 -0000	1.210
+++ configure.ac	24 Nov 2003 16:20:42 -0000
@@ -137,6 +137,8 @@
 AC_CHECK_FUNCS(inet_aton,,AC_CHECK_LIB(resolv,inet_aton))
 dnl Check for -lxpg4 for FreeBSD
 AC_CHECK_LIB(xpg4,_xpg4_setrunelocale)
+dnl Check for -lpoll for Mac OS X/Darwin
+AC_CHECK_LIB(poll,poll)
 dnl Check for -lpthread
 AC_CHECK_LIB(pthread,pthread_create,AC_SUBST(LIBPTHREAD,"-lpthread"))
 
@@ -839,6 +841,7 @@
 AC_SUBST(DLLFLAGS,"-D_REENTRANT")
 AC_SUBST(DLLIBS,"")
 AC_SUBST(LDSHARED,"")
+AC_SUBST(STRIPFLAGS,"--strip-unneeded")
 AC_SUBST(LDDLL,"")
 AC_SUBST(LIBEXT,"so")
 AC_SUBST(IMPLIBEXT,"def")
@@ -915,6 +918,20 @@
         then
           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
           LDDLL="\$(CC) -Wl,-G,-B,symbolic"
+
+        else
+          AC_CACHE_CHECK(whether we can build a Mach-O (Mac OS X/Darwin) dll, ac_cv_c_dll_macho,
+            [WINE_TRY_CFLAGS([-bundle],
+                             ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")])
+                             
+          if test "$ac_cv_c_dll_macho" = "yes"
+          then
+            LIBEXT="dylib"
+            LDDLL="\$(CC) -bundle -flat_namespace -undefined suppress"
+            LDSHARED="\$(CC) -dynamiclib"
+            CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp"
+            STRIPFLAGS="-u -r"
+          fi
         fi
       fi
     fi
@@ -943,6 +960,8 @@
 case $build_os in
   cygwin*|mingw32*)
     AC_SUBST(LDPATH,"PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$PATH\"") ;;
+  darwin*|macosx*)
+    AC_SUBST(LDPATH,"DYLD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$DYLD_LIBRARY_PATH\"") ;;
   *)
     AC_SUBST(LDPATH,"LD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\"") ;;
 esacIndex: Make.rules.in
===================================================================
RCS file: /home/wine/wine/Make.rules.in,v
retrieving revision 1.163
diff -u -r1.163 Make.rules.in
--- Make.rules.in	11 Oct 2003 01:05:18 -0000	1.163
+++ Make.rules.in	24 Nov 2003 16:23:31 -0000
@@ -41,6 +41,7 @@
 AR        = @AR@ rc
 RANLIB    = @RANLIB@
 STRIP     = @STRIP@
+STRIPFLAGS= @STRIPFLAGS@
 WINDRES   = @WINDRES@
 LN        = @LN@
 LN_S      = @LN_S@
Index: libs/Makelib.rules.in
===================================================================
RCS file: /home/wine/wine/libs/Makelib.rules.in,v
retrieving revision 1.3
diff -u -r1.3 Makelib.rules.in
--- libs/Makelib.rules.in	24 Sep 2003 19:01:44 -0000	1.3
+++ libs/Makelib.rules.in	24 Nov 2003 16:25:12 -0000
@@ -31,7 +31,13 @@
 $(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
 	$(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
 
-.PHONY: install-lib-so install-lib-dll install-dev-so install-dev-dll
+$(LIBNAME).$(SOVERSION).dylib: $(OBJS) Makefile.in
+	$(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
+
+$(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
+	$(RM) $@ && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $@
+
+.PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
 
 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
 	$(MKINSTALLDIRS) $(libdir)
@@ -41,6 +47,10 @@
 	$(MKINSTALLDIRS) $(libdir)
 	$(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
 
+install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
+
 install-dev-so: dummy
 	$(MKINSTALLDIRS) $(libdir)
 	cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
@@ -49,11 +59,15 @@
 	$(MKINSTALLDIRS) $(libdir)
 	$(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
 
+install-dev-dylib: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
+
 install install-lib:: $(LIBEXT:%=install-lib-%)
 install install-dev:: $(LIBEXT:%=install-dev-%)
 
 uninstall::
-	$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION)
+	$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
 
 clean::
-	$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll
+	$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib
Index: tools/winemaker
===================================================================
RCS file: /home/wine/wine/tools/winemaker,v
retrieving revision 1.68
diff -u -r1.68 winemaker
--- tools/winemaker	18 Nov 2003 19:39:11 -0000	1.68
+++ tools/winemaker	24 Nov 2003 16:45:12 -0000
@@ -2403,10 +2403,27 @@
       LDSHARED="\$(CC) -Wl,-Bshareable,-Bforcearchive"
       LDXXSHARED="\$(CXX) -Wl,-Bshareable,-Bforcearchive"
       LDDLLFLAGS="" #FIXME
+    else
+      AC_CACHE_CHECK([whether we can build a Mach-O (Mac OS X/Darwin) dll],
+                   ac_cv_c_dll_macho,
+      [saved_cflags=$CFLAGS
+      CFLAGS="$CFLAGS -bundle"
+      AC_TRY_LINK(,[return 1], ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")
+      CFLAGS=$saved_cflags
+      ])
+      if test "$ac_cv_c_dll_macho" = "yes"
+      then
+        LDSHARED="\$(CC) -bundle -flat_namespace -undefined suppress"
+        LDXXSHARED="\$(CXX) -bundle -flat_namespace -undefined suppress"
+        LDDLLFLAGS="-fno-common"
+        CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp -Dsocklen_t=u_int32_t"
+        CXXFLAGS="$CXXFLAGS -ffixed-r13 -no-cpp-precomp -Dsocklen_t=u_int32_t"
+        STRIPFLAGS="-u -r"
+      fi
     fi
   fi
 fi
-if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
+if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no" -a "$ac_cv_c_dll_macho" = "no"
 then
   AC_MSG_ERROR([Could not find how to build a dynamically linked library])
 fi
@@ -2416,6 +2433,7 @@
 AC_SUBST(LDSHARED)
 AC_SUBST(LDXXSHARED)
 AC_SUBST(LDDLLFLAGS)
+AC_SUBST(STRIPFLAGS)
 
 dnl *** check for the need to define __i386__
 
@@ -2455,6 +2473,20 @@
     CXXFLAGS="$CXXFLAGS -D__sun__"
 fi
 
+dnl *** check for the need to define __powerpc__
+
+AC_CACHE_CHECK(whether we need to define __powerpc__,ac_cv_cpp_def_powerpc,
+ AC_EGREP_CPP(yes,[#if (defined(__ppc__) || defined(__PPC__) || defined(__POWERPC__)) && !defined(__powerpc__)
+yes
+#endif],
+ ac_cv_cpp_def_powerpc="yes", ac_cv_cpp_def_powerpc="no"))
+if test "$ac_cv_cpp_def_powerpc" = "yes"
+then
+    CFLAGS="$CFLAGS -D__powerpc__"
+    CXXFLAGS="$CXXFLAGS -D__powerpc__"
+fi
+
+
 dnl **** Test Winelib-related features of the C++ compiler
 AC_LANG_CPLUSPLUS()
 if test "x${GCC}" = "xyes"
@@ -2710,9 +2742,12 @@
 then
   WINE_LIBRARY_ROOT=":/usr/lib/wine:/usr/local/lib:/usr/local/lib/wine:/opt/wine/lib"
 else
-  AC_PATH_FILE(WINE_LIBRARY_ROOT,[libwine.so],[
-    AC_MSG_ERROR([Could not find the Wine libraries (libwine.so)])
-  ],$WINE_LIBRARY_ROOT)
+  AC_PATH_FILE(WINE_LIBRARY_ROOT,[libwine.so],
+    [
+    AC_PATH_FILE(WINE_LIBRARY_ROOT,[libwine.dylib],
+      [AC_MSG_ERROR([Could not find the Wine libraries (libwine.dylib or libwine.so)])],
+      $WINE_LIBRARY_ROOT)
+    ], $WINE_LIBRARY_ROOT)
 fi
 AC_PATH_LIBRARY(WINE_LIBRARY_ROOT,[-lwine],[],[
   AC_MSG_ERROR([Could not link with the Wine libraries (libwine.so)])
@@ -2746,6 +2781,7 @@
     WINE_DLL_ROOT="/lib:/lib/wine:/usr/lib:/usr/lib/wine:/usr/local/lib:/usr/local/lib/wine"
   fi
 fi
+
 AC_PATH_FILE(WINE_DLL_ROOT,[libntdll.def],[
   AC_MSG_ERROR([Could not find the Wine dlls (libntdll.def)])
 ],[$WINE_DLL_ROOT])
@@ -2771,7 +2807,13 @@
   AC_MSG_ERROR([Could not find Wine's wrc tool])
 fi
 
-LDPATH="LD_LIBRARY_PATH=\"$LDPATH:\$\$LD_LIBRARY_PATH\""
+case $build_os in
+  darwin*|macosx*)
+    LDPATH="DYLD_LIBRARY_PATH=\"$LDPATH:\$\$DYLD_LIBRARY_PATH\"";;
+  *)
+    LDPATH="LD_LIBRARY_PATH=\"$LDPATH:\$\$LD_LIBRARY_PATH\""
+esac
+
 AC_SUBST(LDPATH)
 AC_SUBST(WINE_INCLUDE_PATH)
 AC_SUBST(WINE_LIBRARY_PATH)
@@ -3001,7 +3043,7 @@
 LDXXSHARED= @LDXXSHARED@
 LDDLLFLAGS= @LDDLLFLAGS@
 STRIP     = strip
-STRIPFLAGS= --strip-unneeded
+STRIPFLAGS= @STRIPFLAGS@
 LN_S      = @LN_S@
 RM        = rm -f
 MV        = mv


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux