public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alfredo Tupone <tupone@gentoo.org>
To: gentoo-dev@lists.gentoo.org, toolchain@gentoo.org
Subject: [gentoo-dev] [PATCH 3/3] A check that the compiler used to build ada is ada and not newer
Date: Thu, 25 Apr 2024 17:44:07 +0200	[thread overview]
Message-ID: <20240425154537.32502-3-tupone@gentoo.org> (raw)
In-Reply-To: <20240425154537.32502-1-tupone@gentoo.org>

Maybe a more detailed check can be done, as some version can be built with newer compiler
Could be envisaged to switch the compiler automatically "gcc-config x" instead of die

Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
---
 eclass/toolchain.eclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index f8e06fa39884..ce665b3c594b 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -540,30 +540,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}"
-- 
2.43.2



  parent reply	other threads:[~2024-04-25 15:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ada related changes to toolchain.eclass>
2024-04-25 15:44 ` [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work Alfredo Tupone
2024-04-25 15:44   ` [gentoo-dev] [PATCH 2/3] To build ada we need a c++ compiler too Alfredo Tupone
2024-04-26  8:29     ` [gentoo-dev] " Arsen Arsenović
2024-04-26 18:06       ` Alfredo Tupone
2024-04-30  6:25         ` Sam James
2024-04-25 15:44   ` Alfredo Tupone [this message]
2024-04-26  8:34   ` [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work Arsen Arsenović
2024-04-26 17:53     ` Alfredo Tupone
2024-04-30  8:51       ` Arsen Arsenović

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240425154537.32502-3-tupone@gentoo.org \
    --to=tupone@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=toolchain@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox