From b05a6a1701725000db980229708d63d4d023fd9c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 8 May 2021 05:18:02 +0200 Subject: [PATCH] Ports: Add port for gettext --- Ports/AvailablePorts.md | 1 + Ports/gettext/package.sh | 12 +++++++ Ports/gettext/patches/configure.patch | 24 +++++++++++++ Ports/gettext/patches/fnmatch.patch | 14 ++++++++ Ports/gettext/patches/getprogname.patch | 48 +++++++++++++++++++++++++ Ports/gettext/patches/wctype.patch | 22 ++++++++++++ 6 files changed, 121 insertions(+) create mode 100755 Ports/gettext/package.sh create mode 100644 Ports/gettext/patches/configure.patch create mode 100644 Ports/gettext/patches/fnmatch.patch create mode 100644 Ports/gettext/patches/getprogname.patch create mode 100644 Ports/gettext/patches/wctype.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index c6c45f02c9f..e5f87ad196f 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -32,6 +32,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`frotz`](frotz/) | Frotz | 2.53 | https://gitlab.com/DavidGriffith/frotz | | [`gcc`](gcc/) | GNU Compiler Collection | 11.1.0 | https://gcc.gnu.org/ | | [`genemu`](genemu/) | Genesis / MegaDrive Emulator | 3bf6f7c | https://github.com/rasky/genemu | +| [`gettext`](gettext/) | GNU gettext | 0.21 | https://www.gnu.org/software/gettext/ | | [`git`](git/) | Git | 2.31.1 | https://git-scm.com/ | | [`gmp`](gmp/) | GNU Multiple Precision Arithmetic Library (GMP) | 6.2.1 | https://gmplib.org/ | | [`gnucobol`](gnucobol/) | GnuCOBOL | 3.1.2 | https://gnucobol.sourceforge.io/ | diff --git a/Ports/gettext/package.sh b/Ports/gettext/package.sh new file mode 100755 index 00000000000..64dc4904068 --- /dev/null +++ b/Ports/gettext/package.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port=gettext +version=0.21 +useconfigure=true +files="https://ftp.gnu.org/pub/gnu/gettext/gettext-${version}.tar.gz gettext-${version}.tar.gz c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12" +auth_type=sha256 + +install() { + run make DESTDIR=${SERENITY_INSTALL_ROOT} $installopts install + ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libintl.so -Wl,-soname,libintl.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libintl.a -Wl,--no-whole-archive -liconv + rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libintl.la +} diff --git a/Ports/gettext/patches/configure.patch b/Ports/gettext/patches/configure.patch new file mode 100644 index 00000000000..479813d638c --- /dev/null +++ b/Ports/gettext/patches/configure.patch @@ -0,0 +1,24 @@ +diff -Naur gettext-0.21/build-aux/config.sub gettext-0.21.serenity/build-aux/config.sub +--- gettext-0.21/build-aux/config.sub 2020-07-17 22:25:52.000000000 +0200 ++++ gettext-0.21.serenity/build-aux/config.sub 2021-05-08 04:40:29.446280648 +0200 +@@ -1692,7 +1692,7 @@ + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. +- gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ ++ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* | serenity* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ +diff -Naur gettext-0.21/libtextstyle/build-aux/config.sub gettext-0.21.serenity/libtextstyle/build-aux/config.sub +--- gettext-0.21/libtextstyle/build-aux/config.sub 2020-07-17 22:26:48.000000000 +0200 ++++ gettext-0.21.serenity/libtextstyle/build-aux/config.sub 2021-05-08 04:40:43.673225314 +0200 +@@ -1692,7 +1692,7 @@ + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. +- gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ ++ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* | serenity* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ diff --git a/Ports/gettext/patches/fnmatch.patch b/Ports/gettext/patches/fnmatch.patch new file mode 100644 index 00000000000..13466ca840a --- /dev/null +++ b/Ports/gettext/patches/fnmatch.patch @@ -0,0 +1,14 @@ +diff -Naur gettext-0.21/gettext-tools/gnulib-lib/fnmatch_loop.c gettext-0.21.serenity/gettext-tools/gnulib-lib/fnmatch_loop.c +--- gettext-0.21/gettext-tools/gnulib-lib/fnmatch_loop.c 2020-06-26 21:57:10.000000000 +0200 ++++ gettext-0.21.serenity/gettext-tools/gnulib-lib/fnmatch_loop.c 2021-05-08 05:06:59.944736766 +0200 +@@ -19,6 +19,10 @@ + # include + #endif + ++#ifdef __serenity__ ++# define FNM_EXTMATCH 9000 ++#endif ++ + struct STRUCT + { + const CHAR *pattern; diff --git a/Ports/gettext/patches/getprogname.patch b/Ports/gettext/patches/getprogname.patch new file mode 100644 index 00000000000..7bb4ca519ec --- /dev/null +++ b/Ports/gettext/patches/getprogname.patch @@ -0,0 +1,48 @@ +diff -Naur gettext-0.21/gettext-runtime/gnulib-lib/getprogname.c gettext-0.21.serenity/gettext-runtime/gnulib-lib/getprogname.c +--- gettext-0.21/gettext-runtime/gnulib-lib/getprogname.c 2020-07-05 22:09:26.000000000 +0200 ++++ gettext-0.21.serenity/gettext-runtime/gnulib-lib/getprogname.c 2021-05-08 05:04:37.755260750 +0200 +@@ -245,6 +245,8 @@ + } + } + return NULL; ++# elif defined(__serenity__) ++ return NULL; + # else + # error "getprogname module not ported to this OS" + # endif +diff -Naur gettext-0.21/gettext-tools/gnulib-lib/getprogname.c gettext-0.21.serenity/gettext-tools/gnulib-lib/getprogname.c +--- gettext-0.21/gettext-tools/gnulib-lib/getprogname.c 2020-07-05 22:10:31.000000000 +0200 ++++ gettext-0.21.serenity/gettext-tools/gnulib-lib/getprogname.c 2021-05-08 05:04:30.225111896 +0200 +@@ -245,6 +245,8 @@ + } + } + return NULL; ++# elif defined(__serenity__) ++ return NULL; + # else + # error "getprogname module not ported to this OS" + # endif +diff -Naur gettext-0.21/gettext-tools/libgettextpo/getprogname.c gettext-0.21.serenity/gettext-tools/libgettextpo/getprogname.c +--- gettext-0.21/gettext-tools/libgettextpo/getprogname.c 2020-07-05 22:11:43.000000000 +0200 ++++ gettext-0.21.serenity/gettext-tools/libgettextpo/getprogname.c 2021-05-08 05:04:16.591509028 +0200 +@@ -245,6 +245,8 @@ + } + } + return NULL; ++# elif defined(__serenity__) ++ return NULL; + # else + # error "getprogname module not ported to this OS" + # endif +diff -Naur gettext-0.21/libtextstyle/lib/getprogname.c gettext-0.21.serenity/libtextstyle/lib/getprogname.c +--- gettext-0.21/libtextstyle/lib/getprogname.c 2020-07-05 22:12:31.000000000 +0200 ++++ gettext-0.21.serenity/libtextstyle/lib/getprogname.c 2021-05-08 05:04:34.065187807 +0200 +@@ -245,6 +245,8 @@ + } + } + return NULL; ++# elif defined(__serenity__) ++ return NULL; + # else + # error "getprogname module not ported to this OS" + # endif diff --git a/Ports/gettext/patches/wctype.patch b/Ports/gettext/patches/wctype.patch new file mode 100644 index 00000000000..7e191b3786a --- /dev/null +++ b/Ports/gettext/patches/wctype.patch @@ -0,0 +1,22 @@ +diff -Naur gettext-0.21/gettext-tools/gnulib-lib/fnmatch.c gettext-0.21.serenity/gettext-tools/gnulib-lib/fnmatch.c +--- gettext-0.21/gettext-tools/gnulib-lib/fnmatch.c 2020-06-26 21:52:53.000000000 +0200 ++++ gettext-0.21.serenity/gettext-tools/gnulib-lib/fnmatch.c 2021-05-08 05:14:25.420192898 +0200 +@@ -106,6 +106,18 @@ + # define CHAR_CLASS_MAX_LENGTH 256 + #endif + ++#ifdef __serenity__ ++wctype_t wctype(const char*) ++{ ++ asm("int3"); ++} ++ ++int iswctype(wint_t, wctype_t) ++{ ++ asm("int3"); ++} ++#endif ++ + #define IS_CHAR_CLASS(string) wctype (string) + + /* Avoid depending on library functions or files