commit:     8a8eb5890e84734a4d152d270750406950f278c7
Author:     Matthew Smith <matthew <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 22 20:35:50 2022 +0000
Commit:     Matthew Smith <matthew <AT> gentoo <DOT> org>
CommitDate: Tue Feb 22 21:06:16 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a8eb589

sys-devel/mold: check compiler version

Acked-by: Sam James <sam <AT> gentoo.org>
Closes: https://bugs.gentoo.org/831473
Closes: https://github.com/gentoo/gentoo/pull/24321
Signed-off-by: Matthew Smith <matthew <AT> gentoo.org>

 sys-devel/mold/mold-1.0.3.ebuild | 11 +++++++++++
 sys-devel/mold/mold-1.1.ebuild   | 11 +++++++++++
 sys-devel/mold/mold-9999.ebuild  | 11 +++++++++++
 3 files changed, 33 insertions(+)

diff --git a/sys-devel/mold/mold-1.0.3.ebuild b/sys-devel/mold/mold-1.0.3.ebuild
index 7948bbc23805..5536efda5951 100644
--- a/sys-devel/mold/mold-1.0.3.ebuild
+++ b/sys-devel/mold/mold-1.0.3.ebuild
@@ -31,6 +31,17 @@ RDEPEND=">=dev-cpp/tbb-2021.4.0:=
        )"
 DEPEND="${RDEPEND}"
 
+pkg_pretend() {
+       # Requires a c++20 compiler, see #831437
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
+                       die "${PN} needs at least gcc 10"
+               elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
+                       die "${PN} needs at least clang 12"
+               fi
+       fi
+}
+
 src_prepare() {
        default
 

diff --git a/sys-devel/mold/mold-1.1.ebuild b/sys-devel/mold/mold-1.1.ebuild
index caa630e22c18..351ef38c6b51 100644
--- a/sys-devel/mold/mold-1.1.ebuild
+++ b/sys-devel/mold/mold-1.1.ebuild
@@ -32,6 +32,17 @@ RDEPEND=">=dev-cpp/tbb-2021.4.0:=
 # TODO: restore SYSTEM_XXHASH upstream?
 DEPEND="${RDEPEND}"
 
+pkg_pretend() {
+       # Requires a c++20 compiler, see #831473
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
+                       die "${PN} needs at least gcc 10"
+               elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
+                       die "${PN} needs at least clang 12"
+               fi
+       fi
+}
+
 src_prepare() {
        default
 

diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-9999.ebuild
index caa630e22c18..351ef38c6b51 100644
--- a/sys-devel/mold/mold-9999.ebuild
+++ b/sys-devel/mold/mold-9999.ebuild
@@ -32,6 +32,17 @@ RDEPEND=">=dev-cpp/tbb-2021.4.0:=
 # TODO: restore SYSTEM_XXHASH upstream?
 DEPEND="${RDEPEND}"
 
+pkg_pretend() {
+       # Requires a c++20 compiler, see #831473
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
+                       die "${PN} needs at least gcc 10"
+               elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
+                       die "${PN} needs at least clang 12"
+               fi
+       fi
+}
+
 src_prepare() {
        default
 

Reply via email to