Skip to content

Commit d7c5158

Browse files
committed
* moved ndk-build to one place
* disabled debug symbols debug symbols are useful for attaching GDB to a running process. the stacktrace can be retrieved even without the debug flag.
1 parent 9a66d3d commit d7c5158

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

build.sh

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ oldpwd=$(pwd)
55
UPDATE_SERVER="http://update.csploit.org/"
66
RUBY_VERSION=1.0.0
77
CORE_VERSION=1.0.1
8+
DEBUG=false
89

910
die() {
1011
echo "FAILED"
@@ -88,21 +89,23 @@ delete_ruby_packages() {
8889
find ../dist/ -name "ruby*" -type f -exec rm "{}" \;
8990
}
9091

91-
build_core() {
92+
build() {
9293
app_root=$(readlink -f ../)
9394

94-
ndk_args="APP_OPTIM=debug NDK_DEBUG=1 " # debug
95+
ndk_args=""
96+
97+
test "x$DEBUG" == "xtrue" && ndk_args+="APP_OPTIM=debug NDK_DEBUG=1 " # debug
9598
ndk_args+="APP_PLATFORM=android-${api} " # force android api level
9699
ndk_args+="NDK_OUT=${app_root}/obj/android-${api} " # objects directory
97100

98101
echo
99-
echo -n "[core] compiling for android-${api}..."
102+
echo -n "[$pkg] compiling for android-${api}..."
100103

101104
cpus=$(grep -E "^processor" /proc/cpuinfo | wc -l)
102105

103-
echo "running: ndk-build $ndk_args -j${cpus}" >&3
106+
echo "running: ndk-build $ndk_args -j${cpus} $@" >&3
104107

105-
ndk-build $ndk_args -j${cpus} >&3 2>&1 || die
108+
ndk-build $ndk_args -j${cpus} $@ >&3 2>&1 || die
106109

107110
echo "ok"
108111
}
@@ -118,21 +121,11 @@ select_lower_api() {
118121
build_jni_libs() {
119122
app_root=$(readlink -f ../)
120123

121-
ndk_args="APP_OPTIM=debug NDK_DEBUG=1 " # debug
122-
ndk_args+="APP_PLATFORM=android-${api} " # force android api level
123-
ndk_args+="NDK_OUT=${app_root}/obj/android-${api} " # objects directory
124-
125-
ndk_targets="cSploitCommon cSploitClient"
126-
127124
strip=$( ndk-which strip ) 2>&3 || die
128-
129-
echo -n "[jni] compiling for android-${api}..."
130-
131-
cpus=$(grep -E "^processor" /proc/cpuinfo | wc -l)
132125

133-
ndk-build $ndk_args -j${cpus} $ndk_targets >&3 2>&1 || die
126+
build cSploitCommon cSploitClient
134127

135-
echo -ne "ok\n[jni] installing into libs..."
128+
echo -ne "[jni] installing into libs..."
136129

137130
for abi in $abis; do
138131
objs="${app_root}/obj/android-${api}/local/${abi}"
@@ -244,7 +237,7 @@ build_cores() {
244237
delete_core_packages
245238

246239
for api in $apis; do
247-
build_core
240+
build
248241
for abi in $abis; do
249242
pack_core
250243
done
@@ -256,7 +249,7 @@ build_ruby() {
256249
delete_ruby_packages
257250

258251
for api in $apis; do
259-
build_core
252+
build
260253
for abi in $abis; do
261254
pack_ruby
262255
done

0 commit comments

Comments
 (0)