forked from pelya/debian-noroot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setCrossEnvironment-x86.sh
executable file
·91 lines (80 loc) · 1.79 KB
/
setCrossEnvironment-x86.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
#!/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=x86
GCCPREFIX=i686-linux-android
APILEVEL=16
CFLAGS="
-g
-ffunction-sections
-funwind-tables
-fdata-sections
-fstack-protector-strong
-no-canonical-prefixes
-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
-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
$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/$GCCPREFIX-ranlib" \
LD="$CXX" \
AR="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
CPP="$CPP" \
NM="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
AS="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
STRIP="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
"$@"