From 0ecf17cf91622a82d329b7ea2515a175ef7ce3c3 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 3 Jun 2022 17:15:45 +0200 Subject: [PATCH] Ports: Replace manually linking `xz` with a libtool patch --- Ports/xz/package.sh | 7 +- ...hared-library-support-for-SerenityOS.patch | 76 +++++++++++++++++++ Ports/xz/patches/ReadMe.md | 16 ++++ 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch create mode 100644 Ports/xz/patches/ReadMe.md diff --git a/Ports/xz/package.sh b/Ports/xz/package.sh index fe104ce36b..78539040e9 100755 --- a/Ports/xz/package.sh +++ b/Ports/xz/package.sh @@ -2,14 +2,9 @@ port=xz version=5.2.5 useconfigure=true +configopts=("--disable-static" "--enable-shared") use_fresh_config_sub=true config_sub_paths=("build-aux/config.sub") files="https://tukaani.org/xz/xz-${version}.tar.gz xz-${version}.tar.gz f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" auth_type=sha256 depends=("zlib" "libiconv") - -install() { - run make DESTDIR=${SERENITY_INSTALL_ROOT} "${installopts[@]}" install - ${CC} -pthread -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.so -Wl,-soname,liblzma.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.a -Wl,--no-whole-archive -lz -liconv - rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/liblzma.la -} diff --git a/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch b/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch new file mode 100644 index 0000000000..865507f2cd --- /dev/null +++ b/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch @@ -0,0 +1,76 @@ +From 6e8ac02a635810a8be768d6e7bcac786e9e15908 Mon Sep 17 00:00:00 2001 +From: Tim Schumacher +Date: Sun, 29 May 2022 15:01:28 +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. +--- + configure | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/configure b/configure +index f103a6b..099c1e4 100755 +--- a/configure ++++ b/configure +@@ -8734,6 +8734,10 @@ tpf*) + os2*) + lt_cv_deplibs_check_method=pass_all + ;; ++ ++serenity*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; + esac + + fi +@@ -12063,6 +12067,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 + ;; +@@ -13583,6 +13591,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } + hardcode_shlibpath_var=no + ;; + ++ serenity*) ++ ld_shlibs=yes ++ ;; ++ + *) + ld_shlibs=no + ;; +@@ -14651,6 +14663,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/xz/patches/ReadMe.md b/Ports/xz/patches/ReadMe.md new file mode 100644 index 0000000000..0713b50624 --- /dev/null +++ b/Ports/xz/patches/ReadMe.md @@ -0,0 +1,16 @@ +# Patches for xz on SerenityOS + +## `0001-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. +