Re: [gtk-osx-users] Universal ppc/i386 build



Hi!

> Let me go over the patches one more time.  Thanks to your pointers I think I can 
> make them more specific to only apply when building on/for OSX.  I believe that 
> would increase the chances of getting them accepted.

Attached is a new patch for libffi, which, I think, is much cleaner.

Would someone on this list please try this patch (and the glib one).  Just to make sure it works on more than one system.

Steffen
diff -Nur atgreen-libffi-873d687-orig/Makefile.am atgreen-libffi-873d687/Makefile.am
--- atgreen-libffi-873d687-orig/Makefile.am	2012-04-11 19:46:40.000000000 -0700
+++ atgreen-libffi-873d687/Makefile.am	2013-01-25 09:44:05.000000000 -0800
@@ -117,8 +117,9 @@
 if X86_WIN64
 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win64.S
 endif
-if X86_DARWIN
+if DARWIN
 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
+nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
 endif
 if SPARC
 nodist_libffi_la_SOURCES += src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
@@ -141,9 +142,6 @@
 if POWERPC_AIX
 nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
 endif
-if POWERPC_DARWIN
-nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
-endif
 if POWERPC_FREEBSD
 nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
 endif
diff -Nur atgreen-libffi-873d687-orig/Makefile.in atgreen-libffi-873d687/Makefile.in
--- atgreen-libffi-873d687-orig/Makefile.in	2012-04-11 19:47:17.000000000 -0700
+++ atgreen-libffi-873d687/Makefile.in	2013-01-25 09:53:58.000000000 -0800
@@ -42,7 +42,7 @@
 @X86_FREEBSD_TRUE@am__append_4 = src/x86/ffi.c src/x86/freebsd.S
 @X86_WIN32_TRUE@am__append_5 = src/x86/ffi.c src/x86/win32.S
 @X86_WIN64_TRUE@am__append_6 = src/x86/ffi.c src/x86/win64.S
-@X86_DARWIN_TRUE@am__append_7 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
+@DARWIN_TRUE@am__append_7 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
 @SPARC_TRUE@am__append_8 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
 @ALPHA_TRUE@am__append_9 = src/alpha/ffi.c src/alpha/osf.S
 @IA64_TRUE@am__append_10 = src/ia64/ffi.c src/ia64/unix.S
@@ -50,7 +50,7 @@
 @M68K_TRUE@am__append_12 = src/m68k/ffi.c src/m68k/sysv.S
 @POWERPC_TRUE@am__append_13 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
 @POWERPC_AIX_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
-@POWERPC_DARWIN_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
+@DARWIN_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
 @POWERPC_FREEBSD_TRUE@am__append_16 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
 @ARM_TRUE@am__append_17 = src/arm/sysv.S src/arm/ffi.c
 @ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__append_18 = src/arm/trampoline.S
@@ -130,8 +130,8 @@
 @X86_FREEBSD_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/freebsd.lo
 @X86_WIN32_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win32.lo
 @X86_WIN64_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/win64.lo
-@X86_DARWIN_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/darwin.lo \
-@X86_DARWIN_TRUE@	src/x86/ffi64.lo src/x86/darwin64.lo
+@DARWIN_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/darwin.lo \
+@DARWIN_TRUE@	src/x86/ffi64.lo src/x86/darwin64.lo
 @SPARC_TRUE@am__objects_8 = src/sparc/ffi.lo src/sparc/v8.lo \
 @SPARC_TRUE@	src/sparc/v9.lo
 @ALPHA_TRUE@am__objects_9 = src/alpha/ffi.lo src/alpha/osf.lo
@@ -145,9 +145,9 @@
 @POWERPC_AIX_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \
 @POWERPC_AIX_TRUE@	src/powerpc/aix.lo \
 @POWERPC_AIX_TRUE@	src/powerpc/aix_closure.lo
-@POWERPC_DARWIN_TRUE@am__objects_15 = src/powerpc/ffi_darwin.lo \
-@POWERPC_DARWIN_TRUE@	src/powerpc/darwin.lo \
-@POWERPC_DARWIN_TRUE@	src/powerpc/darwin_closure.lo
+@DARWIN_TRUE@am__objects_15 = src/powerpc/ffi_darwin.lo \
+@DARWIN_TRUE@	src/powerpc/darwin.lo \
+@DARWIN_TRUE@	src/powerpc/darwin_closure.lo
 @POWERPC_FREEBSD_TRUE@am__objects_16 = src/powerpc/ffi.lo \
 @POWERPC_FREEBSD_TRUE@	src/powerpc/sysv.lo \
 @POWERPC_FREEBSD_TRUE@	src/powerpc/ppc_closure.lo
