commit:     6d506cce2ed2543b881451f75ce3b898e2c996d8
Author:     Alexey Sokolov <alexey+gentoo <AT> asokolov <DOT> org>
AuthorDate: Fri Jan 26 23:55:43 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 28 08:55:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d506cce

sys-devel/clang-common: support llvm prefix on mac

Bug: https://bugs.gentoo.org/758167
Signed-off-by: Alexey Sokolov <alexey+gentoo <AT> asokolov.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../clang-common/clang-common-16.0.6-r2.ebuild     | 29 ++++++++++++++++++---
 .../clang-common/clang-common-17.0.6-r1.ebuild     | 30 ++++++++++++++++++++--
 .../clang-common/clang-common-18.0.0.9999.ebuild   | 30 ++++++++++++++++++++--
 .../clang-common-18.0.0_pre20240106.ebuild         | 30 ++++++++++++++++++++--
 .../clang-common-18.0.0_pre20240113.ebuild         | 30 ++++++++++++++++++++--
 .../clang-common-18.0.0_pre20240120.ebuild         | 30 ++++++++++++++++++++--
 .../clang-common/clang-common-19.0.0.9999.ebuild   | 30 ++++++++++++++++++++--
 sys-devel/clang-common/metadata.xml                |  1 +
 8 files changed, 195 insertions(+), 15 deletions(-)

diff --git a/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild 
b/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild
index 88fce05309fd..4385b576d482 100644
--- a/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild
+++ b/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -12,8 +12,8 @@ LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86 ~amd64-linux 
~ppc-macos ~x64-macos"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -153,6 +153,29 @@ src_install() {
                        @gentoo-common.cfg
                EOF
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+               cat >> "${ED}/etc/clang/clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild 
b/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild
index 7811c78f5eae..0083e09889b4 100644
--- a/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild
@@ -12,8 +12,8 @@ LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 KEYWORDS="amd64 ~arm arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc x86 ~amd64-linux 
~ppc-macos ~x64-macos"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -75,6 +75,12 @@ _doclang_cfg() {
                EOF
        done
 
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
+
        newins - "${triple}-clang-cpp.cfg" <<-EOF
                # This configuration file is used by the ${triple}-clang-cpp 
driver.
                @gentoo-common.cfg
