commit: 6956bbfbf02b6c9d75143454eb93779b42a21c24
Author: Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Sat Nov 18 18:13:31 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 23 13:26:27 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6956bbfb
sys-devel/clang-common: install config files for llvm internal triples
* Also drop a redundant doclang_cfg invocation.
* This change is to ensure that invoking clang instead of ${TARGET}-clang
also uses the installed config files. Problem being that llvm sees its
target triple differently from what Gentoo uses and therefore may lead
to it ignoring the installed config files. For example x86 Gentoo uses
i686-pc-linux-gnu as its CHOST and this leads to
i686-{pc,unknown,gentoo}-linux-gnu config files to be installed, this is
while llvm internally prefers to use i386-pc-linux-gnu as its target when
not invoked explicitly with a target in the executable name or with --target=
leading it to ingore them when invoked with just "clang". This also affects
multilib so on amd64 clang -m32 exhibits the same issue.
* This doesn't address irregularities with prefix installs where the os version
and the lack of vendor field may lead to this same issue.
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/33893
Signed-off-by: Sam James <sam <AT> gentoo.org>
...17.0.4.ebuild => clang-common-17.0.4-r1.ebuild} | 38 +++++++++++++++++++---
...17.0.5.ebuild => clang-common-17.0.5-r1.ebuild} | 38 +++++++++++++++++++---
.../clang-common/clang-common-18.0.0.9999.ebuild | 38 +++++++++++++++++++---
...d => clang-common-18.0.0_pre20231104-r1.ebuild} | 38 +++++++++++++++++++---
...d => clang-common-18.0.0_pre20231111-r1.ebuild} | 38 +++++++++++++++++++---
5 files changed, 165 insertions(+), 25 deletions(-)
diff --git a/sys-devel/clang-common/clang-common-17.0.4.ebuild
b/sys-devel/clang-common/clang-common-17.0.4-r1.ebuild
similarity index 88%
rename from sys-devel/clang-common/clang-common-17.0.4.ebuild
rename to sys-devel/clang-common/clang-common-17.0.4-r1.ebuild
index 696ae8ee4996..99047721833e 100644
--- a/sys-devel/clang-common/clang-common-17.0.4.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.4-r1.ebuild
@@ -63,7 +63,7 @@ pkg_pretend() {
fi
}
-doclang_cfg() {
+_doclang_cfg() {
local triple="${1}"
local tool
@@ -93,6 +93,37 @@ doclang_cfg() {
done
}
+doclang_cfg() {
+ local triple="${1}"
+
+ _doclang_cfg ${triple}
+
+ # LLVM may have different arch names in some cases. For example in x86
+ # profiles the triple uses i686, but llvm will prefer i386 if invoked
+ # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
+ # be used if invoked through ${CHOST}-clang{,++,-cpp} though.
+ #
+ # To make sure the correct triples are installed,
+ # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
+ # and compare with CHOST values in profiles.
+
+ local abi=${triple%%-*}
+ case ${abi} in
+ armv4l|armv4t|armv5tel|armv6j|armv7a)
+ _doclang_cfg ${triple/${abi}/arm}
+ ;;
+ i686)
+ _doclang_cfg ${triple/${abi}/i386}
+ ;;
+ sparc)
+ _doclang_cfg ${triple/${abi}/sparcel}
+ ;;
+ sparc64)
+ _doclang_cfg ${triple/${abi}/sparcv9}
+ ;;
+ esac
+}
+
src_install() {
newbashcomp bash-autocomplete.sh clang
@@ -204,10 +235,7 @@ src_install() {
# We only install config files for supported ABIs because unprefixed
tools
# might be used for crosscompilation where e.g. PIE may not be
supported.
- # See bug #912237 and bug #901247.
- doclang_cfg "${CHOST}"
-
- # Just ${CHOST} won't do due to bug #912685.
+ # See bug #912237 and bug #901247. Just ${CHOST} won't do due to bug
#912685.
local abi
for abi in $(get_all_abis); do
local abi_chost=$(get_abi_CHOST "${abi}")
diff --git a/sys-devel/clang-common/clang-common-17.0.5.ebuild
b/sys-devel/clang-common/clang-common-17.0.5-r1.ebuild
similarity index 88%
rename from sys-devel/clang-common/clang-common-17.0.5.ebuild
rename to sys-devel/clang-common/clang-common-17.0.5-r1.ebuild
index 696ae8ee4996..99047721833e 100644
--- a/sys-devel/clang-common/clang-common-17.0.5.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.5-r1.ebuild
@@ -63,7 +63,7 @@ pkg_pretend() {
fi
}
-doclang_cfg() {
+_doclang_cfg() {
local triple="${1}"
local tool
@@ -93,6 +93,37 @@ doclang_cfg() {
done
}
+doclang_cfg() {
+ local triple="${1}"
+
+ _doclang_cfg ${triple}
+
+ # LLVM may have different arch names in some cases. For example in x86
+ # profiles the triple uses i686, but llvm will prefer i386 if invoked
+ # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
+ # be used if invoked through ${CHOST}-clang{,++,-cpp} though.
+ #
+ # To make sure the correct triples are installed,
+ # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
+ # and compare with CHOST values in profiles.
+
+ local abi=${triple%%-*}
+ case ${abi} in
+ armv4l|armv4t|armv5tel|armv6j|armv7a)
+ _doclang_cfg ${triple/${abi}/arm}
+ ;;
+ i686)
+ _doclang_cfg ${triple/${abi}/i386}
+ ;;
+ sparc)
+ _doclang_cfg ${triple/${abi}/sparcel}
+ ;;
+ sparc64)
+ _doclang_cfg ${triple/${abi}/sparcv9}
+ ;;
+ esac
+}
+
src_install() {
newbashcomp bash-autocomplete.sh clang
@@ -204,10 +235,7 @@ src_install() {
# We only install config files for supported ABIs because unprefixed
tools
# might be used for crosscompilation where e.g. PIE may not be
supported.
- # See bug #912237 and bug #901247.
- doclang_cfg "${CHOST}"
-
- # Just ${CHOST} won't do due to bug #912685.
+ # See bug #912237 and bug #901247. Just ${CHOST} won't do due to bug
#912685.
local abi
for abi in $(get_all_abis); do
local abi_chost=$(get_abi_CHOST "${abi}")
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 b58ed6b486c2..c70a4d8bd045 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
@@ -62,7 +62,7 @@ pkg_pretend() {
fi
}
-doclang_cfg() {
+_doclang_cfg() {
local triple="${1}"
local tool
@@ -92,6 +92,37 @@ doclang_cfg() {
done
}
+doclang_cfg() {
+ local triple="${1}"
+
+ _doclang_cfg ${triple}
+
+ # LLVM may have different arch names in some cases. For example in x86
+ # profiles the triple uses i686, but llvm will prefer i386 if invoked
+ # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
+ # be used if invoked through ${CHOST}-clang{,++,-cpp} though.
+ #
+ # To make sure the correct triples are installed,
+ # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
+ # and compare with CHOST values in profiles.
+
+ local abi=${triple%%-*}
+ case ${abi} in
+ armv4l|armv4t|armv5tel|armv6j|armv7a)
+ _doclang_cfg ${triple/${abi}/arm}
+ ;;
+ i686)
+ _doclang_cfg ${triple/${abi}/i386}
+ ;;
+ sparc)
+ _doclang_cfg ${triple/${abi}/sparcel}
+ ;;
+ sparc64)
+ _doclang_cfg ${triple/${abi}/sparcv9}
+ ;;
+ esac
+}
+
src_install() {
newbashcomp bash-autocomplete.sh clang
@@ -203,10 +234,7 @@ src_install() {
# We only install config files for supported ABIs because unprefixed
tools
# might be used for crosscompilation where e.g. PIE may not be
supported.
- # See bug #912237 and bug #901247.
- doclang_cfg "${CHOST}"
-
- # Just ${CHOST} won't do due to bug #912685.
+ # See bug #912237 and bug #901247. Just ${CHOST} won't do due to bug
#912685.
local abi
for abi in $(get_all_abis); do
local abi_chost=$(get_abi_CHOST "${abi}")
diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20231111.ebuild
b/sys-devel/clang-common/clang-common-18.0.0_pre20231104-r1.ebuild
similarity index 88%
rename from sys-devel/clang-common/clang-common-18.0.0_pre20231111.ebuild
rename to sys-devel/clang-common/clang-common-18.0.0_pre20231104-r1.ebuild
index b58ed6b486c2..c70a4d8bd045 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20231111.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20231104-r1.ebuild
@@ -62,7 +62,7 @@ pkg_pretend() {
fi
}
-doclang_cfg() {
+_doclang_cfg() {
local triple="${1}"
local tool
@@ -92,6 +92,37 @@ doclang_cfg() {
done
}
+doclang_cfg() {
+ local triple="${1}"
+
+ _doclang_cfg ${triple}
+
+ # LLVM may have different arch names in some cases. For example in x86
+ # profiles the triple uses i686, but llvm will prefer i386 if invoked
+ # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
+ # be used if invoked through ${CHOST}-clang{,++,-cpp} though.
+ #
+ # To make sure the correct triples are installed,
+ # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
+ # and compare with CHOST values in profiles.
+
+ local abi=${triple%%-*}
+ case ${abi} in
+ armv4l|armv4t|armv5tel|armv6j|armv7a)
+ _doclang_cfg ${triple/${abi}/arm}
+ ;;
+ i686)
+ _doclang_cfg ${triple/${abi}/i386}
+ ;;
+ sparc)
+ _doclang_cfg ${triple/${abi}/sparcel}
+ ;;
+ sparc64)
+ _doclang_cfg ${triple/${abi}/sparcv9}
+ ;;
+ esac
+}
+
src_install() {
newbashcomp bash-autocomplete.sh clang
@@ -203,10 +234,7 @@ src_install() {
# We only install config files for supported ABIs because unprefixed
tools
# might be used for crosscompilation where e.g. PIE may not be
supported.
- # See bug #912237 and bug #901247.
- doclang_cfg "${CHOST}"
-
- # Just ${CHOST} won't do due to bug #912685.
+ # See bug #912237 and bug #901247. Just ${CHOST} won't do due to bug
#912685.
local abi
for abi in $(get_all_abis); do
local abi_chost=$(get_abi_CHOST "${abi}")
diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20231104.ebuild
b/sys-devel/clang-common/clang-common-18.0.0_pre20231111-r1.ebuild
similarity index 88%
rename from sys-devel/clang-common/clang-common-18.0.0_pre20231104.ebuild
rename to sys-devel/clang-common/clang-common-18.0.0_pre20231111-r1.ebuild
index b58ed6b486c2..c70a4d8bd045 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20231104.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20231111-r1.ebuild
@@ -62,7 +62,7 @@ pkg_pretend() {
fi
}
-doclang_cfg() {
+_doclang_cfg() {
local triple="${1}"
local tool
@@ -92,6 +92,37 @@ doclang_cfg() {
done
}
+doclang_cfg() {
+ local triple="${1}"
+
+ _doclang_cfg ${triple}
+
+ # LLVM may have different arch names in some cases. For example in x86
+ # profiles the triple uses i686, but llvm will prefer i386 if invoked
+ # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
+ # be used if invoked through ${CHOST}-clang{,++,-cpp} though.
+ #
+ # To make sure the correct triples are installed,
+ # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
+ # and compare with CHOST values in profiles.
+
+ local abi=${triple%%-*}
+ case ${abi} in
+ armv4l|armv4t|armv5tel|armv6j|armv7a)
+ _doclang_cfg ${triple/${abi}/arm}
+ ;;
+ i686)
+ _doclang_cfg ${triple/${abi}/i386}
+ ;;
+ sparc)
+ _doclang_cfg ${triple/${abi}/sparcel}
+ ;;
+ sparc64)
+ _doclang_cfg ${triple/${abi}/sparcv9}
+ ;;
+ esac
+}
+
src_install() {
newbashcomp bash-autocomplete.sh clang
@@ -203,10 +234,7 @@ src_install() {
# We only install config files for supported ABIs because unprefixed
tools
# might be used for crosscompilation where e.g. PIE may not be
supported.
- # See bug #912237 and bug #901247.
- doclang_cfg "${CHOST}"
-
- # Just ${CHOST} won't do due to bug #912685.
+ # See bug #912237 and bug #901247. Just ${CHOST} won't do due to bug
#912685.
local abi
for abi in $(get_all_abis); do
local abi_chost=$(get_abi_CHOST "${abi}")