2015年3月1日 星期日

AndroLua = Luajava + Luajit for android


step 1

https://github.com/mkottman/AndroLua


git clone git://github.com/mkottman/AndroLua.git
cd AndroLua
$NDK/ndk-build
$SDK/tools/android update project -p .
ant debug
ant install

step 2
http://luajit.org/download.html

use one of these
# Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo)
NDK=/opt/android/ndk
NDKABI=8
NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"

# Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS)
NDK=/opt/android/ndk
NDKABI=14
NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
copy result file src/libluajit.a to androlua/jni/luajava
 copy src/lua.h, src/luajit.h,src/luaconf.h, src/lualib.h, src/lauxlib.h to androlua/jni/luajava
remove androlua/jni/lua
step 3
modify androlua/jni/luajava/android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS := $(LOCAL_PATH)/libluajit.a
LOCAL_ARM_MODE := arm
TARGET_PLATFORM := armeabi
#TARGET_PLATFORM := armeabi-v7a
TARGET_ABI := android-8-armeabi
LOCAL_MODULE     := luajava
LOCAL_SRC_FILES  := luajava.c

include $(BUILD_SHARED_LIBRARY)
ndk-build clean
ndk-build
ant clean
ant debug

沒有留言:

張貼留言

追蹤者