From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 315E315802C for ; Tue, 17 Dec 2024 22:14:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 59DF5E0805; Tue, 17 Dec 2024 22:14:17 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 918B5E0805 for ; Tue, 17 Dec 2024 22:14:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4CC2E335C11 for ; Tue, 17 Dec 2024 22:14:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A7FB0AED for ; Tue, 17 Dec 2024 22:14:12 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1734473642.10b4b0976610ae256e6f3bba5181ca57dfad0e08.asturm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/toolchain-funcs.eclass X-VCS-Directories: eclass/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: 10b4b0976610ae256e6f3bba5181ca57dfad0e08 X-VCS-Branch: master Date: Tue, 17 Dec 2024 22:14:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f118dd00-2bc3-43a8-8b7f-2bdcc006135c X-Archives-Hash: 6b4ebf365346f021e1cdcf62f95096d7 commit: 10b4b0976610ae256e6f3bba5181ca57dfad0e08 Author: Andreas Sturmlechner gentoo org> AuthorDate: Fri Dec 13 18:00:16 2024 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Tue Dec 17 22:14:02 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10b4b097 toolchain-funcs.eclass: Add tc-check-min_ver() Signed-off-by: Andreas Sturmlechner gentoo.org> eclass/toolchain-funcs.eclass | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 2911ed66e63c..0abed5b8d75e 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -647,6 +647,50 @@ _tc-has-openmp() { return ${ret} } +# @FUNCTION: tc-check-min_ver +# @USAGE: +# @DESCRIPTION: +# Minimum version of active GCC or Clang to require. +# +# You should test for any necessary minimum version in pkg_pretend in order to +# warn the user of required toolchain changes. You must still check for it at +# build-time, e.g. +# @CODE +# pkg_pretend() { +# [[ ${MERGE_TYPE} != binary ]] && tc-check-min_ver gcc 13.2.0 +# } +# +# pkg_setup() { +# [[ ${MERGE_TYPE} != binary ]] && tc-check-min_ver gcc 13.2.0 +# } +# @CODE +tc-check-min_ver() { + do_check() { + debug-print "Compiler version check for ${1}" + debug-print "Detected: ${2}" + debug-print "Required: ${3}" + if ver_test ${2} -lt ${3}; then + eerror "Your current compiler is too old for this package!" + die "Active compiler is too old for this package (found ${1} ${2})." + fi + } + + case ${1} in + gcc) + tc-is-gcc || return + do_check GCC $(gcc-version) ${2} + ;; + clang) + tc-is-clang || return + do_check Clang $(clang-version) ${2} + ;; + *) + eerror "Unknown first parameter for ${FUNCNAME} - must be gcc or clang" + die "${FUNCNAME}: Parameter ${1} unknown" + ;; + esac +} + # @FUNCTION: tc-check-openmp # @DESCRIPTION: # Test for OpenMP support with the current compiler and error out with