diff -Nur atgreen-libffi-873d687-orig/configure atgreen-libffi-873d687/configure
--- atgreen-libffi-873d687-orig/configure	2012-04-11 20:13:17.000000000 -0700
+++ atgreen-libffi-873d687/configure	2013-01-25 10:08:39.000000000 -0800
@@ -651,8 +651,8 @@
 ARM_TRUE
 POWERPC_FREEBSD_FALSE
 POWERPC_FREEBSD_TRUE
-POWERPC_DARWIN_FALSE
-POWERPC_DARWIN_TRUE
+DARWIN_FALSE
+DARWIN_TRUE
 POWERPC_AIX_FALSE
 POWERPC_AIX_TRUE
 POWERPC_FALSE
@@ -667,8 +667,6 @@
 IA64_TRUE
 ALPHA_FALSE
 ALPHA_TRUE
-X86_DARWIN_FALSE
-X86_DARWIN_TRUE
 X86_WIN64_FALSE
 X86_WIN64_TRUE
 X86_WIN32_FALSE
@@ -13184,7 +13182,7 @@
 	fi
 	;;
   i?86-*-darwin*)
-	TARGET=X86_DARWIN; TARGETDIR=x86
+	TARGET=DARWIN; TARGETDIR=universal
 	;;
   i?86-*-solaris2.1[0-9]*)
 	TARGET=X86_64; TARGETDIR=x86
@@ -13228,7 +13226,7 @@
 	TARGET=POWERPC; TARGETDIR=powerpc
 	;;
   powerpc-*-darwin* | powerpc64-*-darwin*)
-	TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
+	TARGET=DARWIN; TARGETDIR=universal
 	;;
   powerpc-*-aix* | rs6000-*-aix*)
 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
@@ -13259,7 +13257,7 @@
 	;;
 
   x86_64-*-darwin*)
-	TARGET=X86_DARWIN; TARGETDIR=x86
+	TARGET=DARWIN; TARGETDIR=universal
 	;;
 
   x86_64-*-cygwin* | x86_64-*-mingw*)
@@ -13286,6 +13284,28 @@
 if test $TARGETDIR = unknown; then
   as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5
 fi
+if test $TARGETDIR = universal; then
+    mkdir -p src/universal
+    cat > src/universal/ffitarget.h << eof
+#if defined(__ppc__) || defined(__ppc64__)
+#define POWERPC_DARWIN
+
+eof
+    cat src/powerpc/ffitarget.h >> src/universal/ffitarget.h
+    cat >> src/universal/ffitarget.h << eof
+
+#elif defined(__i386__) || defined(__x86_64__)
+#define X86_DARWIN
+
+eof
+    cat src/x86/ffitarget.h >> src/universal/ffitarget.h
+    cat >> src/universal/ffitarget.h << eof
+
+#else
+#error "Unknown architecture"
+#endif
+eof
+fi
 
  if test x$TARGET = xMIPS; then
   MIPS_TRUE=
@@ -13335,12 +13355,12 @@
   X86_WIN64_FALSE=
 fi
 
- if test x$TARGET = xX86_DARWIN; then
-  X86_DARWIN_TRUE=
-  X86_DARWIN_FALSE='#'
+ if test x$TARGET = xDARWIN; then
+  DARWIN_TRUE=
+  DARWIN_FALSE='#'
 else
-  X86_DARWIN_TRUE='#'
-  X86_DARWIN_FALSE=
+  DARWIN_TRUE='#'
+  DARWIN_FALSE=
 fi
 
  if test x$TARGET = xALPHA; then
@@ -13399,14 +13419,6 @@
   POWERPC_AIX_FALSE=
 fi
 
- if test x$TARGET = xPOWERPC_DARWIN; then
-  POWERPC_DARWIN_TRUE=
-  POWERPC_DARWIN_FALSE='#'
-else
-  POWERPC_DARWIN_TRUE='#'
-  POWERPC_DARWIN_FALSE=
-fi
-
  if test x$TARGET = xPOWERPC_FREEBSD; then
   POWERPC_FREEBSD_TRUE=
   POWERPC_FREEBSD_FALSE='#'
