This repository contains Android build files for Wei Dai's Crypto++. It supplies
Application.mk for Crypto++ for those who want to use Android build tools.
The purpose of Crypto++ Android build is two-fold:
- better support Android distributions
- supplement the GNUmakefile which is reaching its limits with repsect to GNUmake-based configuration
Application.mk based on Alex Afanasyev's pull request at http://github.com/weidai11/cryptopp/pull/3. The pull request went unmerged because we did not want to add the directory structure to accommodate Android builds. Though we did not merge Afanasyev's pull request, Afanasyev should get the credit for this work.
There is a wiki page available that discusses the Android build system and the Crypto++ project files in more detail at Android.mk (Command Line).
The Android build files are a work in progress, so use them at your own risk. With that said cryptest-ndk.sh is used to test the build system.
In September 2016 the library added cryptest-ndk.sh to help test the Android.mk gear. The script is located in Crypto++'s TestScripts directory. The script downloads the Android.mk project files and builds the library.
If you want to use cryptest-ndk.sh to drive things then perform the following steps.
cd cryptopp cp -p TestScripts/cryptest-ndk.sh . bash cryptest-ndk.sh
The general workflow is clone Wei Dai's crypto++, fetch the Android files, and then build using
git clone http://github.com/weidai11/cryptopp.git cd cryptopp wget -O Android.mk https://raw.githubusercontent.com/noloader/cryptopp-android/master/Android.mk wget -O Application.mk https://raw.githubusercontent.com/noloader/cryptopp-android/master/Application.mk wget -O make_neon.sh https://raw.githubusercontent.com/noloader/cryptopp-android/master/make_neon.sh # Create *.neon source files for armeabi-v7a bash make_neon.sh ndk-build NDK_PROJECT_PATH=... NDK_APPLICATION_MK=...
If you are working from a Crypto++ release zip file, then you should download the same cryptopp-android release zip file. Both Crypto++ and this project use the same release tags, such as CRYPTOPP_8_0_0.
If you mix and match Master with a release zip file then things may not work as expected. You may find the build project files reference a source file that is not present in the Crypto++ release.
Before running the Android project please ensure you have the following installed:
- Android NDK
- Android SDK
ANDROID_SDK_ROOT are NDK and SDK environmental variables used by the Android tools. They should be set whenever you use Android's command line tools. The project does not use environmental variables from Eclipse or Android Studio like
ANDROID_SDK_HOME. Also see Recommended NDK Directory? on the Android NDK mailing list.
The Android build files require an unusal filesystem layout. Your Crypto++ source files will be located in a folder like
Application.mk will be located in a folder like
<project root>/jni. You must set
Android.mk to a value like
../cryptopp-7.1/. The trailing slash is important because the build system uses GNU Make's
addprefix which is a simple concatenation.
To run the script issue
ndk-build with several NDK build variables set.
NDK_APPLICATION_MK are required when not using Android default paths like
cd cryptopp ndk-build V=1 NDK_PROJECT_PATH="$PWD" NDK_APPLICATION_MK="$PWD/Application.mk"
According to NDK Build you should set
NDK_DEBUG=1 for debug builds and
NDK_DEBUG=0 for release builds. You can also set
V=1 for verbose NDK builds which should help with diagnostics.
We would like all maintainers to be collaborators on this repo. If you are a maintainer then please contact us so we can send you an invite.
If you are a collaborator then make changes as you see fit. You don't need to ask for permission to make a change. Noloader is not an Android expert so there are probably lots of opportunities for improvement.
Keep in mind other folks may be using the files, so try not to break things for the other guy. We have to be mindful of different versions of the NDK and API versions.
Everything in this repo is release under Public Domain code. If the license or terms is unpalatable for you, then don't feel obligated to commit.