public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work
       [not found] <ada related changes to toolchain.eclass>
@ 2024-04-25 15:44 ` Alfredo Tupone
  2024-04-25 15:44   ` [gentoo-dev] [PATCH 2/3] To build ada we need a c++ compiler too Alfredo Tupone
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Alfredo Tupone @ 2024-04-25 15:44 UTC (permalink / raw)
  To: gentoo-dev, toolchain

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

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index a5d4345e7fbf..fd820f60f45d 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -288,31 +288,31 @@ 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+=" ada" TC_FEATURES+=( 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.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"
-- 
2.43.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 2/3] To build ada we need  a c++ compiler too
  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   ` Alfredo Tupone
  2024-04-26  8:29     ` [gentoo-dev] " Arsen Arsenović
  2024-04-25 15:44   ` [gentoo-dev] [PATCH 3/3] A check that the compiler used to build ada is ada and not newer Alfredo Tupone
  2024-04-26  8:34   ` [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work Arsen Arsenović
  2 siblings, 1 reply; 9+ messages in thread
From: Alfredo Tupone @ 2024-04-25 15:44 UTC (permalink / raw)
  To: gentoo-dev, toolchain

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

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index fd820f60f45d..f8e06fa39884 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2495,31 +2495,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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] [PATCH 3/3] A check that the compiler used to build ada is ada and not newer
  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-25 15:44   ` Alfredo Tupone
  2024-04-26  8:34   ` [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work Arsen Arsenović
  2 siblings, 0 replies; 9+ messages in thread
From: Alfredo Tupone @ 2024-04-25 15:44 UTC (permalink / raw)
  To: gentoo-dev, toolchain

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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-dev] Re: [PATCH 2/3] To build ada we need  a c++ compiler too
  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     ` Arsen Arsenović
  2024-04-26 18:06       ` Alfredo Tupone
  0 siblings, 1 reply; 9+ messages in thread
From: Arsen Arsenović @ 2024-04-26  8:29 UTC (permalink / raw)
  To: Alfredo Tupone; +Cc: gentoo-dev, toolchain

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

Hi,

Alfredo Tupone <tupone@gentoo.org> writes:

> Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
> ---
>  eclass/toolchain.eclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
> index fd820f60f45d..f8e06fa39884 100644
> --- a/eclass/toolchain.eclass
> +++ b/eclass/toolchain.eclass
> @@ -2495,31 +2495,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 this redundant?  Would gcc-lang-supported c++ (called through the ada
support check) not suffice?

>  }
>  
>  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

-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work
  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-25 15:44   ` [gentoo-dev] [PATCH 3/3] A check that the compiler used to build ada is ada and not newer Alfredo Tupone
@ 2024-04-26  8:34   ` Arsen Arsenović
  2024-04-26 17:53     ` Alfredo Tupone
  2 siblings, 1 reply; 9+ messages in thread
From: Arsen Arsenović @ 2024-04-26  8:34 UTC (permalink / raw)
  To: Alfredo Tupone; +Cc: gentoo-dev, toolchain

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

looks OK at a glance, but could you summarize the issues the patch set
fixes in the commit messages (and reword them to follow convention
generally)?  it is important to have context while looking at a git log.

Alfredo Tupone <tupone@gentoo.org> writes:

> Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
> ---
>  eclass/toolchain.eclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
> index a5d4345e7fbf..fd820f60f45d 100644
> --- a/eclass/toolchain.eclass
> +++ b/eclass/toolchain.eclass
> @@ -288,31 +288,31 @@ 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+=" ada" TC_FEATURES+=( ada )

does this apply for all versions of GCC?

>  	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.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"

-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work
  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ć
  0 siblings, 1 reply; 9+ messages in thread
From: Alfredo Tupone @ 2024-04-26 17:53 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gentoo-dev, toolchain

On Fri, 26 Apr 2024 10:34:44 +0200
Arsen Arsenović <arsen@gentoo.org> wrote:

> looks OK at a glance, but could you summarize the issues the patch set
> fixes in the commit messages (and reword them to follow convention
> generally)?  it is important to have context while looking at a git
> log.

> > -	IUSE+=" ada"
> > +	IUSE+=" ada" TC_FEATURES+=( ada )  

The change is about adding TC_FEATURES+=( ada )

Some lines towards the end there is 


# TODO: Add a pkg_setup & pkg_pretend check for whether the active
compiler # supports Ada.
if tc_has_feature ada ; then
    BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] )
)"
fi


it looks to me that if TC_FEATURES+=( ada ) is missing, that dependency
is not added

> 
> does this apply for all versions of GCC?

I really don't know. Ada source are provided with gcc-8 too (the oldest
version in the tree). I personally built gcc-10..13



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-dev] Re: [PATCH 2/3] To build ada we need  a c++ compiler too
  2024-04-26  8:29     ` [gentoo-dev] " Arsen Arsenović
