new package: libiconv

This commit is contained in:
Leonid Pliushch 2019-04-22 23:08:12 +03:00 committed by Fredrik Fornwall
parent b5a4911f29
commit 9dda444a87
9 changed files with 37 additions and 79 deletions

View File

@ -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 <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,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/
}

View File

@ -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/
}

View File

@ -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 <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);
+
+#endif

View File

@ -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)"

View File

@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="bin/iconv"
TERMUX_SUBPKG_DESCRIPTION="Utility converting between different character encodings"
TERMUX_SUBPKG_DEPENDS="libiconv"

View File

@ -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 <pty.h> from the previous libutil-dev

View File

@ -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 <sys/capability.h> because it is provided by libcap-dev.
# 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 <glob.h> as we currently provide it from libandroid-glob.
# Remove <iconv.h> as it's provided by libiconv.
# Remove <spawn.h> as it's only for future (later than android-27).
# Remove <zlib.h> and <zconf.h> 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

View File

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