Upgrade dependencies and build system
This commit switches to use official Google NDK version 16 with packages
created/installed using android-crew-staging tool derived from CrystaX
project.
Change-Id: I248fef2a871e44375512dcbf15a5f3166c0ab5de
diff --git a/README.md b/README.md
index 5bf920e..af28fd9 100644
--- a/README.md
+++ b/README.md
@@ -7,65 +7,57 @@
To compile code, the following is necessary
-- Recent version of [Android SDK](http://developer.android.com/sdk/index.html), android-23 SDK
- and 23.0.2 build tools (for build), android-19 SDK (for compatibility), and several other SDK
- components
-- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.3.1
-- Prebuilt version of OpenSSL library
+- Recent version of [Android SDK](http://developer.android.com/sdk/index.html)
Example script for Ubuntu 16.04 to get all dependencies, download SDK and NDK:
- CRYSTAX_NDK_VERSION=10.3.1
- SDK_VERSION=24.4.1
- OPENSSL_VERSION=1.0.2h
-
- BUILD_TOOLS_VERSION=23.0.2
- COMPILE_SDK_VERSION=23
-
sudo apt -q update
sudo apt -qy upgrade
- sudo apt-get install -y build-essential git openjdk-8-jdk unzip
+ sudo apt-get install -y build-essential git openjdk-8-jdk unzip ruby ruby-rugged
sudo apt-get install -y lib32stdc++6 lib32z1 lib32z1-dev
- wget https://www.crystax.net/download/crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
- tar xf crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
- rm crystax-ndk-$CRYSTAX_NDK_VERSION-linux-x86_64.tar.xz
+ mkdir android-sdk-linux
+ cd android-sdk-linux
+ wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
+ unzip sdk-tools-linux-3859397.zip
+ rm sdk-tools-linux-3859397.zip
- wget http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
- tar zxf android-sdk_r$SDK_VERSION-linux.tgz
- rm android-sdk_r$SDK_VERSION-linux.tgz
+ export ANDROID_HOME=`pwd`
+ export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
- export ANDROID_HOME=`pwd`/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+ echo "y" | sdkmanager "platform-tools"
+ sdkmanager "platforms;android-26" "build-tools;26.0.3" "ndk-bundle"
- echo "y" | android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
- echo "y" | android update sdk --filter "android-19" --no-ui --all --force
+ cd ndk-bundle
+ git clone https://github.com/cawka/android-crew-staging.git crew.dir
-To create prebuilt OpenSSL libraries:
+ CREW_OWNER=cawka crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
- git clone https://github.com/crystax/android-vendor-openssl.git
- cd crystax-ndk-$CRYSTAX_NDK_VERSION
- ./build/tools/build-target-openssl.sh ../android-vendor-openssl/
- cp sources/openssl/1.0.1p/Android.mk -o sources/openssl/$OPENSSL_VERSION/Android.mk
+ cd ..
-Alternatively, you can use precompiled versions (currently, available for CrystaX NDK 10.3.1 only):
-
- cd crystax-ndk-10.3.1/sources
- curl -L -o openssl.tar.gz https://github.com/named-data-mobile/crystax-prebuilt-openssl/archive/crystax-10.3.1.tar.gz
- tar zx --strip-components 1 -C openssl -f openssl.tar.gz
- rm openssl.tar.gz
+The above `crew` scripts will install pre-compiled versions of sqlite, openssl, and boost libraries.
+To compile them instead, replace `install` with `build`.
## Building
git clone --recursive http://gerrit.named-data.net/NFD-android
echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
- echo ndk.dir=`pwd`/crystax-ndk-10.3.1 >> NFD-android/local.properties
+ echo ndk.dir=`pwd`/android-sdk-linux/ndk-bundle >> NFD-android/local.properties
cd NFD-android
./gradlew assembleRelease
+Note that you can limit architectures being built using `NDK_BUILD_ABI` variable. For example,
+
+ export NDK_BUILD_ABI=armeabi-v7a,x86_64
+
+will limit build to `armeabi-v7a` and `x86_64`.
+
+By default, the build script will try to parallelize build to the number of CPUs. This can be
+overridden using `NDK_BUILD_PARALLEL` variable.
+
## Setting up environment using Vagrant
The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided