commit:     687e64f1549066f23bd8d744d554b626423aa7fe
Author:     Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Tue Aug 26 15:49:48 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep  2 13:17:42 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=687e64f1

llvm-runtimes/clang-unwindlib-config: New package

Provide a new package which creates a partial clang config file
`/etc/clang/${LLVM_VERSION}/gentoo-unwindlib.cfg`, unsed to control the
default unwindlib used by clang.

Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Closes: https://bugs.gentoo.org/951445
Part-of: https://github.com/gentoo/gentoo/pull/42663
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/42663
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../clang-unwindlib-config-20.ebuild               | 31 ++++++++++++++++++++++
 .../clang-unwindlib-config-21.ebuild               | 31 ++++++++++++++++++++++
 .../clang-unwindlib-config-22.ebuild               | 30 +++++++++++++++++++++
 llvm-runtimes/clang-unwindlib-config/metadata.xml  | 18 +++++++++++++
 metadata/stabilization-groups/llvm.group           |  1 +
 5 files changed, 111 insertions(+)

diff --git 
a/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-20.ebuild 
b/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-20.ebuild
new file mode 100644
index 000000000000..a48029c5aa37
--- /dev/null
+++ b/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-20.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Default unwindlib configuration for clang"
+HOMEPAGE="https://clang.llvm.org/";
+S=${WORKDIR}
+
+LICENSE="public-domain"
+SLOT="${PV}"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 
~amd64-linux ~arm64-macos ~ppc-macos ~x64-macos"
+IUSE="default-compiler-rt llvm-libunwind"
+
+RDEPEND="
+       default-compiler-rt? (
+               llvm-libunwind? ( >=llvm-runtimes/libunwind-${PV}[static-libs] )
+               !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
+       )
+       !default-compiler-rt? ( sys-devel/gcc )
+"
+
+src_install() {
+       insinto "/etc/clang/${SLOT}"
+       newins - gentoo-unwindlib.cfg <<-EOF
+               # This file is initially generated by ${CATEGORY}/${PN}.
+               # It is used to control the default unwindlib used by clang.
+
+               --unwindlib=$(usex default-compiler-rt libunwind libgcc)
+       EOF
+}

diff --git 
a/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-21.ebuild 
b/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-21.ebuild
new file mode 100644
index 000000000000..a48029c5aa37
--- /dev/null
+++ b/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-21.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Default unwindlib configuration for clang"
+HOMEPAGE="https://clang.llvm.org/";
+S=${WORKDIR}
+
+LICENSE="public-domain"
+SLOT="${PV}"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 
~amd64-linux ~arm64-macos ~ppc-macos ~x64-macos"
+IUSE="default-compiler-rt llvm-libunwind"
+
+RDEPEND="
+       default-compiler-rt? (
+               llvm-libunwind? ( >=llvm-runtimes/libunwind-${PV}[static-libs] )
+               !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
+       )
+       !default-compiler-rt? ( sys-devel/gcc )
+"
+
+src_install() {
+       insinto "/etc/clang/${SLOT}"
+       newins - gentoo-unwindlib.cfg <<-EOF
+               # This file is initially generated by ${CATEGORY}/${PN}.
+               # It is used to control the default unwindlib used by clang.
+
+               --unwindlib=$(usex default-compiler-rt libunwind libgcc)
+       EOF
+}

diff --git 
a/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-22.ebuild 
b/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-22.ebuild
new file mode 100644
index 000000000000..fba75218c731
--- /dev/null
+++ b/llvm-runtimes/clang-unwindlib-config/clang-unwindlib-config-22.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Default unwindlib configuration for clang"
+HOMEPAGE="https://clang.llvm.org/";
+S=${WORKDIR}
+
+LICENSE="public-domain"
+SLOT="${PV}"
+IUSE="default-compiler-rt llvm-libunwind"
+
+RDEPEND="
+       default-compiler-rt? (
+               llvm-libunwind? ( >=llvm-runtimes/libunwind-${PV}[static-libs] )
+               !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
+       )
+       !default-compiler-rt? ( sys-devel/gcc )
+"
+
+src_install() {
+       insinto "/etc/clang/${SLOT}"
+       newins - gentoo-unwindlib.cfg <<-EOF
+               # This file is initially generated by ${CATEGORY}/${PN}.
+               # It is used to control the default unwindlib used by clang.
+
+               --unwindlib=$(usex default-compiler-rt libunwind libgcc)
+       EOF
+}

diff --git a/llvm-runtimes/clang-unwindlib-config/metadata.xml 
b/llvm-runtimes/clang-unwindlib-config/metadata.xml
new file mode 100644
index 000000000000..3764a0cbe9e1
--- /dev/null
+++ b/llvm-runtimes/clang-unwindlib-config/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Michal Rostecki</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</email>
+       </maintainer>
+       <use>
+               <flag name="default-compiler-rt">Use compiler-rt + libunwind 
instead of libgcc as the default rtlib for clang</flag>
+               <flag name="llvm-libunwind">Use LLVM libunwind instead of GNU 
libunwind</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">llvm/llvm-project</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/metadata/stabilization-groups/llvm.group 
b/metadata/stabilization-groups/llvm.group
index 7ceb970d5ba7..0346dcc1e558 100644
--- a/metadata/stabilization-groups/llvm.group
+++ b/metadata/stabilization-groups/llvm.group
@@ -26,6 +26,7 @@ llvm-runtimes/openmp
 llvm-runtimes/offload
 llvm-core/clang-linker-config
 llvm-runtimes/clang-rtlib-config
+llvm-runtimes/clang-unwindlib-config
 llvm-core/clang-runtime
 llvm-core/libclc
 llvm-runtimes/libatomic-stub

Reply via email to