Browse Source

JNI-178 Android-Build: Add CryptoPP dependency

android-build-178
Hussein Kasem 3 years ago
committed by Hussein Kasem
parent
commit
5790f1d3c1
No known key found for this signature in database GPG Key ID: 9E61B9BC790E6B02
  1. 3
      android/external/Makefile.conf
  2. 22
      android/external/arm64-v8a/Makefile
  3. 23
      android/external/armeabi-v7a/Makefile
  4. 4
      android/external/downloads/Makefile
  5. 15
      android/external/install_cryptopp.sh
  6. 22
      android/external/x86/Makefile
  7. 30
      android/external/x86_64/Makefile
  8. 2
      android/src/foundation/pEp/jniadapter/AndroidHelper.java

3
android/external/Makefile.conf

@ -29,6 +29,7 @@ BOOST_VERSION=1.74.0
EXTERNAL_GIT_REPOS += libetpan|https://gitea.pep.foundation/pEp.foundation/libetpan.git?507ab94fc9609432ef2d4c62770139482f1b5084
EXTERNAL_GIT_REPOS += sequoia|https://gitlab.com/sequoia-pgp/sequoia.git?openpgp/v1.3.1
EXTERNAL_GIT_REPOS += boost-for-android|https://github.com/moritz-wundke/Boost-for-Android.git?0e12fbd30cb70b668a117c0913a303acfdaae04f
EXTERNAL_GIT_REPOS += cryptopp|https://github.com/weidai11/cryptopp.git?CRYPTOPP_8_6_0
### Common variables
#### Source code targets
@ -37,6 +38,7 @@ EXTERNAL_SRCS += uuid-src
EXTERNAL_SRCS += openssl-src
EXTERNAL_SRCS += gmp-src
EXTERNAL_SRCS += nettle-src
EXTERNAL_SRCS += cryptopp-src
#### Clean source code targets.
EXTERNAL_SRCS_CLEAN += libiconv-clean
@ -45,6 +47,7 @@ EXTERNAL_SRCS_CLEAN += openssl-clean
EXTERNAL_SRCS_CLEAN += gmp-clean
EXTERNAL_SRCS_CLEAN += nettle-clean
EXTERNAL_SRCS_CLEAN += sequoia-ffi-clean
EXTERNAL_SRCS_CLEAN += cryptopp-clean
### Other variables
ANDROID_ETPAN_BUILD_VERSION=2

22
android/external/arm64-v8a/Makefile

@ -17,7 +17,7 @@ APP_ABI ?= arm64-v8a
all: build
build: showsetup uuid-install sequoia-ffi-install libetpan-build
build: showsetup uuid-install sequoia-ffi-install libetpan-build cryptopp-install
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -331,6 +331,26 @@ sequoia-ffi-build: $(CARGO_TARGET_DIR)/aarch64-linux-android/release/libsequoia_
sequoia-ffi-install: sequoia-deps-build $(LOCAL)/lib/libsequoia_openpgp_ffi.so
#------------------------------------------------------------------------------#
# Crypto++
cryptopp.src.stamp: ../downloads/cryptopp.tar.gz
mkdir -p cryptopp
cd cryptopp && tar xvf ../$<
touch $@
cryptopp-src: cryptopp.src.stamp
cryptopp-clean:
rm -rf cryptopp
rm -rf cryptopp.src.stamp
$(LOCAL)/lib/libcryptopp.so: cryptopp.src.stamp
cd cryptopp && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" ../../install_cryptopp.sh $(APP_ABI) $(ANDROID_API) $(LOCAL) $(MAKE)
cryptopp-build: $(LOCAL)/lib/libcryptopp.so
cryptopp-install: $(LOCAL)/lib/libcryptopp.so
#------------------------------------------------------------------------------#
# assets for Android app

23
android/external/armeabi-v7a/Makefile

