Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: Manoj Gupta <manojgupta@××××××.com>
Cc: gentoo-dev@l.g.o, Sergei Trofimovich <slyfox@g.o>, Mike Frysinger <vapier@g.o>, toolchain@g.o
Subject: [gentoo-dev] Re: [PATCH] gcc-config: Add option to not install cc/f77 wrappers.
Date: Tue, 03 Mar 2020 09:17:04
Message-Id: 20200303091654.59c30105@sf
In Reply to: [gentoo-dev] Re: [PATCH] gcc-config: Add option to not install cc/f77 wrappers. by Manoj Gupta
1 On Mon, 2 Mar 2020 19:03:48 -0800
2 Manoj Gupta <manojgupta@××××××.com> wrote:
3
4 > On Thu, Feb 27, 2020 at 11:20 PM Sergei Trofimovich <slyich@×××××.com>
5 > wrote:
6 >
7 > > On Thu, 27 Feb 2020 at 22:41, Manoj Gupta <manojgupta@××××××.com> wrote:
8 > > >
9 > > >
10 > > >
11 > > > On Thu, Feb 27, 2020 at 11:22 AM Manoj Gupta <manojgupta@××××××.com>
12 > > wrote:
13 > > >>
14 > > >> gcc-config installs cc/f77 by default. This may be undesired on
15 > > >> systems that want to set their own versions of cc/f77.
16 > > >>
17 > > >> Add option "-n"/"--no-default-vars" to not install the cc/f77
18 > > >> wrappers.
19 > > >>
20 > > >> Signed-off-by: Manoj Gupta <manojgupta@××××××.com>
21 > > >> ---
22 > > >> gcc-config | 6 +++++-
23 > > >> 1 file changed, 5 insertions(+), 1 deletion(-)
24 > > >>
25 > > >> diff --git a/gcc-config b/gcc-config
26 > > >> index f03a46a..6f306db 100755
27 > > >> --- a/gcc-config
28 > > >> +++ b/gcc-config
29 > > >> @@ -262,7 +262,7 @@ update_wrappers() {
30 > > >> # For all toolchains, we want to create the fully qualified
31 > > >> # `tuple-foo`. Only native ones do we want the simple `foo`.
32 > > >> local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
33 > > >> - if ! is_cross_compiler ; then
34 > > >> + if ! is_cross_compiler && [[ "${DEFAULT_PROGS}" == "yes" ]];
35 > > then
36 > > >> all_wrappers+=( "${new_wrappers[@]}" )
37 > > >> # There are a few fun extra progs which we have to
38 > > handle #412319
39 > > >> all_wrappers+=( cc:gcc f77:g77 )
40 > > >> @@ -951,6 +951,7 @@ FORCE="no"
41 > > >> CC_COMP=
42 > > >> ENV_D="${EROOT}etc/env.d"
43 > > >> GCC_ENV_D="${ENV_D}/gcc"
44 > > >> +DEFAULT_PROGS="yes"
45 > > >>
46 > > >> for x in "$@" ; do
47 > > >> case "${x}" in
48 > > >> @@ -972,6 +973,9 @@ for x in "$@" ; do
49 > > >> -l|--list-profiles)
50 > > >> set_doit list_profiles
51 > > >> ;;
52 > > >> + -n|--no-default-vars)
53 > > >> + DEFAULT_PROGS="no"
54 > > >> + ;;
55 > > >> -S|--split-profile)
56 > > >> if [[ ( $1 != "-S" && $1 != "--split-profile" )
57 > > || $# -eq 1 ]] ; then
58 > > >> usage 1
59 > > >> --
60 > > >>
61 > > >
62 > > > Not sure of the correct mailing list for patches to gcc-config so also
63 > > adding toolchain@gentoo .
64 > > >
65 > >
66 > > toolchain@g.o should generally be fine.
67 > >
68 > > Today cc->gcc and gcc->${CHOST}-gcc symlinks are effectively owned by
69 > > a single sys-devel/gcc-config package.
70 > > gcc-config is calld to update symlinks every time sys-devel/gcc is
71 > > installed/updated. That way we never get cc/gcc
72 > > out of sync.
73 > >
74 > > Your change makes /usr/bin/cc an orphan symlink. I think we need to
75 > > still keep a 'cc'/'f77' ownership somewhere
76 > > (say, a separate package).
77 > >
78 > > I suggest making a decision to handle or not handle 'cc'/'f77' and
79 > > gcc-config build-time, not gcc-config call-time.
80 > > That way sys-devel/gcc updates will behave the same as manual
81 > > 'gcc-config-' calls.
82 > >
83 > > Mechanically that could be a Makefile variable that switches the
84 > > behaviour on/off at
85 > > https://gitweb.gentoo.org/proj/gcc-config.git/tree/Makefile
86 > > and exposed as an USE flag on sys-devel/gcc-config ebuild.
87 > >
88 > > Later we can create a separate ebuild to manage /usr/bin/cc. For gcc
89 > > it's not hard, as gcc-config always provides /usr/bin/gcc and
90 > > /usr/bin/${CHOST}-gcc.
91 > > These can be static symlinks that don't require maintenance updates.
92 > >
93 > > Thanks for the suggestion. I will look into adding a Makefile variable
94 > exposed via an USE flag.
95
96 You might also need to look in the detail at 'c++', 'cpp' and ${CHOST}-* equivalents
97 as those also get linked by gcc-config:
98
99 $ LANG=C ls -l /usr/bin/ | fgrep 10.0.1 | fgrep -v -- '-10.0.1 ->'
100 lrwxrwxrwx 1 root root 43 Feb 4 10:45 c++ -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/c++
101 lrwxrwxrwx 1 root root 43 Feb 4 10:45 cc -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc
102 lrwxrwxrwx 1 root root 43 Feb 4 10:45 cpp -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/cpp
103 lrwxrwxrwx 1 root root 43 Feb 4 10:45 g++ -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/g++
104 lrwxrwxrwx 1 root root 43 Feb 4 10:45 gcc -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc
105 lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-ar -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ar
106 lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-nm -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-nm
107 lrwxrwxrwx 1 root root 50 Feb 4 10:45 gcc-ranlib -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ranlib
108 lrwxrwxrwx 1 root root 45 Feb 4 10:45 gccgo -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gccgo
109 lrwxrwxrwx 1 root root 44 Feb 4 10:45 gcov -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov
110 lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-dump -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump
111 lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-tool -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-tool
112 lrwxrwxrwx 1 root root 48 Feb 4 10:45 gfortran -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gfortran
113 lrwxrwxrwx 1 root root 45 Feb 4 10:45 go-10 -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/go-10
114 lrwxrwxrwx 1 root root 48 Feb 4 10:45 gofmt-10 -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gofmt-10
115 lrwxrwxrwx 1 root root 48 Feb 4 10:45 lto-dump -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/lto-dump
116 lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-c++ -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-c++
117 lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-cpp -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-cpp
118 lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-g++ -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-g++
119 lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-gcc -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc
120 lrwxrwxrwx 1 root root 66 Feb 4 10:45 x86_64-pc-linux-gnu-gcc-ar -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-ar
121 lrwxrwxrwx 1 root root 66 Feb 4 10:45 x86_64-pc-linux-gnu-gcc-nm -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-nm
122 lrwxrwxrwx 1 root root 70 Feb 4 10:45 x86_64-pc-linux-gnu-gcc-ranlib -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-ranlib
123 lrwxrwxrwx 1 root root 65 Feb 4 10:45 x86_64-pc-linux-gnu-gccgo -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gccgo
124 lrwxrwxrwx 1 root root 64 Feb 4 10:45 x86_64-pc-linux-gnu-gcov -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcov
125 lrwxrwxrwx 1 root root 49 Feb 4 10:45 x86_64-pc-linux-gnu-gcov-dump -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump
126 lrwxrwxrwx 1 root root 49 Feb 4 10:45 x86_64-pc-linux-gnu-gcov-tool -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-tool
127 lrwxrwxrwx 1 root root 68 Feb 4 10:45 x86_64-pc-linux-gnu-gfortran -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gfortran
128 lrwxrwxrwx 1 root root 45 Feb 4 10:45 x86_64-pc-linux-gnu-go-10 -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/go-10
129 lrwxrwxrwx 1 root root 48 Feb 4 10:45 x86_64-pc-linux-gnu-gofmt-10 -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gofmt-10
130 lrwxrwxrwx 1 root root 48 Feb 4 10:45 x86_64-pc-linux-gnu-lto-dump -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/lto-dump
131
132 > Regarding the separate ebuild, I hope someone more knowledgeable
133 > than me regarding ebuilds can handle that.
134
135 How do you plan to manage those symlinks meanwhile?
136
137 --
138
139 Sergei

Replies

Subject Author
[gentoo-dev] Re: [PATCH] gcc-config: Add option to not install cc/f77 wrappers. Manoj Gupta <manojgupta@××××××.com>