Skip to content

Commit

Permalink
Add android x86_64 and increas NDK 18b (#332)
Browse files Browse the repository at this point in the history
IB-6207

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored and kristelmerilain committed Jan 8, 2020
1 parent 52cfa9b commit db05c10
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ matrix:
env: TARGET=androidarm64
- os: osx
env: TARGET=androidx86
- os: osx
env: TARGET=androidx86_64
sudo: required
dist: bionic
osx_image: xcode11.2
osx_image: xcode11.3
services:
- docker
cache: ccache
Expand Down
10 changes: 8 additions & 2 deletions build-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if [ "$#" -eq 0 ]; then
echo "Usage:"
echo " $0 target [maketask]"
echo " target: osx ios iossimulator androidarm androidarm64 androidx86"
echo " target: osx ios iossimulator androidarm androidarm64 androidx86 androidx86_64"
echo "To control iOS, macOS builds set environment variables:"
echo " minimum deployment target"
echo " - MACOSX_DEPLOYMENT_TARGET=10.11"
Expand All @@ -17,6 +17,10 @@ fi
case "$@" in
*android*)
case "$@" in
*x86_64*)
TARGET=androidx86_64
ARCH="x86_64"
;;
*x86*)
TARGET=androidx86
ARCH="x86"
Expand All @@ -33,6 +37,7 @@ case "$@" in
TARGET_PATH=/Library/libdigidocpp.${TARGET}
CMAKEARGS="
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${TARGET_PATH} \
-DCMAKE_ANDROID_ARCH_ABI=${ARCH} \
-DCMAKE_C_FLAGS='-DIOAPI_NO_64' \
Expand Down Expand Up @@ -81,7 +86,7 @@ case "$@" in
export MACOSX_DEPLOYMENT_TARGET
esac

sudo rm -rf ${TARGET}
rm -rf ${TARGET}
mkdir -p ${TARGET}
cd ${TARGET}
cmake \
Expand All @@ -91,5 +96,6 @@ cmake \
-DXercesC_ROOT=${TARGET_PATH} \
${CMAKEARGS} \
..
make
sudo make ${@:2}
cd ..
7 changes: 6 additions & 1 deletion examples/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ task copyLibs {
}.files
into 'src/main/jniLibs/arm64-v8a'
}

copy {
from fileTree('/Library/libdigidocpp.androidx86') {
include 'lib/libdigidoc_java.so', 'i686-linux-android/lib/libc++_shared.so'
}.files
into 'src/main/jniLibs/x86'
}
copy {
from fileTree('/Library/libdigidocpp.androidx86_64') {
include 'lib/libdigidoc_java.so', 'x86_64-linux-android/lib64/libc++_shared.so'
}.files
into 'src/main/jniLibs/x86_64'
}
}
2 changes: 1 addition & 1 deletion examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:3.5.3'
}
}

Expand Down
38 changes: 22 additions & 16 deletions prepare_osx_build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ XMLSEC_DIR=xml-security-c-2.0.2
XSD=xsd-4.0.0-i686-macosx
OPENSSL_DIR=openssl-1.1.1d
LIBXML2_DIR=libxml2-2.9.9
ANDROID_NDK=android-ndk-r17c
ANDROID_NDK=android-ndk-r18b
FREETYPE_DIR=freetype-2.9.1
FONTCONFIG_DIR=fontconfig-2.13.1
PODOFO_DIR=podofo-0.9.4
Expand All @@ -15,6 +15,11 @@ ARGS="$@"
case "$@" in
*android*)
case "$@" in
*x86_64*)
ARCH=x86_64
ARCH_ABI="x86_64"
CROSS_COMPILE=x86_64-linux-android
;;
*x86*)
ARCH=x86
ARCH_ABI="x86"
Expand Down Expand Up @@ -42,7 +47,7 @@ case "$@" in
export CFLAGS="-Oz"
export CXXFLAGS="${CFLAGS} -Wno-null-conversion"
export LIBS="-liconv"
CONFIGURE="--host=${CROSS_COMPILE} --enable-static --disable-shared --with-sysroot=${SYSROOT} --disable-dependency-tracking"
CONFIGURE="--host=${CROSS_COMPILE} --enable-static --disable-shared --with-sysroot=${SYSROOT} --disable-dependency-tracking --with-pic"
ARCHS=${ARCH}

