From 9e1de61613c99767fd1bdc5181887a213ebbda23 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 3 Jun 2022 16:37:26 +0200 Subject: [PATCH] Ports: Replace manually linking `libgpg-error` with a libtool patch --- Ports/libgpg-error/package.sh | 6 -- .../patches/0001-Include-errno.h.patch | 4 +- .../0002-Stub-out-the-gpgrt-lock-impl.patch | 4 +- ...hared-library-support-for-SerenityOS.patch | 76 +++++++++++++++++++ Ports/libgpg-error/patches/ReadMe.md | 14 ++++ 5 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 Ports/libgpg-error/patches/0003-libtool-Enable-shared-library-support-for-SerenityOS.patch diff --git a/Ports/libgpg-error/package.sh b/Ports/libgpg-error/package.sh index ad79bf7ba0..498395f3a5 100755 --- a/Ports/libgpg-error/package.sh +++ b/Ports/libgpg-error/package.sh @@ -12,9 +12,3 @@ auth_type=sha256 configure() { run ./configure --host="${SERENITY_ARCH}-pc-serenity" --build="$($workdir/build-aux/config.guess)" "${configopts[@]}" } - -install() { - run make DESTDIR=${SERENITY_INSTALL_ROOT} "${installopts[@]}" install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libgpg-error.so -Wl,-soname,libgpg-error.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libgpg-error.a -Wl,--no-whole-archive -lintl - rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libgpg-error.la -} diff --git a/Ports/libgpg-error/patches/0001-Include-errno.h.patch b/Ports/libgpg-error/patches/0001-Include-errno.h.patch index b1ee2caf49..d1c75456ee 100644 --- a/Ports/libgpg-error/patches/0001-Include-errno.h.patch +++ b/Ports/libgpg-error/patches/0001-Include-errno.h.patch @@ -1,7 +1,7 @@ -From ea4d2441210e9bacb778e892227ed99ff496a9e1 Mon Sep 17 00:00:00 2001 +From bd7b392f9447112458e9e5cfd89a2b25d544c465 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 14 Apr 2021 04:32:34 +0200 -Subject: [PATCH 1/2] Include errno.h +Subject: [PATCH 1/3] Include errno.h --- src/mkerrcodes.c | 1 + diff --git a/Ports/libgpg-error/patches/0002-Stub-out-the-gpgrt-lock-impl.patch b/Ports/libgpg-error/patches/0002-Stub-out-the-gpgrt-lock-impl.patch index 3d4ac14437..595fd6d2cf 100644 --- a/Ports/libgpg-error/patches/0002-Stub-out-the-gpgrt-lock-impl.patch +++ b/Ports/libgpg-error/patches/0002-Stub-out-the-gpgrt-lock-impl.patch @@ -1,7 +1,7 @@ -From 473f87074e63a2786d42035c919e061c8574b7fe Mon Sep 17 00:00:00 2001 +From 29782147d325747be57381458bc9dffb9bbfaf57 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 14 Apr 2021 04:32:34 +0200 -Subject: [PATCH 2/2] Stub out the gpgrt lock impl +Subject: [PATCH 2/3] Stub out the gpgrt lock impl --- src/syscfg/lock-obj-pub.i686-pc-serenity.h | 17 +++++++++++++++++ diff --git a/Ports/libgpg-error/patches/0003-libtool-Enable-shared-library-support-for-SerenityOS.patch b/Ports/libgpg-error/patches/0003-libtool-Enable-shared-library-support-for-SerenityOS.patch new file mode 100644 index 0000000000..644a3ed62c --- /dev/null +++ b/Ports/libgpg-error/patches/0003-libtool-Enable-shared-library-support-for-SerenityOS.patch @@ -0,0 +1,76 @@ +From 8c73450cf10645d91bb3fbe4e240184765d2af92 Mon Sep 17 00:00:00 2001 +From: Tim Schumacher +Date: Sun, 29 May 2022 15:01:28 +0200 +Subject: [PATCH 3/3] 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. +--- + configure | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/configure b/configure +index 24b0799..1838edf 100755 +--- a/configure ++++ b/configure +@@ -6615,6 +6615,10 @@ sysv4 | sysv4.3*) + tpf*) + lt_cv_deplibs_check_method=pass_all + ;; ++ ++serenity*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; + esac + + fi +@@ -9639,6 +9643,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 + ;; +@@ -11055,6 +11063,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } + hardcode_shlibpath_var=no + ;; + ++ serenity*) ++ ld_shlibs=yes ++ ;; ++ + *) + ld_shlibs=no + ;; +@@ -12070,6 +12082,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 + ;; +-- +2.36.1 + diff --git a/Ports/libgpg-error/patches/ReadMe.md b/Ports/libgpg-error/patches/ReadMe.md index 36f89926d1..e139b1fcbf 100644 --- a/Ports/libgpg-error/patches/ReadMe.md +++ b/Ports/libgpg-error/patches/ReadMe.md @@ -10,3 +10,17 @@ Include errno.h Stub out the gpgrt lock impl +## `0003-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. +