commit:     f2616e2c1a6dc2df57b016df5603225fdcb8fa32
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Sun May  5 11:45:25 2024 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Sun May  5 11:45:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2616e2c

dev-libs/libgudev: Fix clang-18 compatibility

Closes: https://bugs.gentoo.org/926350
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 .../files/238-clang18-export-dynamic.patch         | 37 ++++++++++++++++
 dev-libs/libgudev/libgudev-238-r2.ebuild           | 51 ++++++++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/dev-libs/libgudev/files/238-clang18-export-dynamic.patch 
b/dev-libs/libgudev/files/238-clang18-export-dynamic.patch
new file mode 100644
index 000000000000..8894f0116ed0
--- /dev/null
+++ b/dev-libs/libgudev/files/238-clang18-export-dynamic.patch
@@ -0,0 +1,37 @@
+From a354fcbb911220965f737d38fefe700f7b941cf8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.k...@gmail.com>
+Date: Tue, 16 Jan 2024 12:02:46 -0800
+Subject: [PATCH] meson: Pass --export-dynamic option to linker
+
+Bypass the compiler driver trying to comprehend and translate it for
+linker, since its not clear what the right behavior should be, gcc seems
+to translate it into --export-dynamic but clang 18+ rejects it
+
+| x86_64-yoe-linux-clang: error: unknown argument: '-export-dynamic'
+
+also see [1]
+
+This makes it work as intended across gcc and clang
+
+[1] 
https://discourse.llvm.org/t/clang-option-export-dynamic-parse-to-e-xport-dynamic-error/72454
+Signed-off-by: Khem Raj <raj.k...@gmail.com>
+---
+ gudev/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gudev/meson.build b/gudev/meson.build
+index e904203..3ed580b 100644
+--- a/gudev/meson.build
++++ b/gudev/meson.build
+@@ -33,7 +33,7 @@ libgudev_c_args = [
+ ]
+ 
+ libgudev_link_args = [
+-  '-export-dynamic',
++  '-Wl,--export-dynamic',
+   '-Wl,--version-script,@0@/libgudev-1.0.sym'.format(top_srcdir),
+ ]
+ 
+-- 
+GitLab
+

diff --git a/dev-libs/libgudev/libgudev-238-r2.ebuild 
b/dev-libs/libgudev/libgudev-238-r2.ebuild
new file mode 100644
index 000000000000..7e9eb935f5a6
--- /dev/null
+++ b/dev-libs/libgudev/libgudev-238-r2.ebuild
@@ -0,0 +1,51 @@
+# Copyright 2015-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit meson-multilib
+
+DESCRIPTION="GObject bindings for libudev"
+HOMEPAGE="https://wiki.gnome.org/Projects/libgudev";
+SRC_URI="https://download.gnome.org/sources/libgudev/${PV}/${P}.tar.xz";
+
+LICENSE="LGPL-2.1+"
+SLOT="0/0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+IUSE="introspection test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       >=dev-libs/glib-2.38.0:2[${MULTILIB_USEDEP}]
+       >=virtual/libudev-251:=[sticky-tags(+),${MULTILIB_USEDEP}]
+       introspection? ( >=dev-libs/gobject-introspection-1.31.1 )
+"
+DEPEND="${RDEPEND}
+       test? ( dev-util/umockdev[${MULTILIB_USEDEP}] )
+"
+BDEPEND="
+       dev-util/glib-utils
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PV}-clang18-export-dynamic.patch #926350
+)
+
+multilib_src_configure() {
+       local emesonargs=(
+               $(meson_native_use_feature introspection)
+               -Dgtk_doc=false
+               $(meson_feature test tests)
+               -Dvapi=disabled
+       )
+       meson_src_configure
+}
+
+src_test() {
+       # libsandbox interferes somehow.
+       # There are no access violations, but tests fail.
+       # https://bugs.gentoo.org/805449
+       local -x SANDBOX_ON=0
+       meson-multilib_src_test
+}

Reply via email to