Browse Source

Setup libstdc++.so -> libgnustl_shared.so early

Let build-package.sh setup the $PREFIX/lib/libstdc++.so symlink
before building any package, to make sure that all C++ applications
link against a fully featured C++ standard library.

Avoid explicitly declaring a dependency on the libgnustl package
since everyone may link against it at will and instead mark it as
essential.
android-5
Fredrik Fornwall 8 years ago
parent
commit
3f300a10fc
  1. 27
      build-package.sh
  2. 12
      configure.patch
  3. 2
      packages/aapt/build.sh
  4. 5
      packages/apt/build.sh
  5. 2
      packages/aria2/build.sh
  6. 2
      packages/clang/build.sh
  7. 2
      packages/cmake/build.sh
  8. 2
      packages/fish/build.sh
  9. 2
      packages/gcc/build.sh
  10. 2
      packages/lftp/build.sh
  11. 25
      packages/libgnustl/build.sh
  12. 4
      packages/libvpx/build.sh
  13. 20
      packages/libvpx/configure.patch
  14. 2
      packages/ltrace/build.sh
  15. 2
      packages/mosh/build.sh
  16. 1
      packages/ndk-stl/build.sh
  17. 2
      packages/nodejs/build.sh
  18. 2
      packages/poppler/build.sh

27
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

12
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

2
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

5
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 <unistd.h> 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"

2
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"

2
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

2
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

2
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

2
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

2
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.

25
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
}

4
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

20
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"

2
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}

2
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

1
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 () {

2
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

2
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"

Loading…
Cancel
Save