Skip to content

Commit

Permalink
Ports: Replace manually linking SDL2_image with a libtool patch
Browse files Browse the repository at this point in the history
  • Loading branch information
timschumi authored and linusg committed Jun 3, 2022
1 parent 9b4b068 commit e7f8389
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Ports/SDL2_image/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ configure() {
--host="${SERENITY_ARCH}-pc-serenity" \
--with-sdl-prefix="${SERENITY_INSTALL_ROOT}/usr/local" \
--enable-webp=false --enable-webp-shared=false \
--disable-static \
--enable-shared \
LDFLAGS="-lgui -lgfx -lipc -lcore -lm"
}

build() {
run make -k
}

install() {
run make -k DESTDIR="${SERENITY_INSTALL_ROOT}" install
${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.so -Wl,-soname,libSDL2_image.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.a -Wl,--no-whole-archive -lpng -ljpeg -ltiff
rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_image.la
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
From 1f0f0c7055a0f2556d9094b5d1c13381541c00bd Mon Sep 17 00:00:00 2001
From: Tim Schumacher <[email protected]>
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 7eb305d..4299214 100755
--- a/configure
+++ b/configure
@@ -4601,6 +4601,10 @@ sysv4 | sysv4.3*)
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
+
+serenity*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
esac

fi
@@ -7389,6 +7393,10 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
lt_prog_compiler_static='-Bstatic'
;;

+ serenity*)
+ lt_prog_compiler_can_build_shared=yes
+ ;;
+
*)
lt_prog_compiler_can_build_shared=no
;;
@@ -8625,6 +8633,10 @@ rm -f core conftest.err conftest.$ac_objext \
hardcode_shlibpath_var=no
;;

+ serenity*)
+ ld_shlibs=yes
+ ;;
+
*)
ld_shlibs=no
;;
@@ -9527,6 +9539,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

16 changes: 16 additions & 0 deletions Ports/SDL2_image/patches/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Patches for SDL2_image 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.

0 comments on commit e7f8389

Please sign in to comment.