From b802350019ee25353a4a0d32269c36a24946d61b Mon Sep 17 00:00:00 2001 From: Florian Kistner Date: Mon, 25 Jan 2021 13:18:09 +0100 Subject: [PATCH] Enable building with old Xcode SDKs --- native/Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/native/Makefile b/native/Makefile index f54e31e6d7..ba1cc1a4ce 100644 --- a/native/Makefile +++ b/native/Makefile @@ -392,7 +392,14 @@ endif ifeq ($(OS),darwin) - XCODE_VERSION=$(shell xcodebuild -version | grep Xcode | sed 's/^Xcode \([1-9][0-9]*\).*/\1/g') + ifneq ($(SDKROOT),) + CC=$(realpath $(SDKROOT)/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang) + else + CC=clang + endif + APPLE_CLANG_VERSION=$(shell $(CC) --version | grep version | sed 's/^Apple .* version \([1-9][0-9]*\).*/\1/g') + $(info Apple clang version $(APPLE_CLANG_VERSION)) + JAVA_INCLUDES+=-I/System/Library/Frameworks/JavaVM.framework/Headers DEFAULT_ARCH=$(shell arch) # Actual deployment target depends on SDK support @@ -407,7 +414,7 @@ ifeq ($(OS),darwin) # No universal binary for arm64 ifneq ($(ARCH),arm64) ifneq ($(ARCH),i386) - ifeq ($(shell test $(XCODE_VERSION) -lt 10; echo $$?),0) + ifeq ($(shell test $(APPLE_CLANG_VERSION) -lt 10; echo $$?),0) ALT_ARCHS+=i386 ARCHFLAGS+=-arch i386 endif @@ -417,7 +424,7 @@ ifeq ($(OS),darwin) ARCHFLAGS+=-arch x86_64 endif ifneq ($(ARCH),ppc) - ifeq ($(XCODE_VERSION),3) + ifeq ($(shell test $(APPLE_CLANG_VERSION) -lt 2; echo $$?),0) # Xcode 3 options # not supported on XCode 4+ ALT_ARCHS+=ppc @@ -446,7 +453,7 @@ ifeq ($(OS),darwin) $(NO_COMPACT_UNWIND) \ -install_name ${@F} \ $(SYSLIBROOT) - ifeq ($(shell test $(XCODE_VERSION) -lt 12; echo $$?),0) + ifeq ($(shell test $(APPLE_CLANG_VERSION) -lt 12; echo $$?),0) # JAWT linkage handled by -framework JavaVM LIBS+=-framework JavaVM endif