On Mon, 2 Mar 2020 19:03:48 -0800
Manoj Gupta wrote:
> On Thu, Feb 27, 2020 at 11:20 PM Sergei Trofimovich
> wrote:
>
> > On Thu, 27 Feb 2020 at 22:41, Manoj Gupta wrote:
> > >
> > >
> > >
> > > On Thu, Feb 27, 2020 at 11:22 AM Manoj Gupta
> > wrote:
> > >>
> > >> gcc-config installs cc/f77 by default. This may be undesired on
> > >> systems that want to set their own versions of cc/f77.
> > >>
> > >> Add option "-n"/"--no-default-vars" to not install the cc/f77
> > >> wrappers.
> > >>
> > >> Signed-off-by: Manoj Gupta
> > >> ---
> > >> gcc-config | 6 +-
> > >> 1 file changed, 5 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/gcc-config b/gcc-config
> > >> index f03a46a..6f306db 100755
> > >> --- a/gcc-config
> > >> +++ b/gcc-config
> > >> @@ -262,7 +262,7 @@ update_wrappers() {
> > >> # For all toolchains, we want to create the fully qualified
> > >> # `tuple-foo`. Only native ones do we want the simple `foo`.
> > >> local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
> > >> - if ! is_cross_compiler ; then
> > >> + if ! is_cross_compiler && [[ "${DEFAULT_PROGS}" == "yes" ]];
> > then
> > >> all_wrappers+=( "${new_wrappers[@]}" )
> > >> # There are a few fun extra progs which we have to
> > handle #412319
> > >> all_wrappers+=( cc:gcc f77:g77 )
> > >> @@ -951,6 +951,7 @@ FORCE="no"
> > >> CC_COMP=
> > >> ENV_D="${EROOT}etc/env.d"
> > >> GCC_ENV_D="${ENV_D}/gcc"
> > >> +DEFAULT_PROGS="yes"
> > >>
> > >> for x in "$@" ; do
> > >> case "${x}" in
> > >> @@ -972,6 +973,9 @@ for x in "$@" ; do
> > >> -l|--list-profiles)
> > >> set_doit list_profiles
> > >> ;;
> > >> + -n|--no-default-vars)
> > >> + DEFAULT_PROGS="no"
> > >> + ;;
> > >> -S|--split-profile)
> > >> if [[ ( $1 != "-S" && $1 != "--split-profile" )
> > || $# -eq 1 ]] ; then
> > >> usage 1
> > >> --
> > >>
> > >
> > > Not sure of the correct mailing list for patches to gcc-config so also
> > adding toolchain@gentoo .
> > >
> >
> > toolch...@gentoo.org should generally be fine.
> >
> > Today cc->gcc and gcc->${CHOST}-gcc symlinks are effectively owned by
> > a single sys-devel/gcc-config package.
> > gcc-config is calld to update symlinks every time sys-devel/gcc is
> > installed/updated. That way we never get cc/gcc
> > out of sync.
> >
> > Your change makes /usr/bin/cc an orphan symlink. I think we need to
> > still keep a 'cc'/'f77' ownership somewhere
> > (say, a separate package).
> >
> > I suggest making a decision to handle or not handle 'cc'/'f77' and
> > gcc-config build-time, not gcc-config call-time.
> > That way sys-devel/gcc updates will behave the same as manual
> > 'gcc-config-' calls.
> >
> > Mechanically that could be a Makefile variable that switches the
> > behaviour on/off at
> > https://gitweb.gentoo.org/proj/gcc-config.git/tree/Makefile
> > and exposed as an USE flag on sys-devel/gcc-config ebuild.
> >
> > Later we can create a separate ebuild to manage /usr/bin/cc. For gcc
> > it's not hard, as gcc-config always provides /usr/bin/gcc and
> > /usr/bin/${CHOST}-gcc.
> > These can be static symlinks that don't require maintenance updates.
> >
> > Thanks for the suggestion. I will look into adding a Makefile variable
> exposed via an USE flag.
You might also need to look in the detail at 'c++', 'cpp' and ${CHOST}-*
equivalents
as those also get linked by gcc-config:
$ LANG=C ls -l /usr/bin/ | fgrep 10.0.1 | fgrep -v -- '-10.0.1 ->'
lrwxrwxrwx 1 root root 43 Feb 4 10:45 c++ ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/c++
lrwxrwxrwx 1 root root 43 Feb 4 10:45 cc ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc
lrwxrwxrwx 1 root root 43 Feb 4 10:45 cpp ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/cpp
lrwxrwxrwx 1 root root 43 Feb 4 10:45 g++ ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/g++
lrwxrwxrwx 1 root root 43 Feb 4 10:45 gcc ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc
lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-ar ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ar
lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-nm ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-nm
lrwxrwxrwx 1 root root 50 Feb 4 10:45 gcc-ranlib ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ranlib
lrwxrwxrwx 1 root root 45 Feb 4 10:45 gccgo ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gccgo
lrwxrwxrwx 1 root root 44 Feb 4 10:45 gcov ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov
lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-dump ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump
lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-tool ->
/usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-t