@ 2024-04-26 18:06       ` Alfredo Tupone
  2024-04-30  6:25         ` Sam James
  0 siblings, 1 reply; 9+ messages in thread
From: Alfredo Tupone @ 2024-04-26 18:06 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gentoo-dev, toolchain

On Fri, 26 Apr 2024 10:29:43 +0200
Arsen Arsenović <arsen@gentoo.org> wrote:

> >  is_ada() {
> >  	gcc-lang-supported ada || return 1
> > -	_tc_use_if_iuse ada
> > +	_tc_use_if_iuse cxx && _tc_use_if_iuse ada  
> 
> Is this redundant?  Would gcc-lang-supported c++ (called through the
> ada support check) not suffice?

From what I understand this test is checking that both USE=cxx and
USE=ada are enabled, and both cxx and ada are supported by gcc.

If not, gcc is built without the ada compiler


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-dev] Re: [PATCH 2/3] To build ada we need  a c++ compiler too
  2024-04-26 18:06       ` Alfredo Tupone
@ 2024-04-30  6:25         ` Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2024-04-30  6:25 UTC (permalink / raw)
  To: Alfredo Tupone; +Cc: Arsen Arsenović, gentoo-dev, toolchain

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

Alfredo Tupone <tupone@gentoo.org> writes:

> On Fri, 26 Apr 2024 10:29:43 +0200
> Arsen Arsenović <arsen@gentoo.org> wrote:
>
>> >  is_ada() {
>> >  	gcc-lang-supported ada || return 1
>> > -	_tc_use_if_iuse ada
>> > +	_tc_use_if_iuse cxx && _tc_use_if_iuse ada  
>> 
>> Is this redundant?  Would gcc-lang-supported c++ (called through the
>> ada support check) not suffice?
>
> From what I understand this test is checking that both USE=cxx and
> USE=ada are enabled, and both cxx and ada are supported by gcc.
>
> If not, gcc is built without the ada compiler

It's fine with me if you commit these, just please add detail to the
commit messages first. Thanks.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-dev] [PATCH 1/3] To make "tc_has_feature ada" actually work
  2024-04-26 17:53     ` Alfredo Tupone
@ 2024-04-30  8:51       ` Arsen Arsenović
  0 siblings, 0 replies; 9+ messages in thread
From: Arsen Arsenović @ 2024-04-30  8:51 UTC (permalink / raw)
  To: Alfredo Tupone; +Cc: gentoo-dev, toolchain

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

Alfredo Tupone <tupone@gentoo.org> writes:

> On Fri, 26 Apr 2024 10:34:44 +0200
> Arsen Arsenović <arsen@gentoo.org> wrote:
>
>> looks OK at a glance, but could you summarize the issues the patch set
>> fixes in the commit messages (and reword them to follow convention
>> generally)?  it is important to have context while looking at a git
>> log.
>
>> > -	IUSE+=" ada"
>> > +	IUSE+=" ada" TC_FEATURES+=( ada )  
>
> The change is about adding TC_FEATURES+=( ada )
>
> Some lines towards the end there is 
>
>
> # TODO: Add a pkg_setup & pkg_pretend check for whether the active
> compiler # supports Ada.
> if tc_has_feature ada ; then
>     BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] )
> )"
> fi
>
>
> it looks to me that if TC_FEATURES+=( ada ) is missing, that dependency
> is not added

Indeed, but it would be nice to be able to tell that from the git log.

>> 
>> does this apply for all versions of GCC?
>
> I really don't know. Ada source are provided with gcc-8 too (the oldest
> version in the tree). I personally built gcc-10..13

That's good enough for our case I think (given we only have 8+ at all,
and only 11+ are unmasked).

Overall, probably OK.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-30  8:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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   ` [gentoo-dev] [PATCH 3/3] A check that the compiler used to build ada is ada and not newer Alfredo Tupone
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ć

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox