Gentoo Archives: gentoo-dev

From: Joakim Tjernlund <Joakim.Tjernlund@××××××××.com>
To: "gentoo-dev@l.g.o" <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] [PATCH] toolchain.eclass: set CHOST for gcc-config calls
Date: Tue, 27 Dec 2016 11:10:39
Message-Id: 1482837018.28445.0.camel@infinera.com
In Reply to: Re: [gentoo-dev] [PATCH] toolchain.eclass: set CHOST for gcc-config calls by Daniel Campbell
1 On Tue, 2016-12-27 at 00:22 -0800, Daniel Campbell wrote:
2 > On 12/26/2016 12:22 PM, Mike Gilbert wrote:
3 > > Bug: https://bugs.gentoo.org/603776
4 > > ---
5 > >  eclass/toolchain.eclass | 8 ++++----
6 > >  1 file changed, 4 insertions(+), 4 deletions(-)
7 > >
8 > > diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
9 > > index 55249b00249b..97511ee12440 100644
10 > > --- a/eclass/toolchain.eclass
11 > > +++ b/eclass/toolchain.eclass
12 > > @@ -2119,13 +2119,13 @@
13 > >  
14 > >  do_gcc_config() {
15 > >   if ! should_we_gcc_config ; then
16 > > - env -i ROOT="${ROOT}" gcc-config --use-old --force
17 > > + env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config --use-old --force
18 > >   return 0
19 > >   fi
20 > >  
21 > >   local current_gcc_config target
22 > >  
23 > > - current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
24 > > + current_gcc_config=$(env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
25 > >   if [[ -n ${current_gcc_config} ]] ; then
26 > >   local current_specs use_specs
27 > >   # figure out which specs-specific config is active
28 > > @@ -2159,12 +2159,12 @@ should_we_gcc_config() {
29 > >   # if the current config is invalid, we definitely want a new one
30 > >   # Note: due to bash quirkiness, the following must not be 1 line
31 > >   local curr_config
32 > > - curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
33 > > + curr_config=$(env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
34 > >  
35 > >   # if the previously selected config has the same major.minor (branch) as
36 > >   # the version we are installing, then it will probably be uninstalled
37 > >   # for being in the same SLOT, make sure we run gcc-config.
38 > > - local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
39 > > + local curr_config_ver=$(env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config -S ${curr_config} | awk
40 > > '{print $2}')
41 > >  
42 > >   local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
43 > >  
44 > >
45 >
46 > Seems like an obvious bug and fix; is there any reason passing CHOST
47 > around might be a bad idea? It seems to me that it enforces the behavior
48 > it's meant to have to begin with and makes it more obvious that CHOST is
49 > used.
50
51 Will that work for cross toolchains well?
52
53 Jocke

Replies