forked from pelya/libiconv-libicu-android
-
Notifications
You must be signed in to change notification settings - Fork 24
/
setCrossEnvironment-x86.sh
executable file
·98 lines (87 loc) · 2.7 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
92
93
94
95
96
97
98
#!/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
GCCPREFIX=i686-linux-android
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9
[ -z "$PLATFORMVER" ] && PLATFORMVER=android-15
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
CFLAGS="
-fexceptions
-frtti
-ffunction-sections
-funwind-tables
-fstack-protector-strong
-Wno-invalid-command-line-argument
-Wno-unused-command-line-argument
-no-canonical-prefixes
-I$NDK/sources/cxx-stl/llvm-libc++/include
-I$NDK/sources/cxx-stl/llvm-libc++abi/include
-I$NDK/sources/android/support/include
-DANDROID
-Wa,--noexecstack
-Wformat
-Werror=format-security
-DNDEBUG
-O2
-g
-gcc-toolchain
$NDK/toolchains/x86-4.9/prebuilt/linux-x86_64
-target
i686-none-linux-android
-fPIC
-mstackrealign
--sysroot $NDK/platforms/android-14/arch-x86
-isystem $NDK/sysroot/usr/include
-isystem $NDK/sysroot/usr/include/i686-linux-android
-D__ANDROID_API__=15
$CFLAGS"
CFLAGS="`echo $CFLAGS | tr '\n' ' '`"
LDFLAGS="
-shared
--sysroot $NDK/platforms/android-14/arch-x86
$NDK/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a
$NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/x86/libc++abi.a
$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/x86/libandroid_support.a
-latomic -Wl,--exclude-libs,libatomic.a
-gcc-toolchain
$NDK/toolchains/x86-4.9/prebuilt/linux-x86_64
-target i686-none-linux-android -no-canonical-prefixes
-Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
-lc -lm -lstdc++
$LDFLAGS
"
LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`"
CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang"
CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang++"
CPP="$CC -E $CFLAGS"
env PATH=$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \
CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \
LDFLAGS="$LDFLAGS" \
CC="$CC" \
CXX="$CXX" \
RANLIB="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \
LD="$CC" \
AR="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
CPP="$CPP" \
NM="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
AS="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
STRIP="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
"$@"