(svn r3273) -Fix: [OSX] PPC part of universal binaries now target 10.3 instead of 10.4
authorbjarni
Fri, 09 Dec 2005 11:08:24 +0000
changeset 2728 8f50c839cd17
parent 2727 90beb642e8d4
child 2729 5da6ee3bbc0e
(svn r3273) -Fix: [OSX] PPC part of universal binaries now target 10.3 instead of 10.4
10.2 support appears to be broken right now
Changed BUILD_UNIVERSAL_BINARY into FAT_BINARY (I got tired of typing)
Makefile
makefiledir/Makefile.config_writer
os/macosx/Makefile
os/macosx/Makefile.setup
--- a/Makefile	Thu Dec 08 21:12:15 2005 +0000
+++ b/Makefile	Fri Dec 09 11:08:24 2005 +0000
@@ -106,7 +106,7 @@
 #
 # Special for crosscompiling there are some commands available:
 #
-# BUILD_UNIVERSAL_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs
+# FAT_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs
 #
 # ENDIAN_FORCE: forces the endian-check to give a certain result. Can be BE, LE or PREPROCESSOR.
 #	PREPROCESSOR is always used on all OSX targets and will make the preprocessor pick the right endian.
@@ -508,8 +508,12 @@
 	# set the endian flag for OSX, that can't fail
 	ENDIAN_FORCE:=PREPROCESSOR
 
-	# ensure that changing libpathnames will not overwrite anything in the binary
-	LDFLAGS += -headerpad_max_install_names
+	ifdef UNIVERSAL_x86_PART
+		ifdef WITH_SDL
+			# ensure that changing libpathnames will not overwrite anything in the binary
+			LDFLAGS += -headerpad_max_install_names
+		endif
+	endif
 
 	ifndef DEDICATED
 		LIBS += -framework QuickTime
