diff --git a/android/external/Makefile b/android/external/Makefile index b4691a9..f80bd18 100644 --- a/android/external/Makefile +++ b/android/external/Makefile @@ -25,6 +25,9 @@ build: all all: build-arm build-arm64 build-x86 build-x86_64 +build-common: downloads/downloads.stamp + $(MAKE) -C common + build-arm: downloads/downloads.stamp $(MAKE) -C armeabi-v7a diff --git a/android/external/Makefile.conf b/android/external/Makefile.conf index 45aae11..b8656eb 100644 --- a/android/external/Makefile.conf +++ b/android/external/Makefile.conf @@ -4,6 +4,8 @@ NDK_TOOLCHAIN_COMPILER ?= clang ANDROID_API ?= 21 +### Boost for android conf +NCPU ?= 1 ### Select GNU SED on MacOS. NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]') @@ -16,14 +18,17 @@ else TOOLCHAIN_ARCH=linux-x86_64 endif -### Sequoia deps versions + +### Deps versions OPENSSL_VERSION=1.1.1h GMP_VERSION=6.2.1 NETTLE_VERSION=3.7.3 +BOOST_VERSION=1.74.0 ### Git deps repos 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 ### Common variables #### Source code targets diff --git a/android/external/common/Makefile b/android/external/common/Makefile new file mode 100644 index 0000000..ad3637b --- /dev/null +++ b/android/external/common/Makefile @@ -0,0 +1,58 @@ +# Copyright 2022, pEp Foundation +# This file is part of pEpJNIAdapter for Android - MultiArch build +# This file may be used under the terms of the GNU General Public License version 3 +# see LICENSE.txt + +include ../Makefile.conf + +all: build + +build: showsetup boost-install + +#------------------------------------------------------------------------------# +# Manage paths for PREFIX, DESTDIR, LOCAL and PATH + +EXTERNAL_ROOT := $(shell pwd) + +# install root for built files +DESTDIR = $(EXTERNAL_ROOT)/.. +LOCAL := $(DESTDIR)/output + +# debugging stuff + +showsetup: + @echo "ANDROID_NDK: $(ANDROID_NDK)" + @echo "PREFIX: $(LOCAL)" + @echo "BOOST_VERSION: $(BOOST_VERSION)" + @echo "NCPU: $(NCPU)" + +#------------------------------------------------------------------------------# +# boost +boost.src.stamp:../downloads/boost-for-android.tar.gz + mkdir -p boost + cd boost && tar xvf ../$< + touch $@ + + +boost.stamp: boost.src.stamp + cd boost; NCPU=$(NCPU) bash ./build-android.sh $(ANDROID_NDK) \ + --boost=$(BOOST_VERSION) \ + --layout=system \ + --with-libraries=regex,iostreams,system \ + --prefix=$(LOCAL) + touch $@ + +boost-install: boost.stamp + +boost-clean: + rm -rf boost.stamp + +clean-all: clean + rm -rf boost* + rm -rf *.git + rm -rf *.stamp +#------------------------------------------------------------------------------# + +clean: boost-clean + +.PHONY = clean clean-all boost-clean boost-install showsetup diff --git a/android/external/downloads/Makefile b/android/external/downloads/Makefile index bc8bdd1..d15cbab 100644 --- a/android/external/downloads/Makefile +++ b/android/external/downloads/Makefile @@ -13,10 +13,7 @@ include ../Makefile.conf #------------------------------------------------------------------------------# # Build parameters -all: downloads.stamp - -downloads.stamp: download-iconv download-uuid download-sequoia-deps download-etpan download-sequoia - touch $@ +all: download-iconv download-uuid download-sequoia-deps download-etpan download-sequoia download-boost download-iconv: libiconv-1.15.tar.gz @@ -25,9 +22,11 @@ download-uuid: ossp-uuid_1.6.2.orig.tar.gz download-sequoia-deps: openssl-$(OPENSSL_VERSION).tar.gz gmp-$(GMP_VERSION).tar.bz2 \ nettle-$(NETTLE_VERSION).tar.gz -download-etpan: libetpan.git.stamp +download-etpan: libetpan.tar.gz + +download-sequoia: sequoia.tar.gz -download-sequoia: sequoia.git.stamp +download-boost: boost-for-android.tar.gz # Download source and patch it libiconv-1.15.tar.gz: @@ -56,22 +55,20 @@ nettle-$(NETTLE_VERSION).tar.gz: # selected commit is archived in external/$project define per_repo_targets -$(1).git.stamp: +$(1).tar.gz: git clone $(2) $(1).git (cd $(1).git; git archive --format=tar $(3)) > $(1).tar.gz - touch $(1).git.stamp -$(1).git_update: $(1).git.stamp +$(1).git_update: $(1).tar.gz cd $(1).git; git pull rm -rf $(1).tar.gz (cd $(1).git; git archive --format=tar $(3)) > $(1).tar.gz - touch $(1).git.stamp $(1)-clean: rm -rf $(1) rm -f $(1).src.stamp -EXTERNAL_LOCAL_GITS += $(1).git.stamp +EXTERNAL_LOCAL_GITS += $(1).tar.gz EXTERNAL_LOCAL_GITS_UPDATE += $(1).git_update EXTERNAL_SRCS += $(1)-src EXTERNAL_SRCS_CLEAN += $(1)-clean