From db2701f2e21a08b336eb051c81706b5962656284 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 26 Aug 2023 17:51:39 +0300 Subject: [PATCH] Ports: Add libwebp This library includes webp converter to other formats as well and could be used as reference implementation for performance improvements. --- Ports/AvailablePorts.md | 1 + Ports/libwebp/package.sh | 15 ++++ ...hared-library-support-for-SerenityOS.patch | 78 +++++++++++++++++++ Ports/libwebp/patches/ReadMe.md | 21 +++++ 4 files changed, 115 insertions(+) create mode 100755 Ports/libwebp/package.sh create mode 100644 Ports/libwebp/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch create mode 100644 Ports/libwebp/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 138d8b3eca..470d09f359 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -169,6 +169,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`libuuid`](libuuid/) | libuuid (from util-linux) | 2.38 | https://github.com/karelzak/util-linux/tree/master/libuuid | | [`libuv`](libuv/) | libuv | 1.44.1 | https://github.com/libuv/libuv | | [`libvorbis`](libvorbis/) | libvorbis | 1.3.7 | https://github.com/xiph/vorbis | +| [`libwebp`](libwebp/) | libwebp | 1.3.1 | https://github.com/webmproject/libwebp | | [`libxml2`](libxml2/) | libxml2 | 2.9.14 | http://www.xmlsoft.org/ | | [`libyaml`](libyaml/) | libyaml | 0.2.5 | https://pyyaml.org/wiki/LibYAML | | [`libzip`](libzip/) | libzip | 1.8.0 | https://libzip.org/ | diff --git a/Ports/libwebp/package.sh b/Ports/libwebp/package.sh new file mode 100755 index 0000000000..64a67d0fc7 --- /dev/null +++ b/Ports/libwebp/package.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='libwebp' +version='1.3.1' +useconfigure='true' +files=( + "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${version}.tar.gz b3779627c2dfd31e3d8c4485962c2efe17785ef975e2be5c8c0c9e6cd3c4ef66" +) +depends=( + 'libjpeg' + 'libpng' + 'libtiff' +) +configopts=( + "--with-pnglibdir=${SERENITY_INSTALL_ROOT}/usr/local/include" +) diff --git a/Ports/libwebp/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch b/Ports/libwebp/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch new file mode 100644 index 0000000000..21051fe929 --- /dev/null +++ b/Ports/libwebp/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Liav A +Date: Fri, 1 Sep 2023 23:44:19 +0300 +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 +--- + configure | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/configure b/configure +index d4507aa5761e23c732cc219af4c1c119055cb377..884c76f4da0d8d2640b9fa66cd869816ff35c927 100755 +--- a/configure ++++ b/configure +@@ -5635,6 +5635,10 @@ else $as_nop + lt_cv_sys_max_cmd_len=8192 + ;; + ++ serenity*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not +@@ -9224,6 +9228,10 @@ lt_prog_compiler_static= + lt_prog_compiler_pic='-fPIC -shared' + ;; + ++ serenity) ++ lt_prog_compiler_can_build_shared=yes ++ ;; ++ + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic +@@ -10067,6 +10075,10 @@ _LT_EOF + fi + ;; + ++ serenity*) ++ ld_shlibs=no ++ ;; ++ + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no +@@ -11474,6 +11486,16 @@ beos*) + dynamic_linker="$host_os ld.so" + shlibpath_var=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' ++ ;; + + bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor diff --git a/Ports/libwebp/patches/ReadMe.md b/Ports/libwebp/patches/ReadMe.md new file mode 100644 index 0000000000..ffa3adc2c5 --- /dev/null +++ b/Ports/libwebp/patches/ReadMe.md @@ -0,0 +1,21 @@ +# Patches for libwebp 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. + +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. + +