Merge in Release_2.1

pull/23/head
heck 2 months ago
commit c2ccd91c4c
  1. 7
      .gitignore
  2. 4
      DEPENDENCIES
  3. 1
      Makefile.conf
  4. 7
      android/README.md
  5. 18
      android/build.gradle
  6. 21
      android/external/Makefile.conf
  7. 36
      android/external/arm64-v8a/Makefile
  8. 21
      android/external/arm64-v8a/generate-standalone-ndk-toolchain.sh
  9. 35
      android/external/armeabi-v7a/Makefile
  10. 21
      android/external/armeabi-v7a/generate-standalone-ndk-toolchain.sh
  11. 17
      android/external/downloads/Makefile
  12. 1
      android/external/downloads/openssl-1.1.1h.tar.gz.md5
  13. 1
      android/external/downloads/openssl-1.1.1q.tar.gz.md5
  14. 44
      android/external/x86/Makefile
  15. 21
      android/external/x86/generate-standalone-ndk-toolchain.sh
  16. 32
      android/external/x86_64/Makefile
  17. 21
      android/external/x86_64/generate-standalone-ndk-toolchain.sh
  18. 2
      android/src/foundation/pEp/jniadapter/AndroidHelper.java
  19. 52
      build-windows/generate_code.cmd
  20. 139
      build-windows/pEpJNIAdapter.vcxproj
  21. 75
      build-windows/pEpJNIAdapter.vcxproj.filters
  22. 2
      scripts/debian10/java8.pEpJNIAdapter.debian10.Dockerfile
  23. 2
      scripts/debian10/pEpJNIAdapter.debian10.Dockerfile
  24. 7
      src/codegen/pEp.yml2
  25. 28
      src/cxx/basic_api.cc
  26. 21
      src/cxx/foundation_pEp_jniadapter_AbstractEngine.cc
  27. 14
      src/cxx/jniutils.cc
  28. 1
      src/cxx/jniutils.hh
  29. 13
      src/java/foundation/pEp/jniadapter/AbstractEngine.java
  30. 1
      utils/gen_status_codes.sh
  31. 2
      utils/ndk_toolchains_path.py

7
.gitignore vendored

@ -89,5 +89,12 @@ org.tar.gz
android/external/[?]*
android/external/build
# Ignore Windows build
build-windows/Debug
build-windows/Release
build-windows/.vs
build-windows/pEpJNIAdapter.vcxproj.user
# Default ignored files
?idea/

@ -1,5 +1,5 @@
# 1st Party Dependencies
## Prefer git tags instead of SHA hashes when possible.
libpEpAdapter=Release_2.1.21
pEpEngine=Release_2.1.42
libpEpAdapter=Release_2.1.22
pEpEngine=Release_2.1.64

@ -17,7 +17,6 @@ YML2_PATH=$(PREFIX)/src/yml2
YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS)
YML2_OPTS=--encoding=utf8
### Guessing JAVA_HOME
ifeq ($(PLATFORM),linux)
JAVA_HOME=$(subst /bin,,$(dir $(realpath /usr/bin/javac)))

@ -16,13 +16,13 @@ It can be done with the SDK and the sdkmanager cli tool, or using Android Studio
Android studio -> Configure -> SDK Manager -> SDK Tools (tab) -> Select NDK and install
Tip: To install other versions click on "Show packages details" and select the desired NDK version (Currently using: 21.0.6113669)
Tip: To install other versions click on "Show packages details" and select the desired NDK version (Currently using: 25.1.8937393)
## Required env\_vars (for MacOS):
``` bash
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export ANDROID_NDK=$ANDROID_SDK/ndk/21.0.6113669
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
export ANDROID_NDK=$ANDROID_SDK/ndk/25.1.8937393
export HOST_TAG=darwin-x86_64
export ANDROID_MIN_SDK_32=18
export ANDROID_MIN_SDK_64=21
@ -39,6 +39,7 @@ rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-andro
Tell rust the location of the new target linker and AR
TODO: Update and point to llvm-ar
```bash
echo "
[target.aarch64-linux-android]

