listup_binaries(){ find . -type f | while read o; do case "$o" in ./.arch_ppc/*|./.arch_ppc64/*|./.arch_i386/*|./.arch_x86_64/*) continue ;; *) t="`file -b \"$o\"`" case "$t" in *"Mach-O"*" executable"*) ;; *"current ar archive"*|*"ar archive random library"*) ;; *"Mach-O"*" dynamically linked shared library"*) ;; *"Mach-O"*" object"*) ;; *"Mach-O"*" bundle"*) ;; *) continue ;; esac ;; esac echo "$o" done } listup_headers(){ find . -type f | while read o; do case "$o" in ./.arch_ppc/*|./.arch_ppc64/*|./.arch_i386/*|./.arch_x86_64/*) continue ;; *.h|*.hpp) t="`file -b \"$o\"`" case "$t" in *"program text"*) ;; *) continue ;; esac ;; *) continue ;; esac echo "$o" done } #make clean distclean && ./configure 'CFLAGS=-arch x86_64 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib -arch x86_64 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' --host=x86_64-apple-darwin --build=`sh config.guess` --prefix=/opt/local && make && { make check || true; } && { [ -d .arch_x86_64 ] || mkdir .arch_x86_64 && listup_binaries > .arch_x86_64/.binaries.lst && tar --files-from=.arch_x86_64/.binaries.lst -cf - | (cd .arch_x86_64 && tar xf -) && listup_headers > .arch_x86_64/.headers.lst && tar --files-from=.arch_x86_64/.headers.lst -cf - | (cd .arch_x86_64 && tar xf -) } && make clean distclean && ./configure 'CFLAGS=-arch i386 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib -arch i386 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' --host=i386-apple-darwin --build=`sh config.guess` --prefix=/opt/local && make && { make check || true; } && { [ -d .arch_i386 ] || mkdir .arch_i386 && listup_binaries > .arch_i386/.binaries.lst && tar --files-from=.arch_i386/.binaries.lst -cf - | (cd .arch_i386 && tar xf -) && listup_headers > .arch_i386/.headers.lst && tar --files-from=.arch_i386/.headers.lst -cf - | (cd .arch_i386 && tar xf -) } && make clean distclean && ./configure 'CFLAGS=-arch ppc64 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib -arch ppc64 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' --host=ppc64-apple-darwin --build=`sh config.guess` --prefix=/opt/local && make && { make check || true; } && { [ -d .arch_ppc64 ] || mkdir .arch_ppc64 && listup_binaries > .arch_ppc64/.binaries.lst && tar --files-from=.arch_ppc64/.binaries.lst -cf - | (cd .arch_ppc64 && tar xf -) && listup_headers > .arch_ppc64/.headers.lst && tar --files-from=.arch_ppc64/.headers.lst -cf - | (cd .arch_ppc64 && tar xf -) } && make clean distclean && ./configure 'CFLAGS=-arch ppc -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib -arch ppc -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' --host=ppc-apple-darwin --build=`sh config.guess` --prefix=/opt/local && make && { make check || true; } && { [ -d .arch_ppc ] || mkdir .arch_ppc && listup_binaries > .arch_ppc/.binaries.lst && tar --files-from=.arch_ppc/.binaries.lst -cf - | (cd .arch_ppc && tar xf -) && listup_headers > .arch_ppc/.headers.lst && tar --files-from=.arch_ppc/.headers.lst -cf - | (cd .arch_ppc && tar xf -) } && { cat .arch_ppc/.headers.lst | while read h; do diff .arch_ppc/"$h" .arch_ppc64/"$h" > /dev/null 2>&1 && diff .arch_ppc/"$h" .arch_i386/"$h" > /dev/null 2>&1 && diff .arch_ppc/"$h" .arch_x86_64/"$h" > /dev/null 2>&1 || { echo univarsalized header: "$h" cat < "$h" && #if defined(__ppc__) `cat .arch_ppc/"$h"` #elif defined(__ppc64__) `cat .arch_ppc64/"$h"` #elif defined(__i386__) `cat .arch_i386/"$h"` #elif defined(__x86_64__) `cat .arch_x86_64/"$h"` #endif /* defined(__arch__) */ EOF touch -r .arch_ppc/"$h" "$h" } done } && { listup_binaries | while read o; do echo lipo -create -output "$o" -arch ppc .arch_ppc/"$o" -arch ppc64 .arch_ppc64/"$o" -arch i386 .arch_i386/"$o" -arch x86_64 .arch_x86_64/"$o" lipo -create -output "$o" -arch ppc .arch_ppc/"$o" -arch ppc64 .arch_ppc64/"$o" -arch i386 .arch_i386/"$o" -arch x86_64 .arch_x86_64/"$o" && touch -r .arch_ppc/"$o" "$o" done }