commit:     03e708a309cc6ec49ed64636c351f84f6984ae07
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 10 14:38:19 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 14:38:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03e708a3

sys-devel/clang-common: Handle missing gcc-config gracefully

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-devel/clang-common/clang-common-15.0.2-r1.ebuild       | 14 +++++++-------
 sys-devel/clang-common/clang-common-15.0.3.9999.ebuild     | 14 +++++++-------
 sys-devel/clang-common/clang-common-16.0.0.9999.ebuild     | 14 +++++++-------
 .../clang-common/clang-common-16.0.0_pre20221006-r1.ebuild | 14 +++++++-------
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild 
b/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild
index 287aa05d2957..c921dc1cf0c6 100644
--- a/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild
+++ b/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild
@@ -115,12 +115,12 @@ src_install() {
 }
 
 pkg_preinst() {
-       # TODO: move this to gcc-config and call it here?
-
-       local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
-       if [[ -n ${gcc_path} ]]; then
-               cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
-                       --gcc-install-dir="${gcc_path%%:*}"
-               EOF
+       if has_version sys-devel/gcc-config; then
+               local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
+               if [[ -n ${gcc_path} ]]; then
+                       cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
+                               --gcc-install-dir="${gcc_path%%:*}"
+                       EOF
+               fi
        fi
 }

diff --git a/sys-devel/clang-common/clang-common-15.0.3.9999.ebuild 
b/sys-devel/clang-common/clang-common-15.0.3.9999.ebuild
index 93434632f168..9d8ad198445d 100644
--- a/sys-devel/clang-common/clang-common-15.0.3.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-15.0.3.9999.ebuild
@@ -114,12 +114,12 @@ src_install() {
 }
 
 pkg_preinst() {
-       # TODO: move this to gcc-config and call it here?
-
-       local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
-       if [[ -n ${gcc_path} ]]; then
-               cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
-                       --gcc-install-dir="${gcc_path%%:*}"
-               EOF
+       if has_version sys-devel/gcc-config; then
+               local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
+               if [[ -n ${gcc_path} ]]; then
+                       cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
+                               --gcc-install-dir="${gcc_path%%:*}"
+                       EOF
+               fi
        fi
 }

diff --git a/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild 
b/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild
index 93434632f168..9d8ad198445d 100644
--- a/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild
@@ -114,12 +114,12 @@ src_install() {
 }
 
 pkg_preinst() {
-       # TODO: move this to gcc-config and call it here?
-
-       local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
-       if [[ -n ${gcc_path} ]]; then
-               cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
-                       --gcc-install-dir="${gcc_path%%:*}"
-               EOF
+       if has_version sys-devel/gcc-config; then
+               local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
+               if [[ -n ${gcc_path} ]]; then
+                       cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
+                               --gcc-install-dir="${gcc_path%%:*}"
+                       EOF
+               fi
        fi
 }

diff --git a/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild 
b/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild
index 93434632f168..9d8ad198445d 100644
--- a/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild
+++ b/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild
@@ -114,12 +114,12 @@ src_install() {
 }
 
 pkg_preinst() {
-       # TODO: move this to gcc-config and call it here?
-
-       local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
-       if [[ -n ${gcc_path} ]]; then
-               cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
-                       --gcc-install-dir="${gcc_path%%:*}"
-               EOF
+       if has_version sys-devel/gcc-config; then
+               local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
+               if [[ -n ${gcc_path} ]]; then
+                       cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
+                               --gcc-install-dir="${gcc_path%%:*}"
+                       EOF
+               fi
        fi
 }

Reply via email to