summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-11-12 02:52:40 +0000
committerSam James <sam@gentoo.org>2022-11-12 02:53:22 +0000
commit8ab5097f819e140eeb8a4266e5b77b2156beef19 (patch)
tree384795e27ccf369e476a57827b32a01dba17be4d /media-libs/sdl-sound
parentapp-emulation/wine-proton: skip deregister for rebuilds (diff)
downloadgentoo-8ab5097f819e140eeb8a4266e5b77b2156beef19.tar.gz
gentoo-8ab5097f819e140eeb8a4266e5b77b2156beef19.tar.bz2
gentoo-8ab5097f819e140eeb8a4266e5b77b2156beef19.zip
media-libs/sdl-sound: fix linking with lld
See patch header for commentary but I was pretty sure I'd checked one of the sdl-* for an underlinking patch and it was obsolete. Maybe it was another one. In any case, sent upstream this time, unlike the one from 10 years ago(!) Reported-by: John Helmert III <ajak@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-libs/sdl-sound')
-rw-r--r--media-libs/sdl-sound/files/sdl-sound-1.0.3_p20220525-underlinking.patch45
-rw-r--r--media-libs/sdl-sound/sdl-sound-1.0.3_p20220525.ebuild13
2 files changed, 57 insertions, 1 deletions
diff --git a/media-libs/sdl-sound/files/sdl-sound-1.0.3_p20220525-underlinking.patch b/media-libs/sdl-sound/files/sdl-sound-1.0.3_p20220525-underlinking.patch
new file mode 100644
index 000000000000..cbf96a66320e
--- /dev/null
+++ b/media-libs/sdl-sound/files/sdl-sound-1.0.3_p20220525-underlinking.patch
@@ -0,0 +1,45 @@
+https://github.com/icculus/SDL_sound/pull/80
+
+From 83f33e04125517197520e26452d06b81c2d7b429 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 12 Nov 2022 02:49:21 +0000
+Subject: [PATCH] Fix underlinking with lld (missing -lm)
+
+We need to explicitly search for and link with -lm if needed by
+libc for math libraries like `log` and `sin`:
+```
+ld.lld: error: undefined reference due to --no-allow-shlib-undefined: sin
+>>> referenced by ../.libs/libSDL_sound.so
+
+ld.lld: error: undefined reference due to --no-allow-shlib-undefined: log
+>>> referenced by ../.libs/libSDL_sound.so
+```
+
+It turns out Gentoo has actually had a patch for this since 2012 (mea
+culpa!) but it never made its way upstream.
+
+We're already using libtool, so just use the macro it provides for
+this purpose.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -12,7 +12,7 @@ endif
+ SDLSOUND_HDRS = SDL_sound.h
+ SDLSOUND_SRCS = SDL_sound.c SDL_sound_internal.h alt_audio_convert.c alt_audio_convert.h audio_convert.c
+ SDLSOUND_LDFLAGS = -no-undefined -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+-SDLSOUND_LIBADD = decoders/libdecoders.la $(TIMIDITY_LIB)
++SDLSOUND_LIBADD = decoders/libdecoders.la $(TIMIDITY_LIB) $(LIBM)
+
+ if USE_SDL2
+ lib_LTLIBRARIES = libSDL2_sound.la
+--- a/configure.ac
++++ b/configure.ac
+@@ -54,6 +54,7 @@ AC_PROG_CC
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+ LT_INIT([win32-dll])
++LT_LIB_M
+ PKG_PROG_PKG_CONFIG
+
+
diff --git a/media-libs/sdl-sound/sdl-sound-1.0.3_p20220525.ebuild b/media-libs/sdl-sound/sdl-sound-1.0.3_p20220525.ebuild
index 59d4ac776545..f4f1d4c6bc7c 100644
--- a/media-libs/sdl-sound/sdl-sound-1.0.3_p20220525.ebuild
+++ b/media-libs/sdl-sound/sdl-sound-1.0.3_p20220525.ebuild
@@ -5,7 +5,7 @@ EAPI=8
# Check stable-1.0 branch for possible backports/new snapshots
-inherit multilib-minimal
+inherit autotools multilib-minimal
SDL_SOUND_COMMIT="2076a4f555f95ed28dead5e28ee8e57cc74e425f"
@@ -36,6 +36,17 @@ RDEPEND="
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.0.3_p20220525-underlinking.patch
+)
+
+src_prepare() {
+ default
+
+ # Drop this once sdl-sound-1.0.3_p20220525-underlinking.patch merged
+ eautoreconf
+}
+
multilib_src_configure() {
local myeconfargs=(
# TODO: make this optional or switch unconditionally?