LibC: Remove our iconv.h header and add libiconv port

If I ever end up writing my own iconv, i will drop the port :D
This commit is contained in:
Bananymous 2025-08-11 18:46:15 +03:00
parent fde4d4662e
commit 59fff26a5f
4 changed files with 72 additions and 21 deletions

20
ports/libiconv/build.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash ../install.sh
NAME='libiconv'
VERSION='1.18'
DOWNLOAD_URL="https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$VERSION.tar.gz#3b08f5f4f9b4eb82f151a7040bfd6fe6c6fb922efe4b1659c66ea933276965e8"
CONFIG_SUB=('build-aux/config.sub' 'libcharset/build-aux/config.sub')
CONFIGURE_OPTIONS=(
'--disable-nls'
'CFLAGS=-std=c11'
)
pre_configure() {
echo '#include_next <sys/types.h>' > srclib/sys_types.in.h
}
post_install() {
# remove libtool file
rm -f $BANAN_SYSROOT/usr/lib/libcharset.la
rm -f $BANAN_SYSROOT/usr/lib/libiconv.la
}

View File

@ -0,0 +1,31 @@
diff -ruN libiconv-1.18/configure libiconv-1.18-banan_os/configure
--- libiconv-1.18/configure 2024-12-15 13:57:14.000000000 +0200
+++ libiconv-1.18-banan_os/configure 2025-08-07 23:49:03.383717069 +0300
@@ -8779,6 +8779,10 @@
lt_cv_deplibs_check_method=pass_all
;;
+banan_os*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
beos*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -14510,6 +14514,16 @@
esac
;;
+banan_os*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+ soname_spec='$libname$release$shared_ext$major'
+ dynamic_linker="$host_os DynamicLoader.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
beos*)
library_names_spec='$libname$shared_ext'
dynamic_linker="$host_os ld.so"

View File

@ -0,0 +1,21 @@
diff -ruN libiconv-1.18/srclib/getprogname.c libiconv-1.18-banan_os/srclib/getprogname.c
--- libiconv-1.18/srclib/getprogname.c 2024-07-12 14:55:16.000000000 +0300
+++ libiconv-1.18-banan_os/srclib/getprogname.c 2025-08-07 23:42:50.691745454 +0300
@@ -50,7 +50,7 @@
# include <sys/procfs.h>
#endif
-#if defined __SCO_VERSION__ || defined __sysv5__
+#if defined __SCO_VERSION__ || defined __sysv5__ || defined __banan_os__
# include <fcntl.h>
# include <string.h>
#endif
@@ -265,7 +265,7 @@
}
}
return NULL;
-# elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */
+# elif defined __SCO_VERSION__ || defined __sysv5__ || defined __banan_os__ /* SCO OpenServer6/UnixWare */
char buf[80];
int fd;
sprintf (buf, "/proc/%d/cmdline", getpid());

View File

@ -1,21 +0,0 @@
#ifndef _ICONV_H
#define _ICONV_H 1
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/iconv.h.html
#include <sys/cdefs.h>
__BEGIN_DECLS
#define __need_size_t
#include <sys/types.h>
typedef void* iconv_t;
size_t iconv(iconv_t cd, char** __restrict inbuf, size_t* __restrict inbytesleft, char** __restrict outbuf, size_t* __restrict outbytesleft);
int iconv_close(iconv_t cd);
iconv_t iconv_open(const char* tocode, const char* fromcode);
__END_DECLS
#endif