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 (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 43A27158041 for ; Fri, 22 Mar 2024 18:12:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58C9DE29E2; Fri, 22 Mar 2024 18:12:29 +0000 (UTC) Received: from tupone.it (tupone.it [IPv6:2a01:4f9:2b:129a::2]) (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 DC5AEE29C0 for ; Fri, 22 Mar 2024 18:12:28 +0000 (UTC) Received: from alfredo.tupone.it (unknown [IPv6:2a01:e11:b:c630:2e0:4cff:fe69:49b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by tupone.it (Postfix) with ESMTPSA id 215DF84004A for ; Fri, 22 Mar 2024 19:12:27 +0100 (CET) Date: Fri, 22 Mar 2024 19:12:22 +0100 From: Alfredo Tupone To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] Subject: [PATCH] toolchain-func.eclass: ada related changes Message-ID: <20240322191222.7089fc95@alfredo.tupone.it> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.39; x86_64-pc-linux-gnu) 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: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: b263cbd7-db70-488c-b0f6-c18cd0a99b23 X-Archives-Hash: c71d3eae5ec6e768144f69ee09e1d3f0 inject ada in TC_FEATURES so the check on 'tc_has_feature ada' works. Check that when building ada we do not use a newer compiler to build it. Probably there is a better sed to check the selected compiler. I take the first number that is in the gnatmake -v string, and if present, the ada compiler is available and that is the slot. dev-lang/gnat-gpl-2021 return 2021 and that is slot 10. Please review Signed-off-by: Alfredo Tupone --- eclass/toolchain.eclass | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index e962c8181693..c58837bef811 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -243,38 +243,38 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then IUSE+=" objc-gc" TC_FEATURES+=( objc-gc ) IUSE+=" libssp objc++" # Stop forcing openmp on by default in the eclass. Gradually phase it out. # See bug #890999. if tc_version_is_at_least 13.0.0_pre20221218 ; then IUSE+=" openmp" else IUSE+=" +openmp" fi IUSE+=" fixed-point" IUSE+=" go" IUSE+=" +sanitize" TC_FEATURES+=( sanitize ) IUSE+=" graphite" TC_FEATURES+=( graphite ) - IUSE+=" ada" IUSE+=" vtv" IUSE+=" jit" IUSE+=" +pie +ssp pch" IUSE+=" systemtap" TC_FEATURES+=( systemtap ) tc_version_is_at_least 9.0 && IUSE+=" d" TC_FEATURES+=( d ) + tc_version_is_at_least 9.0 && IUSE+=" ada" TC_FEATURES+=( ada ) tc_version_is_at_least 9.1 && IUSE+=" lto" tc_version_is_at_least 10 && IUSE+=" cet" tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd ) tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind ) tc_version_is_at_least 11 && IUSE+=" custom-cflags" tc_version_is_at_least 12 && IUSE+=" ieee-long-double" tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-znow" tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection" tc_version_is_at_least 13.0.0_pre20221218 ${PV} && IUSE+=" modula2" # See https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615944.html # and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why # it was disabled in 13. tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" fi @@ -486,30 +486,42 @@ get_gcc_src_uri() { echo "${GCC_SRC_URI}" } SRC_URI=$(get_gcc_src_uri) #---->> pkg_pretend <<---- toolchain_pkg_pretend() { if ! _tc_use_if_iuse cxx ; then _tc_use_if_iuse go && \ ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' _tc_use_if_iuse objc++ && \ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' fi + if _tc_use_if_iuse ada ; then + if ! _tc_use_if_iuse cxx ; then + ewarn 'Ada requires a C++ compiler, disabled due to USE="-cxx"' + else + prevAdaSLOT=$(gnatmake -v 2>&1 | sed -n '2 p' | sed 's:^[^0-9]*\([0-9]\+\).*:\1:' | sed 's:2021:10:' ) + if [[ -z "${prevAdaSLOT}" ]] ; then + die 'Ada requires an Ada compiler' + elif [[ ${SLOT} -lt ${prevAdaSLOT} ]] ; then + die 'Ada cannot be built with a newer compiler' + fi + fi + fi } #---->> pkg_setup <<---- toolchain_pkg_setup() { # We don't want to use the installed compiler's specs to build gcc unset GCC_SPECS # bug #265283 unset LANGUAGES # See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html # Avoid really confusing logs from subconfigure spam, makes logs far # more legible. MAKEOPTS="--output-sync=line ${MAKEOPTS}" @@ -2372,31 +2384,31 @@ should_we_gcc_config() { # # Also add a hook so special ebuilds (kgcc64) can control which languages # exactly get enabled gcc-lang-supported() { grep ^language=\"${1}\" "${S}"/gcc/*/config-lang.in > /dev/null || return 1 [[ -z ${TOOLCHAIN_ALLOWED_LANGS} ]] && return 0 has $1 ${TOOLCHAIN_ALLOWED_LANGS} } _tc_use_if_iuse() { in_iuse $1 && use $1 } is_ada() { gcc-lang-supported ada || return 1 - _tc_use_if_iuse ada + _tc_use_if_iuse cxx && _tc_use_if_iuse ada } is_cxx() { gcc-lang-supported 'c++' || return 1 _tc_use_if_iuse cxx } is_d() { gcc-lang-supported d || return 1 _tc_use_if_iuse d } is_f77() { gcc-lang-supported f77 || return 1 _tc_use_if_iuse fortran -- 2.43.2