10
10
MODULES=$MODULES
11
11
12
12
# Paths
13
- ROOT_PATH=" $( dirname $( readlink -f $0 ) ) "
13
+ ROOT_PATH=" $( dirname $( python -c ' import os,sys;print os.path.realpath(sys.argv[1]) ' $0 ) ) "
14
14
RECIPES_PATH=" $ROOT_PATH /recipes"
15
15
BUILD_PATH=" $ROOT_PATH /build"
16
16
LIBS_PATH=" $ROOT_PATH /build/libs"
@@ -23,6 +23,10 @@ DIST_PATH="$ROOT_PATH/dist/default"
23
23
export LIBLINK_PATH=" $BUILD_PATH /objects"
24
24
export LIBLINK=" $ROOT_PATH /src/tools/liblink"
25
25
export BIGLINK=" $ROOT_PATH /src/tools/biglink"
26
+ MD5SUM=$( which md5sum)
27
+ if [ " X$MD5SUM " == " X" ]; then
28
+ MD5SUM=" md5 -r"
29
+ fi
26
30
27
31
# Internals
28
32
CRED=" \x1b[31;01m"
@@ -39,7 +43,7 @@ if [ $? -eq 0 ]; then
39
43
export NDK_CCACHE=" ccache"
40
44
fi
41
45
42
- # set -x
46
+ set -x
43
47
44
48
function try () {
45
49
" $@ " || exit -1
@@ -98,7 +102,13 @@ function push_arm() {
98
102
export CXXFLAGS=" $CFLAGS "
99
103
100
104
# this must be something depending of the API level of Android
101
- export PATH=" $ANDROIDNDK /toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/:$ANDROIDNDK :$ANDROIDSDK /tools:$PATH "
105
+ PYPLATFORM=$( python -c ' import sys; print sys.platform' )
106
+ if [ " $PYPLATFORM " == " linux2" ]; then
107
+ PYPLATFORM=" linux"
108
+ elif [ " $PYPLATFORM " == " linux3" ]; then
109
+ PYPLATFORM=" linux"
110
+ fi
111
+ export PATH=" $ANDROIDNDK /toolchains/arm-eabi-4.4.0/prebuilt/$PYPLATFORM -x86/bin/:$ANDROIDNDK :$ANDROIDSDK /tools:$PATH "
102
112
if [ " X${ANDROIDNDKVER: 0: 2} " == " Xr7" ] || [ " X$ANDROIDNDKVER " == " Xr8" ]; then
103
113
export TOOLCHAIN_PREFIX=arm-linux-androideabi
104
114
export TOOLCHAIN_VERSION=4.4.3
@@ -110,7 +120,7 @@ function push_arm() {
110
120
exit -1
111
121
fi
112
122
113
- export PATH=" $ANDROIDNDK /toolchains/$TOOLCHAIN_PREFIX -$TOOLCHAIN_VERSION /prebuilt/linux -x86/bin/:$ANDROIDNDK :$ANDROIDSDK /tools:$PATH "
123
+ export PATH=" $ANDROIDNDK /toolchains/$TOOLCHAIN_PREFIX -$TOOLCHAIN_VERSION /prebuilt/$PYPLATFORM -x86/bin/:$ANDROIDNDK :$ANDROIDSDK /tools:$PATH "
114
124
115
125
# search compiler in the path, to fail now instead of later.
116
126
CC=$( which $TOOLCHAIN_PREFIX -gcc)
@@ -219,7 +229,7 @@ function run_prepare() {
219
229
220
230
info " Check mandatory tools"
221
231
# ensure that some tools are existing
222
- for tool in md5sum tar bzip2 unzip make gcc g++; do
232
+ for tool in tar bzip2 unzip make gcc g++; do
223
233
which $tool & > /dev/null
224
234
if [ $? -ne 0 ]; then
225
235
error " Tool $tool is missing"
@@ -274,7 +284,7 @@ function in_array() {
274
284
275
285
function run_source_modules() {
276
286
needed=($MODULES )
277
- declare -A processed
287
+ declare -a processed
278
288
order=()
279
289
280
290
while [ ${# needed[*]} -ne 0 ]; do
@@ -285,13 +295,14 @@ function run_source_modules() {
285
295
needed=( ${needed[@]} )
286
296
287
297
# check if the module have already been declared
288
- if [[ ${processed[$module]} ]]; then
298
+ in_array $module " ${processed[@]} "
299
+ if [ $? -ne 255 ]; then
289
300
debug " Ignored $module , already processed"
290
301
continue ;
291
302
fi
292
303
293
304
# add this module as done
294
- processed[ $module ]=1
305
+ processed=( ${processed[@]} $module )
295
306
296
307
# append our module at the end only if we are not exist yet
297
308
in_array $module " ${order[@]} "
@@ -369,7 +380,7 @@ function run_get_packages() {
369
380
if [ -f $filename ]; then
370
381
if [ -n " $md5 " ]; then
371
382
# check if the md5 is correct
372
- current_md5=$( md5sum $filename | cut -d\ -f1)
383
+ current_md5=$( $MD5SUM $filename | cut -d\ -f1)
373
384
if [ " X$current_md5 " == " X$md5 " ]; then
374
385
# correct, no need to download
375
386
do_download=0
@@ -393,7 +404,7 @@ function run_get_packages() {
393
404
394
405
# check md5
395
406
if [ -n " $md5 " ]; then
396
- current_md5=$( md5sum $filename | cut -d\ -f1)
407
+ current_md5=$( $MD5SUM $filename | cut -d\ -f1)
397
408
if [ " X$current_md5 " != " X$md5 " ]; then
398
409
error " File $filename md5 check failed (got $current_md5 instead of $md5 )."
399
410
error " Ensure the file is correctly downloaded, and update MD5S_$module "
0 commit comments