summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <zx2c4@gentoo.org>2024-04-02 01:08:38 +0200
committerJason A. Donenfeld <zx2c4@gentoo.org>2024-04-02 01:08:38 +0200
commit85b120bb3ea6d7583cbdd1bec0d7dee134359a69 (patch)
tree0da9d86c4039fe87db1f0981d7652ef31b5351ec
parentmedia-sound/reaper-bin: add -Wl,-z,lazy for swell preloading (diff)
downloadgentoo-85b120bb3ea6d7583cbdd1bec0d7dee134359a69.tar.gz
gentoo-85b120bb3ea6d7583cbdd1bec0d7dee134359a69.tar.bz2
gentoo-85b120bb3ea6d7583cbdd1bec0d7dee134359a69.zip
media-sound/reaper-bin: move -z,lazy into patch
Now that we've sent this upstream, add this as a patch. Link: https://github.com/justinfrankel/WDL/pull/22 Signed-off-by: Jason A. Donenfeld <zx2c4@gentoo.org>
-rw-r--r--media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch46
-rw-r--r--media-sound/reaper-bin/reaper-bin-7.12-r1.ebuild4
2 files changed, 48 insertions, 2 deletions
diff --git a/media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch b/media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch
new file mode 100644
index 000000000000..9d9508071af8
--- /dev/null
+++ b/media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch
@@ -0,0 +1,46 @@
+From d7fa7b22fdbc894a9986ab686b9c009d25f8cae7 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Tue, 2 Apr 2024 01:03:30 +0200
+Subject: [PATCH] swell-linux: ensure LD lazily binds symbols
+
+On newer toolchains that by default set `-Wl,-z,now`, such as Gentoo's
+23.0 toolchain, setting PRELOAD_GDK causes swell's dlopen() to fail with
+an error like:
+
+ Error loading '/opt/REAPER/libSwell.so': /opt/REAPER/libSwell.so: undefined symbol: gdk_x11_window_get_xid
+
+This is because -z,now, according to the man page, "When generating an
+executable or shared library, mark it to tell the dynamic linker to
+resolve all symbols when the program is started, or when the shared
+library is loaded by dlopen, instead of deferring function call
+resolution to the point when the function is first called." This is
+basically the opposite of what swell's preloading feature wants.
+
+This can be overridden by setting -z,lazy, which according to the man
+page, "When generating an executable or shared library, mark it to tell
+the dynamic linker to defer function call resolution to the point when
+the function is called (lazy binding), rather than at load time."
+
+So pass -Wl,-z,lazy in the preloading case, so that it works no matter
+what the toolchain defaults are.
+---
+ WDL/swell/Makefile | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/WDL/swell/Makefile b/WDL/swell/Makefile
+index 9e7e2d87..8033fb30 100644
+--- a/WDL/swell/Makefile
++++ b/WDL/swell/Makefile
+@@ -140,6 +140,9 @@ ifndef NOGDK
+ endif
+ endif
+ LINKEXTRA += -lGL
++ ifdef PRELOAD_GDK
++ CFLAGS += -Wl,-z,lazy
++ endif
+ endif
+
+ CXXFLAGS = $(CFLAGS)
+--
+2.44.0
+
diff --git a/media-sound/reaper-bin/reaper-bin-7.12-r1.ebuild b/media-sound/reaper-bin/reaper-bin-7.12-r1.ebuild
index 06bcf6617d8f..a6338707abea 100644
--- a/media-sound/reaper-bin/reaper-bin-7.12-r1.ebuild
+++ b/media-sound/reaper-bin/reaper-bin-7.12-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit desktop flag-o-matic xdg
+inherit desktop xdg
DESCRIPTION="Digital audio workstation"
HOMEPAGE="https://www.reaper.fm"
@@ -49,10 +49,10 @@ src_prepare() {
default
cd "WDL-${WDL_COMMIT}" || die
eapply "${FILESDIR}"/libSwell-makefile-cflags.patch
+ eapply "${FILESDIR}"/libSwell-makefile-lazy-binding.patch
}
src_compile() {
- append-cflags -Wl,-z,lazy
emake -C "WDL-${WDL_COMMIT}/WDL/swell" \
PRELOAD_GDK=1 \
ALLOW_WARNINGS=1