On Mac OS switch default compiler from gcc to clang. XCode has been shipping with clang since XCode 5.0 released in September 2013.

Change iOS cross compilation instructions to rely on `xcrun` to locate compiler instead of hard-coding the path and SDK version. Provide instructions for cross-compilation to ARM64.

Fixes issue #1. Fixes issue #4.
This commit is contained in:
Vyacheslav Egorov 2015-10-20 17:43:02 +02:00
parent 52ea1a30af
commit a320f1a082
2 changed files with 42 additions and 25 deletions

View File

@ -453,13 +453,18 @@ much slower than the JIT compiler. Please complain to Apple, not me.
Or use Android. :-p Or use Android. :-p
</p> </p>
<pre class="code"> <pre class="code">
IXCODE=`xcode-select -print-path` # Cross-compile for a 32bit ARM.
ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer ISDKP=`xcrun --sdk iphoneos --show-sdk-path`
ISDKVER=iPhoneOS6.0.sdk ICC=`xcrun --sdk iphoneos --find clang`
ISDKP=$ISDK/usr/bin/ ISDKF="-arch armv7 -isysroot $ISDKP"
ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER" make HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" \
make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
TARGET_SYS=iOS
# Cross-compile for an ARM64.
ISDKP=`xcrun --sdk iphoneos --show-sdk-path`
ICC=`xcrun --sdk iphoneos --find clang`
ISDKF="-arch arm64 -isysroot $ISDKP"
make CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
</pre> </pre>
<h3 id="consoles">Cross-compiling for consoles</h3> <h3 id="consoles">Cross-compiling for consoles</h3>

View File

@ -16,6 +16,33 @@ RELVER= 0
ABIVER= 5.1 ABIVER= 5.1
NODOTABIVER= 51 NODOTABIVER= 51
##############################################################################
################################ HOST SYSTEM ###############################
##############################################################################
ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
HOST_SYS= Windows
HOST_RM= del
else
HOST_SYS:= $(shell uname -s)
ifneq (,$(findstring MINGW,$(HOST_SYS)))
HOST_SYS= Windows
HOST_MSYS= mingw
endif
ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
HOST_SYS= Windows
HOST_MSYS= cygwin
endif
endif
# We default to GCC on all platforms except Mac OS where the default compiler is
# clang starting with XCode 5.0.
ifneq (Darwin,$(HOST_SYS))
DEFAULT_CC= gcc
else
DEFAULT_CC= clang
endif
############################################################################## ##############################################################################
############################# COMPILER OPTIONS ############################# ############################# COMPILER OPTIONS #############################
############################################################################## ##############################################################################
@ -25,10 +52,10 @@ NODOTABIVER= 51
# with "make clean", followed by "make" if you change any options. # with "make clean", followed by "make" if you change any options.
# #
# LuaJIT builds as a native 32 or 64 bit binary by default. # LuaJIT builds as a native 32 or 64 bit binary by default.
CC= gcc CC= $(DEFAULT_CC)
# #
# Use this if you want to force a 32 bit build on a 64 bit multilib OS. # Use this if you want to force a 32 bit build on a 64 bit multilib OS.
#CC= gcc -m32 # CC= $(DEFAULT_CC) -m32
# #
# Since the assembler part does NOT maintain a frame pointer, it's pointless # Since the assembler part does NOT maintain a frame pointer, it's pointless
# to slow down the C part by not omitting it. Debugging, tracebacks and # to slow down the C part by not omitting it. Debugging, tracebacks and
@ -268,24 +295,9 @@ ifneq (,$(LMULTILIB))
endif endif
############################################################################## ##############################################################################
# System detection. # Target system features.
############################################################################## ##############################################################################
ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
HOST_SYS= Windows
HOST_RM= del
else
HOST_SYS:= $(shell uname -s)
ifneq (,$(findstring MINGW,$(HOST_SYS)))
HOST_SYS= Windows
HOST_MSYS= mingw
endif
ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
HOST_SYS= Windows
HOST_MSYS= cygwin
endif
endif
TARGET_SYS?= $(HOST_SYS) TARGET_SYS?= $(HOST_SYS)
ifeq (Windows,$(TARGET_SYS)) ifeq (Windows,$(TARGET_SYS))
TARGET_STRIP+= --strip-unneeded TARGET_STRIP+= --strip-unneeded