Home | History | Annotate | Download | only in import-install
      1 cd `dirname $0`
      2 PWD=$(pwd)
      3 
      4 # Update NDK_MODULE_PATH so we can find our imported modules
      5 export 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>
     11 PARAM_ABIS=$(echo "$@" | tr ' ' '\n' | grep -e "^APP_ABI=")
     12 PARAM_ABIS=${PARAM_ABIS##APP_ABI=}
     13 if [ -z "$PARAM_ABIS" ]; then
     14     echo "NO ABIS in param '$@'"
     15     ABIS="armeabi armeabi-v7a x86 mips armeabi-v7a-hard"
     16 else
     17     echo "FOUND ABIS in param '$@': $PARAM_ABIS"
     18     ABIS="$PARAM_ABIS"
     19 fi
     20 
     21 # Now ensure that all files were installed to all supported ABIs
     22 ANDROID_NDK_ROOT=$NDK
     23 NDK_BUILDTOOLS_PATH=$NDK/build/tools
     24 source $NDK_BUILDTOOLS_PATH/prebuilt-common.sh
     25 MISSING=
     26 for ABI in $ABIS; do
     27     DIR=$PWD/libs/$ABI
     28     SUFFIX=$(get_lib_suffix_for_abi $ABI)
     29     for FILENAME in libfoo$SUFFIX libpath1$SUFFIX libpath2$SUFFIX; do
     30         FILE=$DIR/$FILENAME
     31         if [ ! -f "$FILE" ]; then
     32             MISSING="$MISSING $FILE"
     33 	fi
     34     done
     35 done
     36 
     37 # In case of missing files, error out
     38 if [ "$MISSING" ]; then
     39     echo "ERROR: Missing files in build tree:"
     40     for FILE in $MISSING; do echo "  $FILE"; done
     41     exit 1
     42 fi
     43 
     44 # Otherwise, our test is good
     45 exit 0
     46