Re: [gtk-osx-users] Universal ppc/i386 build
- From: Steffen Gutmann <muibase yahoo com>
- To: "gtk-osx-users-list gnome org" <gtk-osx-users-list gnome org>
- Subject: Re: [gtk-osx-users] Universal ppc/i386 build
- Date: Tue, 22 Jan 2013 09:53:15 -0800 (PST)
>
> The first problem I ran into is libffi. I see that 10.5 has its own version of
> libffi. Has anyone already tried using that one instead of building the one
> that comes with meta-osx-gtk-core?
I answer the question myself. meta-gtk-osx-core needs libffi version 3.0 or better. otool -L /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libffi.dylib reports version 1.0.0 (it might be a later version but probably not 3.0).
Anyways, I have been successful in compiling gtk-osx for a universal ppc/x86 Leopard build. I have only tested it for my app by running the same universal binary on a Leopard ppc and a Lion x86_64 Mac.
In .jhbuildrc-custom I set:
setup_universal_build(target="10.5", sdk_version="10.5",
architectures=["ppc", "i386"])
The only two modules that needed a change are libffi and glib. Attached are the two diffs. The way to apply them is to unpack each tarball manually and then use the 'patch' program to make the changes. The patch needs to be applied before running configure.
While the changes I made (and therefore the resulting diff) are quite specific to a universal build for ppc/x86 on MacOSX I post them here in the hope that they will be useful for others. In general, the modules try to determine architecture (libffi) or endianness (glib) in the configure script and then choose the one-for-all instantiation. My modifications make them use the __POWERPC__ and __i386__ preprocessor symbols for choosing one or the other. It would be great if some of these changes would go back to the maintainers of the two modules with the hope that they support universal builds directly for MacOSX.
Note that my app does not use the full feature set of Gtk, so there might be things missing or not working properly.
Regards,
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-21 16:51:35.000000000 -0800
@@ -119,6 +119,7 @@
endif
if X86_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
@@ -142,6 +143,7 @@
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/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 POWERPC_FREEBSD
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-21 17:01:50.000000000 -0800
@@ -43,6 +43,7 @@
@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
+@POWERPC_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,6 +51,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
+@X86_DARWIN_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
@POWERPC_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
@@ -132,6 +134,8 @@
@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
+@POWERPC_DARWIN_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/darwin.lo \
+@POWERPC_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
@@ -148,6 +152,9 @@
@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
+@X86_DARWIN_TRUE@am__objects_15 = src/powerpc/ffi_darwin.lo \
+@X86_DARWIN_TRUE@ src/powerpc/darwin.lo \
+@X86_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-21 16:39:54.000000000 -0800
@@ -14592,7 +14592,10 @@
ac_config_commands="$ac_config_commands src"
-ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
+#ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h"
+ac_config_links="$ac_config_links include/ffitarget-powerpc.h:src/powerpc/ffitarget.h"
+ac_config_links="$ac_config_links include/ffitarget-x86.h:src/x86/ffitarget.h"
+ac_config_links="$ac_config_links include/ffitarget.h:src/universal/ffitarget.h"
ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
@@ -15752,7 +15755,10 @@
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;;
"src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;;
- "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;;
+# "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;;
+ "include/ffitarget-powerpc.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget-powerpc.h:src/powerpc/ffitarget.h" ;;
+ "include/ffitarget-x86.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget-x86.h:src/x86/ffitarget.h" ;;
+ "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/universal/ffitarget.h" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
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-21 16:13:46.000000000 -0800
@@ -495,7 +495,10 @@
test -d src/$TARGETDIR || mkdir src/$TARGETDIR
], [TARGETDIR="$TARGETDIR"])
-AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
+#AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
+AC_CONFIG_LINKS(include/ffitarget-powerpc.h:src/powerpc/ffitarget.h)
+AC_CONFIG_LINKS(include/ffitarget-x86.h:src/x86/ffitarget.h)
+AC_CONFIG_LINKS(include/ffitarget.h:src/universal/ffitarget.h)
AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
diff -Nur atgreen-libffi-873d687-orig/include/ffi.h.in atgreen-libffi-873d687/include/ffi.h.in
--- atgreen-libffi-873d687-orig/include/ffi.h.in 2012-04-11 19:46:06.000000000 -0700
+++ atgreen-libffi-873d687/include/ffi.h.in 2013-01-21 16:08:37.000000000 -0800
@@ -58,9 +58,19 @@
#endif
/* Specify which architecture libffi is configured for. */
+#if defined(__POWERPC__)
+#ifndef POWERPC_DARWIN
+#define POWERPC_DARWIN
+#endif
+#elif defined(__i386__)
+#ifndef X86_DARWIN
+#define X86_DARWIN
+#endif
+#else
#ifndef @TARGET@
#define @TARGET@
#endif
+#endif
/* ---- System configuration information --------------------------------- */
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-21 16:15:28.000000000 -0800
@@ -24,6 +24,8 @@
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
+#ifdef __POWERPC__
+
#define LIBFFI_ASM
#if defined(__ppc64__)
#define MODE_CHOICE(x, y) y
@@ -381,3 +383,5 @@
LEFDE1:
.align 1
+#endif
+
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-21 16:15:28.000000000 -0800
@@ -25,6 +25,8 @@
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
+#ifdef __POWERPC__
+
#define LIBFFI_ASM
#define L(x) x
@@ -574,3 +576,6 @@
.g_long dyld_stub_binding_helper
# endif
#endif
+
+#endif
+
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-21 16:15:28.000000000 -0800
@@ -27,6 +27,8 @@
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
+#ifdef __POWERPC__
+
#include <ffi.h>
#include <ffi_common.h>
@@ -1357,3 +1359,6 @@
/* Tell ffi_closure_ASM to perform return type promotions. */
return cif->rtype;
}
+
+#endif
+
diff -Nur atgreen-libffi-873d687-orig/src/universal/ffitarget.h atgreen-libffi-873d687/src/universal/ffitarget.h
--- atgreen-libffi-873d687-orig/src/universal/ffitarget.h 1969-12-31 16:00:00.000000000 -0800
+++ atgreen-libffi-873d687/src/universal/ffitarget.h 2013-01-21 16:23:11.000000000 -0800
@@ -0,0 +1,7 @@
+#if defined(__POWERPC__)
+#include "ffitarget-powerpc.h"
+#elif defined(__i386__)
+#include "ffitarget-x86.h"
+#else
+#error "No ffitarget.h
+#endif
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-21 16:15:28.000000000 -0800
@@ -26,6 +26,7 @@
-----------------------------------------------------------------------
*/
+#if defined(__i386__) || defined(__x86_64__)
#ifndef __x86_64__
#define LIBFFI_ASM
@@ -442,3 +443,4 @@
#endif
#endif /* ifndef __x86_64__ */
+#endif
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-21 16:15:28.000000000 -0800
@@ -28,6 +28,7 @@
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
+#if defined(__i386__) || defined(__x86_64__)
#if !defined(__x86_64__) || defined(_WIN64)
#ifdef _WIN64
@@ -840,4 +841,5 @@
#endif
#endif /* !__x86_64__ || X86_WIN64 */
+#endif
Only in glib-2.34.1: config.h.in.orig
Only in glib-2.34.1: config.h.in.rej
diff -ru glib-2.34.1-orig/configure glib-2.34.1/configure
--- glib-2.34.1-orig/configure 2012-10-15 17:29:14.000000000 -0700
+++ glib-2.34.1/configure 2013-01-21 13:19:46.000000000 -0800
@@ -32598,10 +32598,22 @@
g_bit_sizes="16 32 64"
for bits in $g_bit_sizes; do
cat >>$outfile <<_______EOF
+#if defined(__POWERPC__)
+#define GINT${bits}_TO_BE(val) ((gint${bits}) (val))
+#define GUINT${bits}_TO_BE(val) ((guint${bits}) (val))
+#define GINT${bits}_TO_LE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
+#define GUINT${bits}_TO_LE(val) (GUINT${bits}_SWAP_LE_BE (val))
+#elif defined(__i386__)
+#define GINT${bits}_TO_LE(val) ((gint${bits}) (val))
+#define GUINT${bits}_TO_LE(val) ((guint${bits}) (val))
+#define GINT${bits}_TO_BE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
+#define GUINT${bits}_TO_BE(val) (GUINT${bits}_SWAP_LE_BE (val))
+#else
#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val))
#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val))
#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val))
+#endif
_______EOF
done
@@ -32618,7 +32630,13 @@
#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val))
#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val))
#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val))
-#define G_BYTE_ORDER $g_byte_order
+#if defined(__POWERPC__)
+ #define G_BYTE_ORDER G_BIG_ENDIAN
+#elif defined(__i386__)
+ #define G_BYTE_ORDER G_LITTLE_ENDIAN
+#else
+ #define G_BYTE_ORDER $g_byte_order
+#endif
#define GLIB_SYSDEF_POLLIN =$g_pollin
#define GLIB_SYSDEF_POLLOUT =$g_pollout
diff -ru glib-2.34.1-orig/configure.ac glib-2.34.1/configure.ac
--- glib-2.34.1-orig/configure.ac 2012-10-15 17:28:53.000000000 -0700
+++ glib-2.34.1/configure.ac 2013-01-21 13:19:52.000000000 -0800
@@ -3061,10 +3061,22 @@
g_bit_sizes="16 32 64"
for bits in $g_bit_sizes; do
cat >>$outfile <<_______EOF
+#if defined(__POWERPC__)
+#define GINT${bits}_TO_BE(val) ((gint${bits}) (val))
+#define GUINT${bits}_TO_BE(val) ((guint${bits}) (val))
+#define GINT${bits}_TO_LE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
+#define GUINT${bits}_TO_LE(val) (GUINT${bits}_SWAP_LE_BE (val))
+#elif defined(__i386__)
+#define GINT${bits}_TO_LE(val) ((gint${bits}) (val))
+#define GUINT${bits}_TO_LE(val) ((guint${bits}) (val))
+#define GINT${bits}_TO_BE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
+#define GUINT${bits}_TO_BE(val) (GUINT${bits}_SWAP_LE_BE (val))
+#else
#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val))
#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val))
#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val))
+#endif
_______EOF
done
@@ -3081,7 +3093,13 @@
#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val))
#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val))
#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val))
-#define G_BYTE_ORDER $g_byte_order
+#if defined(__POWERPC__)
+ #define G_BYTE_ORDER G_BIG_ENDIAN
+#elif defined(__i386__)
+ #define G_BYTE_ORDER G_LITTLE_ENDIAN
+#else
+ #define G_BYTE_ORDER $g_byte_order
+#endif
#define GLIB_SYSDEF_POLLIN =$g_pollin
#define GLIB_SYSDEF_POLLOUT =$g_pollout
Only in glib-2.34.1: configure.ac.orig
Only in glib-2.34.1: configure.orig
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]