Last active
December 10, 2015 14:08
-
-
Save npepinpe/4445512 to your computer and use it in GitHub Desktop.
Fixes compilation of the official mupen64plus-1.99.5 release on OSX with Xcode 4.3+. The problem was detecting which SDK to use, and where it was located.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/source/mupen64plus-audio-sdl/projects/unix/Makefile b/source/mupen64plus-audio-sdl/projects/unix/Makefile | |
index 45db3d1..133ee44 100644 | |
--- a/source/mupen64plus-audio-sdl/projects/unix/Makefile | |
+++ b/source/mupen64plus-audio-sdl/projects/unix/Makefile | |
@@ -134,19 +134,32 @@ ifeq ($(OS), LINUX) | |
LDLIBS += -ldl | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
LDLIBS += -ldl | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
- LDLIBS += -ldl | |
+ LDLIBS += -ldl -read_only_relocs suppress | |
endif | |
endif | |
endif | |
+ | |
# test for presence of SDL | |
ifeq ($(shell which sdl-config 2>/dev/null),) | |
$(error No SDL development libraries found!) | |
diff --git a/source/mupen64plus-core/projects/unix/Makefile b/source/mupen64plus-core/projects/unix/Makefile | |
index e2df2c6..ce30ac0 100644 | |
--- a/source/mupen64plus-core/projects/unix/Makefile | |
+++ b/source/mupen64plus-core/projects/unix/Makefile | |
@@ -138,12 +138,24 @@ ifeq ($(OS), OSX) | |
TARGET = libmupen64plus.dylib | |
LDFLAGS += -bundle -read_only_relocs suppress | |
LDLIBS += -ldl -framework OpenGL | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
else | |
- CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
ifneq ($(PROFILE), 1) | |
CFLAGS += -fomit-frame-pointer | |
diff --git a/source/mupen64plus-input-sdl/projects/unix/Makefile b/source/mupen64plus-input-sdl/projects/unix/Makefile | |
index 590d186..ab91a4c 100644 | |
--- a/source/mupen64plus-input-sdl/projects/unix/Makefile | |
+++ b/source/mupen64plus-input-sdl/projects/unix/Makefile | |
@@ -135,14 +135,26 @@ ifeq ($(OS), LINUX) | |
LDLIBS += -ldl | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDLIBS += -ldl | |
else | |
- CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
- LDLIBS += -ldl | |
+ LDLIBS += -ldl -read_only_relocs suppress | |
endif | |
endif | |
endif | |
diff --git a/source/mupen64plus-rsp-hle/projects/unix/Makefile b/source/mupen64plus-rsp-hle/projects/unix/Makefile | |
index b50545b..cd5400c 100644 | |
--- a/source/mupen64plus-rsp-hle/projects/unix/Makefile | |
+++ b/source/mupen64plus-rsp-hle/projects/unix/Makefile | |
@@ -136,13 +136,25 @@ ifeq ($(OS), LINUX) | |
LDFLAGS += -Wl,-version-script,$(SRCDIR)/rsp_api_export.ver | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
- LDFLAGS += -arch i686 | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
+ LDFLAGS += -arch i686 -read_only_relocs suppress | |
endif | |
endif | |
endif | |
diff --git a/source/mupen64plus-ui-console/projects/unix/Makefile b/source/mupen64plus-ui-console/projects/unix/Makefile | |
index c747910..1a824d4 100644 | |
--- a/source/mupen64plus-ui-console/projects/unix/Makefile | |
+++ b/source/mupen64plus-ui-console/projects/unix/Makefile | |
@@ -101,12 +101,26 @@ endif | |
ifeq ($(OS), OSX) | |
# The mac version of SDL requires inclusion of SDL_main in the executable | |
LDLIBS += -ldl $(shell sdl-config --libs) | |
+ CFLAGS += $(shell sdl-config --cflags) | |
+ | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
endif | |
endif | |
diff --git a/source/mupen64plus-video-rice/projects/unix/Makefile b/source/mupen64plus-video-rice/projects/unix/Makefile | |
index 1d3ee89..56eaafd 100644 | |
--- a/source/mupen64plus-video-rice/projects/unix/Makefile | |
+++ b/source/mupen64plus-video-rice/projects/unix/Makefile | |
@@ -138,13 +138,25 @@ ifeq ($(OS), LINUX) | |
LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -bundle -framework OpenGL -arch x86_64 | |
LDLIBS += -ldl | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -bundle -framework OpenGL -arch i686 | |
LDLIBS += -ldl | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment