标签:
git clone http://repo.or.cz/luajit-2.0.git进入Luajit下载代码目录签出分支v2.1
git checkout v2.1
LUAJIT=./luajit-2.1 DEVDIR=`xcode-select -print-path`/Platforms IOSVER=iPhoneOS8.1.sdk SIMVER=iPhoneSimulator.sdk IOSDIR=$DEVDIR/iPhoneOS.platform/Developer SIMDIR=$DEVDIR/iPhoneSimulator.platform/Developer IOSBIN=$DEVDIR/../usr/bin/ SIMBIN=$SIMDIR/usr/bin/ BUILD_DIR=$LUAJIT/build rm -rf $BUILD_DIR mkdir -p $BUILD_DIR rm *.a 1>/dev/null 2>/dev/null echo ================================================= echo ARMV7 Architecture ISDKF="-arch armv7 -isysroot $IOSDIR/SDKs/$IOSVER" make -j -C $LUAJIT HOST_CC="gcc -m32 " CROSS=$IOSBIN TARGET_FLAGS="$ISDKF" TARGET=armv7 TARGET_SYS=iOS clean make -j -C $LUAJIT HOST_CC="gcc -m32 " CROSS=$IOSBIN TARGET_FLAGS="$ISDKF" TARGET=armv7 TARGET_SYS=iOS mv $LUAJIT/src/libluajit.a $BUILD_DIR/libluajitA7.a echo ================================================= echo ARM64 Architecture ISDKF="-arch arm64 -isysroot $IOSDIR/SDKs/$IOSVER" make -j -C $LUAJIT HOST_CC="gcc " CROSS=$IOSBIN TARGET_FLAGS="$ISDKF" TARGET=arm64 TARGET_SYS=iOS clean make -j -C $LUAJIT HOST_CC="gcc " CROSS=$IOSBIN TARGET_FLAGS="$ISDKF" TARGET=arm64 TARGET_SYS=iOS mv $LUAJIT/src/libluajit.a $BUILD_DIR/libluajit64bit.a echo ================================================= echo IOS Simulator Architecture ISDKF="-arch x86_64 -isysroot $SIMDIR/SDKs/$SIMVER -miphoneos-version-min=7.0" make -j -C $LUAJIT HOST_CFLAGS="-arch x86_64" HOST_LDFLAGS="-arch x86_64" TARGET_SYS=iOS TARGET=x86_64 clean make -j -C $LUAJIT HOST_CFLAGS="-arch x86_64" HOST_LDFLAGS="-arch x86_64" TARGET_SYS=iOS TARGET=x86_64 amalg CROSS=$SIMBIN TARGET_FLAGS="$ISDKF" mv $LUAJIT/src/libluajit.a $BUILD_DIR/libluajitx86_64.a libtool -o $BUILD_DIR/libluajit21.a $BUILD_DIR/*.a 2> /dev/null mkdir -p $BUILD_DIR/Headers cp $LUAJIT/src/lua.h $BUILD_DIR/Headers cp $LUAJIT/src/lauxlib.h $BUILD_DIR/Headers cp $LUAJIT/src/lualib.h $BUILD_DIR/Headers cp $LUAJIT/src/luajit.h $BUILD_DIR/Headers cp $LUAJIT/src/lua.hpp $BUILD_DIR/Headers cp $LUAJIT/src/luaconf.h $BUILD_DIR/Headers mv $BUILD_DIR/libluajit21.a ../lib/ios
由于iphone5s以上虚拟机需要x86_64支持,luajit为了支持此模式需要在other
linker flags中增加参数
-pagezero_size 10000 -image_base 100000000
1: 目前luajit 2.1只是alpha版本,有没有大的bug不清楚
2:在arm64平台下的luajit的bytecode与早前的bytecode有区别无法直接在mac下编译后在arm64平台使用。它使用了最新的lj_gc64与lj_fr2。所以直接在macos下编译的lua代码不能在ios上运行。需要上传源代码在ios下编译
标签:
原文地址:http://blog.csdn.net/dragoncheng/article/details/43482109