-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild-natives-eris_mac.sh
executable file
·60 lines (47 loc) · 1.4 KB
/
build-natives-eris_mac.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
mkdir native-build
mkdir native-debug
rm native-build/*.dylib
rm native-debug/*.dylib
if [ ! -d eris ]; then
git clone https://github.com/fnuecke/eris
fi
cd native
for lua_ver in 5.2 5.3; do
for arch_type in amd64; do
for plat_type in mac; do
MY_GCC="gcc"
MY_STRIP="strip"
MY_LIB_SUFFIX="dylib"
if [ "$arch_type" == "i686" ]; then
MY_CFLAGS="-fPIC -O2 -m32"
MY_LDFLAGS="-m32 -dynamic"
else
MY_CFLAGS="-fPIC -O2 -m64"
MY_LDFLAGS="-m64 -dynamic"
fi
LUA_TYPE="posix"
cd ../eris
if [ "$lua_ver" == "5.2" ]; then
MY_JNLUA_SUFFIX="52"
MY_LUA_CFLAGS=""
git checkout master
else
MY_JNLUA_SUFFIX="53"
MY_LUA_CFLAGS="-DLUA_COMPAT_5_2"
git checkout master-lua5.3
fi
make clean
make CC="$MY_GCC" CFLAGS="$MY_CFLAGS $MY_LUA_CFLAGS" LDFLAGS="$MY_LDFLAGS" $LUA_TYPE
cd ../native
rm *.dll *.so build/*.o
CFLAGS="$MY_CFLAGS -DJNLUA_USE_ERIS -DLUA_USE_POSIX" LDFLAGS="$MY_LDFLAGS" ARCH=amd64 JNLUA_SUFFIX="$MY_JNLUA_SUFFIX" \
LUA_LIB_NAME=lua LUA_INC_DIR=../eris/src LUA_LIB_DIR=../eris/src LIB_SUFFIX="$MY_LIB_SUFFIX" \
CC="$MY_GCC" LUA_VERSION="$lua_ver" \
make -f Makefile.mac libjnlua
cp libjnlua"$MY_JNLUA_SUFFIX"."$MY_LIB_SUFFIX" ../native-debug/libjnlua-"$lua_ver"-"$plat_type"-"$arch_type"."$MY_LIB_SUFFIX"
"$MY_STRIP" libjnlua"$MY_JNLUA_SUFFIX"."$MY_LIB_SUFFIX"
mv libjnlua"$MY_JNLUA_SUFFIX"."$MY_LIB_SUFFIX" ../native-build/libjnlua-"$lua_ver"-"$plat_type"-"$arch_type"."$MY_LIB_SUFFIX"
done
done
done