Browse Source

PEMA-103

Added Cargo.toml, mostly to generate a static lib so we don't have to link.
Moved libuuid to static lib as it should be.

TODO: Update MakefileTemplate to reflect these changes.
pull/25/head
Sascha Bacardit 3 years ago
parent
commit
5ba924dab2
  1. 44
      android/external/Cargo.toml.tmp
  2. 2
      android/external/MakefileTemplate
  3. 10
      android/jni/Android.mk
  4. 2
      android/src/foundation/pEp/jniadapter/AndroidHelper.java

44
android/external/Cargo.toml.tmp

@ -0,0 +1,44 @@
[package]
name = "pep_engine_sequoia_backend"
description = "An implementation of the p≡p Engine's cryptotech interface using Sequoia."
version = "0.1.0"
authors = ["Neal H. Walfield <neal@pep.foundation>"]
homepage = "https://sequoia-pgp.org/"
repository = "https://gitea.pep.foundation/neal/pEpEngineSequoiaBackend/"
readme = "README.md"
keywords = ["cryptography", "openpgp", "pgp", "encryption", "signing"]
categories = ["cryptography", "authentication", "email"]
license = "GPL-3.0-or-later"
edition = "2018"
[badges]
maintenance = { status = "actively-developed" }
[dependencies]
anyhow = "1"
backtrace = "0.3.61"
chrono = "0.4"
enumber = "0.3"
lazy_static = "1"
libc = "0.2"
lru = "0.6.6"
memmem = "0.1"
memoffset = "0.6"
# When bumping the version of Sequoia search the code for XXX to find
# spots where we can take advantage of new features.
sequoia-openpgp = { version = "1.0", default-features = false }
thiserror = "1"
[dependencies.rusqlite]
version = "0.25"
features = ["bundled", "collation", "blob"]
[lib]
crate-type = ["lib", "cdylib", "staticlib"]
[features]
default = [
"sequoia-openpgp/default",
]
crypto-nettle = ["sequoia-openpgp/crypto-nettle"]
crypto-cng = ["sequoia-openpgp/crypto-cng"]

2
android/external/MakefileTemplate

@ -282,7 +282,7 @@ $(CARGO_TARGET_DIR)/$(SEQUOIA_ARCH)/release/libpep_engine_sequoia_backend.so: p
ARMV7_LINUX_ANDROIDEABI_OPENSSL_INCLUDE_DIR="$(LOCAL)/include" \
ARMV7_LINUX_ANDROIDEABI_OPENSSL_DIR="$(LOCAL)/bin" \
CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo build --target $(SEQUOIA_ARCH) -p pep_engine_sequoia_backend --release
#TODO PEMA-103 we cna move seq to static (.a)
$(LOCAL)/lib/libpep_engine_sequoia_backend.so: $(CARGO_TARGET_DIR)/$(SEQUOIA_ARCH)/release/libpep_engine_sequoia_backend.so
cp $(CARGO_TARGET_DIR)/$(SEQUOIA_ARCH)/release/libpep_engine_sequoia_backend.* $(LOCAL)/lib/

10
android/jni/Android.mk

@ -13,8 +13,8 @@ include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpep_engine_sequoia_backend
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/lib/libpep_engine_sequoia_backend.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/lib/libpep_engine_sequoia_backend.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libhogweed
@ -44,9 +44,9 @@ $(shell sh $(ENGINE_PATH)/build-android/takeOutHeaderFiles.sh $(ENGINE_PATH))
include $(CLEAR_VARS)
LOCAL_MODULE := pEpJNI
LOCAL_SHARED_LIBRARIES := libnettle libhogweed libgmp libpep_engine_sequoia_backend
LOCAL_STATIC_LIBRARIES := pEpEngine libetpan libiconv pEpAdapter pEpCxx11
LOCAL_WHOLE_STATIC_LIBRARIES := libuuid
#TODO PEMA-103 we cna move seq to static
LOCAL_SHARED_LIBRARIES := libnettle libhogweed libgmp
LOCAL_STATIC_LIBRARIES := pEpEngine libetpan libuuid libiconv pEpAdapter pEpCxx11 libpep_engine_sequoia_backend
LOCAL_CPP_FEATURES += exceptions
LOCAL_CPPFLAGS += -std=c++11 -DANDROID_STL=c++_shared -DHAVE_PTHREADS -DDISABLE_SYNC -fuse-ld=lld
LOCAL_SRC_FILES := \

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

@ -128,6 +128,8 @@ public class AndroidHelper {
System.loadLibrary("gmp");
System.loadLibrary("nettle");
System.loadLibrary("hogweed");
//TODO PEMA-103 Check if we are required to link the shared lib here
// System.loadLibrary("libpep_engine_sequoia_backend");
migrateFromGPGToSequoiaIfNeeded(c.getFilesDir());

Loading…
Cancel
Save