Skip to content

Commit b802350

Browse files
committed
Enable building with old Xcode SDKs
1 parent c783a4d commit b802350

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

native/Makefile

+11-4
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,14 @@ endif
392392

393393

394394
ifeq ($(OS),darwin)
395-
XCODE_VERSION=$(shell xcodebuild -version | grep Xcode | sed 's/^Xcode \([1-9][0-9]*\).*/\1/g')
395+
ifneq ($(SDKROOT),)
396+
CC=$(realpath $(SDKROOT)/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang)
397+
else
398+
CC=clang
399+
endif
400+
APPLE_CLANG_VERSION=$(shell $(CC) --version | grep version | sed 's/^Apple .* version \([1-9][0-9]*\).*/\1/g')
401+
$(info Apple clang version $(APPLE_CLANG_VERSION))
402+
396403
JAVA_INCLUDES+=-I/System/Library/Frameworks/JavaVM.framework/Headers
397404
DEFAULT_ARCH=$(shell arch)
398405
# Actual deployment target depends on SDK support
@@ -407,7 +414,7 @@ ifeq ($(OS),darwin)
407414
# No universal binary for arm64
408415
ifneq ($(ARCH),arm64)
409416
ifneq ($(ARCH),i386)
410-
ifeq ($(shell test $(XCODE_VERSION) -lt 10; echo $$?),0)
417+
ifeq ($(shell test $(APPLE_CLANG_VERSION) -lt 10; echo $$?),0)
411418
ALT_ARCHS+=i386
412419
ARCHFLAGS+=-arch i386
413420
endif
@@ -417,7 +424,7 @@ ifeq ($(OS),darwin)
417424
ARCHFLAGS+=-arch x86_64
418425
endif
419426
ifneq ($(ARCH),ppc)
420-
ifeq ($(XCODE_VERSION),3)
427+
ifeq ($(shell test $(APPLE_CLANG_VERSION) -lt 2; echo $$?),0)
421428
# Xcode 3 options
422429
# not supported on XCode 4+
423430
ALT_ARCHS+=ppc
@@ -446,7 +453,7 @@ ifeq ($(OS),darwin)
446453
$(NO_COMPACT_UNWIND) \
447454
-install_name ${@F} \
448455
$(SYSLIBROOT)
449-
ifeq ($(shell test $(XCODE_VERSION) -lt 12; echo $$?),0)
456+
ifeq ($(shell test $(APPLE_CLANG_VERSION) -lt 12; echo $$?),0)
450457
# JAWT linkage handled by -framework JavaVM
451458
LIBS+=-framework JavaVM
452459
endif

0 commit comments

Comments
 (0)