public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] toolchain-funcs.eclass: tc-env_build: override (E)SYSROOT
@ 2024-04-19 16:14 Mike Gilbert
  2024-04-19 17:56 ` James Le Cuirot
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2024-04-19 16:14 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Mike Gilbert

When using the CBUILD toolchain, it makes no sense to look for headers
and libraries in the CHOST-based SYSROOT.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/toolchain-funcs.eclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index cde84e6f34c8..58a718180079 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2023 Gentoo Authors
+# Copyright 2002-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: toolchain-funcs.eclass
@@ -384,6 +384,12 @@ tc-export_build_env() {
 # the target build system does not check.
 tc-env_build() {
 	tc-export_build_env
+	local -x SYSROOT=
+	if [[ ${EAPI} == 6 ]]; then
+		local -x ESYSROOT=${EPREFIX}
+	else
+		local -x ESYSROOT=${BROOT}
+	fi
 	CFLAGS=${BUILD_CFLAGS} \
 	CXXFLAGS=${BUILD_CXXFLAGS} \
 	CPPFLAGS=${BUILD_CPPFLAGS} \
-- 
2.44.0



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

* Re: [gentoo-dev] [PATCH] toolchain-funcs.eclass: tc-env_build: override (E)SYSROOT
  2024-04-19 16:14 [gentoo-dev] [PATCH] toolchain-funcs.eclass: tc-env_build: override (E)SYSROOT Mike Gilbert
@ 2024-04-19 17:56 ` James Le Cuirot
  2024-04-19 18:41   ` Mike Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: James Le Cuirot @ 2024-04-19 17:56 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Mike Gilbert

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

On Fri, 2024-04-19 at 12:14 -0400, Mike Gilbert wrote:
> When using the CBUILD toolchain, it makes no sense to look for headers
> and libraries in the CHOST-based SYSROOT.
> 
> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
> ---
>  eclass/toolchain-funcs.eclass | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
> index cde84e6f34c8..58a718180079 100644
> --- a/eclass/toolchain-funcs.eclass
> +++ b/eclass/toolchain-funcs.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 2002-2023 Gentoo Authors
> +# Copyright 2002-2024 Gentoo Authors
>  # Distributed under the terms of the GNU General Public License v2
>  
>  # @ECLASS: toolchain-funcs.eclass
> @@ -384,6 +384,12 @@ tc-export_build_env() {
>  # the target build system does not check.
>  tc-env_build() {
>  	tc-export_build_env
> +	local -x SYSROOT=
> +	if [[ ${EAPI} == 6 ]]; then
> +		local -x ESYSROOT=${EPREFIX}
> +	else
> +		local -x ESYSROOT=${BROOT}
> +	fi
>  	CFLAGS=${BUILD_CFLAGS} \
>  	CXXFLAGS=${BUILD_CXXFLAGS} \
>  	CPPFLAGS=${BUILD_CPPFLAGS} \

What do you need this for? Just wondering because I wouldn't have thought
anything you wrap with tc-env_build would care about ESYSROOT.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 858 bytes --]

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

* Re: [gentoo-dev] [PATCH] toolchain-funcs.eclass: tc-env_build: override (E)SYSROOT
  2024-04-19 17:56 ` James Le Cuirot
@ 2024-04-19 18:41   ` Mike Gilbert
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Gilbert @ 2024-04-19 18:41 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Mike Gilbert

On Fri, Apr 19, 2024 at 1:56 PM James Le Cuirot <chewi@gentoo.org> wrote:
>
> On Fri, 2024-04-19 at 12:14 -0400, Mike Gilbert wrote:
> > When using the CBUILD toolchain, it makes no sense to look for headers
> > and libraries in the CHOST-based SYSROOT.
> >
> > Signed-off-by: Mike Gilbert <floppym@gentoo.org>
> > ---
> >  eclass/toolchain-funcs.eclass | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
> > index cde84e6f34c8..58a718180079 100644
> > --- a/eclass/toolchain-funcs.eclass
> > +++ b/eclass/toolchain-funcs.eclass
> > @@ -1,4 +1,4 @@
> > -# Copyright 2002-2023 Gentoo Authors
> > +# Copyright 2002-2024 Gentoo Authors
> >  # Distributed under the terms of the GNU General Public License v2
> >
> >  # @ECLASS: toolchain-funcs.eclass
> > @@ -384,6 +384,12 @@ tc-export_build_env() {
> >  # the target build system does not check.
> >  tc-env_build() {
> >       tc-export_build_env
> > +     local -x SYSROOT=
> > +     if [[ ${EAPI} == 6 ]]; then
> > +             local -x ESYSROOT=${EPREFIX}
> > +     else
> > +             local -x ESYSROOT=${BROOT}
> > +     fi
> >       CFLAGS=${BUILD_CFLAGS} \
> >       CXXFLAGS=${BUILD_CXXFLAGS} \
> >       CPPFLAGS=${BUILD_CPPFLAGS} \
>
> What do you need this for? Just wondering because I wouldn't have thought
> anything you wrap with tc-env_build would care about ESYSROOT.

I ran into this when converting dev-build/ninja to use cmake.eclass.
Basically, I need to invoke ninja to build its own docs. I accomplish
this by building a second "native" (CBUILD) copy of ninja when
cross-compiling.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1122aa04647a60de150811c133490d248de4bc43

cmake.eclass utilizes ESYSROOT when SYSROOT is not empty.

https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/cmake.eclass?id=1122aa04647a60de150811c133490d248de4bc43#n503

If I don't set SYSROOT to empty when building the "native" ninja, it
explodes with a segfault when I invoke it in the ebuild.


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

end of thread, other threads:[~2024-04-19 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 16:14 [gentoo-dev] [PATCH] toolchain-funcs.eclass: tc-env_build: override (E)SYSROOT Mike Gilbert
2024-04-19 17:56 ` James Le Cuirot
2024-04-19 18:41   ` Mike Gilbert

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