diff --git a/ndk-patches/iconv.h b/ndk-patches/iconv.h deleted file mode 100644 index 7b0a1b32f..000000000 --- a/ndk-patches/iconv.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _ICONV_H -#define _ICONV_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef void* iconv_t; - -iconv_t iconv_open(const char*, const char*); -size_t iconv(iconv_t, char**, size_t*, char**, size_t*); -int iconv_close(iconv_t); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/packages/iconv/build.sh b/packages/iconv/build.sh deleted file mode 100644 index afd095840..000000000 --- a/packages/iconv/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/libiconv/ -TERMUX_PKG_DESCRIPTION="Utility converting between different character encodings" -TERMUX_PKG_LICENSE="LGPL-2.0" -TERMUX_PKG_VERSION=1.15 -TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/libiconv/libiconv-${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178 -# Only install the binary, not the library since we use libandroid-support for iconv functions: -TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-static --disable-shared" - -termux_step_make_install() { - mkdir -p $TERMUX_PREFIX/share/man/man1 - make -C lib install # this installs libiconv.{a,la} which the below install task needs: - make -C src install - rm $TERMUX_PREFIX/lib/libiconv.{a,la} - # .. and the man page: - cp $TERMUX_PKG_SRCDIR/man/iconv.1 $TERMUX_PREFIX/share/man/man1/ -} diff --git a/packages/libandroid-support/build.sh b/packages/libandroid-support/build.sh index aa9aa0ed7..0ec0e4b38 100644 --- a/packages/libandroid-support/build.sh +++ b/packages/libandroid-support/build.sh @@ -2,24 +2,17 @@ TERMUX_PKG_HOMEPAGE=https://github.com/termux/libandroid-support TERMUX_PKG_DESCRIPTION="Library extending the Android C library (Bionic) for additional multibyte, locale and math support" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_VERSION=24 +TERMUX_PKG_REVISION=1 +TERMUX_PKG_SRCURL=https://github.com/termux/libandroid-support/archive/v$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=e14e262429a60bea733d5bed69d2f3a1cada53fcadaf76787fca5c8b0d4dae2f -TERMUX_PKG_SRCURL=https://github.com/termux/libandroid-support/archive/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_BUILD_IN_SRC=yes TERMUX_PKG_ESSENTIAL=yes termux_step_make_install() { - # Remove files previously in package to avoid them being left - # in build environments. - rm -f $TERMUX_PREFIX/include/langinfo.h $TERMUX_PREFIX/include/iconv.h - _C_FILES="src/musl-*/*.c" $CC $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS $LDFLAGS \ -Iinclude \ $_C_FILES \ -shared -fpic \ -o $TERMUX_PREFIX/lib/libandroid-support.so - - ln -sf libandroid-support.so $TERMUX_PREFIX/lib/libiconv.so - - rm -Rf $TERMUX_PREFIX/include/libandroid-support/ } diff --git a/packages/libandroid-support/iconv.h.patch b/packages/libandroid-support/iconv.h.patch new file mode 100644 index 000000000..7030ca609 --- /dev/null +++ b/packages/libandroid-support/iconv.h.patch @@ -0,0 +1,16 @@ +diff -uNr libandroid-support-24/include/iconv.h libandroid-support-24.mod/include/iconv.h +--- libandroid-support-24/include/iconv.h 1970-01-01 03:00:00.000000000 +0300 ++++ libandroid-support-24.mod/include/iconv.h 2019-04-28 22:49:00.107252621 +0300 +@@ -0,0 +1,12 @@ ++#ifndef _ICONV_H ++#define _ICONV_H ++ ++#include ++ ++typedef void* iconv_t; ++ ++iconv_t iconv_open(const char*, const char*); ++size_t iconv(iconv_t, char**, size_t*, char**, size_t*); ++int iconv_close(iconv_t); ++ ++#endif diff --git a/packages/libiconv/build.sh b/packages/libiconv/build.sh new file mode 100644 index 000000000..f8d0986be --- /dev/null +++ b/packages/libiconv/build.sh @@ -0,0 +1,10 @@ +TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/libiconv/ +TERMUX_PKG_DESCRIPTION="An implementation of iconv()" +TERMUX_PKG_LICENSE="LGPL-2.0" +TERMUX_PKG_VERSION=1.15 +TERMUX_PKG_REVISION=1 +TERMUX_PKG_SRCURL=https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178 +TERMUX_PKG_CONFLICTS="libandroid-support (<= 24)" +TERMUX_PKG_DEVPACKAGE_BREAKS="ndk-sysroot (<< 19b-4)" +TERMUX_PKG_DEVPACKAGE_REPLACES="ndk-sysroot (<< 19b-4)" diff --git a/packages/libiconv/iconv.subpackage.sh b/packages/libiconv/iconv.subpackage.sh new file mode 100644 index 000000000..aab918af3 --- /dev/null +++ b/packages/libiconv/iconv.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_INCLUDE="bin/iconv" +TERMUX_SUBPKG_DESCRIPTION="Utility converting between different character encodings" +TERMUX_SUBPKG_DEPENDS="libiconv" diff --git a/packages/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index b0feeb1c0..68f65d982 100644 --- a/packages/ndk-sysroot/build.sh +++ b/packages/ndk-sysroot/build.sh @@ -2,7 +2,7 @@ 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=3 +TERMUX_PKG_REVISION=4 TERMUX_PKG_NO_DEVELSPLIT=yes TERMUX_PKG_KEEP_STATIC_LIBRARIES="true" # This package has taken over from the previous libutil-dev diff --git a/scripts/build/termux_step_setup_toolchain.sh b/scripts/build/termux_step_setup_toolchain.sh index c66bd5791..e9b19c397 100644 --- a/scripts/build/termux_step_setup_toolchain.sh +++ b/scripts/build/termux_step_setup_toolchain.sh @@ -127,19 +127,19 @@ termux_step_setup_toolchain() { sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \ patch --silent -p1; done - # elf.h: Taken from glibc since the elf.h in the NDK is lacking. # ifaddrs.h: Added in android-24 unified headers, use a inline implementation for now. + # libintl.h: Inline implementation gettext functions. # langinfo.h: Inline implementation of nl_langinfo(). - # iconv.h: Header for iconv, implemented in libandroid-support. - cp "$TERMUX_SCRIPTDIR"/ndk-patches/{ifaddrs.h,libintl.h,langinfo.h,iconv.h} usr/include + cp "$TERMUX_SCRIPTDIR"/ndk-patches/{ifaddrs.h,libintl.h,langinfo.h} usr/include # Remove because it is provided by libcap-dev. # Remove from the NDK in favour of that from the libandroid-shmem. # Remove as it doesn't work for non-root. # Remove as we currently provide it from libandroid-glob. + # Remove as it's provided by libiconv. # Remove as it's only for future (later than android-27). # Remove and as we build our own zlib - rm usr/include/sys/{capability.h,shm.h,sem.h} usr/include/{glob.h,spawn.h,zlib.h,zconf.h} + rm usr/include/sys/{capability.h,shm.h,sem.h} usr/include/{glob.h,iconv.h,spawn.h,zlib.h,zconf.h} sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \ usr/include/android/api-level.h diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 798305fc4..9f90c8c9a 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -5,7 +5,7 @@ termux_step_start_build() { TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_COMMON_CACHEDIR/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_PKG_API_LEVEL}" # Bump the below version if a change is made in toolchain setup to ensure # that everyone gets an updated toolchain: - TERMUX_STANDALONE_TOOLCHAIN+="-v3" + TERMUX_STANDALONE_TOOLCHAIN+="-v4" if [ -n "${TERMUX_PKG_BLACKLISTED_ARCHES:=""}" ] && [ "$TERMUX_PKG_BLACKLISTED_ARCHES" != "${TERMUX_PKG_BLACKLISTED_ARCHES/$TERMUX_ARCH/}" ]; then echo "Skipping building $TERMUX_PKG_NAME for arch $TERMUX_ARCH"