@@ -241,6 +247,26 @@ src_install() {
                local abi_chost=$(get_abi_CHOST "${abi}")
                doclang_cfg "${abi_chost}"
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild 
b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
index dbc4a213e1c4..a50679150043 100644
--- a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
@@ -11,8 +11,8 @@ HOMEPAGE="https://llvm.org/";
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -74,6 +74,12 @@ _doclang_cfg() {
                EOF
        done
 
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
+
        newins - "${triple}-clang-cpp.cfg" <<-EOF
                # This configuration file is used by the ${triple}-clang-cpp 
driver.
                @gentoo-common.cfg
@@ -242,6 +248,26 @@ src_install() {
                local abi_chost=$(get_abi_CHOST "${abi}")
                doclang_cfg "${abi_chost}"
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20240106.ebuild 
b/sys-devel/clang-common/clang-common-18.0.0_pre20240106.ebuild
index dbc4a213e1c4..a50679150043 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20240106.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20240106.ebuild
@@ -11,8 +11,8 @@ HOMEPAGE="https://llvm.org/";
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -74,6 +74,12 @@ _doclang_cfg() {
                EOF
        done
 
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
+
        newins - "${triple}-clang-cpp.cfg" <<-EOF
                # This configuration file is used by the ${triple}-clang-cpp 
driver.
                @gentoo-common.cfg
@@ -242,6 +248,26 @@ src_install() {
                local abi_chost=$(get_abi_CHOST "${abi}")
                doclang_cfg "${abi_chost}"
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20240113.ebuild 
b/sys-devel/clang-common/clang-common-18.0.0_pre20240113.ebuild
index dbc4a213e1c4..a50679150043 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20240113.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20240113.ebuild
@@ -11,8 +11,8 @@ HOMEPAGE="https://llvm.org/";
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -74,6 +74,12 @@ _doclang_cfg() {
                EOF
        done
 
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
+
        newins - "${triple}-clang-cpp.cfg" <<-EOF
                # This configuration file is used by the ${triple}-clang-cpp 
driver.
                @gentoo-common.cfg
@@ -242,6 +248,26 @@ src_install() {
                local abi_chost=$(get_abi_CHOST "${abi}")
                doclang_cfg "${abi_chost}"
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20240120.ebuild 
b/sys-devel/clang-common/clang-common-18.0.0_pre20240120.ebuild
index dbc4a213e1c4..a50679150043 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20240120.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20240120.ebuild
@@ -11,8 +11,8 @@ HOMEPAGE="https://llvm.org/";
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -74,6 +74,12 @@ _doclang_cfg() {
                EOF
        done
 
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
+
        newins - "${triple}-clang-cpp.cfg" <<-EOF
                # This configuration file is used by the ${triple}-clang-cpp 
driver.
                @gentoo-common.cfg
@@ -242,6 +248,26 @@ src_install() {
                local abi_chost=$(get_abi_CHOST "${abi}")
                doclang_cfg "${abi_chost}"
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild 
b/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild
index dbc4a213e1c4..a50679150043 100644
--- a/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild
@@ -11,8 +11,8 @@ HOMEPAGE="https://llvm.org/";
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
 IUSE="
-       default-compiler-rt default-libcxx default-lld llvm-libunwind
-       hardened
+       default-compiler-rt default-libcxx default-lld
+       bootstrap-prefix hardened llvm-libunwind
 "
 
 PDEPEND="
@@ -74,6 +74,12 @@ _doclang_cfg() {
                EOF
        done
 
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die
+                       -lc++abi
+               EOF
+       fi
+
        newins - "${triple}-clang-cpp.cfg" <<-EOF
                # This configuration file is used by the ${triple}-clang-cpp 
driver.
                @gentoo-common.cfg
@@ -242,6 +248,26 @@ src_install() {
                local abi_chost=$(get_abi_CHOST "${abi}")
                doclang_cfg "${abi_chost}"
        done
+
+       if use kernel_Darwin; then
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       # Gentoo Prefix on Darwin
+                       -Wl,-search_paths_first
+                       -Wl,-rpath,${EPREFIX}/usr/lib
+                       -L ${EPREFIX}/usr/lib
+                       -isystem ${EPREFIX}/usr/include
+                       -isysroot ${EPREFIX}/MacOSX.sdk
+               EOF
+               if use bootstrap-prefix ; then
+                       # bootstrap-prefix is only set during stage2 of 
bootstrapping
+                       # Prefix, where EPREFIX is set to EPREFIX/tmp.
+                       # Here we need to point it at the future lib dir of the 
stage3's
+                       # EPREFIX.
+                       cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                               -Wl,-rpath,${EPREFIX}/../usr/lib
+                       EOF
+               fi
+       fi
 }
 
 pkg_preinst() {

diff --git a/sys-devel/clang-common/metadata.xml 
b/sys-devel/clang-common/metadata.xml
index 7ea033c083c9..1b10f34f3338 100644
--- a/sys-devel/clang-common/metadata.xml
+++ b/sys-devel/clang-common/metadata.xml
@@ -8,6 +8,7 @@
                <remote-id type="github">llvm/llvm-project</remote-id>
        </upstream>
        <use>
+               <flag name="bootstrap-prefix">!!internal use only!! DO NOT SET 
THIS FLAG YOURSELF!, used for bootstrapping Gentoo Prefix</flag>
                <flag name="default-compiler-rt">Use compiler-rt + libunwind 
instead of libgcc as the default rtlib for clang</flag>
                <flag name="default-libcxx">Use libc++ instead of libstdc++ as 
the default stdlib for clang</flag>
                <flag name="default-lld">Use lld as the default linker for 
clang</flag>

Reply via email to