Someone created a fork, which essentially adds a script to build LuaJIT for the several architectures needed by iOS, then combines them using lipo: github.com/cailei/luajit.
I updated the script by taking the latest SDK versions and removing the reference to gcc inside the Xcode bundle:
#/bin/sh # Check if the binary exists. # if [ -f "lib/libluajit.a" ]; then # exit 0 # fi if [ ! -d lib/temp ]; then mkdir -p lib/temp fi IXCODE=`xcode-select -print-path` # Build for MacOS (x86_64) echo "Building for macOS x86_84" ISDK=$IXCODE/Platforms/MacOSX.platform/Developer ISDKVER=MacOSX10.12.sdk ISDKP=$ISDK/usr/bin/ ISDKF="-arch x86_64 -isysroot $ISDK/SDKs/$ISDKVER" make clean make TARGET_FLAGS="-arch x86_64" mv src/libluajit.a lib/temp/libluajit-macos-x86_64.a # Build for iOS device (armv7) echo "Building for iOS armv7" ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer ISDKVER=iPhoneOS10.2.sdk ISDKP=/usr/bin/ ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER" make clean make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ TARGET_SYS=iOS mv src/libluajit.a lib/temp/libluajit-ios-armv7.a # Build for iOS device (armv7s) echo "Building for iOS armv7s" ISDKF="-arch armv7s -isysroot $ISDK/SDKs/$ISDKVER" make clean make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ TARGET_SYS=iOS mv src/libluajit.a lib/temp/libluajit-ios-armv7s.a # Build for iOS simulator echo "Building for iOS Simulator" ISDK=$IXCODE/Platforms/iPhoneSimulator.platform/Developer ISDKVER=iPhoneSimulator10.2.sdk ISDKP=/usr/bin/ ISDKF="-arch i386 -isysroot $ISDK/SDKs/$ISDKVER" make clean make HOST_CFLAGS="-arch i386" HOST_LDFLAGS="-arch i386" TARGET_SYS=iOS TARGET=x86 CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ TARGET_SYS=iOS mv src/libluajit.a lib/temp/libluajit-simulator.a # Combine all archives to one. libtool -o lib/libluajit.a lib/temp/*.a 2> /dev/null rm -rf lib/temp make clean
The script works seamlessly with LuaJIT 2.0.4.
Unfortunately, LuaJIT does not support the arm64 architecture yet.