@ -12,13 +12,12 @@ include ../Makefile.conf
#------------------------------------------------------------------------------#
# Build parameters
APP_ABI ?= armeabi-v7a
all: build
#assets
build: showsetup uuid-install sequoia-ffi-install libetpan-build
build: showsetup uuid-install sequoia-ffi-install libetpan-build cryptopp-install
#------------------------------------------------------------------------------#
@ -334,6 +333,26 @@ sequoia-ffi-build: $(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoi
sequoia-ffi-install: sequoia-deps-build $(LOCAL)/lib/libsequoia_openpgp_ffi.so
#------------------------------------------------------------------------------#
# Crypto++
cryptopp.src.stamp: ../downloads/cryptopp.tar.gz
mkdir -p cryptopp
cd cryptopp && tar xvf ../$<
touch $@
cryptopp-src: cryptopp.src.stamp
cryptopp-clean:
rm -rf cryptopp
rm -rf cryptopp.src.stamp
$(LOCAL)/lib/libcryptopp.so: cryptopp.src.stamp
cd cryptopp && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" ../../install_cryptopp.sh $(APP_ABI) $(ANDROID_API) $(LOCAL) $(MAKE)
cryptopp-build: $(LOCAL)/lib/libcryptopp.so
cryptopp-install: $(LOCAL)/lib/libcryptopp.so
#------------------------------------------------------------------------------#
# assets for Android app

4
android/external/downloads/Makefile

@ -13,7 +13,7 @@ include ../Makefile.conf
#------------------------------------------------------------------------------#
# Build parameters
all: download-iconv download-uuid download-sequoia-deps download-etpan download-sequoia download-boost
all: download-iconv download-uuid download-sequoia-deps download-etpan download-sequoia download-boost download-cryptopp
download-iconv: libiconv-1.15.tar.gz
@ -28,6 +28,8 @@ download-sequoia: sequoia.tar.gz
download-boost: boost-for-android.tar.gz
download-cryptopp: cryptopp.tar.gz
# Download source and patch it
libiconv-1.15.tar.gz:
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

15
android/external/install_cryptopp.sh

@ -0,0 +1,15 @@
#!/bin/bash
###
### Script to isolate ENV required by crytptoPP to build.
###
ANDROID_CPU=$1
ANDROID_API=$2
PREFIX=$3
MAKE=$4
echo $3
export ANDROID_NDK_ROOT=$ANDROID_NDK
export ANDROID_SDK_ROOT=$ANDROID_SDK
source TestScripts/setenv-android.sh ANDROID_API=$ANDROID_API ANDROID_CPU=$ANDROID_CPU
PREFIX=$PREFIX $MAKE -f GNUmakefile-cross shared install

22
android/external/x86/Makefile

@ -17,7 +17,7 @@ APP_ABI ?= x86
all: build
build: showsetup uuid-install sequoia-ffi-install libetpan-build
build: showsetup uuid-install sequoia-ffi-install libetpan-build cryptopp-install
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -331,6 +331,26 @@ sequoia-ffi-build: $(CARGO_TARGET_DIR)/i686-linux-android/release/libsequoia_ope
sequoia-ffi-install: sequoia-deps-build $(LOCAL)/lib/libsequoia_openpgp_ffi.so
#------------------------------------------------------------------------------#
# Crypto++
cryptopp.src.stamp: ../downloads/cryptopp.tar.gz
mkdir -p cryptopp
cd cryptopp && tar xvf ../$<
touch $@
cryptopp-src: cryptopp.src.stamp
cryptopp-clean:
rm -rf cryptopp
rm -rf cryptopp.src.stamp
$(LOCAL)/lib/libcryptopp.so: cryptopp.src.stamp
cd cryptopp && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" ../../install_cryptopp.sh $(APP_ABI) $(ANDROID_API) $(LOCAL) $(MAKE)
cryptopp-build: $(LOCAL)/lib/libcryptopp.so
cryptopp-install: $(LOCAL)/lib/libcryptopp.so
#------------------------------------------------------------------------------#
# assets for Android app

30
android/external/x86_64/Makefile

@ -17,7 +17,7 @@ APP_ABI ?= x86_64
all: build
build:showsetup uuid-install sequoia-ffi-install libetpan-build
build: showsetup uuid-install sequoia-ffi-install libetpan-build cryptopp-install
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -108,7 +108,7 @@ libiconv/lib/.libs/libiconv.a: libiconv/Makefile
$(LOCAL)/lib/libiconv.a: libiconv/lib/.libs/libiconv.a
$(MAKE) -C libiconv DESTDIR=$(DESTDIR) prefix=$(prefix) install
ls -l $(LOCAL)/lib/libiconv.a
ls -l $(LOCAL)/lib
libiconv-build: libiconv/lib/.libs/libiconv.a
@ -168,7 +168,7 @@ $(LOCAL)/lib/libuuid.so: uuid/.libs/libuuid.so
# install fails copying uuid cmdline tool, but libs are copied ...
-$(MAKE) -C uuid DESTDIR=$(DESTDIR) prefix=$(prefix) install
echo "****** THIS ERROR WAS WILLINGLY IGNORED ******"
ls -l $(LOCAL)/lib/libuuid.so
ls -l $(LOCAL)/lib
uuid-build: uuid/.libs/libuuid.so
@ -214,7 +214,7 @@ $(LOCAL)/lib/libssl.so: openssl/libssl.so
cp libcrypto.a $(LOCAL)/lib && \
cp libssl.so $(LOCAL)/lib && \
cp libssl.a $(LOCAL)/lib
ls -l $(LOCAL)/lib/libssl.so
ls -l $(LOCAL)/lib
openssl-build: openssl/libssl.so
@ -250,7 +250,7 @@ gmp/.libs/libgmp.so: gmp/Makefile
$(LOCAL)/lib/libgmp.so: gmp/.libs/libgmp.so
$(MAKE) -C gmp DESTDIR=$(DESTDIR) prefix=$(prefix) install
#gmp/libtool --finish $(LOCAL)/lib/
ls -l $(LOCAL)/lib/libgmp.so
ls -l $(LOCAL)/lib
touch $@
gmp-build: gmp/.libs/libgmp.so
@ -331,6 +331,26 @@ sequoia-ffi-build: $(CARGO_TARGET_DIR)/x86_64-linux-android/release/libsequoia_o
sequoia-ffi-install: sequoia-deps-build $(LOCAL)/lib/libsequoia_openpgp_ffi.so
#------------------------------------------------------------------------------#
# Crypto++
cryptopp.src.stamp: ../downloads/cryptopp.tar.gz
mkdir -p cryptopp
cd cryptopp && tar xvf ../$<
touch $@
cryptopp-src: cryptopp.src.stamp
cryptopp-clean:
rm -rf cryptopp
rm -rf cryptopp.src.stamp
$(LOCAL)/lib/libcryptopp.so: cryptopp.src.stamp
cd cryptopp && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" ../../install_cryptopp.sh $(APP_ABI) $(ANDROID_API) $(LOCAL) $(MAKE)
cryptopp-build: $(LOCAL)/lib/libcryptopp.so
cryptopp-install: $(LOCAL)/lib/libcryptopp.so
#------------------------------------------------------------------------------#
# assets for Android app

2
android/src/foundation/pEp/jniadapter/AndroidHelper.java

@ -129,6 +129,8 @@ public class AndroidHelper {
System.loadLibrary("nettle");
System.loadLibrary("hogweed");
System.loadLibrary("cryptopp");
migrateFromGPGToSequoiaIfNeeded(c.getFilesDir());
}

Loading…
Cancel
Save