Ports/gettext: Replace manually linking libintl with a libtool patch

The `gettext` port comprises of multiple libraries, however `libintl.so`
is the one most commonly used in external executables/libraries, so
porting the patches to this one is enough.
This commit is contained in:
Daniel Bertalan 2023-08-01 21:16:22 +02:00 committed by Tim Schumacher
parent e9ce317483
commit a2daed5817
4 changed files with 129 additions and 8 deletions

View file

@ -6,9 +6,3 @@ files="https://ftpmirror.gnu.org/gettext/gettext-${version}.tar.gz gettext-${ver
depends=("libiconv")
use_fresh_config_sub='true'
config_sub_paths=("build-aux/config.sub" "libtextstyle/build-aux/config.sub")
install() {
run make DESTDIR=${SERENITY_INSTALL_ROOT} "${installopts[@]}" install
${CC} -shared -pthread -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
}

View file

@ -8,10 +8,10 @@ Subject: [PATCH] Stub out some wctype functions
1 file changed, 12 insertions(+)
diff --git a/gettext-tools/gnulib-lib/fnmatch.c b/gettext-tools/gnulib-lib/fnmatch.c
index 3937ce3..84aa6e6 100644
index b33a127d9802be15eeafef4622e63aac709bef8e..87f1f7c218c1708f84f3e4394eaa219e1d7c5858 100644
--- a/gettext-tools/gnulib-lib/fnmatch.c
+++ b/gettext-tools/gnulib-lib/fnmatch.c
@@ -106,6 +106,18 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
@@ -112,6 +112,18 @@ typedef ptrdiff_t idx_t;
# define CHAR_CLASS_MAX_LENGTH 256
#endif

View file

@ -0,0 +1,108 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
Date: Tue, 1 Aug 2023 20:45:12 +0200
Subject: [PATCH] libtool: Enable shared library support for SerenityOS
For some odd reason, libtool handles the configuration for shared
libraries entirely statically and in its configure script. If no
shared library support is "present", building shared libraries is
disabled entirely.
Fix that by just adding the appropriate configuration options for
`serenity`. This allows us to finally create dynamic libraries
automatically using libtool, without having to manually link the
static library into a shared library.
This patch here is a bit more elaborate for other ports, as libintl's
configure includes the code for detecting dynamic linker characteristics
twice, and it also queries the C++ compiler for shared library support.
Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
---
gettext-runtime/configure | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/gettext-runtime/configure b/gettext-runtime/configure
index 56cc8e17be7ed390b4a692dde31434dceff45a94..268c7c572abde069814834be25d08175e51f195e 100755
--- a/gettext-runtime/configure
+++ b/gettext-runtime/configure
@@ -10219,6 +10219,10 @@ tpf*)
os2*)
lt_cv_deplibs_check_method=pass_all
;;
+
+serenity*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
esac
fi
@@ -13707,6 +13711,10 @@ lt_prog_compiler_static=
lt_prog_compiler_static='-Bstatic'
;;
+ serenity*)
+ lt_prog_compiler_can_build_shared=yes
+ ;;
+
*)
lt_prog_compiler_can_build_shared=no
;;
@@ -15239,6 +15247,10 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; }
hardcode_shlibpath_var=no
;;
+ serenity*)
+ ld_shlibs=yes
+ ;;
+
*)
ld_shlibs=no
;;
@@ -16311,6 +16323,17 @@ uts4*)
shlibpath_var=LD_LIBRARY_PATH
;;
+serenity*)
+ version_type=linux
+ 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}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ dynamic_linker='SerenityOS LibELF'
+ ;;
+
*)
dynamic_linker=no
;;
@@ -18601,6 +18624,10 @@ fi
ld_shlibs_CXX=no
;;
+ serenity*)
+ ld_shlibs_CXX=yes
+ ;;
+
*)
# FIXME: insert proper C++ library support
ld_shlibs_CXX=no
@@ -20300,6 +20327,17 @@ uts4*)
shlibpath_var=LD_LIBRARY_PATH
;;
+serenity*)
+ version_type=linux
+ 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}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ dynamic_linker='SerenityOS LibELF'
+ ;;
+
*)
dynamic_linker=no
;;

View file

@ -5,3 +5,22 @@
Stub out some wctype functions
## `0002-libtool-Enable-shared-library-support-for-SerenityOS.patch`
libtool: Enable shared library support for SerenityOS
For some odd reason, libtool handles the configuration for shared
libraries entirely statically and in its configure script. If no
shared library support is "present", building shared libraries is
disabled entirely.
Fix that by just adding the appropriate configuration options for
`serenity`. This allows us to finally create dynamic libraries
automatically using libtool, without having to manually link the
static library into a shared library.
This patch here is a bit more elaborate for other ports, as libintl's
configure includes the code for detecting dynamic linker characteristics
twice, and it also queries the C++ compiler for shared library support.