diff build-scripts/fatbuild.sh @ 1657:5b0805ceb50f SDL-1.3

Merge trunk-1.3-2
author Sam Lantinga <slouken@libsdl.org>
date Fri, 28 Apr 2006 16:55:41 +0000
parents 9f59d4c5aaea
children 14717b52abc0
line wrap: on
line diff
--- a/build-scripts/fatbuild.sh	Thu Apr 27 09:09:48 2006 +0000
+++ b/build-scripts/fatbuild.sh	Fri Apr 28 16:55:41 2006 +0000
@@ -2,9 +2,18 @@
 #
 # Build a fat binary on Mac OS X, thanks Ryan!
 
+# Number of CPUs (for make -j)
+NCPU=`sysctl -n hw.ncpu`
+NJOB=$NCPU
+#NJOB=`expr $NCPU + 1`
+
+# Generic, cross-platform CFLAGS you always want go here.
+CFLAGS="-O3 -g -pipe"
+
 # PowerPC compiler flags (10.2 runtime compatibility)
-CC_PPC="gcc-3.3"
-CFLAGS_PPC="-arch ppc"
+CC_PPC="gcc-3.3 -arch ppc"
+CXX_PPC="g++-3.3 -arch ppc"
+CFLAGS_PPC=""
 CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
 -nostdinc \
 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
@@ -18,8 +27,9 @@
 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
 
 # Intel compiler flags (10.4 runtime compatibility)
-CC_X86="gcc-4.0"
-CFLAGS_X86="-arch i386 -mmacosx-version-min=10.4"
+CC_X86="gcc-4.0 -arch i386"
+CXX_X86="g++-4.0 -arch i386"
+CFLAGS_X86="-mmacosx-version-min=10.4"
 CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
 -nostdinc \
 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
@@ -44,6 +54,7 @@
 # configure, configure-ppc, configure-x86,
 # make, make-ppc, make-x86, merge
 # install
+# clean
 if test x"$1" = x; then
     phase=all
 else
@@ -103,8 +114,18 @@
     install-man)
         install_man="yes"
         ;;
+    clean)
+        clean_ppc="yes"
+        clean_x86="yes"
+        ;;
+    clean-ppc)
+        clean_ppc="yes"
+        ;;
+    clean-x86)
+        clean_x86="yes"
+        ;;
     *)
-        echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge]"
+        echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]"
         exit 1
         ;;
 esac
@@ -137,10 +158,10 @@
 #
 if test x$configure_ppc = xyes; then
     (cd build/ppc && \
-     sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CFLAGS="$CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
+     sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
 fi
 if test x$make_ppc = xyes; then
-    (cd build/ppc && make) || exit 3
+    (cd build/ppc && ls include && make -j$NJOB) || exit 3
 fi
 
 #
@@ -148,10 +169,10 @@
 #
 if test x$configure_x86 = xyes; then
     (cd build/x86 && \
-     sh ../../configure --build=`uname -p`-apple-darwin --host=i686-apple-darwin CC="$CC_X86" CFLAGS="$CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
+     sh ../../configure --build=`uname -p`-apple-darwin --host=i386-apple-darwin CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
 fi
 if test x$make_x86 = xyes; then
-    (cd build/x86 && make) || exit 3
+    (cd build/x86 && make -j$NJOB) || exit 3
 fi
 
 #
@@ -233,3 +254,19 @@
         do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \
     done
 fi
+
+#
+# Clean up
+#
+do_clean()
+{
+    echo $*
+    $* || exit 6
+}
+if test x$clean_x86 = xyes; then
+    do_clean rm -r build/x86
+fi
+if test x$clean_ppc = xyes; then
+    do_clean rm -r build/ppc
+fi
+