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 7E85F1581F0 for ; Fri, 13 Dec 2024 22:32:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 69B2AE08F9; Fri, 13 Dec 2024 22:32:02 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 DCE4DE07FA for ; Fri, 13 Dec 2024 22:32:00 +0000 (UTC) From: Andreas Sturmlechner To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [RFC] [PATCH] toolchain-funcs.eclass: toolchain-funcs.eclass: Add tc-check-min_ver() Date: Fri, 13 Dec 2024 23:31:54 +0100 Message-ID: <6124732.lOV4Wx5bFT@tuxbrain.fritz.box> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart4987495.31r3eYUQgx"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Archives-Salt: d1779b2a-0407-4297-ad00-c3ee81bb8ecb X-Archives-Hash: c8bc476e9319885fa86bb45c0ceca0f7 --nextPart4987495.31r3eYUQgx Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Andreas Sturmlechner To: gentoo-dev@lists.gentoo.org Date: Fri, 13 Dec 2024 23:31:54 +0100 Message-ID: <6124732.lOV4Wx5bFT@tuxbrain.fritz.box> MIME-Version: 1.0 Every once in a while, a package requires a really up to date active compiler in order to build successfully. ecm.eclass had inherited such a mechanism, albeit GCC specific, from older kde* eclasses. I don't think that is a good place for it so I suggest to add a more universal function to toolchain-funcs.eclass. Similar to tc-check-openmp. eclass/toolchain-funcs.eclass | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 2911ed66e63c..cd3dcf000db7 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 ${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 --nextPart4987495.31r3eYUQgx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQITBAABCgB9FiEESn1gz6RHOTQPAoX/ASQjMY0fts0FAmdctdpfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDRB N0Q2MENGQTQ0NzM5MzQwRjAyODVGRjAxMjQyMzMxOEQxRkI2Q0QACgkQASQjMY0f ts3pbAv/QI92uXv5pGiqsIkqt174KCGF9pprlVANDJvimr1G0CdfM2xXoALpT4P+ 6gs78bCUoqEDKGd6JxCs6Qv0ndMHayM503J5JSgacDzXCdJgD8l1N1/typyMga08 RdgSx1I+B5JuelZtiGlzAy5P0wmcHC0102KeXbWNexEnZrUyor6J1dP4MCKggRo3 q7bbWcOmf2jVgLhyTz+j00qBOO9ihiJIeKeVfW4zVjrdXfCO9Td73yax/B/+WqI/ iHAROcEMQqG7DOjvPm2LBVyHKkeN+3lzqCjyWb8Djw60+q/Q2inaRfiSb4Q5VwKK Vlklfvblrt3mMEqRijwCVDSdRczsgghAib7HKFpQtCxWgYWGiZ63wrWdq6jeH0yW 6TiHHzgPWchRnB2kfHzatIQvSOsHnnzR1vfifTf/hwZANOm467CsmXdotCpJH4+i S9WUKMa5ZF/PB7IlQMosgdJNwMEELR4sctZzUl84/tpG0e8Az+Rdz/9PcqnKrv5g kbi7M3ce =Hw76 -----END PGP SIGNATURE----- --nextPart4987495.31r3eYUQgx--