1cd `dirname $0`
2PWD=$(pwd)
3
4# Update NDK_MODULE_PATH so we can find our imported modules
5export NDK_MODULE_PATH="$PWD"
6
7# Build everything
8$NDK/ndk-build "$@"
9
10# Extract ABIs list from parameters, we're looking for something like APP_ABI=<something>
11PARAM_ABIS=$(echo "$@" | tr ' ' '\n' | grep -e "^APP_ABI=")
12PARAM_ABIS=${PARAM_ABIS##APP_ABI=}
13if [ -z "$PARAM_ABIS" ]; then
14    echo "NO ABIS in param '$@'"
15    ABIS="armeabi armeabi-v7a x86 mips"
16else
17    echo "FOUND ABIS in param '$@': $PARAM_ABIS"
18    ABIS="$PARAM_ABIS"
19fi
20
21# Now ensure that all files were installed to all supported ABIs
22MISSING=
23for ABI in $ABIS; do
24    DIR=$PWD/libs/$ABI
25    for FILENAME in libfoo.so libpath1.so libpath2.so; do
26        FILE=$DIR/$FILENAME
27        if [ ! -f "$FILE" ]; then
28            MISSING="$MISSING $FILE"
29	fi
30    done
31done
32
33# In case of missing files, error out
34if [ "$MISSING" ]; then
35    echo "ERROR: Missing files in build tree:"
36    for FILE in $MISSING; do echo "  $FILE"; done
37    exit 1
38fi
39
40# Otherwise, our test is good
41exit 0
42