Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Updated fatbuild.sh to match 1.2 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 19, 2011
1 parent d394510 commit 4dc7286
Showing 1 changed file with 60 additions and 53 deletions.
113 changes: 60 additions & 53 deletions build-scripts/fatbuild.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,59 +16,27 @@ fi
# Generic, cross-platform CFLAGS you always want go here. # Generic, cross-platform CFLAGS you always want go here.
CFLAGS="-O3 -g -pipe" CFLAGS="-O3 -g -pipe"


# Intel 32-bit configure flags (10.4 runtime compatibility)
# We dynamically load X11, so using the system X11 headers is fine. # We dynamically load X11, so using the system X11 headers is fine.
CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \ BASE_CONFIG_FLAGS="--build=`uname -p`-apple-darwin \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib" --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"


# They changed this from "darwin9" to "darwin10" in Xcode 3.2 (Snow Leopard). # PowerPC 32-bit compiler flags
GCCUSRPATH_X86=`ls -d $SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin*/4.0.1` CONFIG_PPC="--host=powerpc-apple-darwin"
if [ ! -d "$GCCUSRPATH_X86" ]; then CC_PPC="gcc-4.0"
echo "Couldn't find any GCC usr path for 32-bit x86" CXX_PPC="g++-4.0"
exit 1 BUILD_FLAGS_PPC="-arch ppc -mmacosx-version-min=10.4"
fi
GCCUSRPATH_X64=`ls -d $SDK_PATH/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin*/4.0.1`
if [ ! -d "$GCCUSRPATH_X64" ]; then
echo "Couldn't find any GCC usr path for 64-bit x86"
exit 1
fi


# Intel 32-bit compiler flags # Intel 32-bit compiler flags
CC_X86="gcc-4.0 -arch i386" CONFIG_X86="--host=i386-apple-darwin"
CXX_X86="g++-4.0 -arch i386" CC_X86="gcc"
CFLAGS_X86="-mmacosx-version-min=10.4" CXX_X86="g++"
CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ BUILD_FLAGS_X86="-arch i386 -mmacosx-version-min=10.4"
-nostdinc \
-F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
-I$GCCUSRPATH_X86/include \
-isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include"

# Intel 32-bit linker flags
LFLAGS_X86="-arch i386 -Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 \
-F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
-L$GCCUSRPATH_X86 \
-Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk"

# Intel 64-bit configure flags (10.5 runtime compatibility)
# We dynamically load X11, so using the system X11 headers is fine.
CONFIG_X64="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"


# Intel 64-bit compiler flags # Intel 64-bit compiler flags
CC_X64="gcc-4.0 -arch x86_64" CONFIG_X64="--host=x86_64-apple-darwin"
CXX_X64="g++-4.0 -arch x86_64" CC_X64="gcc"
CFLAGS_X64="-mmacosx-version-min=10.5" CXX_X64="g++"
CPPFLAGS_X64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \ BUILD_FLAGS_X64="-arch x86_64 -mmacosx-version-min=10.6"
-nostdinc \
-F$SDK_PATH/MacOSX10.5.sdk/System/Library/Frameworks \
-I$GCCUSRPATH_X64/include \
-isystem $SDK_PATH/MacOSX10.5.sdk/usr/include"

# Intel 64-bit linker flags
LFLAGS_X64="-arch x86_64 -Wl,-headerpad_max_install_names -mmacosx-version-min=10.5 \
-F$SDK_PATH/MacOSX10.5.sdk/System/Library/Frameworks \
-L$GCCUSRPATH_X64/x86_64 \
-Wl,-syslibroot,$SDK_PATH/MacOSX10.5.sdk"


# #
# Find the configure script # Find the configure script
Expand All @@ -77,11 +45,19 @@ srcdir=`dirname $0`/..
auxdir=$srcdir/build-scripts auxdir=$srcdir/build-scripts
cd $srcdir cd $srcdir


allow_ppc="yes"
which gcc-4.0 >/dev/null 2>/dev/null
if [ "x$?" = "x1" ]; then
#echo "WARNING: Can't find gcc-4.0, which means you don't have Xcode 3."
#echo "WARNING: Therefore, we can't do PowerPC support."
allow_ppc="no"
fi

