diff --git a/README.md b/README.md index 1e364a2f2..060a1b4e4 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ To compile Boost for Android you may use one of the following NDKs: | r17b from the [official android repository](http://developer.android.com). | | | | | | | x | x | | | r18 from the [official android repository](http://developer.android.com). | | | | | | | | x | | | r18b from the [official android repository](http://developer.android.com). | | | | | | | | x | x | +| r19 from the [official android repository](http://developer.android.com). | | | | | | | | | x | # Quick Start diff --git a/build-android.sh b/build-android.sh index d19c246d4..c650d4a85 100755 --- a/build-android.sh +++ b/build-android.sh @@ -247,6 +247,8 @@ fi echo "Detected Android NDK version $NDK_RN" +CONFIG_VARIANT=boost + case "$NDK_RN" in 4*) TOOLCHAIN=${TOOLCHAIN:-arm-eabi-4.4.0} @@ -303,6 +305,12 @@ case "$NDK_RN" in CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/clang++ TOOLSET=clang ;; + "19.0") + TOOLCHAIN=${TOOLCHAIN:-llvm} + CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/clang++ + TOOLSET=clang + CONFIG_VARIANT=ndk19 + ;; *) echo "Undefined or not supported Android NDK version: $NDK_RN" exit 1 @@ -318,7 +326,7 @@ if [ -z "${ARCHLIST}" ]; then case "$NDK_RN" in # NDK 17+: Support for ARMv5 (armeabi), MIPS, and MIPS64 has been removed. - "17.1"|"17.2"|"18.0"|"18.1") + "17.1"|"17.2"|"18.0"|"18.1"|"19.0") ARCHLIST="arm64-v8a armeabi-v7a x86 x86_64" ;; *) @@ -332,7 +340,7 @@ if [ "${ARCHLIST}" '!=' "armeabi" ] && [ "${TOOLSET}" '!=' "clang" ]; then exit 1 fi -echo Building with TOOLSET=$TOOLSET CXXPATH=$CXXPATH CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS | tee $PROGDIR/build.log +echo Building with TOOLSET=$TOOLSET CONFIG_VARIANT=${CONFIG_VARIANT} CXXPATH=$CXXPATH CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS | tee $PROGDIR/build.log # Check if the ndk is valid or not if [ ! -f $CXXPATH ] @@ -407,19 +415,19 @@ then PATCH_BOOST_DIR=$PROGDIR/patches/boost-${BOOST_VER} if [ "$TOOLSET" = "clang" ]; then - cp configs/user-config-boost-${BOOST_VER}.jam $BOOST_DIR/tools/build/src/user-config.jam || exit 1 - for FILE in configs/user-config-boost-${BOOST_VER}-*.jam; do - ARCH="`echo $FILE | sed s%configs/user-config-boost-${BOOST_VER}-%% | sed s/[.]jam//`" + cp configs/user-config-${CONFIG_VARIANT}-${BOOST_VER}.jam $BOOST_DIR/tools/build/src/user-config.jam || exit 1 + for FILE in configs/user-config-${CONFIG_VARIANT}-${BOOST_VER}-*.jam; do + ARCH="`echo $FILE | sed s%configs/user-config-${CONFIG_VARIANT}-${BOOST_VER}-%% | sed s/[.]jam//`" if [ "$ARCH" = "common" ]; then continue fi JAMARCH="`echo ${ARCH} | tr -d '_-'`" # Remove all dashes, bjam does not like them - sed "s/%ARCH%/${JAMARCH}/g" configs/user-config-boost-${BOOST_VER}-common.jam >> $BOOST_DIR/tools/build/src/user-config.jam || exit 1 - cat configs/user-config-boost-${BOOST_VER}-$ARCH.jam >> $BOOST_DIR/tools/build/src/user-config.jam || exit 1 + sed "s/%ARCH%/${JAMARCH}/g" configs/user-config-${CONFIG_VARIANT}-${BOOST_VER}-common.jam >> $BOOST_DIR/tools/build/src/user-config.jam || exit 1 + cat configs/user-config-${CONFIG_VARIANT}-${BOOST_VER}-$ARCH.jam >> $BOOST_DIR/tools/build/src/user-config.jam || exit 1 echo ';' >> $BOOST_DIR/tools/build/src/user-config.jam || exit 1 done else - cp configs/user-config-boost-${BOOST_VER}.jam $BOOST_DIR/tools/build/v2/user-config.jam || exit 1 + cp configs/user-config-${CONFIG_VARIANT}-${BOOST_VER}.jam $BOOST_DIR/tools/build/v2/user-config.jam || exit 1 fi for dir in $PATCH_BOOST_DIR; do @@ -473,7 +481,7 @@ echo "Building boost for android for $ARCH" echo "ICONV and ICU already compiled" else echo "boost_locale selected - compiling ICONV and ICU" - git clone https://github.com/pelya/libiconv-libicu-android.git + git clone --depth=1 https://github.com/pelya/libiconv-libicu-android.git cd libiconv-libicu-android ./build.sh || exit 1 cd .. @@ -483,12 +491,12 @@ echo "Building boost for android for $ARCH" cd $BOOST_DIR echo "Adding pathname: `dirname $CXXPATH`" - # `AndroidBinariesPath` could be used by user-config-boost-*.jam + # `AndroidBinariesPath` could be used by user-config-*.jam export AndroidBinariesPath=`dirname $CXXPATH` export PATH=$AndroidBinariesPath:$PATH - export AndroidNDKRoot + export AndroidNDKRoot=$AndroidNDKRoot export NO_BZIP2=1 - export PlatformOS + export PlatformOS=$PlatformOS cflags="" for flag in $CFLAGS; do cflags="$cflags cflags=$flag"; done diff --git a/configs/user-config-ndk19-1_69_0-arm64-v8a.jam b/configs/user-config-ndk19-1_69_0-arm64-v8a.jam new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/configs/user-config-ndk19-1_69_0-arm64-v8a.jam @@ -0,0 +1 @@ + diff --git a/configs/user-config-ndk19-1_69_0-armeabi-v7a.jam b/configs/user-config-ndk19-1_69_0-armeabi-v7a.jam new file mode 100644 index 000000000..a5cfdf54d --- /dev/null +++ b/configs/user-config-ndk19-1_69_0-armeabi-v7a.jam @@ -0,0 +1 @@ +-mthumb diff --git a/configs/user-config-ndk19-1_69_0-common.jam b/configs/user-config-ndk19-1_69_0-common.jam new file mode 100644 index 000000000..568d029d8 --- /dev/null +++ b/configs/user-config-ndk19-1_69_0-common.jam @@ -0,0 +1,21 @@ + +# -------------------------------------------------------------------- + +using clang : %ARCH% +: +$(AndroidCompiler_%ARCH%) +: +$(AndroidBinariesPath)/llvm-ar +-fPIC +-ffunction-sections +-fdata-sections +-funwind-tables +-fstack-protector-strong +-no-canonical-prefixes +-Wformat +-Werror=format-security +-frtti +-fexceptions +-DNDEBUG +-g +-Oz diff --git a/configs/user-config-ndk19-1_69_0-x86.jam b/configs/user-config-ndk19-1_69_0-x86.jam new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/configs/user-config-ndk19-1_69_0-x86.jam @@ -0,0 +1 @@ + diff --git a/configs/user-config-ndk19-1_69_0-x86_64.jam b/configs/user-config-ndk19-1_69_0-x86_64.jam new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/configs/user-config-ndk19-1_69_0-x86_64.jam @@ -0,0 +1 @@ + diff --git a/configs/user-config-ndk19-1_69_0.jam b/configs/user-config-ndk19-1_69_0.jam new file mode 100644 index 000000000..fef2b6dda --- /dev/null +++ b/configs/user-config-ndk19-1_69_0.jam @@ -0,0 +1,47 @@ +# Copyright 2003, 2005 Douglas Gregor +# Copyright 2004 John Maddock +# Copyright 2002, 2003, 2004, 2007 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +# This file is used to configure your Boost.Build installation. You can modify +# this file in place, or you can place it in a permanent location so that it +# does not get overwritten should you get a new version of Boost.Build. See: +# +# http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html +# +# for documentation about possible permanent locations. + +# This file specifies which toolsets (C++ compilers), libraries, and other +# tools are available. Often, you should be able to just uncomment existing +# example lines and adjust them to taste. The complete list of supported tools, +# and configuration instructions can be found at: +# +# http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html +# + +# This file uses Jam language syntax to describe available tools. Mostly, +# there are 'using' lines, that contain the name of the used tools, and +# parameters to pass to those tools -- where paremeters are separated by +# semicolons. Important syntax notes: +# +# - Both ':' and ';' must be separated from other tokens by whitespace +# - The '\' symbol is a quote character, so when specifying Windows paths you +# should use '/' or '\\' instead. +# +# More details about the syntax can be found at: +# +# http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language +# +# ------------------ +# Android configurations. +# ------------------ + +import os ; +local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; +local AndroidBinariesPath = [ os.environ AndroidBinariesPath ] ; + +local AndroidCompiler_arm64v8a = $(AndroidBinariesPath)/aarch64-linux-android21-clang++ ; +local AndroidCompiler_armeabiv7a = $(AndroidBinariesPath)/armv7a-linux-androideabi16-clang++ ; +local AndroidCompiler_x86 = $(AndroidBinariesPath)/i686-linux-android16-clang++ ; +local AndroidCompiler_x8664 = $(AndroidBinariesPath)/x86_64-linux-android21-clang++ ; diff --git a/patches/boost-1_69_0/boost-1_69_0.patch b/patches/boost-1_69_0/boost-1_69_0.patch index dcfe4603e..e43e72336 100644 --- a/patches/boost-1_69_0/boost-1_69_0.patch +++ b/patches/boost-1_69_0/boost-1_69_0.patch @@ -66,3 +66,21 @@ diff -u -r boost_1_69_0.orig/libs/filesystem/src/operations.cpp boost_1_69_0/lib typedef int err_t; // POSIX uses a 0 return to indicate success +diff -u -r boost_1_69_0.orig/tools/build/src/tools/common.jam boost_1_69_0/tools/build/src/tools/common.jam +--- boost_1_69_0.orig/tools/build/src/tools/common.jam 2019-01-25 23:18:34.544755629 +0200 ++++ boost_1_69_0/tools/build/src/tools/common.jam 2019-01-25 23:20:42.309047754 +0200 +@@ -976,10 +976,10 @@ + } + + # Ditto, from Clang 4 +- if $(tag) in clang clangw && [ numbers.less 3 $(version[1]) ] +- { +- version = $(version[1]) ; +- } ++ #if $(tag) in clang clangw && [ numbers.less 3 $(version[1]) ] ++ #{ ++ # version = $(version[1]) ; ++ #} + + # On intel, version is not added, because it does not matter and it is the + # version of vc used as backend that matters. Ideally, we should encode the