@ -2,25 +2,27 @@
def pEpEngineSrc = hasProperty('pEpEngineSrc') ? pEpEngineSrc : "../../pEpEngine"
def buildAutomatic = hasProperty('buildAutomatic') ? buildAutomatic : "true"
def threadsToUse = hasProperty('threadsToUse') ?
threadsToUse : Runtime.getRuntime().availableProcessors()
//CHeck M1 answers the correct thing off .avaialableprocessors here
//def threadsToUse = hasProperty('threadsToUse') ?
// threadsToUse : Runtime.getRuntime().availableProcessors()
def threadsToUse = 1
def pEpEngineDB = new File(new File(pEpEngineSrc), 'db')
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
@ -30,10 +32,10 @@ android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 30
versionCode 7
versionName "2.1.29"
versionName "2.1.43"
externalNativeBuild {
ndkBuild {
@ -145,7 +147,7 @@ android {
from file(new File(pEpEngineDB, 'system.db'))
into 'assets'
}
ndkVersion '21.0.6113669'
ndkVersion '25.1.8937393'
if(buildAutomatic == "true") {
buildpEpEngineSystemDB.dependsOn(buildExternal)

@ -2,6 +2,7 @@
### Android NDK Common conf
NDK_TOOLCHAIN_COMPILER ?= clang
ANDROID_API ?= 21
### Select GNU SED on MacOS.
@ -9,18 +10,28 @@ NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
ifeq ($(NDK_UNAME),darwin)
SED=gsed
TOOLCHAIN_ARCH=darwin-x86_64
else
SED=sed
TOOLCHAIN_ARCH=linux-x86_64
endif
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
### Toolchain tools
LD := $(ANDROID_NDK_HOME)/bin/ld
AR := $(ANDROID_NDK_HOME)/bin/llvm-ar
RANLIB := $(ANDROID_NDK_HOME)/bin/llvm-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/llvm-strip
### Sequoia deps versions
OPENSSL_VERSION=1.1.1h
OPENSSL_VERSION=1.1.1q
GMP_VERSION=6.2.1
NETTLE_VERSION=3.7.3
### Git deps repos
EXTERNAL_GIT_REPOS += libetpan|https://gitea.pep.foundation/pEp.foundation/libetpan.git?0123f34ec4ef7711b3670b744b3ae7e97178afe1
EXTERNAL_GIT_REPOS += sequoia|https://gitlab.com/sequoia-pgp/sequoia.git?openpgp/v1.3.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
### Common variables
#### Source code targets
@ -38,3 +49,7 @@ EXTERNAL_SRCS_CLEAN += gmp-clean
EXTERNAL_SRCS_CLEAN += nettle-clean
EXTERNAL_SRCS_CLEAN += sequoia-ffi-clean
### Other variables
ANDROID_ETPAN_BUILD_VERSION=2

@ -14,18 +14,10 @@ include ../Makefile.conf
# Build parameters
APP_ABI ?= arm64-v8a
ANDROID_API ?= 21
all: build
build: generate-ndk-toolchain showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Generate standalone toolchain
generate-ndk-toolchain: ndk-standalone-toolchain/bin/clang
ndk-standalone-toolchain/bin/clang:
bash generate-standalone-ndk-toolchain.sh
build: showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -48,16 +40,9 @@ NDK_TOOLCHAIN = $(HOST)-$(NDK_TOOLCHAIN_COMPILER)
TARGET_ARCH_ABI = $(APP_ABI)
include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(EXTERNAL_ROOT)/ndk-standalone-toolchain
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang++
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -131,9 +116,9 @@ libetpan.src.stamp: ../downloads/libetpan.tar.gz
touch $@
libetpan/Makefile: libetpan.src.stamp | libiconv-install
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh
cp -r libetpan/build-android/libetpan-android-1/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-1/include/* $(LOCAL)/include/
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh $(APP_ABI)
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/include/* $(LOCAL)/include/
touch $@
libetpan-build: libetpan/Makefile
@ -300,6 +285,8 @@ nettle/libnettle.so: nettle/Makefile
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
@ -314,7 +301,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build/
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -323,6 +314,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/aarch64-linux-android/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -1,21 +0,0 @@
#!/bin/bash
usage="Usage: $(basename "$0") [-h][--force] -- Script to generate android standalone toolchain to build pEp for Android.
where:
-h Show this help text
--force Force generating the toolchain"
if [ "$1" == "-h" ]; then
echo "$usage"
exit 0
fi
if [ -z "$ANDROID_NDK" ]; then
echo "Please define \$ANDROID_NDK"
exit 1
fi
$ANDROID_NDK/build/tools/make_standalone_toolchain.py $1 --arch arm64 --api 21 --install-dir=ndk-standalone-toolchain
exit 0

@ -14,19 +14,12 @@ include ../Makefile.conf
# Build parameters
APP_ABI ?= armeabi-v7a
ANDROID_API ?= 18
all: build
#assets
build: generate-ndk-toolchain showsetup uuid-install sequoia-ffi-install libetpan-build
build: showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Generate standalone toolchain
generate-ndk-toolchain: ndk-standalone-toolchain/bin/clang
ndk-standalone-toolchain/bin/clang:
bash generate-standalone-ndk-toolchain.sh
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -43,21 +36,18 @@ PATH := ${PATH}:$(NDK_TOOLCHAIN)/bin:$(LOCAL)/bin
NDK_SYSROOT=$(ANDROID_NDK_HOME)/sysroot
HOST = arm-linux-androideabi
HOST_V7 = armv7a-linux-androideabi
NDK_TOOLCHAIN = $(HOST)-$(NDK_TOOLCHAIN_COMPILER)
# include Android's build flags
TARGET_ARCH_ABI = $(APP_ABI)
include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(EXTERNAL_ROOT)/ndk-standalone-toolchain
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
CC := $(ANDROID_NDK_HOME)/bin/$(HOST_V7)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST_V7)$(ANDROID_API)-clang++
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -131,9 +121,9 @@ libetpan.src.stamp: ../downloads/libetpan.tar.gz
touch $@
libetpan/Makefile: libetpan.src.stamp | libiconv-install
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh
cp -r libetpan/build-android/libetpan-android-1/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-1/include/* $(LOCAL)/include/
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh $(APP_ABI)
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/include/* $(LOCAL)/include/
touch $@
libetpan-build: libetpan/Makefile
@ -300,6 +290,8 @@ nettle/libnettle.so: nettle/Makefile
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
@ -313,7 +305,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -322,6 +318,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -1,21 +0,0 @@
#!/bin/bash
usage="Usage: $(basename "$0") [-h][--force] -- Script to generate android standalone toolchain to build pEp for Android.
where:
-h Show this help text
--force Force generating the toolchain"
if [ "$1" == "-h" ]; then
echo "$usage"
exit 0
fi
if [ -z "$ANDROID_NDK" ]; then
echo "Please define \$ANDROID_NDK"
exit 1
fi
$ANDROID_NDK/build/tools/make_standalone_toolchain.py $1 --arch arm --api 18 --install-dir=ndk-standalone-toolchain
exit 0

@ -15,22 +15,9 @@ include ../Makefile.conf
all: downloads.stamp
downloads.stamp: download-iconv download-uuid download-sequoia-deps download-etpan download-sequoia \
generate-ndk-arm generate-ndk-arm64 generate-ndk-x86 generate-ndk-x86_64
downloads.stamp: download-iconv download-uuid download-sequoia-deps download-etpan download-sequoia
touch $@
generate-ndk-arm64:
cd ../arm64-v8a && bash generate-standalone-ndk-toolchain.sh
generate-ndk-arm:
cd ../armeabi-v7a && bash generate-standalone-ndk-toolchain.sh
generate-ndk-x86:
cd ../x86 && bash generate-standalone-ndk-toolchain.sh
generate-ndk-x86_64:
cd ../x86_64 && bash generate-standalone-ndk-toolchain.sh
download-iconv: libiconv-1.15.tar.gz
download-uuid: ossp-uuid_1.6.2.orig.tar.gz
@ -118,4 +105,4 @@ clean:
.PHONY: all clean download-iconv \
download-uuid download-etpan \
download-sequoia-deps download-sequoia
download-sequoia-deps download-sequoia

@ -1 +0,0 @@
53840c70434793127a3574433494e8d3 openssl-1.1.1h.tar.gz

@ -0,0 +1 @@
c685d239b6a6e1bd78be45624c092f51 openssl-1.1.1q.tar.gz

@ -14,18 +14,10 @@ include ../Makefile.conf
# Build parameters
APP_ABI ?= x86
ANDROID_API ?= 18
all: build
build: generate-ndk-toolchain showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Generate standalone toolchain
generate-ndk-toolchain: ndk-standalone-toolchain/bin/clang
ndk-standalone-toolchain/bin/clang:
bash generate-standalone-ndk-toolchain.sh
build: showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -48,16 +40,11 @@ NDK_TOOLCHAIN = $(APP_ABI)-$(NDK_TOOLCHAIN_COMPILER)
TARGET_ARCH_ABI = $(APP_ABI)
include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(EXTERNAL_ROOT)/ndk-standalone-toolchain
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang++
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -131,9 +118,9 @@ libetpan.src.stamp: ../downloads/libetpan.tar.gz
touch $@
libetpan/Makefile: libetpan.src.stamp | libiconv-install
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh
cp -r libetpan/build-android/libetpan-android-1/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-1/include/* $(LOCAL)/include/
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh $(APP_ABI)
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/include/* $(LOCAL)/include/
touch $@
libetpan-build: libetpan/Makefile
@ -294,15 +281,17 @@ nettle/Makefile: nettle.src.stamp
--host=$(HOST) \
--prefix=$(LOCAL)
nettle/libnettle.so: nettle/Makefile
nettle/libnettle.so nettle/libhogweed.so: nettle/Makefile
$(MAKE) -C nettle
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(LOCAL)/lib/libnettle.so $(LOCAL)/lib/libhogweed.so: nettle/libnettle.so nettle/libhogweed.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
nettle-build: nettle/libnettle.so nettle/libhogweed.so
nettle-install: $(LOCAL)/lib/libnettle.so
nettle-install: $(LOCAL)/lib/libnettle.so $(LOCAL)/lib/libhogweed.so
#------------------------------------------------------------------------------#
@ -313,7 +302,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build/
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -322,6 +315,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/i686-linux-android/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -1,21 +0,0 @@
#!/bin/bash
usage="Usage: $(basename "$0") [-h][--force] -- Script to generate android standalone toolchain to build pEp for Android.
where:
-h Show this help text
--force Force generating the toolchain"
if [ "$1" == "-h" ]; then
echo "$usage"
exit 0
fi
if [ -z "$ANDROID_NDK" ]; then
echo "Please define \$ANDROID_NDK"
exit 1
fi
$ANDROID_NDK/build/tools/make_standalone_toolchain.py $1 --arch x86 --api 18 --install-dir=ndk-standalone-toolchain
exit 0

@ -14,18 +14,10 @@ include ../Makefile.conf
# Build parameters
APP_ABI ?= x86_64
ANDROID_API ?= 21
all: build
build: generate-ndk-toolchain showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Generate standalone toolchain
generate-ndk-toolchain: ndk-standalone-toolchain/bin/clang
ndk-standalone-toolchain/bin/clang:
bash generate-standalone-ndk-toolchain.sh
build:showsetup uuid-install sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -48,16 +40,11 @@ NDK_TOOLCHAIN = $(APP_ABI)-$(NDK_TOOLCHAIN_COMPILER)
TARGET_ARCH_ABI = $(APP_ABI)
include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(EXTERNAL_ROOT)/ndk-standalone-toolchain
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -131,9 +118,9 @@ libetpan.src.stamp: ../downloads/libetpan.tar.gz
touch $@
libetpan/Makefile: libetpan.src.stamp | libiconv-install
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh
cp -r libetpan/build-android/libetpan-android-1/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-1/include/* $(LOCAL)/include/
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh $(APP_ABI)
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/$(APP_ABI)/lib/* $(LOCAL)/lib/
cp -r libetpan/build-android/libetpan-android-$(ANDROID_ETPAN_BUILD_VERSION)/include/* $(LOCAL)/include/
touch $@
libetpan-build: libetpan/Makefile
@ -299,6 +286,8 @@ nettle/libnettle.so: nettle/Makefile
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
@ -313,7 +302,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build/
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -322,6 +315,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/x86_64-linux-android/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -1,21 +0,0 @@
#!/bin/bash
usage="Usage: $(basename "$0") [-h][--force] -- Script to generate android standalone toolchain to build pEp for Android.
where:
-h Show this help text
--force Force generating the toolchain"
if [ "$1" == "-h" ]; then
echo "$usage"
exit 0
fi
if [ -z "$ANDROID_NDK" ]; then
echo "Please define \$ANDROID_NDK"
exit 1
fi
$ANDROID_NDK/build/tools/make_standalone_toolchain.py $1 --arch x86_64 --api 21 --install-dir=ndk-standalone-toolchain
exit 0

@ -31,7 +31,7 @@ public class AndroidHelper {
// TODO : Increment when needed.
// TODO : Check if this version tracking is really needed and Automatize it
public static String ENGINE_VERSION_CODE = "Release_2.1.37";
public static String ENGINE_VERSION_CODE = "Release_2.1.56";
private static File shareDir;

@ -0,0 +1,52 @@
SET current_directory=%~dp0
SET dist_directory=%current_directory:~0,-15%\dist
SET build_directory=%current_directory:~0,-15%\build
SET marker_dir=%build_directory%\marker
SET exceptions_directory=%current_directory:~0,-15%\src\java\foundation\pEp\jniadapter\exceptions
SET java_build_root=%build_directory%\java
SET java_pkg_basename=foundation\pEp\jniadapter
:: Create directories as necessary
MKDIR %marker_dir%
MKDIR %exceptions_directory%
:: Generate Status files
SH ..\utils\gen_status_codes.sh ..\..\pEp\pEpEngine.h
MV passphrase_status_list.yml2 ..\src\codegen\
MV status_list.yml2 ..\src\codegen\
:: Generate YML2 code
PUSHD ..
CD src
CD codegen
PY -m yml2.yml2proc -E utf-8 -y gen_java_Engine.ysl2 pEp.yml2
IF %ERRORLEVEL% NEQ 0 GOTO end
PY -m yml2.yml2proc -E utf-8 -y gen_java_Message.ysl2 pEp.yml2
IF %ERRORLEVEL% NEQ 0 GOTO end
PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Engine.ysl2 pEp.yml2
IF %ERRORLEVEL% NEQ 0 GOTO end
PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Message.ysl2 pEp.yml2
IF %ERRORLEVEL% NEQ 0 GOTO end
PY -m yml2.yml2proc -E utf-8 -y gen_throw_pEp_exception.ysl2 pEp.yml2
IF %ERRORLEVEL% NEQ 0 GOTO end
:: Compile the Java part
CD ..
CD java
"%JAVA_HOME%\bin\javac" -encoding UTF-8 -d "%java_build_root%" -h ..\cxx %java_pkg_basename%\*.java
IF %ERRORLEVEL% NEQ 0 GOTO end
"%JAVA_HOME%\bin\javac" -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\*.java
IF %ERRORLEVEL% NEQ 0 GOTO end
"%JAVA_HOME%\bin\javac" -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\exceptions\*.java
IF %ERRORLEVEL% NEQ 0 GOTO end
"%JAVA_HOME%\bin\javac" -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\interfaces\*.java
IF %ERRORLEVEL% NEQ 0 GOTO end
"%JAVA_HOME%\bin\jar" -cvf "%java_build_root%\pEp.jar" -C "%java_build_root%" foundation
IF %ERRORLEVEL% NEQ 0 GOTO end
:end
POPD
EXIT /B %ERRORLEVEL%

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\cxx\basic_api.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Engine.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Message.cc" />
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter__Blob.cc" />
<ClCompile Include="..\src\cxx\get_header.cc" />
<ClCompile Include="..\src\cxx\identity_api.cc" />
<ClCompile Include="..\src\cxx\jniutils.cc" />
<ClCompile Include="..\src\cxx\throw_pEp_exception.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Engine.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Identity.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Message.h" />
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter__Blob.h" />
<ClInclude Include="..\src\cxx\jniutils.hh" />
<ClInclude Include="..\src\cxx\passphrase_callback.hh" />
<ClInclude Include="..\src\cxx\passphrase_callback.hxx" />
<ClInclude Include="..\src\cxx\throw_pEp_exception.hh" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\libpEpAdapter\build-windows\libpEpAdapter.vcxproj">
<Project>{ec44fec9-2f3a-4a0c-b60e-0f22aa43ef58}</Project>
</ProjectReference>
<ProjectReference Include="..\..\pEpEngine\build-windows\pEpEngine.vcxproj">
<Project>{146e69f8-e1da-456a-b048-6dd29d9acf6b}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2a1167be-f438-4e08-b32e-25f130d97c33}</ProjectGuid>
<RootNamespace>pEpJNIAdapter</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LibraryPath>$(ProjectDir)..\..\pEpForWindowsAdapterSolution\Debug\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>__LP64__;WIN32;_DEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>%JAVA_HOME%\include\win32;%JAVA_HOME%\include;$(ProjectDir)..\..\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>IF NOT EXIST "..\build" CALL generate_code.cmd</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>CP "..\build\java\pEp.jar" "$(SolutionDir)\$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>__LP64__;WIN32;NDEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>%JAVA_HOME%\include\win32;%JAVA_HOME%\include;$(ProjectDir)..\..\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>IF NOT EXIST "..\build" CALL generate_code.cmd</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command>CP "..\build\java\pEp.jar" "$(SolutionDir)\$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="CustomClean" BeforeTargets="Clean">
<RemoveDir Directories="..\build" />
</Target>
</Project>

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\cxx\basic_api.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter__Blob.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Engine.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\foundation_pEp_jniadapter_Message.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\get_header.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\identity_api.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\jniutils.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cxx\throw_pEp_exception.cc">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cxx\jniutils.hh">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\passphrase_callback.hh">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\passphrase_callback.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\throw_pEp_exception.hh">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter__Blob.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_AbstractEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Engine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Identity.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cxx\foundation_pEp_jniadapter_Message.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -20,7 +20,7 @@ RUN git clone --depth=1 \
WORKDIR ${BUILDROOT}/libpEpAdapter
### Build libpEpAdapter
RUN sh ./scripts/${CURRENT_DISTRO}/build_libpEpAdapter.sh && \
RUN sh ./scripts/common/build_libpEpAdapter.sh && \
rm -rf ${BUILDROOT}/*

@ -20,7 +20,7 @@ RUN git clone --depth=1 \
WORKDIR ${BUILDROOT}/libpEpAdapter
### Build libpEpAdapter
RUN sh ./scripts/${CURRENT_DISTRO}/build_libpEpAdapter.sh && \
RUN sh ./scripts/common/build_libpEpAdapter.sh && \
rm -rf ${BUILDROOT}/*
### Install system dependencies

@ -70,6 +70,7 @@ namespace pEp {
enumitem sync_notify_accepted_device_added > 6
enumitem sync_notify_accepted_group_created > 7
enumitem sync_notify_accepted_device_accepted > 8
enumitem sync_notify_outgoing_rating_change > 64
enumitem sync_passphrase_required > 128
enumitem sync_notify_sole > 254
enumitem sync_notify_in_group > 255
@ -189,7 +190,7 @@ namespace pEp {
in string fpr2,
in string lang,
returns sstring words,
in bool full
in bool full
);
method cached=true get_message_trustwords(
@ -253,6 +254,8 @@ namespace pEp {
in string fpr
);
method cached=true sync_reinit();
// "basic" methods are generated on the java side, but
// on the C++ side, manually implemented in basic_api.cc
@ -273,6 +276,8 @@ namespace pEp {
basic void config_passphrase(string passphrase);
basic void config_passphrase_for_new_keys(bool enable, string passphrase);
basic bytearray export_key(string fpr);
basic void config_enable_echo_protocol(bool enable);
basic void config_enable_echo_in_outgoing_message_rating_preview(bool enable);
};
struct message {

@ -457,5 +457,33 @@ JNIEXPORT jbyteArray JNICALL Java_foundation_pEp_jniadapter_Engine__1export_1key
return from_string(env, buff);
}
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1enable_1echo_1protocol(JNIEnv *env,
jobject obj,
jboolean enable)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
::config_enable_echo_protocol(session(),static_cast<bool>(enable));
}
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1enable_1echo_1in_1outgoing_1message_1rating_1preview(JNIEnv *env,
jobject obj,
jboolean enable)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
::config_enable_echo_in_outgoing_message_rating_preview(session(),static_cast<bool>(enable));
}
} // extern "C"

@ -2,6 +2,7 @@
#include <pEp/keymanagement.h>
#include <pEp/message_api.h>
#include <pEp/sync_api.h>
#include <pEp/media_key.h>
#include <pEp/pEpLog.hh>
#include <pEp/passphrase_cache.hh>
#include <pEp/callback_dispatcher.hh>
@ -358,6 +359,26 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_AbstractEngine__1stopSync(
Adapter::stop_sync();
}
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_AbstractEngine__1config_1media_1keys(JNIEnv *env,
jobject obj,
jobject value)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
PEP_STATUS status = ::config_media_keys(Adapter::session(),to_stringpairlist(env, value));
if (status) {
throw_pEp_Exception(env, status);
}
}
JNIEXPORT jboolean JNICALL Java_foundation_pEp_jniadapter_AbstractEngine__1isSyncRunning(JNIEnv *env,
jobject obj)
{

@ -3,6 +3,17 @@
#include <cassert>
#include <cstring>
#ifdef ANDROID
#ifndef __LP64__
#include <time64.h>
#define time_t time64_t
#define timegm timegm64
#define gmtime_r gmtime64_r
#endif
#endif
namespace pEp {
namespace JNIAdapter {
@ -237,7 +248,6 @@ jbyteArray from_string(JNIEnv *env,
const char *str)
{
if (str && str[0]) {
jboolean isCopy;
size_t l = strlen(str);
jbyteArray _str = env->NewByteArray(l);
env->SetByteArrayRegion(_str, 0, l, (jbyte *) str);
@ -433,7 +443,7 @@ timestamp *to_timestamp(JNIEnv *env,
if (t) {
time_t clock = t / 1000;
gmtime_r(&clock, ts);
gmtime_r(&clock, (struct tm*)ts);
//LOGD("/* Seconds (0-60) */ TO :%d", ts->tm_sec);
//LOGD("/* Minutes (0-59) */ :%d", ts->tm_min);

@ -10,6 +10,7 @@
#include <pEp/message.h>
#include <pEp/sync_api.h>
#include <pEp/passphrase_cache.hh>
#include <pEp/platform.h>
#if 0 // Enable if log needed
#include <android/log.h>

@ -77,6 +77,19 @@ abstract class AbstractEngine extends UniquelyIdentifiable implements AbstractEn
private native void _stopSync();
public void config_media_keys(ArrayList<Pair<String, String>> value) {
if (value != null) {
ArrayList<Pair<byte[], byte[]>> list = new ArrayList<Pair<byte[], byte[]>>();
for (Pair<String, String> i : value) {
list.add(new Pair<byte[],byte[]>(Utils.toUTF8(i.first), Utils.toUTF8(i.second)));
}
_config_media_keys(list);
} else {
_config_media_keys(null);
}
}
private native void _config_media_keys(ArrayList<Pair<byte[], byte[]>> value);
public boolean isSyncRunning() {
return _isSyncRunning();

@ -23,6 +23,7 @@ OS="$(uname -s)"
case "${OS}" in
Linux*) SED=sed;;
Darwin*) SED=gsed;;
MSYS*) SED=sed;;
CYGWIN*) echo "UNSUPORTED YET" && exit;;
MINGW*) echo "UNSUPORTED YET" && exit;;
*) echo "UNKNOWN:${OS}" && exit;;

@ -42,7 +42,7 @@ def main():
host_tag = get_host_tag_or_die()
toolchain_path = get_toolchain_path_or_die(args.ndk, host_tag)
print toolchain_path
print(toolchain_path)
if __name__ == '__main__':
main()

Loading…
Cancel
Save