# #
# Figure out which phase to build: # Figure out which phase to build:
# all, # all,
# configure, configure-x86, configure-x64 # configure, configure-ppc, configure-x86, configure-x64
# make, make-x86, make-x64, merge # make, make-ppc, make-x86, make-x64, merge
# install # install
# clean # clean
if test x"$1" = x; then if test x"$1" = x; then
Expand All @@ -91,27 +67,37 @@ else
fi fi
case $phase in case $phase in
all) all)
configure_ppc="$allow_ppc"
configure_x86="yes" configure_x86="yes"
configure_x64="yes" configure_x64="yes"
make_ppc="$allow_ppc"
make_x86="yes" make_x86="yes"
make_x64="yes" make_x64="yes"
merge="yes" merge="yes"
;; ;;
configure) configure)
configure_ppc="$allow_ppc"
configure_x86="yes" configure_x86="yes"
configure_x64="yes" configure_x64="yes"
;; ;;
configure-ppc)
configure_ppc="$allow_ppc"
;;
configure-x86) configure-x86)
configure_x86="yes" configure_x86="yes"
;; ;;
configure-x64) configure-x64)
configure_x64="yes" configure_x64="yes"
;; ;;
make) make)
make_ppc="$allow_ppc"
make_x86="yes" make_x86="yes"
make_x64="yes" make_x64="yes"
merge="yes" merge="yes"
;; ;;
make-ppc)
make_ppc="$allow_ppc"
;;
make-x86) make-x86)
make_x86="yes" make_x86="yes"
;; ;;
Expand Down Expand Up @@ -144,24 +130,31 @@ case $phase in
install_man="yes" install_man="yes"
;; ;;
clean) clean)
clean_ppc="yes"
clean_x86="yes" clean_x86="yes"
clean_x64="yes" clean_x64="yes"
;; ;;
clean-ppc)
clean_ppc="yes"
;;
clean-x86) clean-x86)
clean_x86="yes" clean_x86="yes"
;; ;;
clean-x64) clean-x64)
clean_x64="yes" clean_x64="yes"
;; ;;
*) *)
echo "Usage: $0 [all|configure[-x86|-x64]|make[-x86|-x64]|merge|install|clean[-x86|-x64]]" echo "Usage: $0 [all|configure[-ppc|-x86|-x64]|make[-ppc|-x86|-x64]|merge|install|clean[-ppc|-x86|-x64]]"
exit 1 exit 1
;; ;;
esac esac
case `uname -p` in case `uname -p` in
*86) *86)
native_path=x86 native_path=x86
;; ;;
*powerpc)
native_path=ppc
;;
x86_64) x86_64)
native_path=x64 native_path=x64
;; ;;
Expand All @@ -174,31 +167,42 @@ esac
# #
# Create the build directories # Create the build directories
# #
for dir in build build/x86 build/x64; do for dir in build build/ppc build/x86 build/x64; do
if test -d $dir; then if test -d $dir; then
: :
else else
mkdir $dir || exit 1 mkdir $dir || exit 1
fi fi
done done



#
# Build the PowerPC 32-bit binary
#
if test x$configure_ppc = xyes; then
(cd build/ppc && \
sh ../../configure $BASE_CONFIG_FLAGS $CONFIG_PPC CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $BUILD_FLAGS_PPC $CFLAGS_PPC" LDFLAGS="$BUILD_FLAGS_PPC $LFLAGS_PPC") || exit 2
fi
if test x$make_ppc = xyes; then
(cd build/ppc && make -j$NJOB) || exit 3
fi
# #
# Build the Intel 32-bit binary # Build the Intel 32-bit binary
# #
if test x$configure_x86 = xyes; then if test x$configure_x86 = xyes; then
(cd build/x86 && \ (cd build/x86 && \
sh ../../configure $CONFIG_X86 CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 sh ../../configure $BASE_CONFIG_FLAGS $CONFIG_X86 CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $BUILD_FLAGS_X86 $CFLAGS_X86" LDFLAGS="$BUILD_FLAGS_X86 $LFLAGS_X86") || exit 2
fi fi
if test x$make_x86 = xyes; then if test x$make_x86 = xyes; then
(cd build/x86 && make -j$NJOB) || exit 3 (cd build/x86 && make -j$NJOB) || exit 3
fi fi


# #
# Build the Intel 32-bit binary # Build the Intel 64-bit binary
# #
if test x$configure_x64 = xyes; then if test x$configure_x64 = xyes; then
(cd build/x64 && \ (cd build/x64 && \
sh ../../configure $CONFIG_X64 CC="$CC_X64" CXX="$CXX_X64" CFLAGS="$CFLAGS $CFLAGS_X64" CPPFLAGS="$CPPFLAGS_X64" LDFLAGS="$LFLAGS_X64") || exit 2 sh ../../configure $BASE_CONFIG_FLAGS $CONFIG_X64 CC="$CC_X64" CXX="$CXX_X64" CFLAGS="$CFLAGS $BUILD_FLAGS_X64 $CFLAGS_X64" LDFLAGS="$BUILD_FLAGS_X64 $LFLAGS_X64") || exit 2
fi fi
if test x$make_x64 = xyes; then if test x$make_x64 = xyes; then
(cd build/x64 && make -j$NJOB) || exit 3 (cd build/x64 && make -j$NJOB) || exit 3
Expand Down Expand Up @@ -291,6 +295,9 @@ do_clean()
echo $* echo $*
$* || exit 6 $* || exit 6
} }
if test x$clean_ppc = xyes; then
do_clean rm -r build/ppc
fi
if test x$clean_x86 = xyes; then if test x$clean_x86 = xyes; then
do_clean rm -r build/x86 do_clean rm -r build/x86
fi fi
Expand Down

0 comments on commit 4dc7286

Please sign in to comment.