commit:     846b5d12f21afe7f6f06c9c829a453625ad14142
Author:     mojyack <mojyack <AT> gmail <DOT> com>
AuthorDate: Thu Mar 13 01:53:05 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Apr 13 15:22:00 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=846b5d12

llvm-runtimes/libatomic-stub: new package, add 0

Clang(LLVM) implements atomic functions in compiler-rt, while GCC
provides a dedicated libatomic for it.
Some apps such as nodejs erroneously depend on GCC through libatomic.
LLVM's atomic builtins and libatomic are source-compatible so such
packages should be also buildable with LLVM.
It would be hard to fix all those packages, so let's deal with it
on compiler-rt side by installing a stub libatomic.a.

Bug: https://bugs.gentoo.org/911340
Signed-off-by: mojyack <mojyack <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/41045
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../libatomic-stub/libatomic-stub-0.ebuild         | 25 ++++++++++++++++++++++
 llvm-runtimes/libatomic-stub/metadata.xml          | 15 +++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/llvm-runtimes/libatomic-stub/libatomic-stub-0.ebuild 
b/llvm-runtimes/libatomic-stub/libatomic-stub-0.ebuild
new file mode 100644
index 000000000000..beb08178ef5b
--- /dev/null
+++ b/llvm-runtimes/libatomic-stub/libatomic-stub-0.ebuild
@@ -0,0 +1,25 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Stub library which allows compiler-rt to replace libatomic"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage";
+S="${WORKDIR}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+       llvm-runtimes/compiler-rt[atomic-builtins(-)]
+       !sys-devel/gcc
+"
+
+src_install() {
+       # Create an empty library, so that -latomic will not fail.
+       # The atomic routines will be provided implicitly by the compiler-rt
+       # builtins library.
+       ${AR} rc libatomic.a || die
+       dolib.a libatomic.a
+}

diff --git a/llvm-runtimes/libatomic-stub/metadata.xml 
b/llvm-runtimes/libatomic-stub/metadata.xml
new file mode 100644
index 000000000000..66178f2b2df6
--- /dev/null
+++ b/llvm-runtimes/libatomic-stub/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+    <maintainer type="person" proxied="yes">
+        <email>[email protected]</email>
+        <name>mojyack</name>
+    </maintainer>
+    <maintainer type="project">
+        <email>[email protected]</email>
+    </maintainer>
+    <maintainer type="project" proxied="proxy">
+        <email>[email protected]</email>
+        <name>Proxy Maintainers</name>
+    </maintainer>
+</pkgmetadata>

Reply via email to