changeset 2729:be311350d05b draft

(svn r3274) -Fix: [OSX] added JAGUAR flag to crosscompile for OSX 10.2 (codenamed jaguar) JAGUAR and FAT_BINARY can't be used at the same time JAGUAR will disable network support due to missing libs in 10.2
author bjarni <bjarni@openttd.org>
date Fri, 09 Dec 2005 12:15:52 +0000
parents f6eeec4d31f9
children 349517742aa9
files Makefile makefiledir/Makefile.config_writer os/macosx/Makefile os/macosx/Makefile.setup
diffstat 4 files changed, 50 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile
+++ b/Makefile
@@ -107,6 +107,7 @@
 # Special for crosscompiling there are some commands available:
 #
 # FAT_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs
+# JAGUAR: Make the binary suited for MacOS X 10.2 (codenamed jaguar). It will not include network support
 #
 # 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.
@@ -514,6 +515,10 @@
 			LDFLAGS += -headerpad_max_install_names
 		endif
 	endif
+	ifdef JAGUAR
+		# ensure that changing libpathnames will not overwrite anything in the binary
+		LDFLAGS += -headerpad_max_install_names
+	endif
 
 	ifndef DEDICATED
 		LIBS += -framework QuickTime
--- a/makefiledir/Makefile.config_writer
+++ b/makefiledir/Makefile.config_writer
@@ -116,6 +116,11 @@
 	$(call CONFIG_LINE,LDFLAGS_x86:=$(LDFLAGS_x86))
 	$(call CONFIG_LINE,)
 
+	$(call CONFIG_LINE,\# For OSX 10.2 support)
+	$(call CONFIG_LINE,CFLAGS_JAGUAR:=$(CFLAGS_JAGUAR))
+	$(call CONFIG_LINE,LDFLAGS_JAGUAR:=$(LDFLAGS_JAGUAR))
+	$(call CONFIG_LINE,)
+
 	$(call CONFIG_LINE,\# For cross-compiling)
 	$(call CONFIG_LINE,CC_TARGET:=$(CC_TARGET))
 	$(call CONFIG_LINE,CC_HOST:=$(CC_HOST))
--- a/os/macosx/Makefile
+++ b/os/macosx/Makefile
@@ -4,7 +4,7 @@
 
 ifdef FAT_BINARY
 FAT_BINARY:=build_universal_binary
-COPY_x86_SDL_LIB:=$(Q)cp $(x86_SDL_LIB) $(OSXAPP)/Contents/lib/libSDL-x86.dylib
+POST_BUNDLE_BUILDING:=$(Q)cp $(x86_SDL_LIB) $(OSXAPP)/Contents/lib/libSDL-x86.dylib
 endif
 
 ifdef UNIVERSAL_x86_PART
@@ -14,6 +14,17 @@
 BUILD_OSX_BUNDLE:=build_OSX_bundle
 endif
 
+ifdef JAGUAR
+JAGUAR:=jaguar
+POST_BUNDLE_BUILDING:=$(Q)cp /usr/lib/libmx.A.dylib $(OSXAPP)/Contents/lib/libmx.A.dylib
+endif
+
+# MacOS X got some issues in OpenTTD, so we got a workaround target to solve them
+# only network support will not be fixed this way, so we will have a binary without network support
+
+$(JAGUAR):
+	$(Q)install_name_tool -change /usr/lib/libmx.A.dylib @executable_path/../lib/libmx.A.dylib $(TTD)
+
 # building an universal binary
 # since we can only compile for PPC or x86 at any one time, we compile one and then
 # we make clean and compile the other one. In the end we use lipo to join them together
@@ -33,7 +44,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) $(FAT_BINARY)
+$(BUILD_OSX_BUNDLE): $(TTD) $(FAT_BINARY) $(JAGUAR)
 	@echo '===> Building application bundle'
 	$(Q)rm -fr "$(OSXAPP)"
 	$(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS
@@ -47,7 +58,7 @@
 	$(Q)cp data/* "$(OSXAPP)"/Contents/Data/
 	$(Q)cp lang/*.lng "$(OSXAPP)"/Contents/Lang/
 	$(Q)cp $(TTD) "$(OSXAPP)"/Contents/MacOS/$(TTD)
-	$(COPY_x86_SDL_LIB)
+	$(POST_BUNDLE_BUILDING)
 
 # make the release disk image. Should only be used with releases and is a good and fast way to make sure to remember all the needed files
 release: all
@@ -70,4 +81,4 @@
 
 $(OSX): $(TTD) $(BUILD_OSX_BUNDLE)
 
-.PHONY: release $(BUILD_OSX_BUNDLE) $(FAT_BINARY)
+.PHONY: release $(BUILD_OSX_BUNDLE) $(FAT_BINARY) $(JAGUAR)
--- a/os/macosx/Makefile.setup
+++ b/os/macosx/Makefile.setup
@@ -29,16 +29,29 @@
 endif
 endif
 
+ifdef JAGUAR
+ifdef FAT_BINARY
+$(error FAT_BINARY and JAGUAR can't be used at the same time)
+endif
+endif
+
 # setup flags if none are defined
+ifndef CFLAGS_JAGUAR
+	CFLAGS_JAGUAR:= -isysroot /Developer/SDKs/MacOSX10.2.8.sdk
+endif
+ifndef LDFLAGS_JAGUAR
+	LDFLAGS_JAGUAR:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk
+endif
+
+ifndef PPC_CC
+	PPC_CC:=powerpc-apple-darwin8-gcc-4.0.0
+endif
 ifndef CFLAGS_PPC
 	CFLAGS_PPC:= -isysroot /Developer/SDKs/MacOSX10.3.9.sdk
 endif
 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
@@ -115,3 +128,12 @@
 		LDFLAGS:= $(LDFLAGS_PPC)
 	endif
 endif
+
+ifdef JAGUAR
+	CFLAGS:=$(CFLAGS_JAGUAR)
+	LDFLAGS:=$(LDFLAGS_JAGUAR)
+	# network support is broken is jaguar (OSX 10.2)
+	WITH_NETWORK:=
+	# crosscompiling for jaguar should always be static
+	STATIC:=1
+endif
\ No newline at end of file