--- a/makefiledir/Makefile.config_writer	Thu Dec 08 21:12:15 2005 +0000
+++ b/makefiledir/Makefile.config_writer	Fri Dec 09 11:08:24 2005 +0000
@@ -94,17 +94,26 @@
 	$(call CONFIG_LINE,)
 
 	$(call CONFIG_LINE,\# Universal binary setup)
-	$(call CONFIG_LINE,\# use these settings for building universal binaries. Most settings should work with the default settings)
-	$(call CONFIG_LINE,UNIVERSAL_CFLAGS:=$(UNIVERSAL_CFLAGS))
-	$(call CONFIG_LINE,UNIVERSAL_LDFLAGS:=$(UNIVERSAL_LDFLAGS))
+	$(call CONFIG_LINE,\# use these settings for building universal binaries. Most systems should work with the default settings)
+	$(call CONFIG_LINE,SDL_PPC_CONFIG:=$(SDL_PPC_CONFIG))
+	$(call CONFIG_LINE,SDL_x86_CONFIG:=$(SDL_x86_CONFIG))
+
+	$(call CONFIG_LINE,\# if you got a fat libpng you should not need to change this. It is recommended to get a fat libpng lib)
+	$(call CONFIG_LINE,LIBPNG_PPC_CONFIG:=$(LIBPNG_PPC_CONFIG))
+	$(call CONFIG_LINE,LIBPNG_x86_CONFIG:=$(LIBPNG_x86_CONFIG))
+
+	$(call CONFIG_LINE,\# autodetected SDL lib path, but it is not detected in a reliable way, so verify it. It needs to be the x86 lib)
+	$(call CONFIG_LINE,x86_SDL_LIB:=$(x86_SDL_LIB))
+
+	$(call CONFIG_LINE,\# default values should be good enough for the rest of the universal binary flags, but check them anyway)
 	$(call CONFIG_LINE,SKIP_LIB_TEST:=$(SKIP_LIB_TEST))
 	$(call CONFIG_LINE,PPC_CC:=$(PPC_CC))
-	$(call CONFIG_LINE,SDL_PPC_CONFIG:=$(SDL_PPC_CONFIG))
-	$(call CONFIG_LINE,LIBPNG_PPC_CONFIG:=$(LIBPNG_PPC_CONFIG))
+	$(call CONFIG_LINE,CFLAGS_PPC:=$(CFLAGS_PPC))
+	$(call CONFIG_LINE,LDFLAGS_PPC:=$(LDFLAGS_PPC))
+
 	$(call CONFIG_LINE,x86_CC:=$(x86_CC))
-	$(call CONFIG_LINE,SDL_x86_CONFIG:=$(SDL_x86_CONFIG))
-	$(call CONFIG_LINE,LIBPNG_x86_CONFIG:=$(LIBPNG_x86_CONFIG))
-	$(call CONFIG_LINE,x86_SDL_LIB:=$(x86_SDL_LIB))
+	$(call CONFIG_LINE,CFLAGS_x86:=$(CFLAGS_x86))
+	$(call CONFIG_LINE,LDFLAGS_x86:=$(LDFLAGS_x86))
 	$(call CONFIG_LINE,)
 
 	$(call CONFIG_LINE,\# For cross-compiling)
--- a/os/macosx/Makefile	Thu Dec 08 21:12:15 2005 +0000
+++ b/os/macosx/Makefile	Fri Dec 09 11:08:24 2005 +0000
@@ -2,8 +2,8 @@
 # This makefile is not a standalone makefile, but is called from the general one
 # it contains targets specific to MacOS X
 
-ifdef BUILD_UNIVERSAL_BINARY
-BUILD_UNIVERSAL_BINARY:=build_universal_binary
+ifdef FAT_BINARY
+FAT_BINARY:=build_universal_binary
 COPY_x86_SDL_LIB:=$(Q)cp $(x86_SDL_LIB) $(OSXAPP)/Contents/lib/libSDL-x86.dylib
 endif
 
@@ -19,7 +19,7 @@
 # we make clean and compile the other one. In the end we use lipo to join them together
 # when this is done, we can continue with the targets from the first run, which is build_OSX_bundle
 
-$(BUILD_UNIVERSAL_BINARY): $(TTD)
+$(FAT_BINARY): $(TTD)
 	$(Q)mkdir -p temp_binary_dir
 	$(Q)cp $(TTD) temp_binary_dir/$(TTD)_a
 	$(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new endian
@@ -33,7 +33,7 @@
 # build the bundle. OSX wants to keep apps in bundles, so we will give it one
 # the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it
 
-$(BUILD_OSX_BUNDLE): $(TTD) $(BUILD_UNIVERSAL_BINARY)
+$(BUILD_OSX_BUNDLE): $(TTD) $(FAT_BINARY)
 	@echo '===> Building application bundle'
 	$(Q)rm -fr "$(OSXAPP)"
 	$(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS
@@ -70,4 +70,4 @@
 
 $(OSX): $(TTD) $(BUILD_OSX_BUNDLE)
 
-.PHONY: release $(BUILD_OSX_BUNDLE) $(BUILD_UNIVERSAL_BINARY)
+.PHONY: release $(BUILD_OSX_BUNDLE) $(FAT_BINARY)
--- a/os/macosx/Makefile.setup	Thu Dec 08 21:12:15 2005 +0000
+++ b/os/macosx/Makefile.setup	Fri Dec 09 11:08:24 2005 +0000
@@ -11,11 +11,18 @@
 endif
 
 ifdef RELEASE
-ifndef BUILD_UNIVERSAL_BINARY
+ifndef FAT_BINARY
 $(warning Compiling a release build, that is not a universal binary)
 endif
 endif
 
+ifdef FAT_BINARY
+ifndef STATIC
+$(warning Compiling a universal binary, that is not static. Adding static flag)
+STATIC:=1
+endif
+endif
+
 ifdef RELEASE
 ifdef DEBUG
 $(warning Compiling a release build, that is a debug build)
@@ -23,15 +30,21 @@
 endif
 
 # setup flags if none are defined
-ifndef UNIVERSAL_CFLAGS
-	UNIVERSAL_CFLAGS:= -isysroot /Developer/SDKs/MacOSX10.4u.sdk
+ifndef CFLAGS_PPC
+	CFLAGS_PPC:= -isysroot /Developer/SDKs/MacOSX10.3.9.sdk
 endif
-ifndef UNIVERSAL_LDFLAGS
-	UNIVERSAL_LDFLAGS:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
+ifndef LDFLAGS_PPC
+	LDFLAGS_PPC:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk
 endif
 ifndef PPC_CC
 	PPC_CC:=powerpc-apple-darwin8-gcc-4.0.0
 endif
+ifndef CFLAGS_x86
+	CFLAGS_x86:= -isysroot /Developer/SDKs/MacOSX10.4u.sdk
+endif
+ifndef LDFLAGS_x86
+	LDFLAGS_x86:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
+endif
 ifndef x86_CC
 	x86_CC:=i686-apple-darwin8-gcc-4.0.0
 endif
@@ -50,12 +63,12 @@
 	ifndef SDL_x86_CONFIG
 		SDL_x86_CONFIG:=$(SDL-CONFIG)
 	endif
+	ifndef x86_SDL_LIB
+		x86_SDL_LIB:=$(shell echo "`$(SDL_x86_CONFIG) --prefix`/lib/libSDL-1.2.0.dylib")
+	endif
 endif
 
-ifdef BUILD_UNIVERSAL_BINARY
-	CFLAGS:= $(UNIVERSAL_CFLAGS)
-	LDFLAGS:= $(UNIVERSAL_LDFLAGS)
-
+ifdef FAT_BINARY
 	# set up config files
 	ifndef SKIP_LIB_TEST
 		ifdef WITH_PNG
@@ -87,16 +100,18 @@
 	endif
 
 	ifdef UNIVERSAL_x86_PART
-		CFLAGS += -arch i386
 		LIBPNG-CONFIG:=$(LIBPNG_x86_CONFIG)
 		SDL-CONFIG:=$(SDL_x86_CONFIG)
 		CC_TARGET:=$(x86_CC)
 		# clear the cached list of PPC libs
 		LIBS:=
+		CFLAGS:= $(CFLAGS_x86) -arch i386
+		LDFLAGS:= $(LDFLAGS_x86)
 	else
-		CFLAGS += -arch ppc
 		LIBPNG-CONFIG:=$(LIBPNG_PPC_CONFIG)
 		SDL-CONFIG:=$(SDL_PPC_CONFIG)
 		CC_TARGET:=$(PPC_CC)
+		CFLAGS:= $(CFLAGS_PPC) -arch ppc
+		LDFLAGS:= $(LDFLAGS_PPC)
 	endif
 endif