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

Commit

Permalink
Added 64-bit architectures to the fat build script
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 5, 2009
1 parent 0b5009e commit 94eca3b
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 17 deletions.
123 changes: 110 additions & 13 deletions build-scripts/fatbuild.sh
Expand Up @@ -9,12 +9,12 @@ NJOB=$NCPU
# Generic, cross-platform CFLAGS you always want go here.
CFLAGS="-O3 -g -pipe"

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

# PowerPC compiler flags
# PowerPC 32-bit compiler flags
CC_PPC="gcc-4.0 -arch ppc"
CXX_PPC="g++-4.0 -arch ppc"
CFLAGS_PPC=""
Expand All @@ -24,18 +24,44 @@ CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include \
-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"

# PowerPC linker flags
LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.3 \
# PowerPC 32-bit linker flags
LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.4 \
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1 \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"

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

# PowerPC 64-bit compiler flags
CC_PPC64="gcc-4.0 -arch ppc64"
CXX_PPC64="g++-4.0 -arch ppc64"
CFLAGS_PPC64=""
CPPFLAGS_PPC64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
-nostdinc \
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include \
-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include"

# PowerPC 64-bit linker flags
LFLAGS_PPC64="-arch ppc64 -mmacosx-version-min=10.5 \
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/ppc64 \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"

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

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

# Intel compiler flags
# Intel 32-bit compiler flags
CC_X86="gcc-4.0 -arch i386"
CXX_X86="g++-4.0 -arch i386"
CFLAGS_X86="-mmacosx-version-min=10.4"
Expand All @@ -45,12 +71,33 @@ CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include \
-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"

# Intel linker flags
# Intel 32-bit linker flags
LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1 \
-Wl,-syslibroot,/Developer/SDKs/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
CC_X64="gcc-4.0 -arch x86_64"
CXX_X64="g++-4.0 -arch x86_64"
CFLAGS_X64="-mmacosx-version-min=10.5"
CPPFLAGS_X64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
-nostdinc \
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include \
-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include"

# Intel 64-bit linker flags
LFLAGS_X64="-arch x86_64 -mmacosx-version-min=10.5 \
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/x86_64 \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"

#
# Find the configure script
#
Expand All @@ -61,8 +108,8 @@ cd $srcdir
#
# Figure out which phase to build:
# all,
# configure, configure-ppc, configure-x86,
# make, make-ppc, make-x86, merge
# configure, configure-ppc, configure-ppc64, configure-x86, configure-x64
# make, make-ppc, make-ppc64, make-x86, make-x64, merge
# install
# clean
if test x"$1" = x; then
Expand All @@ -73,32 +120,52 @@ fi
case $phase in
all)
configure_ppc="yes"
configure_ppc64="yes"
configure_x86="yes"
configure_x64="yes"
make_ppc="yes"
make_ppc64="yes"
make_x86="yes"
make_x64="yes"
merge="yes"
;;
configure)
configure_ppc="yes"
configure_ppc64="yes"
configure_x86="yes"
configure_x64="yes"
;;
configure-ppc)
configure_ppc="yes"
;;
configure-ppc64)
configure_ppc64="yes"
;;
configure-x86)
configure_x86="yes"
;;
configure-x64)
configure_x64="yes"
;;
make)
make_ppc="yes"
make_ppc64="yes"
make_x86="yes"
make_x64="yes"
merge="yes"
;;
make-ppc)
make_ppc="yes"
;;
make-ppc64)
make_ppc64="yes"
;;
make-x86)
make_x86="yes"
;;
make-x64)
make_x64="yes"
;;
merge)
merge="yes"
;;
Expand Down Expand Up @@ -126,16 +193,24 @@ case $phase in
;;
clean)
clean_ppc="yes"
clean_ppc64="yes"
clean_x86="yes"
clean_x64="yes"
;;
clean-ppc)
clean_ppc="yes"
;;
clean-ppc64)
clean_ppc64="yes"
;;
clean-x86)
clean_x86="yes"
;;
clean-x64)
clean_x64="yes"
;;
*)
echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]"
echo "Usage: $0 [all|configure[-ppc|-ppc64|-x86|-x64]|make[-ppc|-ppc64|-x86|-x64]|merge|install|clean[-ppc|-ppc64|-x86|-x64]]"
exit 1
;;
esac
Expand All @@ -155,7 +230,7 @@ esac
#
# Create the build directories
#
for dir in build build/ppc build/x86; do
for dir in build build/ppc build/ppc64 build/x86 build/x64; do
if test -d $dir; then
:
else
Expand All @@ -164,7 +239,7 @@ for dir in build build/ppc build/x86; do
done

#
# Build the PowerPC binary
# Build the PowerPC 32-bit binary
#
if test x$configure_ppc = xyes; then
(cd build/ppc && \
Expand All @@ -175,7 +250,18 @@ if test x$make_ppc = xyes; then
fi

#
# Build the Intel binary
# Build the PowerPC 64-bit binary
#
if test x$configure_ppc64 = xyes; then
(cd build/ppc64 && \
sh ../../configure $CONFIG_PPC64 CC="$CC_PPC64" CXX="$CXX_PPC64" CFLAGS="$CFLAGS $CFLAGS_PPC64" CPPFLAGS="$CPPFLAGS_PPC64" LDFLAGS="$LFLAGS_PPC64") || exit 2
fi
if test x$make_ppc64 = xyes; then
(cd build/ppc64 && ls include && make -j$NJOB) || exit 3
fi

#
# Build the Intel 32-bit binary
#
if test x$configure_x86 = xyes; then
(cd build/x86 && \
Expand All @@ -185,6 +271,17 @@ if test x$make_x86 = xyes; then
(cd build/x86 && make -j$NJOB) || exit 3
fi

#
# Build the Intel 32-bit binary
#
if test x$configure_x64 = xyes; then
(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
fi
if test x$make_x64 = xyes; then
(cd build/x64 && make -j$NJOB) || exit 3
fi

#
# Combine into fat binary
#
Expand Down
4 changes: 2 additions & 2 deletions src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -25,7 +25,7 @@

#include "SDL_cpuinfo.h"

#if defined(__MACOSX__) && defined(__ppc__)
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
#include <sys/sysctl.h> /* For AltiVec check */
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
#include <signal.h>
Expand Down Expand Up @@ -356,7 +356,7 @@ static __inline__ int
CPU_haveAltiVec(void)
{
volatile int altivec = 0;
#if defined(__MACOSX__) && defined(__ppc__)
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
int hasVectorUnit = 0;
size_t length = sizeof(hasVectorUnit);
Expand Down
4 changes: 2 additions & 2 deletions src/video/cocoa/SDL_cocoamodes.m
Expand Up @@ -23,7 +23,7 @@

#include "SDL_cocoavideo.h"

#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
/*
Add methods to get at private members of NSScreen.
Since there is a bug in Apple's screen switching code
Expand Down Expand Up @@ -250,7 +250,7 @@ - (void) setFrame:(NSRect)frame;
CGReleaseDisplayFadeReservation(fade_token);
}

#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
/*
There is a bug in Cocoa where NSScreen doesn't synchronize
with CGDirectDisplay, so the main screen's frame is wrong.
Expand Down

0 comments on commit 94eca3b

Please sign in to comment.