iconv.h from libandroid-support to ndk-patches

This commit is contained in:
Fredrik Fornwall 2019-01-25 02:57:27 +01:00
parent 933390b075
commit 873f60cbb5
4 changed files with 58 additions and 12 deletions

View File

@ -431,7 +431,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"
@ -735,14 +735,15 @@ termux_step_setup_toolchain() {
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.
cp "$TERMUX_SCRIPTDIR"/ndk-patches/{ifaddrs.h,libintl.h,langinfo.h} usr/include
# 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
# Remove <sys/shm.h> from the NDK in favour of that from the libandroid-shmem.
# Remove <sys/sem.h> as it doesn't work for non-root.
# Remove <iconv.h> as we currently provide it from libandroid-support.
# Remove <glob.h> as we currently provide it from libandroid-glob.
# Remove <spawn.h> as it's only for future (later than android-27).
rm usr/include/sys/{shm.h,sem.h} usr/include/{iconv.h,glob.h,spawn.h}
rm usr/include/sys/{shm.h,sem.h} usr/include/{glob.h,spawn.h}
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
usr/include/android/api-level.h
@ -890,6 +891,7 @@ termux_step_configure_autotools () {
# https://gitlab.com/sortix/sortix/wikis/Gnulib
# https://github.com/termux/termux-packages/issues/76
local AVOID_GNULIB=""
AVOID_GNULIB+=" ac_cv_func_nl_langinfo=yes"
AVOID_GNULIB+=" ac_cv_func_calloc_0_nonnull=yes"
AVOID_GNULIB+=" ac_cv_func_chown_works=yes"
AVOID_GNULIB+=" ac_cv_func_getgroups_works=yes"

47
ndk-patches/iconv.h Normal file
View File

@ -0,0 +1,47 @@
/*
* 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 <stddef.h>
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

View File

@ -1,16 +1,16 @@
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=23
TERMUX_PKG_SHA256=9683eccb6da260715babd56c8f2b8e48b21caf3f6e878bd80c631f3b9d76e13f
TERMUX_PKG_VERSION=24
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 file previously in package to avoid this being left
# Remove files previously in package to avoid them being left
# in build environments.
rm -f $TERMUX_PREFIX/include/langinfo.h
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 \
@ -22,5 +22,4 @@ termux_step_make_install () {
ln -sf libandroid-support.so $TERMUX_PREFIX/lib/libiconv.so
rm -Rf $TERMUX_PREFIX/include/libandroid-support/
cp --remove-destination include/*.h $TERMUX_PREFIX/include/
}

View File

@ -2,10 +2,8 @@ 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=8
TERMUX_PKG_REVISION=9
TERMUX_PKG_NO_DEVELSPLIT=yes
# Depend on libandroid-support-dev so that iconv.h and libintl.h are available:
TERMUX_PKG_DEPENDS="libandroid-support-dev"
TERMUX_PKG_KEEP_STATIC_LIBRARIES="true"
# This package has taken over <pty.h> from the previous libutil-dev:
TERMUX_PKG_CONFLICTS="libutil-dev, libgcc"