(svn r3262) -Fix: [OSX] universal binaries can now include the dynamic SDL lib into the bundle
authorbjarni
Tue, 06 Dec 2005 09:27:42 +0000
changeset 2717 06474b396054
parent 2716 2eb2687665e7
child 2718 687e5c297db8
(svn r3262) -Fix: [OSX] universal binaries can now include the dynamic SDL lib into the bundle
Makefile
makefiledir/Makefile.config_writer
os/macosx/Makefile
--- a/Makefile	Mon Dec 05 16:48:07 2005 +0000
+++ b/Makefile	Tue Dec 06 09:27:42 2005 +0000
@@ -177,6 +177,7 @@
 	LDFLAGS = $(LDFLAGS_UNI)
 	SDL-CONFIG = $(SDL-CONFIG_UNI)
 	LIBPNG-CONFIG = $(LIBPNG-CONFIG_UNI)
+	LIBS:=
 endif
 
 # this is used if there aren't any Makefile.config
@@ -419,6 +420,15 @@
 CDEFS += -DDEDICATED
 endif
 
+ifdef OSX
+ifdef STATIC
+ifdef UNIVERSAL_OTHER_HALF
+	STATIC:=
+	DYNAMIC_SDL_IN_STATIC:=1
+endif
+endif
+endif
+
 # SDL config
 ifdef WITH_SDL
 CDEFS += -DWITH_SDL
@@ -430,6 +440,9 @@
 endif
 endif
 
+ifdef DYNAMIC_SDL_IN_STATIC
+STATIC:=1
+endif
 
 # zlib config
 ifdef WITH_ZLIB
--- a/makefiledir/Makefile.config_writer	Mon Dec 05 16:48:07 2005 +0000
+++ b/makefiledir/Makefile.config_writer	Tue Dec 06 09:27:42 2005 +0000
@@ -74,10 +74,11 @@
 	$(call CONFIG_LINE,STATIC_ZLIB_PATH:=$(STATIC_ZLIB_PATH))
 	$(call CONFIG_LINE,)
 
-	$(call CONFIG_LINE,\# Lib paths for OSX. If you do not know what they do, do not touch them)
+	$(call CONFIG_LINE,\# Lib paths for OSX. Read os/MacOSX/Makefile for more info)
 	$(call CONFIG_LINE,OSX_LIB_PATH:=$(OSX_LIB_PATH))
 	$(call CONFIG_LINE,OSX_LOCAL_LIB_PATH:=$(OSX_LOCAL_LIB_PATH))
 	$(call CONFIG_LINE,OSX_CHANGE_LIB_PATH:=$(OSX_CHANGE_LIB_PATH))
+	$(call CONFIG_LINE,x86_SDL_LIB:=$(x86_SDL_LIB))
 	$(call CONFIG_LINE,)
 
 	$(call CONFIG_LINE,\# OS flags)
--- a/os/macosx/Makefile	Mon Dec 05 16:48:07 2005 +0000
+++ b/os/macosx/Makefile	Tue Dec 06 09:27:42 2005 +0000
@@ -4,6 +4,7 @@
 
 ifdef BUILD_UNIVERSAL_BINARY
 BUILD_UNIVERSAL_BINARY:=build_universal_binary
+COPY_x86_SDL_LIB:=$(Q)cp $(x86_SDL_LIB) $(OSXAPP)/Contents/lib/libSDL-x86.dylib
 endif
 
 # setting the default vars for making universal binaries
@@ -42,13 +43,12 @@
 	@echo '===> Cleaning up to build for the other architecture'
 	$(Q)make clean
 	$(Q)make UNIVERSAL_OTHER_HALF:=1
+	$(Q)install_name_tool -change $(x86_SDL_LIB) @executable_path/../lib/libSDL-x86.dylib $(TTD)
 	$(Q)cp $(TTD) temp_binary_dir/$(TTD)_b
 	@echo '===> Joining binaries into one universal one'
 	$(Q)lipo temp_binary_dir/$(TTD)_a temp_binary_dir/$(TTD)_b -create -output $(TTD)
 	$(Q)rm -rf temp_binary_dir
 
-
-
 # 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
 
@@ -58,12 +58,14 @@
 	$(Q)mkdir -p "$(OSXAPP)"/Contents/Resources
 	$(Q)mkdir -p "$(OSXAPP)"/Contents/Data
 	$(Q)mkdir -p "$(OSXAPP)"/Contents/Lang
+	$(Q)mkdir -p "$(OSXAPP)"/Contents/lib
 	$(Q)echo "APPL????" > "$(OSXAPP)"/Contents/PkgInfo
 	$(Q)cp os/macosx/openttd.icns "$(OSXAPP)"/Contents/Resources/openttd.icns
 	$(Q)os/macosx/plistgen.sh "$(OSXAPP)" "$(REV)"
 	$(Q)cp data/* "$(OSXAPP)"/Contents/Data/
 	$(Q)cp lang/*.lng "$(OSXAPP)"/Contents/Lang/
 	$(Q)cp $(TTD) "$(OSXAPP)"/Contents/MacOS/$(TTD)
+	$(COPY_x86_SDL_LIB)
 
 # 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