Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Changed ndk-r16b to ndk-r19c #83

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ that may be need for your applications.

* `libindy.a` - This is a static library, which is compiled with NDK.

[How to use instructions.](https://github.com/hyperledger/indy-sdk/blob/master/docs/android-build.md#usage)
[How to use instructions.](https://github.com/hyperledger/indy-sdk/blob/master/docs/android-build.md#usage)

{release channel} must be replaced with rc or stable to define corresponded release channel.
See section "Release channels" for more details.
Expand All @@ -188,7 +188,7 @@ See section "Release channels" for more details.

- [WARNING] This library should be considered as experimental as currently unit tests are *not* executed in the CI phase.

- We are using the [NDK16b](https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip) because it is the last NDK to have support for `gnustl_shared` stl.
- We are using the [NDK16b](https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip) because it is the last NDK to have support for `gnustl_shared` stl.
gnustl_shared is deprecated in latest NDK. gnustal_shared is needed because the dependencies are compiled using gnustal_shared and you will get build errors if more than one type of stl while compiling.


Expand Down
15 changes: 8 additions & 7 deletions vcx/ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def testing() {

stage('Testing') {
parallel([
'Xenial' : { mainUbuntu() },
//'Xenial' : { mainUbuntu() },
'Android': { android() },
'iOS' : { ios() }
//'iOS' : { ios() }
])
}
} else {
Expand Down Expand Up @@ -262,8 +262,8 @@ def android() {

stage('Android Build') {
parallel([
"x86" : { buildAndroid("x86") },
"x86_64" : { buildAndroid("x86_64") },
//"x86" : { buildAndroid("x86") },
//"x86_64" : { buildAndroid("x86_64") },
"arm" : { buildAndroid("arm") },
"arm64" : { buildAndroid("arm64") },
"armv7" : { buildAndroid("armv7") }
Expand All @@ -283,10 +283,10 @@ def android() {
packageAndroid(android)
}
stage('Android Publishing') {
if (env.BRANCH_NAME == "master") {
//if (env.BRANCH_NAME == "master") {
//Publish package on aptly
publishAndroid(android)
}
//}
}
} catch (Exception ex) {
currentBuild.result = "FAILED"
Expand Down Expand Up @@ -397,7 +397,8 @@ def buildAndroid(arch) {
}

def packageAndroid(android) {
all_archs = ["arm", "arm64", "armv7", "x86", "x86_64"]
//all_archs = ["arm", "arm64", "armv7", "x86", "x86_64"]
all_archs = ["arm", "arm64", "armv7"]
for (arch in all_archs) {
dir("runtime_android_build/libvcx_${arch}") {
unstash name: "libvcx_${arch}"
Expand Down
18 changes: 9 additions & 9 deletions vcx/ci/scripts/androidBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ retrieve_prebuilt_binaries() {
ANDROID_BUILD_FOLDER=${PWD}
pushd ${ANDROID_BUILD_FOLDER}
echo -e "${GREEN}Downloading openssl for $1 ${RESET}"
curl -sSLO https://repo.sovrin.org/android/libindy/deps/openssl/openssl_$1.zip
unzip -o -qq openssl_$1.zip
export OPENSSL_DIR=${ANDROID_BUILD_FOLDER}/openssl_$1
curl -sSLO https://repo.corp.evernym.com/filely/android/openssl-1.1.1a_$1.zip
unzip -o -qq openssl-1.1.1a_$1.zip
export OPENSSL_DIR=${ANDROID_BUILD_FOLDER}/openssl-1.1.1a_$1
echo -e "${GREEN}Done!${RESET}"

echo -e "${GREEN}Downloading sodium for $1 ${RESET}"
curl -sSLO https://repo.sovrin.org/android/libindy/deps/sodium/libsodium_$1.zip
curl -sSLO https://repo.corp.evernym.com/filely/android/libsodium_$1.zip
unzip -o -qq libsodium_$1.zip
export SODIUM_DIR=${ANDROID_BUILD_FOLDER}/libsodium_$1
echo -e "${GREEN}Done!${RESET}"

echo -e "${GREEN}Downloading zmq for $1 ${RESET}"
curl -sSLO https://repo.sovrin.org/android/libindy/deps/zmq/libzmq_$1.zip
curl -sSLO https://repo.corp.evernym.com/filely/android/libzmq_$1.zip
unzip -o -qq libzmq_$1.zip
export LIBZMQ_DIR=${ANDROID_BUILD_FOLDER}/libzmq_$1
echo -e "${GREEN}Done!${RESET}"

rm openssl_$1.zip
rm openssl-1.1.1a_$1.zip
rm libsodium_$1.zip
rm libzmq_$1.zip
popd
Expand All @@ -70,19 +70,19 @@ generate_flags(){
if [ $1 == "arm" ]; then
export ARCH="arm"
export TRIPLET="arm-linux-androideabi"
export PLATFORM="16"
export PLATFORM="21"
elif [ $1 == "arm64" ]; then
export ARCH="arm64"
export TRIPLET="aarch64-linux-android"
export PLATFORM="21"
elif [ $1 == "armv7" ]; then
export ARCH="armv7"
export TRIPLET="armv7-linux-androideabi"
export PLATFORM="16"
export PLATFORM="21"
elif [ $1 == "x86" ]; then
export ARCH="x86"
export TRIPLET="i686-linux-android"
export PLATFORM="16"
export PLATFORM="21"
elif [ $1 == "x86_64" ]; then
export ARCH="x86_64"
export TRIPLET="x86_64-linux-android"
Expand Down
3 changes: 2 additions & 1 deletion vcx/ci/scripts/androidPackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set -e
ANDROID_JNI_LIB=vcx/wrappers/java/android/src/main/jniLibs

for arch in arm arm64 armv7 x86 x86_64
#for arch in arm arm64 armv7 x86 x86_64
for arch in arm arm64 armv7
do
arch_folder=${arch}
if [ "${arch}" = "armv7" ]; then
Expand Down
1 change: 1 addition & 0 deletions vcx/libvcx/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ fn main() {
println!("cargo:rustc-link-search=native={}",libindy_lib_path);
println!("cargo:rustc-link-lib=static=indy");
}else if target.contains("aarch64-linux-android") || target.contains("armv7-linux-androideabi") ||
target.contains("armv7a-linux-androideabi") ||
target.contains("arm-linux-androideabi") || target.contains("i686-linux-android") ||
target.contains("x86_64-linux-android") || target.contains("aarch64-apple-ios") ||
target.contains("armv7-apple-ios") || target.contains("armv7s-apple-ios") ||
Expand Down
6 changes: 3 additions & 3 deletions vcx/libvcx/build_scripts/android/indy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ENV SODIUM_LIB_DIR /home/indy_user/${sodium_dir}/lib
ENV SODIUM_INCLUDE_DIR /home/indy_user/${sodium_dir}/include
ENV LIBZMQ_LIB_DIR /home/indy_user/${libzmq_dir}/lib
ENV LIBZMQ_INCLUDE_DIR /home/indy_user/${libzmq_dir}/include
ENV ANDROID_NDK_ROOT /home/indy_user/android-ndk-r16b
ENV ANDROID_NDK_ROOT /home/indy_user/android-ndk-r19c
ENV TOOLCHAIN_DIR /home/indy_user/${target_arch}
ENV PATH ${TOOLCHAIN_DIR}/bin:${PATH}
ENV PKG_CONFIG_ALLOW_CROSS=1
Expand All @@ -37,8 +37,8 @@ RUN chmod 0440 /etc/sudoers.d/indy_user
USER indy_user
WORKDIR /home/indy_user

COPY android-ndk-r16b-linux-x86_64.zip /home/indy_user/
RUN unzip -qq /home/indy_user/android-ndk-r16b-linux-x86_64.zip -d /home/indy_user/
COPY android-ndk-r19c-linux-x86_64.zip /home/indy_user/
RUN unzip -qq /home/indy_user/android-ndk-r19c-linux-x86_64.zip -d /home/indy_user/
COPY --chown=indy_user:indy_user indy-sdk/ /home/indy_user/indy-sdk/
COPY --chown=indy_user:indy_user ${openssl_dir}/ ${OPENSSL_DIR}/
COPY --chown=indy_user:indy_user ${sodium_dir}/ /home/indy_user/${sodium_dir}/
Expand Down
18 changes: 9 additions & 9 deletions vcx/libvcx/build_scripts/android/indy/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ GIT_INSTALL=${4:-master}
if [ -z "${TARGET_ARCH}" ]; then
echo STDERR "Missing TARGET_ARCH argument"
echo STDERR "e.g. x86 or arm"
exit 1
exit 1
fi

if [ -z "${TARGET_API}" ]; then
echo STDERR "Missing TARGET_API argument"
echo STDERR "e.g. 21"
exit 1
exit 1
fi

if [ -z "${CROSS_COMPILE}" ]; then
echo STDERR "Missing CROSS_COMPILE argument"
echo STDERR "e.g. i686-linux-android"
exit 1
exit 1
fi

if [ -z "${GIT_INSTALL}" ] ; then
Expand Down Expand Up @@ -62,11 +62,11 @@ if [ -z "${SODIUM_DIR}" ]; then
exit 1
else
SODIUM_DIR=$6
fi
fi
fi

if [ -z "${LIBZMQ_DIR}" ] ; then
LIBZMQ_DIR="libzmq_${TARGET_ARCH}"
LIBZMQ_DIR="libzmq_${TARGET_ARCH}"
if [ -d "${LIBZMQ_DIR}" ] ; then
echo "Found ${LIBZMQ_DIR}"
elif [ -z "$7" ] ; then
Expand All @@ -78,11 +78,11 @@ if [ -z "${LIBZMQ_DIR}" ] ; then
fi
fi

if [ ! -f "android-ndk-r16b-linux-x86_64.zip" ] ; then
echo "Downloading android-ndk-r16b-linux-x86_64.zip"
wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
if [ ! -f "android-ndk-r19c-linux-x86_64.zip" ] ; then
echo "Downloading android-ndk-r19c-linux-x86_64.zip"
wget -q https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip
else
echo "Skipping download android-ndk-r16b-linux-x86_64.zip"
echo "Skipping download android-ndk-r19c-linux-x86_64.zip"
fi

_INDY_SDK_REPO="https://github.com/hyperledger/indy-sdk.git"
Expand Down
6 changes: 3 additions & 3 deletions vcx/libvcx/build_scripts/android/libsodium/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG cross_compile
ENV TARGET_ARCH ${target_arch}
ENV TARGET_API ${target_api}
ENV CROSS_COMPILE ${cross_compile}
ENV ANDROID_NDK_ROOT /home/sodium_user/android-ndk-r16b
ENV ANDROID_NDK_ROOT /home/sodium_user/android-ndk-r19c
ENV TOOLCHAIN_DIR /home/sodium_user/${target_arch}
ENV PATH ${TOOLCHAIN_DIR}/bin:${PATH}
ENV CC ${TOOLCHAIN_DIR}/bin/${cross_compile}-clang
Expand All @@ -27,9 +27,9 @@ RUN usermod -aG sudo sodium_user
USER sodium_user
WORKDIR /home/sodium_user

COPY android-ndk-r16b-linux-x86_64.zip /home/sodium_user/
COPY android-ndk-r19c-linux-x86_64.zip /home/sodium_user/
COPY libsodium-1.0.12.tar.gz /home/sodium_user/
RUN unzip -qq /home/sodium_user/android-ndk-r16b-linux-x86_64.zip -d /home/sodium_user/
RUN unzip -qq /home/sodium_user/android-ndk-r19c-linux-x86_64.zip -d /home/sodium_user/
RUN tar xf /home/sodium_user/libsodium-1.0.12.tar.gz -C /home/sodium_user/
RUN python3 ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch ${target_arch} --api ${target_api} --install-dir ${TOOLCHAIN_DIR}

Expand Down
14 changes: 7 additions & 7 deletions vcx/libvcx/build_scripts/android/libsodium/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ CROSS_COMPILE=$3
if [ -z "${TARGET_ARCH}" ]; then
echo STDERR "Missing TARGET_ARCH argument"
echo STDERR "e.g. x86 or arm"
exit 1
exit 1
fi

if [ -z "${TARGET_API}" ]; then
echo STDERR "Missing TARGET_API argument"
echo STDERR "e.g. 21"
exit 1
exit 1
fi

if [ -z "${CROSS_COMPILE}" ]; then
echo STDERR "Missing CROSS_COMPILE argument"
echo STDERR "e.g. i686-linux-android"
exit 1
exit 1
fi

if [ ! -f "android-ndk-r16b-linux-x86_64.zip" ] ; then
echo "Downloading android-ndk-r16b-linux-x86_64.zip"
wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
if [ ! -f "android-ndk-r19c-linux-x86_64.zip" ] ; then
echo "Downloading android-ndk-r19c-linux-x86_64.zip"
wget -q https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip
else
echo "Skipping download android-ndk-r16b-linux-x86_64.zip"
echo "Skipping download android-ndk-r19c-linux-x86_64.zip"
fi

if [ ! -f "libsodium-1.0.12.tar.gz" ] ; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ar = "$NDK_DIR/arm64/bin/aarch64-linux-android-ar"
linker = "$NDK_DIR/arm64/bin/aarch64-linux-android-clang"

[target.armv7-linux-androideabi]
[target.armv7a-linux-androideabi]
ar = "$NDK_DIR/arm/bin/arm-linux-androideabi-ar"
linker = "$NDK_DIR/arm/bin/arm-linux-androideabi-clang"

Expand Down
24 changes: 12 additions & 12 deletions vcx/libvcx/build_scripts/android/mac/mac.libzmq.libsodium.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ WORK_DIR=$(abspath "$WORK_DIR")
NDK_DIR=$WORK_DIR/NDK

declare -a archs=(
"arm" "arm" "16" "arm-linux-androideabi"
"arm" "armv7" "16" "arm-linux-androideabi"
"arm64" "arm64" "21" "aarch64-linux-android"
"x86" "x86" "16" "i686-linux-android"
"x86_64" "x86_64" "21" "x86_64-linux-android"
"arm" "arm" "23" "arm-linux-androideabi"
"arm" "armv7" "23" "armv7a-linux-androideabi"
"arm64" "arm64" "23" "aarch64-linux-android"
"x86" "x86" "23" "i686-linux-android"
"x86_64" "x86_64" "23" "x86_64-linux-android"
)
archslen=${#archs[@]}

Expand All @@ -25,15 +25,15 @@ mkdir -p $WORK_DIR/libzmq-android/zmq

cd $WORK_DIR/libzmq-android/libsodium

if [ ! -f "libsodium-1.0.12.tar.gz" ] ; then
echo "Downloading libsodium-1.0.12.tar.gz"
wget -q wget https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz
if [ ! -f "libsodium-1.0.17.tar.gz" ] ; then
echo "Downloading libsodium-1.0.17.tar.gz"
wget -q wget https://github.com/jedisct1/libsodium/releases/download/1.0.17/libsodium-1.0.17.tar.gz
else
echo "Skipping download libsodium-1.0.12.tar.gz"
echo "Skipping download libsodium-1.0.17.tar.gz"
fi

if [ ! -d "$WORK_DIR/libzmq-android/libsodium/libsodium-1.0.12" ]; then
tar zxf ./libsodium-1.0.12.tar.gz
if [ ! -d "$WORK_DIR/libzmq-android/libsodium/libsodium-1.0.17" ]; then
tar zxf ./libsodium-1.0.17.tar.gz
fi

for (( arch=0; arch<${archslen}; arch=arch+4 ));
Expand All @@ -56,7 +56,7 @@ do
#cd /home/sodium_user
#echo "Building Android NDK for architecture ${target_arch}"
#python3 ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch ${ndk_arch} --api ${target_api} --install-dir ${TOOLCHAIN_DIR}
cd $WORK_DIR/libzmq-android/libsodium/libsodium-1.0.12
cd $WORK_DIR/libzmq-android/libsodium/libsodium-1.0.17
make clean
./autogen.sh
./configure --prefix=$WORK_DIR/libzmq-android/libsodium/libsodium_${TARGET_ARCH} --disable-soname-versions --host=${CROSS_COMPILE}
Expand Down
6 changes: 3 additions & 3 deletions vcx/libvcx/build_scripts/android/openssl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG cross_compile
ENV TARGET_ARCH ${target_arch}
ENV TARGET_API ${target_api}
ENV CROSS_COMPILE ${cross_compile}
ENV ANDROID_NDK_ROOT /home/openssl_user/android-ndk-r16b
ENV ANDROID_NDK_ROOT /home/openssl_user/android-ndk-r19c
ENV TOOLCHAIN_DIR /home/openssl_user/${target_arch}

RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update -y && apt-get -qq install -y zip unzip autoconf cmake wget python3 2>&1 > /dev/null
Expand All @@ -19,9 +19,9 @@ RUN chmod 0440 /etc/sudoers.d/openssl_user
USER openssl_user
WORKDIR /home/openssl_user
COPY make_openssl.sh /home/openssl_user/
COPY android-ndk-r16b-linux-x86_64.zip /home/openssl_user/
COPY android-ndk-r19c-linux-x86_64.zip /home/openssl_user/
COPY openssl-1.1.0h.tar.gz /home/openssl_user/
RUN unzip -qq /home/openssl_user/android-ndk-r16b-linux-x86_64.zip -d /home/openssl_user/
RUN unzip -qq /home/openssl_user/android-ndk-r19c-linux-x86_64.zip -d /home/openssl_user/
RUN tar xf /home/openssl_user/openssl-1.1.0h.tar.gz -C /home/openssl_user/
RUN python3 ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch ${TARGET_ARCH} --api ${TARGET_API} --install-dir ${TOOLCHAIN_DIR}
RUN bash make_openssl.sh
16 changes: 8 additions & 8 deletions vcx/libvcx/build_scripts/android/openssl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ CROSS_COMPILE=$3
if [ -z "${TARGET_ARCH}" ]; then
echo STDERR "Missing TARGET_ARCH argument"
echo STDERR "e.g. x86 or arm"
exit 1
exit 1
fi

if [ -z "${TARGET_API}" ]; then
echo STDERR "Missing TARGET_API argument"
echo STDERR "e.g. 21"
exit 1
exit 1
fi

if [ -z "${CROSS_COMPILE}" ]; then
echo STDERR "Missing CROSS_COMPILE argument"
echo STDERR "e.g. i686-linux-android"
exit 1
exit 1
fi

if [ ! -f "android-ndk-r16b-linux-x86_64.zip" ] ; then
echo "Downloading android-ndk-r16b-linux-x86_64.zip"
wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
if [ ! -f "android-ndk-r19c-linux-x86_64.zip" ] ; then
echo "Downloading android-ndk-r19c-linux-x86_64.zip"
wget -q https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip
else
echo "Skipping download android-ndk-r16b-linux-x86_64.zip"
echo "Skipping download android-ndk-r19c-linux-x86_64.zip"
fi

if [ ! -f "openssl-1.1.0h.tar.gz" ] ; then
Expand All @@ -36,7 +36,7 @@ else
echo "Skipping download openssl-1.1.0h.tar.gz"
fi

docker build -t openssl-android:latest . --build-arg target_arch=${TARGET_ARCH} --build-arg target_api=${TARGET_API} --build-arg cross_compile=${CROSS_COMPILE} && \
docker build -t openssl-android:latest . --build-arg target_arch=${TARGET_ARCH} --build-arg target_api=${TARGET_API} --build-arg cross_compile=${CROSS_COMPILE} && \
docker run openssl-android:latest && \
docker_id=$(docker ps -a | grep openssl-android:latest | grep Exited | tail -n 1 | cut -d ' ' -f 1) && \
docker_image_id=$(docker image ls | grep openssl-android | perl -pe 's/\s+/ /g' | cut -d ' ' -f 3) && \
Expand Down
Loading