@@ -14759,8 +14771,8 @@
   as_fn_error $? "conditional \"X86_WIN64\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${X86_DARWIN_TRUE}" && test -z "${X86_DARWIN_FALSE}"; then
-  as_fn_error $? "conditional \"X86_DARWIN\" was never defined.
+if test -z "${DARWIN_TRUE}" && test -z "${DARWIN_FALSE}"; then
+  as_fn_error $? "conditional \"DARWIN\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${ALPHA_TRUE}" && test -z "${ALPHA_FALSE}"; then
@@ -14791,10 +14803,6 @@
   as_fn_error $? "conditional \"POWERPC_AIX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${POWERPC_DARWIN_TRUE}" && test -z "${POWERPC_DARWIN_FALSE}"; then
-  as_fn_error $? "conditional \"POWERPC_DARWIN\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${POWERPC_FREEBSD_TRUE}" && test -z "${POWERPC_FREEBSD_FALSE}"; then
   as_fn_error $? "conditional \"POWERPC_FREEBSD\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff -Nur atgreen-libffi-873d687-orig/configure.ac atgreen-libffi-873d687/configure.ac
--- atgreen-libffi-873d687-orig/configure.ac	2012-04-11 20:10:51.000000000 -0700
+++ atgreen-libffi-873d687/configure.ac	2013-01-25 10:08:16.000000000 -0800
@@ -109,7 +109,7 @@
 	fi
 	;;
   i?86-*-darwin*)
-	TARGET=X86_DARWIN; TARGETDIR=x86
+	TARGET=DARWIN; TARGETDIR=universal
 	;;
   i?86-*-solaris2.1[[0-9]]*)
 	TARGET=X86_64; TARGETDIR=x86
@@ -153,7 +153,7 @@
 	TARGET=POWERPC; TARGETDIR=powerpc
 	;;
   powerpc-*-darwin* | powerpc64-*-darwin*)
-	TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
+	TARGET=DARWIN; TARGETDIR=universal
 	;;
   powerpc-*-aix* | rs6000-*-aix*)
 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
@@ -184,7 +184,7 @@
 	;;
 
   x86_64-*-darwin*)
-	TARGET=X86_DARWIN; TARGETDIR=x86
+	TARGET=DARWIN; TARGETDIR=universal
 	;;
 
   x86_64-*-cygwin* | x86_64-*-mingw*)
@@ -211,6 +211,28 @@
 if test $TARGETDIR = unknown; then
   AC_MSG_ERROR(["libffi has not been ported to $host."])
 fi
+if test $TARGETDIR = universal; then
+    mkdir -p src/universal
+    cat > src/universal/ffitarget.h << eof
+#if defined(__ppc__) || defined(__ppc64__)
+#define POWERPC_DARWIN
+
+eof
+    cat src/powerpc/ffitarget.h >> src/universal/ffitarget.h
+    cat >> src/universal/ffitarget.h << eof
+
+#elif defined(__i386__) || defined(__x86_64__)
+#define X86_DARWIN
+
+eof
+    cat src/x86/ffitarget.h >> src/universal/ffitarget.h
+    cat >> src/universal/ffitarget.h << eof
+
+#else
+#error "Unknown architecture"
+#endif
+eof
+fi
 
 AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
@@ -218,7 +240,7 @@
 AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
 AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
 AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
-AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
+AM_CONDITIONAL(DARWIN, test x$TARGET = xDARWIN)
 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
 AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
@@ -226,7 +248,6 @@
 AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
 AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
-AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
 AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
 AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
diff -Nur atgreen-libffi-873d687-orig/src/powerpc/darwin.S atgreen-libffi-873d687/src/powerpc/darwin.S
--- atgreen-libffi-873d687-orig/src/powerpc/darwin.S	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/powerpc/darwin.S	2013-01-25 10:01:31.000000000 -0800
@@ -24,6 +24,8 @@
    OTHER DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+#if defined(__ppc__) || defined(__ppc64__)
+
 #define LIBFFI_ASM
 #if defined(__ppc64__)
 #define MODE_CHOICE(x, y) y
