diff --git a/README.md b/README.md index 0ce01e6dc..e15bfb4d6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Boost for Android Boost for android is a set of tools to compile the main part of the [Boost C++ Libraries](http://www.boost.org/) for the Android platform. -Currently supported boost versions are 1.45.0, 1.48.0, 1.49.0, 1.53.0, 1.54.0, 1.55.0, and 1.65.1. +Currently supported boost versions are 1.45.0, 1.48.0, 1.49.0, 1.53.0, 1.54.0, 1.55.0, 1.65.1 and 1.66.0. x86, mips, and 64-bit architectures are built with Boost 1.65.1 and NDK r16-beta2, this version uses clang toolchain with llvm libc++ STL library. @@ -9,19 +9,19 @@ Other versions of Boost are built only for arm architecture, they are using gcc To compile Boost for Android you may use one of the following NDKs: -| NDK / boost | 1.45 | 1.48 | 1.49 | 1.53 | 1.65 | -| ----------- | ---- | ---- | ---- | ---- | ---- | -| r4 customized by [Dmitry Moskalchuk aka CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | -| r5 from the [official android repository](http://developer.android.com). | x | | | | | -| r5 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | -| r7 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | x | x | | | -| r8 from the [official android repository](http://developer.android.com). | x | x | x | | | -| r8b from the [official android repository](http://developer.android.com). | | x | x | | | -| r8c from the [official android repository](http://developer.android.com). | | | x | | | -| r8d from the [official android repository](http://developer.android.com). | | | x | x | | -| r8e from the [official android repository](http://developer.android.com). | | | x | x | | -| r10 from the [official android repository](http://developer.android.com). | | | x | x | | -| r16 from the [official android repository](http://developer.android.com). | | | | | x | +| NDK / boost | 1.45 | 1.48 | 1.49 | 1.53 | 1.65 | 1.66 | +| ----------- | ---- | ---- | ---- | ---- | ---- | ---- | +| r4 customized by [Dmitry Moskalchuk aka CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | | +| r5 from the [official android repository](http://developer.android.com). | x | | | | | | +| r5 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | | | | | | +| r7 customized by [CrystaX](http://www.crystax.net/android/ndk.php). | x | x | x | | | | +| r8 from the [official android repository](http://developer.android.com). | x | x | x | | | | +| r8b from the [official android repository](http://developer.android.com). | | x | x | | | | +| r8c from the [official android repository](http://developer.android.com). | | | x | | | | +| r8d from the [official android repository](http://developer.android.com). | | | x | x | | | +| r8e from the [official android repository](http://developer.android.com). | | | x | x | | | +| r10 from the [official android repository](http://developer.android.com). | | | x | x | | | +| r16 from the [official android repository](http://developer.android.com). | | | | | x | x | # Quick Start diff --git a/build-android.sh b/build-android.sh index 38d0978cf..f7103d4cc 100755 --- a/build-android.sh +++ b/build-android.sh @@ -28,12 +28,16 @@ # ----------------------- BOOST_VER1=1 -BOOST_VER2=65 -BOOST_VER3=1 -register_option "--boost=" boost_version "Boost version to be used, one of {1.65.1, 1.55.0, 1.54.0, 1.53.0, 1.49.0, 1.48.0, 1.45.0}, default is 1.53.0." +BOOST_VER2=66 +BOOST_VER3=0 +register_option "--boost=" boost_version "Boost version to be used, one of {1.66.0, 1.65.1, 1.55.0, 1.54.0, 1.53.0, 1.49.0, 1.48.0, 1.45.0}, default is 1.66.0." boost_version() { - if [ "$1" = "1.65.1" ]; then + if [ "$1" = "1.66.0" ]; then + BOOST_VER1=1 + BOOST_VER2=66 + BOOST_VER3=0 + elif [ "$1" = "1.65.1" ]; then BOOST_VER1=1 BOOST_VER2=65 BOOST_VER3=1 diff --git a/configs/user-config-boost-1_66_0-arm64-v8a.jam b/configs/user-config-boost-1_66_0-arm64-v8a.jam new file mode 100644 index 000000000..96ea50319 --- /dev/null +++ b/configs/user-config-boost-1_66_0-arm64-v8a.jam @@ -0,0 +1,10 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 +-target +aarch64-none-linux-android +-fpic +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/aarch64-linux-android +-D__ANDROID_API__=21 diff --git a/configs/user-config-boost-1_66_0-armeabi-v7a.jam b/configs/user-config-boost-1_66_0-armeabi-v7a.jam new file mode 100644 index 000000000..13da6e814 --- /dev/null +++ b/configs/user-config-boost-1_66_0-armeabi-v7a.jam @@ -0,0 +1,15 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 +-target +armv7-none-linux-androideabi15 +-march=armv7-a +-mfloat-abi=softfp +-mfpu=vfpv3-d16 +-mthumb +-fpic +-fno-integrated-as +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/arm-linux-androideabi +-D__ANDROID_API__=15 diff --git a/configs/user-config-boost-1_66_0-armeabi.jam b/configs/user-config-boost-1_66_0-armeabi.jam new file mode 100644 index 000000000..0ddb48d4c --- /dev/null +++ b/configs/user-config-boost-1_66_0-armeabi.jam @@ -0,0 +1,15 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 +-target +armv5te-none-linux-androideabi15 +-march=armv5te +-mtune=xscale +-msoft-float +-mthumb +-fpic +-fno-integrated-as +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/arm-linux-androideabi +-D__ANDROID_API__=15 diff --git a/configs/user-config-boost-1_66_0-common.jam b/configs/user-config-boost-1_66_0-common.jam new file mode 100644 index 000000000..9bb70c1f0 --- /dev/null +++ b/configs/user-config-boost-1_66_0-common.jam @@ -0,0 +1,26 @@ + +# -------------------------------------------------------------------- + +using clang : %ARCH% +: +$(AndroidBinariesPath)/clang++ +: +$(AndroidBinariesPath)/llvm-ar +-fexceptions +-frtti +-ffunction-sections +-funwind-tables +-fstack-protector-strong +-Wno-invalid-command-line-argument +-Wno-unused-command-line-argument +-no-canonical-prefixes +-I$(AndroidNDKRoot)/sources/cxx-stl/llvm-libc++/include +-I$(AndroidNDKRoot)/sources/cxx-stl/llvm-libc++abi/include +-I$(AndroidNDKRoot)/sources/android/support/include +-DANDROID +-Wa,--noexecstack +-Wformat +-Werror=format-security +-DNDEBUG +-O2 +-g diff --git a/configs/user-config-boost-1_66_0-mips.jam b/configs/user-config-boost-1_66_0-mips.jam new file mode 100644 index 000000000..3a8693fce --- /dev/null +++ b/configs/user-config-boost-1_66_0-mips.jam @@ -0,0 +1,11 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64 +-target +mipsel-none-linux-android +-mips32 +-fpic +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/mipsel-linux-android +-D__ANDROID_API__=15 diff --git a/configs/user-config-boost-1_66_0-mips64.jam b/configs/user-config-boost-1_66_0-mips64.jam new file mode 100644 index 000000000..f1864c32f --- /dev/null +++ b/configs/user-config-boost-1_66_0-mips64.jam @@ -0,0 +1,11 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64 +-target +mips64el-none-linux-android +-fpic +-fintegrated-as +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/mips64el-linux-android +-D__ANDROID_API__=21 diff --git a/configs/user-config-boost-1_66_0-x86.jam b/configs/user-config-boost-1_66_0-x86.jam new file mode 100644 index 000000000..ac1586d40 --- /dev/null +++ b/configs/user-config-boost-1_66_0-x86.jam @@ -0,0 +1,11 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/x86-4.9/prebuilt/linux-x86_64 +-target +i686-none-linux-android +-fPIC +-mstackrealign +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/i686-linux-android +-D__ANDROID_API__=15 diff --git a/configs/user-config-boost-1_66_0-x86_64.jam b/configs/user-config-boost-1_66_0-x86_64.jam new file mode 100644 index 000000000..0f0d292e7 --- /dev/null +++ b/configs/user-config-boost-1_66_0-x86_64.jam @@ -0,0 +1,10 @@ +-gcc-toolchain +$(AndroidNDKRoot)/toolchains/x86_64-4.9/prebuilt/linux-x86_64 +-target +x86_64-none-linux-android +-fPIC +--sysroot +$(AndroidNDKRoot)/sysroot +-isystem +$(AndroidNDKRoot)/sysroot/usr/include/x86_64-linux-android +-D__ANDROID_API__=21 diff --git a/configs/user-config-boost-1_66_0.jam b/configs/user-config-boost-1_66_0.jam new file mode 100644 index 000000000..0a159d93c --- /dev/null +++ b/configs/user-config-boost-1_66_0.jam @@ -0,0 +1,42 @@ +# 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 ] ; diff --git a/patches/boost-1_66_0/boost-1_66_0.patch b/patches/boost-1_66_0/boost-1_66_0.patch new file mode 100644 index 000000000..355ab197a --- /dev/null +++ b/patches/boost-1_66_0/boost-1_66_0.patch @@ -0,0 +1,52 @@ +diff -u -r boost_1_66_0.orig/boost/config/user.hpp boost_1_66_0/boost/config/user.hpp +--- boost_1_66_0.orig/boost/config/user.hpp 2017-12-14 00:56:42.000000000 +0100 ++++ boost_1_66_0/boost/config/user.hpp 2018-02-16 10:22:39.000000000 +0100 +@@ -13,6 +13,12 @@ + // configuration policy: + // + ++// Android defines ++// There is problem with std::atomic on android (and some other platforms). ++// See this link for more info: ++// https://code.google.com/p/android/issues/detail?id=42735#makechanges ++#define BOOST_ASIO_DISABLE_STD_ATOMIC 1 ++ + // define this to locate a compiler config file: + // #define BOOST_COMPILER_CONFIG + +diff -u -r boost_1_66_0.orig/boost/system/error_code.hpp boost_1_66_0/boost/system/error_code.hpp +--- boost_1_66_0.orig/boost/system/error_code.hpp 2017-12-14 00:56:48.000000000 +0100 ++++ boost_1_66_0/boost/system/error_code.hpp 2018-02-16 10:27:46.000000000 +0100 +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -u -r boost_1_66_0.orig/libs/filesystem/src/operations.cpp boost_1_66_0/libs/filesystem/src/operations.cpp +--- boost_1_66_0.orig/libs/filesystem/src/operations.cpp 2017-12-14 00:56:42.000000000 +0100 ++++ boost_1_66_0/libs/filesystem/src/operations.cpp 2018-02-16 10:32:44.000000000 +0100 +@@ -207,6 +207,21 @@ + + # if defined(BOOST_POSIX_API) + ++# if defined(__ANDROID__) ++# define truncate libboost_truncate_wrapper ++// truncate() is present in Android libc only starting from ABI 21, so here's a simple wrapper ++static int libboost_truncate_wrapper(const char *path, off_t length) ++{ ++ int fd = open(path, O_WRONLY); ++ if (fd == -1) { ++ return -1; ++ } ++ int status = ftruncate(fd, length); ++ close(fd); ++ return status; ++} ++# endif ++ + typedef int err_t; + + // POSIX uses a 0 return to indicate success