diff --git a/build-package.sh b/build-package.sh index c9250781a..c6fe7f718 100755 --- a/build-package.sh +++ b/build-package.sh @@ -51,12 +51,16 @@ else fi # Compute standalone toolchain dir, bitness of arch and name of host platform: -TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/android-standalone-toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${TERMUX_API_LEVEL}-" +TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${TERMUX_API_LEVEL}-" if [ "$TERMUX_CLANG" = "" ]; then TERMUX_STANDALONE_TOOLCHAIN+="gcc4.9" else TERMUX_STANDALONE_TOOLCHAIN+="clang38" fi +# Bump the below version if a change is made in toolchain setup, to ensure +# that everyone gets an updated toolchain: +TERMUX_STANDALONE_TOOLCHAIN+="-v1" + if [ "x86_64" = $TERMUX_ARCH -o "aarch64" = $TERMUX_ARCH ]; then TERMUX_ARCH_BITS=64 else @@ -208,6 +212,27 @@ if [ ! -d $TERMUX_STANDALONE_TOOLCHAIN ]; then mv $_TERMUX_TOOLCHAIN_TMPDIR $TERMUX_STANDALONE_TOOLCHAIN fi +if [ ! -f $TERMUX_PREFIX/lib/libstdc++.so ]; then + # Setup libgnustl_shared.so in $PREFIX/lib and libstdc++.so as a symlink to it, + # so that other C++ using packages links to it instead of the default android + # C++ library which does not support exceptions or STL: + # https://developer.android.com/ndk/guides/cpp-support.html + # We do however want to avoid installing this, to avoid problems # where e.g. + # libm.so on some i686 devices links against libstdc++.so. + # The libgnustl_shared.so library will be packaged in the libgnustl package + # which is part of the base Termux installation. + mkdir -p $TERMUX_PREFIX/lib + cd $TERMUX_PREFIX/lib + _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib/libgnustl_shared.so + if [ $TERMUX_ARCH = arm ]; then + _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib/armv7-a/libgnustl_shared.so + elif [ $TERMUX_ARCH = x86_64 ]; then + _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib64/libgnustl_shared.so + fi + cp $_STL_LIBFILE . + ln -f -s libgnustl_shared.so libstdc++.so +fi + export TERMUX_COMMON_CACHEDIR="$TERMUX_TOPDIR/_cache" export TERMUX_DEBDIR="$TERMUX_SCRIPTDIR/debs" mkdir -p $TERMUX_COMMON_CACHEDIR $TERMUX_DEBDIR diff --git a/configure.patch b/configure.patch new file mode 100644 index 000000000..77743a30c --- /dev/null +++ b/configure.patch @@ -0,0 +1,12 @@ +diff -u -r ../libvpx-1.5.0/configure ./configure +--- ../libvpx-1.5.0/configure 2015-11-09 17:12:38.000000000 -0500 ++++ ./configure 2015-11-17 15:20:15.792584646 -0500 +@@ -507,7 +507,7 @@ + # Can only build shared libs on a subset of platforms. Doing this check + # here rather than at option parse time because the target auto-detect + # magic happens after the command line has been parsed. +- if ! enabled linux && ! enabled os2; then ++ if ! enabled linux && ! enabled os2 && ! enabled android; then + if enabled gnu; then + echo "--enable-shared is only supported on ELF; assuming this is OK" + else diff --git a/packages/aapt/build.sh b/packages/aapt/build.sh index 95f4d436e..5e9e29913 100644 --- a/packages/aapt/build.sh +++ b/packages/aapt/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Android Asset Packaging Tool" TERMUX_PKG_VERSION=5.1.1 TERMUX_PKG_BUILD_REVISION=1 TERMUX_PKG_BUILD_IN_SRC=yes -TERMUX_PKG_DEPENDS="libexpat, libpng, libgnustl" +TERMUX_PKG_DEPENDS="libexpat, libpng" termux_step_make_install () { local _TAGNAME=${TERMUX_PKG_VERSION}_r8 diff --git a/packages/apt/build.sh b/packages/apt/build.sh index c309faa02..514ea6cc0 100644 --- a/packages/apt/build.sh +++ b/packages/apt/build.sh @@ -1,6 +1,6 @@ TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager" -TERMUX_PKG_DEPENDS="liblzma, libgnustl, dpkg, gnupg" +TERMUX_PKG_DEPENDS="liblzma, dpkg, gnupg" # Wait with updating to later version until the NDK supports std::to_string() and other # functions (hopefully in r13): TERMUX_PKG_VERSION=1.2.12 @@ -13,9 +13,6 @@ TERMUX_PKG_FOLDERNAME=apt-${TERMUX_PKG_VERSION} TERMUX_PKG_ESSENTIAL=yes TERMUX_PKG_CONFFILES="etc/apt/sources.list" -# $NDK/docs/STANDALONE-TOOLCHAIN.html: "If you use the GNU libstdc++, you will need to explicitly link with libsupc++ if you use these features" -export LDFLAGS="$LDFLAGS -lgnustl_shared" # -lsupc++" - # Some files use STD*_FILENO without including where they are declared. # Define them here to avoid having to patch files: CXXFLAGS+=" -DSTDIN_FILENO=0 -DSTDOUT_FILENO=1 -DSTDERR_FILENO=2 -DAI_IDN=0" diff --git a/packages/aria2/build.sh b/packages/aria2/build.sh index 3c31600eb..4b4a092cf 100644 --- a/packages/aria2/build.sh +++ b/packages/aria2/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=http://aria2.sourceforge.net/ TERMUX_PKG_DESCRIPTION="Multi-protocol & multi-source command-line download utility supporting HTTP/HTTPS, FTP, BitTorrent and Metalink" TERMUX_PKG_VERSION=1.25.0 TERMUX_PKG_SRCURL=https://github.com/tatsuhiro-t/aria2/releases/download/release-$TERMUX_PKG_VERSION/aria2-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_DEPENDS="c-ares, openssl, libxml2, libgnustl" +TERMUX_PKG_DEPENDS="c-ares, openssl, libxml2" # sqlite3 is only used for loading cookies from firefox or chrome: TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-openssl --without-gnutls --without-libuv --without-sqlite3 ac_cv_search_getaddrinfo=no ac_cv_func_getaddrinfo=yes ac_cv_func_gettimeofday=yes ac_cv_func_sleep=yes ac_cv_func_usleep=yes ac_cv_func_basename=yes" diff --git a/packages/clang/build.sh b/packages/clang/build.sh index 49fa6d6a2..e15b14ad5 100644 --- a/packages/clang/build.sh +++ b/packages/clang/build.sh @@ -5,7 +5,7 @@ TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.1 TERMUX_PKG_SRCURL=http://llvm.org/releases/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_RM_AFTER_INSTALL="bin/macho-dump bin/bugpoint bin/llvm-tblgen lib/BugpointPasses.so lib/LLVMHello.so" -TERMUX_PKG_DEPENDS="binutils, libgnustl, ncurses, ndk-sysroot, ndk-stl, libgcc" +TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libgcc" termux_step_post_extract_package () { CLANG_SRC_TAR=cfe-${TERMUX_PKG_VERSION}.src.tar.xz diff --git a/packages/cmake/build.sh b/packages/cmake/build.sh index 11f48b685..ce5fc2c2f 100644 --- a/packages/cmake/build.sh +++ b/packages/cmake/build.sh @@ -4,7 +4,7 @@ _MAJOR_VERSION=3.5 TERMUX_PKG_VERSION=${_MAJOR_VERSION}.2 TERMUX_PKG_BUILD_REVISION=1 TERMUX_PKG_SRCURL=http://www.cmake.org/files/v${_MAJOR_VERSION}/cmake-${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_DEPENDS="libarchive, libcurl, libexpat, ncurses, jsoncpp, libgnustl" +TERMUX_PKG_DEPENDS="libarchive, libcurl, libexpat, ncurses, jsoncpp" termux_step_configure () { cd $TERMUX_PKG_BUILDDIR diff --git a/packages/fish/build.sh b/packages/fish/build.sh index bd72451a3..3aac8f634 100644 --- a/packages/fish/build.sh +++ b/packages/fish/build.sh @@ -5,7 +5,7 @@ TERMUX_PKG_BUILD_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/fish-shell/fish-shell/releases/download/$TERMUX_PKG_VERSION/fish-${TERMUX_PKG_VERSION}.tar.gz # fish calls 'tput' from ncurses-utils, at least when cancelling (Ctrl+C) a command line. # man is needed since fish calls apropos during command completion. -TERMUX_PKG_DEPENDS="ncurses, libgnustl, libandroid-support, ncurses-utils, man" +TERMUX_PKG_DEPENDS="ncurses, libandroid-support, ncurses-utils, man" TERMUX_PKG_BUILD_IN_SRC=yes TERMUX_PKG_FOLDERNAME=fish-$TERMUX_PKG_VERSION diff --git a/packages/gcc/build.sh b/packages/gcc/build.sh index 1c28ef8d4..90f799b83 100755 --- a/packages/gcc/build.sh +++ b/packages/gcc/build.sh @@ -1,6 +1,6 @@ TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/ TERMUX_PKG_DESCRIPTION="GNU C compiler" -TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl, libgnustl" +TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl" TERMUX_PKG_VERSION=6.1.0 TERMUX_PKG_BUILD_REVISION=2 TERMUX_PKG_SRCURL=ftp://ftp.gnu.org/gnu/gcc/gcc-${TERMUX_PKG_VERSION}/gcc-${TERMUX_PKG_VERSION}.tar.bz2 diff --git a/packages/lftp/build.sh b/packages/lftp/build.sh index 4cbedf75c..c9e65fc22 100644 --- a/packages/lftp/build.sh +++ b/packages/lftp/build.sh @@ -6,7 +6,7 @@ TERMUX_PKG_SRCURL=http://lftp.yar.ru/ftp/lftp-${TERMUX_PKG_VERSION}.tar.xz # (2) Use --with-openssl to use openssl instead of gnutls. TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_func_dn_expand=no --with-openssl --with-zlib=$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr --with-expat=$TERMUX_PREFIX" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-readline=$TERMUX_PREFIX" -TERMUX_PKG_DEPENDS="libexpat, openssl, readline, libutil, libidn, libgnustl" +TERMUX_PKG_DEPENDS="libexpat, openssl, readline, libutil, libidn" termux_step_pre_configure () { # We have patched an m4 file. diff --git a/packages/libgnustl/build.sh b/packages/libgnustl/build.sh index 6d2cbad67..41c4b15e3 100644 --- a/packages/libgnustl/build.sh +++ b/packages/libgnustl/build.sh @@ -2,23 +2,14 @@ TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/onlinedocs/libstdc++/ TERMUX_PKG_DESCRIPTION="The GNU Standard C++ Library (a.k.a. libstdc++-v3), necessary on android since the system libstdc++.so is stripped down" TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION TERMUX_PKG_BUILD_REVISION=4 +# Since every C++ package links against this by default (due +# to the libstdc++.so -> libgnustl_shared.so setup in +# build-package.sh) this package is considered essential, +# and other packages does not need to declare explicit +# dependency on it. +TERMUX_PKG_ESSENTIAL=yes termux_step_make_install () { - local LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib/libgnustl_shared.so - if [ $TERMUX_ARCH = arm ]; then - LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib/armv7-a/libgnustl_shared.so - elif [ $TERMUX_ARCH = x86_64 ]; then - LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib64/libgnustl_shared.so - fi - - cp $LIBFILE $TERMUX_PREFIX/lib/ -} - -termux_step_post_massage () { - # Setup a libgnustl_shared.so in $PREFIX/lib, so that other C++ using packages - # links to it. We do however want to avoid installing this, to avoid problems - # where e.g. libm.so on some i686 devices links against libstdc++.so, so do - # this here in termux_step_post_massage. - cd $TERMUX_PREFIX/lib - ln -f -s libgnustl_shared.so libstdc++.so + # Just bump timestamp to have it packaged. + touch $TERMUX_PREFIX/lib/libgnustl_shared.so } diff --git a/packages/libvpx/build.sh b/packages/libvpx/build.sh index 36e57ffb8..7916a8c67 100644 --- a/packages/libvpx/build.sh +++ b/packages/libvpx/build.sh @@ -1,10 +1,8 @@ TERMUX_PKG_HOMEPAGE=http://www.webmproject.org/ TERMUX_PKG_DESCRIPTION="VP9 Codec SDK" -TERMUX_PKG_VERSION=1.5.0 -TERMUX_PKG_BUILD_REVISION=1 +TERMUX_PKG_VERSION=1.6.0 TERMUX_PKG_SRCURL=https://github.com/webmproject/libvpx/archive/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_FOLDERNAME=libvpx-${TERMUX_PKG_VERSION} -TERMUX_PKG_DEPENDS="libgnustl" termux_step_configure () { if [ $TERMUX_ARCH = "arm" ]; then diff --git a/packages/libvpx/configure.patch b/packages/libvpx/configure.patch index 77743a30c..84ce7f3f5 100644 --- a/packages/libvpx/configure.patch +++ b/packages/libvpx/configure.patch @@ -1,12 +1,12 @@ -diff -u -r ../libvpx-1.5.0/configure ./configure ---- ../libvpx-1.5.0/configure 2015-11-09 17:12:38.000000000 -0500 -+++ ./configure 2015-11-17 15:20:15.792584646 -0500 -@@ -507,7 +507,7 @@ - # Can only build shared libs on a subset of platforms. Doing this check - # here rather than at option parse time because the target auto-detect - # magic happens after the command line has been parsed. -- if ! enabled linux && ! enabled os2; then -+ if ! enabled linux && ! enabled os2 && ! enabled android; then - if enabled gnu; then +diff -u -r ../libvpx-1.6.0/configure ./configure +--- ../libvpx-1.6.0/configure 2016-07-20 21:15:41.000000000 -0400 ++++ ./configure 2016-08-10 19:36:59.873847660 -0400 +@@ -509,7 +509,7 @@ + # Supported platforms + ;; + *) +- if enabled gnu; then ++ if enabled gnu || enabled android; then echo "--enable-shared is only supported on ELF; assuming this is OK" else + die "--enable-shared only supported on ELF, OS/2, and Darwin for now" diff --git a/packages/ltrace/build.sh b/packages/ltrace/build.sh index 364c26469..75f798374 100644 --- a/packages/ltrace/build.sh +++ b/packages/ltrace/build.sh @@ -1,7 +1,7 @@ TERMUX_PKG_HOMEPAGE=http://www.ltrace.org/ TERMUX_PKG_DESCRIPTION="Tracks runtime library calls in dynamically linked programs" TERMUX_PKG_VERSION=0.7.3.20160411 -TERMUX_PKG_DEPENDS="elfutils, libgnustl" +TERMUX_PKG_DEPENDS="elfutils" # TERMUX_PKG_SRCURL=http://www.ltrace.org/ltrace_${TERMUX_PKG_VERSION}.orig.tar.bz2 # TERMUX_PKG_FOLDERNAME=ltrace-${TERMUX_PKG_VERSION} diff --git a/packages/mosh/build.sh b/packages/mosh/build.sh index 35110595c..b127f2188 100644 --- a/packages/mosh/build.sh +++ b/packages/mosh/build.sh @@ -4,7 +4,7 @@ TERMUX_PKG_VERSION=1.2.6 TERMUX_PKG_SRCURL=https://github.com/mobile-shell/mosh/archive/mosh-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_FOLDERNAME=mosh-mosh-$TERMUX_PKG_VERSION -TERMUX_PKG_DEPENDS="libandroid-support, protobuf, ncurses, openssl, openssh, libutil, libgnustl" +TERMUX_PKG_DEPENDS="libandroid-support, protobuf, ncurses, openssl, openssh, libutil" export PROTOC=$TERMUX_TOPDIR/protobuf/host-build/src/protoc diff --git a/packages/ndk-stl/build.sh b/packages/ndk-stl/build.sh index b5fc10fdc..a3a909925 100644 --- a/packages/ndk-stl/build.sh +++ b/packages/ndk-stl/build.sh @@ -1,7 +1,6 @@ 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_VERSION=$TERMUX_NDK_VERSION -TERMUX_PKG_DEPENDS="libgnustl" TERMUX_PKG_NO_DEVELSPLIT=yes termux_step_extract_into_massagedir () { diff --git a/packages/nodejs/build.sh b/packages/nodejs/build.sh index 9789145ba..52961f044 100644 --- a/packages/nodejs/build.sh +++ b/packages/nodejs/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=http://nodejs.org/ TERMUX_PKG_DESCRIPTION="Platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications" TERMUX_PKG_VERSION=6.3.1 TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_DEPENDS="openssl, libuv, libgnustl, c-ares" +TERMUX_PKG_DEPENDS="openssl, libuv, c-ares" TERMUX_PKG_RM_AFTER_INSTALL="lib/node_modules/npm/html lib/node_modules/npm/make.bat share/systemtap lib/dtrace" TERMUX_PKG_BUILD_IN_SRC=yes diff --git a/packages/poppler/build.sh b/packages/poppler/build.sh index 87cb86e32..cf05eeb03 100644 --- a/packages/poppler/build.sh +++ b/packages/poppler/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="PDF rendering library" TERMUX_PKG_VERSION=0.43.0 TERMUX_PKG_SRCURL=http://poppler.freedesktop.org/poppler-${TERMUX_PKG_VERSION}.tar.xz # libcairo and littlecms is used by pdftocairo: -TERMUX_PKG_DEPENDS="fontconfig, libcairo, libpng, libjpeg-turbo, libtiff, littlecms, libgnustl, openjpeg" +TERMUX_PKG_DEPENDS="fontconfig, libcairo, libpng, libjpeg-turbo, libtiff, littlecms, openjpeg" TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-poppler-glib" # $NDK/docs/STANDALONE-TOOLCHAIN.html: "If you use the GNU libstdc++, you will need to explicitly link with libsupc++ if you use these features"