commit:     e9fc524a096802f3c6842b91d4aaf4d36b373b63
Author:     Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Wed Aug 27 03:35:07 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep  2 13:17:41 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9fc524a

llvm-core/clang-linker-config: New package

Provide a new package which creates a partial clang config file
`/etc/clang/${LLVM_VERSION}/gentoo-linker.cfg`, used to control the
default linker 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-linker-config-20.ebuild                  | 28 ++++++++++++++++++++++
 .../clang-linker-config-21.ebuild                  | 28 ++++++++++++++++++++++
 .../clang-linker-config-22.ebuild                  | 27 +++++++++++++++++++++
 llvm-core/clang-linker-config/metadata.xml         | 17 +++++++++++++
 metadata/stabilization-groups/llvm.group           |  1 +
 5 files changed, 101 insertions(+)

diff --git a/llvm-core/clang-linker-config/clang-linker-config-20.ebuild 
b/llvm-core/clang-linker-config/clang-linker-config-20.ebuild
new file mode 100644
index 000000000000..c0040174baf9
--- /dev/null
+++ b/llvm-core/clang-linker-config/clang-linker-config-20.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Default linker 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-lld"
+
+RDEPEND="
+       default-lld? ( llvm-core/lld:${PV} )
+       !default-lld? ( sys-devel/binutils )
+"
+
+src_install() {
+       insinto "/etc/clang/${SLOT}"
+       newins - gentoo-linker.cfg <<-EOF
+               # This file is initially generated by ${CATEGORY}/${PN}.
+               # It is used to control the default linker used by clang.
+
+               -fuse-ld=$(usex default-lld lld bfd)
+       EOF
+}

diff --git a/llvm-core/clang-linker-config/clang-linker-config-21.ebuild 
b/llvm-core/clang-linker-config/clang-linker-config-21.ebuild
new file mode 100644
index 000000000000..c0040174baf9
--- /dev/null
+++ b/llvm-core/clang-linker-config/clang-linker-config-21.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Default linker 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-lld"
+
+RDEPEND="
+       default-lld? ( llvm-core/lld:${PV} )
+       !default-lld? ( sys-devel/binutils )
+"
+
+src_install() {
+       insinto "/etc/clang/${SLOT}"
+       newins - gentoo-linker.cfg <<-EOF
+               # This file is initially generated by ${CATEGORY}/${PN}.
+               # It is used to control the default linker used by clang.
+
+               -fuse-ld=$(usex default-lld lld bfd)
+       EOF
+}

diff --git a/llvm-core/clang-linker-config/clang-linker-config-22.ebuild 
b/llvm-core/clang-linker-config/clang-linker-config-22.ebuild
new file mode 100644
index 000000000000..8954763de264
--- /dev/null
+++ b/llvm-core/clang-linker-config/clang-linker-config-22.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Default linker configuration for clang"
+HOMEPAGE="https://clang.llvm.org/";
+S=${WORKDIR}
+
+LICENSE="public-domain"
+SLOT="${PV}"
+IUSE="default-lld"
+
+RDEPEND="
+       default-lld? ( llvm-core/lld:${PV} )
+       !default-lld? ( sys-devel/binutils )
+"
+
+src_install() {
+       insinto "/etc/clang/${SLOT}"
+       newins - gentoo-linker.cfg <<-EOF
+               # This file is initially generated by ${CATEGORY}/${PN}.
+               # It is used to control the default linker used by clang.
+
+               -fuse-ld=$(usex default-lld lld bfd)
+       EOF
+}

diff --git a/llvm-core/clang-linker-config/metadata.xml 
b/llvm-core/clang-linker-config/metadata.xml
new file mode 100644
index 000000000000..13b40c5f71d1
--- /dev/null
+++ b/llvm-core/clang-linker-config/metadata.xml
@@ -0,0 +1,17 @@
+<?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-lld">Use lld as the default linker for 
clang</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 98b17dae62be..caa0d6c619e5 100644
--- a/metadata/stabilization-groups/llvm.group
+++ b/metadata/stabilization-groups/llvm.group
@@ -24,6 +24,7 @@ llvm-runtimes/libcxx
 llvm-runtimes/libgcc
 llvm-runtimes/openmp
 llvm-runtimes/offload
+llvm-core/clang-linker-config
 llvm-core/clang-runtime
 llvm-core/libclc
 llvm-runtimes/libatomic-stub

Reply via email to