@@ -381,3 +383,5 @@
 LEFDE1:
 	.align 1
 
+#endif /* __ppc__ || __ppc64__ */
+
diff -Nur atgreen-libffi-873d687-orig/src/powerpc/darwin_closure.S atgreen-libffi-873d687/src/powerpc/darwin_closure.S
--- atgreen-libffi-873d687-orig/src/powerpc/darwin_closure.S	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/powerpc/darwin_closure.S	2013-01-25 09:51:03.000000000 -0800
@@ -25,6 +25,8 @@
    OTHER DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+#if defined(__ppc__) || defined(__ppc64__)
+
 #define LIBFFI_ASM
 #define L(x) x
 
@@ -574,3 +576,6 @@
 	.g_long	dyld_stub_binding_helper
 #  endif
 #endif
+
+#endif /* __ppc__ || __ppc64__ */
+
diff -Nur atgreen-libffi-873d687-orig/src/powerpc/ffi_darwin.c atgreen-libffi-873d687/src/powerpc/ffi_darwin.c
--- atgreen-libffi-873d687-orig/src/powerpc/ffi_darwin.c	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/powerpc/ffi_darwin.c	2013-01-25 10:05:26.000000000 -0800
@@ -27,6 +27,8 @@
    OTHER DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+#if defined(__ppc__) || defined(__ppc64__)
+
 #include <ffi.h>
 #include <ffi_common.h>
 
@@ -1357,3 +1359,6 @@
   /* Tell ffi_closure_ASM to perform return type promotions.  */
   return cif->rtype;
 }
+
+#endif /* __ppc__ || __ppc64__ */
+
diff -Nur atgreen-libffi-873d687-orig/src/x86/darwin.S atgreen-libffi-873d687/src/x86/darwin.S
--- atgreen-libffi-873d687-orig/src/x86/darwin.S	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/x86/darwin.S	2013-01-25 09:47:53.000000000 -0800
@@ -26,6 +26,8 @@
    -----------------------------------------------------------------------
    */
 
+#if defined(__i386__) || defined(__x86_64__)
+
 #ifndef __x86_64__
 
 #define LIBFFI_ASM	
@@ -442,3 +444,6 @@
 #endif
 
 #endif /* ifndef __x86_64__ */
+
+#endif /* __i386__ || __x86_64__ */
+
diff -Nur atgreen-libffi-873d687-orig/src/x86/darwin64.S atgreen-libffi-873d687/src/x86/darwin64.S
--- atgreen-libffi-873d687-orig/src/x86/darwin64.S	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/x86/darwin64.S	2013-01-25 09:48:58.000000000 -0800
@@ -25,6 +25,8 @@
    OTHER DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+#if defined(__i386__) || defined(__x86_64__)
+
 #ifdef __x86_64__
 #define LIBFFI_ASM
 #include <fficonfig.h>
@@ -414,3 +416,6 @@
 	.subsections_via_symbols
 
 #endif /* __x86_64__ */
+
+#endif /* __i386__ || __x86_64__ */
+
diff -Nur atgreen-libffi-873d687-orig/src/x86/ffi.c atgreen-libffi-873d687/src/x86/ffi.c
--- atgreen-libffi-873d687-orig/src/x86/ffi.c	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/x86/ffi.c	2013-01-25 09:47:13.000000000 -0800
@@ -28,6 +28,8 @@
    DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+#if defined(__i386__) || defined(__x86_64__)
+
 #if !defined(__x86_64__) || defined(_WIN64)
 
 #ifdef _WIN64
@@ -841,3 +843,5 @@
 
 #endif /* !__x86_64__  || X86_WIN64 */
 
+#endif /* __i386__ || __x86_64__ */
+
diff -Nur atgreen-libffi-873d687-orig/src/x86/ffi64.c atgreen-libffi-873d687/src/x86/ffi64.c
--- atgreen-libffi-873d687-orig/src/x86/ffi64.c	2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/src/x86/ffi64.c	2013-01-25 09:48:30.000000000 -0800
@@ -26,6 +26,8 @@
    DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
+#if defined(__i386__) || defined(__x86_64__)
+
 #include <ffi.h>
 #include <ffi_common.h>
 
@@ -641,3 +643,6 @@
 }
 
 #endif /* __x86_64__ */
+
+#endif /* __i386__ || __x86_64__ */
+


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