-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid.sh
More file actions
executable file
·29 lines (29 loc) · 846 Bytes
/
android.sh
File metadata and controls
executable file
·29 lines (29 loc) · 846 Bytes
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
#!/bin/bash
ndk=~/bin/android-ndk
abi=armeabi
ver=4.9
api=9
bld=darwin-x86_64
bin=${ndk}/toolchains/arm-linux-androideabi-${ver}/prebuilt/${bld}/bin
#export PATH=${bin}:$PATH
flg=()
flg+=(--sysroot=${ndk}/platforms/android-${api}/arch-arm)
flg+=(-I${ndk}/sources/cxx-stl/gnu-libstdc++/${ver}/include)
flg+=(-I${ndk}/sources/cxx-stl/gnu-libstdc++/${ver}/libs/${abi}/include)
ldf=()
ldf+=(-L${ndk}/sources/cxx-stl/gnu-libstdc++/${ver}/libs/${abi})
ldf+=(-lgnustl_static)
tgt=arm-linux-androideabi
cc=${bin}/${tgt}-gcc
cxx=${bin}/${tgt}-g++
cpp=()
ccf=()
ccf+=(-g0 -O3)
function cfg() {
cfg=$1
shift
"${cfg}" \
CC="${cc} ${flg[*]}" CXX="${cxx} ${flg[*]}" OBJCXX="${cxx} ${flg[*]}" \
CFLAGS="${ccf[*]}" CXXFLAGS="${ccf[*]}" OBJCXXFLAGS="${ccf[*]}" \
--host="${tgt}" CPPFLAGS="${cpp[*]}" LDFLAGS="${ldf[*]}" "$@"
}