Steps for building and testing NDK

From Dmz-portal

Jump to: navigation, search
 #!/bin/sh
 # 1. Get two directories from googlesource
 export MYTMP=/tmp
 cd $MYTMP
 git clone https://android.googlesource.com/platform/ndk
 git clone https://android.googlesource.com/platform/development
 # 2. Download toolchain source
 export NDK=$MYTMP/ndk
 $NDK/build/tools/download-toolchain-sources.sh $MYTMP/src
 # 3. Build arm, x86 and mips NDK toolchains
 cd $NDK
 $NDK/build/tools/rebuild-all-prebuilt.sh --systems=linux-x86 --package-dir=$MYTMP/package $MYTMP/src
 $NDK/build/tools/package-release.sh --systems=linux-x86 --out-dir=$MYTMP/out --prebuilt-dir=$MYTMP/package
 # 4. Test arm, x86 and mips
 # For running code on real devices, we need to connect a device to a usb port.
 # The adb command is in android-sdk-linux that can be downloaded from http://developer.android.com/sdk/index.html.
 adb kill-server
 sudo adb start-server
 adb devices
 cd $NDK/tests
 ./run-tests.sh --abi=armeabi
 ./run-tests.sh --abi=armeabi-v7a
 ./run-tests.sh --abi=x86
 ./run-tests.sh --abi=mips
 # 5. The current NDK build is for 4.4.3.  We need to build 4.6 toolchains explicitly.
 cd $NDK
 $NDK/build/tools/build-gcc.sh $MYTMP/src $NDK arm-linux-androideabi-4.6 --build-out=$MYTMP/arm-out --sysroot=$NDK/platforms/android-9/arch-arm --package-dir=$MYTMP/package
 $NDK/build/tools/build-gcc.sh $MYTMP/src $NDK x86-4.6 --build-out=$MYTMP/x86-out --sysroot=$NDK/platforms/android-9/arch-x86 --package-dir=$MYTMP/package
 $NDK/build/tools/build-gcc.sh $MYTMP/src $NDK mipsel-linux-android-4.6 --build-out=$MYTMP/mips-out --sysroot=$NDK/platforms/android-9/arch-mips --package-dir=$MYTMP/package
 # Copy *.mk *.x *.xsc files to new toolchains
 cp toolchains/arm-linux-androideabi-4.4.3/*.* toolchains/arm-linux-androideabi-4.6/
 cp toolchains/x86-4.4.3/*.* toolchains/x86-4.6/
 cp toolchains/mipsel-linux-android-4.4.3/*.* toolchains/mipsel-linux-android-4.6/
 # 6. Test arm, x86 and mips again with 4.6 toolchains
 # Scripts will pick up 4.6 toolchains automatically.
 cd $NDK/tests
 ./run-tests.sh --abi=armeabi
 ./run-tests.sh --abi=armeabi-v7a
 ./run-tests.sh --abi=x86
 ./run-tests.sh --abi=mips
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox