From 50decd816b6c4259a94b5e9bb67981980d17c10e Mon Sep 17 00:00:00 2001 From: its-pointless Date: Sun, 17 Feb 2019 11:34:52 +1100 Subject: [PATCH] r19b update --- build-package.sh | 11 +++++- packages/libllvm/build.sh | 2 +- ...lang-lib-Driver-ToolChains-Linux.cpp.patch | 37 +++++++++++++++++-- packages/ndk-stl/build.sh | 22 ----------- packages/ndk-stl/math-header.diff | 24 ------------ packages/ndk-sysroot/build.sh | 16 ++++---- 6 files changed, 50 insertions(+), 62 deletions(-) delete mode 100644 packages/ndk-stl/build.sh delete mode 100644 packages/ndk-stl/math-header.diff diff --git a/build-package.sh b/build-package.sh index d4efe7849..b1deea4f5 100755 --- a/build-package.sh +++ b/build-package.sh @@ -694,7 +694,7 @@ termux_step_start_build() { Requires: Libs: -lz HERE - + ln -sf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libz.so $TERMUX_PREFIX/lib/libz.so # Keep track of when build started so we can see what files have been created. # We start by sleeping so that any generated files above (such as zlib.pc) get # an older timestamp than the TERMUX_BUILD_TS_FILE. @@ -786,7 +786,11 @@ termux_step_setup_toolchain() { export AS=${TERMUX_HOST_PLATFORM}-clang export CC=$TERMUX_HOST_PLATFORM-clang export CXX=$TERMUX_HOST_PLATFORM-clang++ - + + export CCTERMUX_HOST_PLATFORM=$TERMUX_HOST_PLATFORM$TERMUX_PKG_API_LEVEL + if [ $TERMUX_ARCH = arm ]; then + CCTERMUX_HOST_PLATFORM=armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL + fi export AR=$TERMUX_HOST_PLATFORM-ar export CPP=${TERMUX_HOST_PLATFORM}-cpp export CC_FOR_BUILD=gcc @@ -1125,6 +1129,9 @@ termux_step_configure_cmake() { else MAKE_PROGRAM_PATH=$(which make) fi + CFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM" + CXXFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM" + LDFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM" # XXX: CMAKE_{AR,RANLIB} needed for at least jsoncpp build to not # pick up cross compiled binutils tool in $PREFIX/bin: diff --git a/packages/libllvm/build.sh b/packages/libllvm/build.sh index 4361fcbd6..009e5f297 100644 --- a/packages/libllvm/build.sh +++ b/packages/libllvm/build.sh @@ -20,7 +20,7 @@ bin/macho-dump lib/libgomp.a lib/libiomp5.a " -TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libffi" +TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, libffi" # Replace gcc since gcc is deprecated by google on android and is not maintained upstream. # Conflict with clang versions earlier than 3.9.1-3 since they bundled llvm. TERMUX_PKG_CONFLICTS="gcc, clang (<< 3.9.1-3)" diff --git a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch b/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch index ac8cc2a67..9dc054baa 100644 --- a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch +++ b/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch @@ -1,11 +1,40 @@ ---- ../cache/cfe-6.0.0.src/lib/Driver/ToolChains/Linux.cpp 2017-12-11 18:14:51.000000000 +0000 -+++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2018-03-13 03:32:36.142985756 +0000 -@@ -816,7 +816,7 @@ +--- ./tools/clang/lib/Driver/ToolChains/Linux.cpp.orig 2019-02-16 23:00:22.943658132 +0000 ++++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2019-02-16 23:15:04.826482282 +0000 +@@ -652,8 +652,27 @@ + return; + + if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) ++ if (getTriple().isAndroid()) { ++ switch (getTriple().getArch()) { ++ case llvm::Triple::x86_64: ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/x86_64-linux-android"); ++ break; ++ case llvm::Triple::x86: ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/i686-linux-android"); ++ break; ++ case llvm::Triple::aarch64: ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/aarch64-linux-android"); ++ break; ++ case llvm::Triple::arm: ++ case llvm::Triple::thumb: ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/arm-linux-androideabi"); ++ break; ++ default: ++ break; ++ } ++ + addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include"); +- ++ } + if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { + SmallString<128> P(D.ResourceDir); + llvm::sys::path::append(P, "include"); +@@ -968,7 +987,7 @@ } bool Linux::isPIEDefault() const { - return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || -+ return getTriple().isAndroid() || ++ return getTriple().isAndroid() || getTriple().isMusl() || getSanitizerArgs().requiresPIE(); } diff --git a/packages/ndk-stl/build.sh b/packages/ndk-stl/build.sh deleted file mode 100644 index daa1b0f08..000000000 --- a/packages/ndk-stl/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html -TERMUX_PKG_DESCRIPTION="Header files from the Android NDK needed for compiling C++ programs using STL" -TERMUX_PKG_LICENSE="NCSA" -TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION -TERMUX_PKG_REVISION=4 -TERMUX_PKG_NO_DEVELSPLIT=yes - -termux_step_extract_into_massagedir() { - mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ - cp -Rf $TERMUX_STANDALONE_TOOLCHAIN/include/c++/4.9.x/* $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ - - ( cd $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ && patch -p1 < $TERMUX_PKG_BUILDER_DIR/math-header.diff ) - - # Revert the patch for that's only used for using g++ - # from the ndk (https://github.com/android-ndk/ndk/issues/215): - cd $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ - sed "s%\@TERMUX_HOST_PLATFORM\@%${TERMUX_HOST_PLATFORM}%g" $TERMUX_SCRIPTDIR/ndk-patches/cstddef.cpppatch | patch -p1 -R -} - -termux_step_massage() { - echo "overriding termux_step_massage to avoid removing header files" -} diff --git a/packages/ndk-stl/math-header.diff b/packages/ndk-stl/math-header.diff deleted file mode 100644 index 33618e596..000000000 --- a/packages/ndk-stl/math-header.diff +++ /dev/null @@ -1,24 +0,0 @@ -diff -u -r ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/cmath ./cmath ---- ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/cmath 2018-01-03 00:47:31.973545021 +0100 -+++ ./cmath 2018-01-03 00:48:02.453189261 +0100 -@@ -302,7 +302,7 @@ - */ - - #include <__config> --#include -+#include - - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) - #pragma GCC system_header -diff -u -r ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/math.h ./math.h ---- ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/math.h 2018-01-03 00:47:31.985544880 +0100 -+++ ./math.h 2018-01-03 00:48:24.732929153 +0100 -@@ -298,7 +298,7 @@ - #pragma GCC system_header - #endif - --#include_next -+#include <../../math.h> - - #ifdef __cplusplus - diff --git a/packages/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index ea588d8c7..2fab55775 100644 --- a/packages/ndk-sysroot/build.sh +++ b/packages/ndk-sysroot/build.sh @@ -2,13 +2,13 @@ TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK needed for compiling C programs" TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION -TERMUX_PKG_REVISION=10 +#TERMUX_PKG_REVISION=10 TERMUX_PKG_NO_DEVELSPLIT=yes TERMUX_PKG_KEEP_STATIC_LIBRARIES="true" # This package has taken over from the previous libutil-dev # and iconv.h from libandroid-support-dev: TERMUX_PKG_CONFLICTS="libutil-dev, libgcc, libandroid-support-dev" -TERMUX_PKG_REPLACES="libutil-dev, libgcc, libandroid-support-dev" +TERMUX_PKG_REPLACES="libutil-dev, libgcc, libandroid-support-dev, ndk-stl" termux_step_extract_into_massagedir() { mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/pkgconfig \ @@ -17,11 +17,7 @@ termux_step_extract_into_massagedir() { cp -Rf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/include/* \ $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include - local _LIBDIR=lib - if [ "$TERMUX_ARCH" = "x86_64" ]; then - _LIBDIR=lib64 - fi - cp $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/${_LIBDIR}/*.o \ + cp $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/*.o \ $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib cp "$PKG_CONFIG_LIBDIR/zlib.pc" \ @@ -35,8 +31,10 @@ termux_step_extract_into_massagedir() { local LIBGCC_PATH=$TERMUX_STANDALONE_TOOLCHAIN/lib/gcc/$TERMUX_HOST_PLATFORM/4.9.x if [ $TERMUX_ARCH = "arm" ]; then LIBGCC_PATH+="/armv7-a"; fi - LIBGCC_PATH+="/libgcc.a" - cp $LIBGCC_PATH $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/ + #LIBGCC_PATH+="/libgcc.a" + cp $LIBGCC_PATH/* $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/ + + cp $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libcompiler_rt-extras.a $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/ # librt and libpthread are built into libc on android, so setup them as symlinks # to libc for compatibility with programs that users try to build: