forked from pelya/debian-noroot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setCrossEnvironment-armeabi-v7a.sh
executable file
·94 lines (83 loc) · 1.88 KB
/
setCrossEnvironment-armeabi-v7a.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
IFS='
'
NDK=`which ndk-build`
NDK=`dirname $NDK`
if uname -s | grep -i "linux" > /dev/null ; then
MYARCH=linux-$(arch)
NDK=`readlink -f $NDK`
elif uname -s | grep -i "darwin" > /dev/null ; then
MYARCH=darwin-x86_64
elif uname -s | grep -i "windows" > /dev/null ; then
MYARCH=windows-x86_64
fi
#echo NDK $NDK
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9
LOCAL_PATH=`dirname $0`
if which realpath > /dev/null ; then
LOCAL_PATH=`realpath $LOCAL_PATH`
else
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
fi
ARCH=armeabi-v7a
GCCPREFIX=armv7a-linux-androideabi
BINUTILSPREFIX=arm-linux-androideabi
APILEVEL=16
CFLAGS="
-g
-ffunction-sections
-fdata-sections
-funwind-tables
-fstack-protector-strong
-no-canonical-prefixes
-mthumb
-Wformat
-Werror=format-security
-Oz
-DNDEBUG
-fPIC
$CFLAGS"
CFLAGS="`echo $CFLAGS | tr '\n' ' '`"
LDFLAGS="
-fPIC
-g
-ffunction-sections
-fdata-sections
-Wl,--gc-sections
-funwind-tables
-fstack-protector-strong
-no-canonical-prefixes
-mthumb
-Wformat
-Werror=format-security
-Oz
-DNDEBUG
-Wl,--build-id
-Wl,--warn-shared-textrel
-Wl,--fatal-warnings
-Wl,--no-undefined
-Wl,-z,noexecstack
-Qunused-arguments
-Wl,-z,relro
-Wl,-z,now
-latomic
-ldl
$LDFLAGS"
LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`"
CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang"
CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang++"
CPP="$CC -E $CFLAGS"
env \
CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \
LDFLAGS="$LDFLAGS" \
CC="$CC" \
CXX="$CXX" \
RANLIB="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-ranlib" \
LD="$CXX" \
AR="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-ar" \
CPP="$CPP" \
NM="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-nm" \
AS="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-as" \
STRIP="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-strip" \
"$@"