if [ ! -f ${ANDROID_NDK}-darwin-x86_64.zip ]; then
Expand All @@ -62,23 +67,23 @@ case "$@" in
sudo ${CROSS_COMPILE}-ar rcs ${SYSROOT}/usr/lib/libiconv.a ${SYSROOT}/usr/lib/libiconv.o
fi
;;
*ios*)
echo "Building for iOS"
TARGET_PATH=/Library/libdigidocpp.iphoneos
*simulator*)
echo "Building for iOS Simulator"
TARGET_PATH=/Library/libdigidocpp.iphonesimulator
CONFIGURE="--host=arm-apple-darwin --enable-static --disable-shared --disable-dependency-tracking"
SYSROOT=$(xcrun -sdk iphoneos --show-sdk-path)
: ${ARCHS:="armv7 arm64"}
SYSROOT=$(xcrun -sdk iphonesimulator --show-sdk-path)
: ${ARCHS:="x86_64"}
: ${IPHONEOS_DEPLOYMENT_TARGET:="9.0"}
export IPHONEOS_DEPLOYMENT_TARGET
export CFLAGS="-arch ${ARCHS// / -arch } -isysroot ${SYSROOT}"
export CXXFLAGS="${CFLAGS} -Wno-null-conversion"
;;
*simulator*)
echo "Building for iOS Simulator"
TARGET_PATH=/Library/libdigidocpp.iphonesimulator
*ios*)
echo "Building for iOS"
TARGET_PATH=/Library/libdigidocpp.iphoneos
CONFIGURE="--host=arm-apple-darwin --enable-static --disable-shared --disable-dependency-tracking"
SYSROOT=$(xcrun -sdk iphonesimulator --show-sdk-path)
: ${ARCHS:="x86_64"}
SYSROOT=$(xcrun -sdk iphoneos --show-sdk-path)
: ${ARCHS:="armv7 arm64"}
: ${IPHONEOS_DEPLOYMENT_TARGET:="9.0"}
export IPHONEOS_DEPLOYMENT_TARGET
export CFLAGS="-arch ${ARCHS// / -arch } -isysroot ${SYSROOT}"
Expand Down Expand Up @@ -131,6 +136,7 @@ function xalan {
*android*)
cmake \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${TARGET_PATH} \
-DCMAKE_ANDROID_ARCH_ABI=${ARCH_ABI} \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
Expand Down Expand Up @@ -245,7 +251,7 @@ function openssl {
do
case "${ARCH}" in
*x86_64*)
CC="" CFLAGS="" ./Configure iossimulator-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-hw no-engine
CC="" CFLAGS="" ./Configure iossimulator-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-hw no-asm no-engine
;;
*arm64*)
CC="" CFLAGS="" ./Configure ios64-xcrun --prefix=${TARGET_PATH} no-shared no-dso no-hw no-asm no-engine
Expand Down Expand Up @@ -408,14 +414,14 @@ case "$@" in
*)
echo "Usage:"
echo " $0 [target] [task]"
echo " target: osx ios simulator androidarm androidarm64 androidx86"
echo " target: osx ios iossimulator androidarm androidarm64 androidx86 androidx86_64"
echo " tasks: xerces, xalan, openssl, xmlsec, xsd, all, help"
echo "To control iOS, macOS builds set environment variables:"
echo " minimum deployment target"
echo " - MACOSX_DEPLOYMENT_TARGET=10.11"
echo " - IPHONEOS_DEPLOYMENT_TARGET=9.0"
echo " archs to build on iOS"
echo " - ARCHS=\"armv7 armv7s arm64\" (iOS)"
echo " - ARCHS=\"i386 x86_64\" (iPhoneSimulator)"
echo " - ARCHS=\"armv7 arm64\" (iOS)"
echo " - ARCHS=\"x86_64\" (iPhoneSimulator)"
;;
esac

0 comments on commit db05c10

Please sign in to comment.