commit:     1a3cdc7e4e06d62b30c081c0e5c655414cb5a414
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 18 16:31:37 2021 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Mon Oct 18 16:31:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a3cdc7e

app-emulation/fs-uae: Fix 3.1.35 build on musl

Closes: https://bugs.gentoo.org/818757
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../fs-uae/files/fs-uae-3.1.35-deepbind.patch      | 43 ++++++++++++++++++++++
 app-emulation/fs-uae/fs-uae-3.1.35.ebuild          |  1 +
 2 files changed, 44 insertions(+)

diff --git a/app-emulation/fs-uae/files/fs-uae-3.1.35-deepbind.patch 
b/app-emulation/fs-uae/files/fs-uae-3.1.35-deepbind.patch
new file mode 100644
index 00000000000..0a60301772f
--- /dev/null
+++ b/app-emulation/fs-uae/files/fs-uae-3.1.35-deepbind.patch
@@ -0,0 +1,43 @@
+From c5b02df4598c5fbe7a034b67ee06c506abeb3828 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <ch...@gentoo.org>
+Date: Mon, 18 Oct 2021 10:22:09 +0100
+Subject: [PATCH] Don't assume RTLD_DEEPBIND is always present on Linux
+
+It's not supported by musl.
+---
+ configure.ac   | 5 +++++
+ src/dlopen.cpp | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 6e41d68e..2cac2dac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -655,6 +655,11 @@ AC_CHECK_FUNCS([gettimeofday])
+ AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [#include <time.h>])
+ 
+ 
++# RTLD_DEEPBIND is not supported by all C libraries.
++
++AC_CHECK_DECLS([RTLD_DEEPBIND], [], [], [#include <dlfcn.h>])
++
++
+ # Check for POSIX support.
+ 
+ AS_CASE([$host_os],
+diff --git a/src/dlopen.cpp b/src/dlopen.cpp
+index f79c401b..14edbc02 100644
+--- a/src/dlopen.cpp
++++ b/src/dlopen.cpp
+@@ -22,7 +22,7 @@ UAE_DLHANDLE uae_dlopen(const TCHAR *path)
+       }
+ #ifdef _WIN32
+       result = LoadLibrary(path);
+-#elif defined(LINUX)
++#elif HAVE_DECL_RTLD_DEEPBIND == 1
+       result = dlopen(path, RTLD_NOW | RTLD_DEEPBIND);
+ #else
+       result = dlopen(path, RTLD_NOW);
+-- 
+2.32.0
+

diff --git a/app-emulation/fs-uae/fs-uae-3.1.35.ebuild 
b/app-emulation/fs-uae/fs-uae-3.1.35.ebuild
index d60ff90041d..be1afebd83d 100644
--- a/app-emulation/fs-uae/fs-uae-3.1.35.ebuild
+++ b/app-emulation/fs-uae/fs-uae-3.1.35.ebuild
@@ -41,6 +41,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-3.0.0-libmpeg2.patch
        "${FILESDIR}"/${PN}-3.0.0-Xatom.h.patch
        "${FILESDIR}"/${PN}-3.1.35-ar.patch
+       "${FILESDIR}"/${PN}-3.1.35-deepbind.patch
 )
 
 src_prepare() {

Reply via email to