-
Notifications
You must be signed in to change notification settings - Fork 3
/
Build_Android.sh
executable file
·60 lines (46 loc) · 1.4 KB
/
Build_Android.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -ex
if [[ -z "${LUA_UE4_VERSION}" ]]; then
echo "LUA_UE4_VERSION is not set, exit."
exit 1
else
echo "LUA_UE4_VERSION: ${LUA_UE4_VERSION}"
fi
if [[ -z "${LUA_UE4_PREFIX}" ]]; then
echo "LUA_UE4_PREFIX is not set, exit."
exit 1
else
echo "LUA_UE4_PREFIX: ${LUA_UE4_PREFIX}"
fi
readonly LUA_UE4_URL=http://www.lua.org/ftp/lua-${LUA_UE4_VERSION}.tar.gz
readonly LUA_UE4_DIR=lua-${LUA_UE4_VERSION}
readonly LUA_UE4_TAR=${LUA_UE4_DIR}.tar.gz
wget -q -O ${LUA_UE4_TAR} ${LUA_UE4_URL}
function change_source {
sed -i 's:define LUA_IDSIZE:define LUA_IDSIZE 256 // :' luaconf.h
}
function build_android {
MYARCH=$1
MYABI=$1
tar zxf ${LUA_UE4_TAR}
mkdir -p "${LUA_UE4_PREFIX}/${MYARCH}"
pushd ${LUA_UE4_DIR}/src
change_source
popd
cp CMakeLists.txt ./${LUA_UE4_DIR}
pushd ${LUA_UE4_DIR}
cmake . \
-DCMAKE_INSTALL_PREFIX="${LUA_UE4_PREFIX}/${MYARCH}" \
-DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake \
-DANDROID_NDK="${NDKROOT}" \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_ABI="${MYABI}" \
-DANDROID_NATIVE_API_LEVEL="android-24"
make
make install
objdump -h "${LUA_UE4_PREFIX}/${MYARCH}/lib/liblua.a" | head -n 25
popd
}
build_android armeabi-v7a
rm -rfv ${LUA_UE4_DIR}
build_android arm64-v8a