1 |
commit: d91cd5bdc56a6fcb71a998fd8ba81b47c9a13246 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 22 09:39:26 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 22 09:39:26 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d91cd5bd |
7 |
|
8 |
gcc-config: add build-time and runtime switches to disable native symlinks |
9 |
|
10 |
We have two knobs here: |
11 |
1. Build-time knob USE_NATIVE_LINKS to set a default, defaults to 'yes' (existing behaviour) |
12 |
2. Run-time --enable-native-links / --disable-native-links knobs. These are not persistent |
13 |
across gcc-config runs and are meant for manual testing. Undocumented for now. |
14 |
|
15 |
Reported-by: Kent Fredric |
16 |
Bug: https://bugs.gentoo.org/724454 |
17 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
18 |
|
19 |
Makefile | 8 ++++++++ |
20 |
gcc-config | 8 ++++++-- |
21 |
2 files changed, 14 insertions(+), 2 deletions(-) |
22 |
|
23 |
diff --git a/Makefile b/Makefile |
24 |
index 2b3b235..c74adec 100644 |
25 |
--- a/Makefile |
26 |
+++ b/Makefile |
27 |
@@ -1,3 +1,10 @@ |
28 |
+# configurable options: |
29 |
+# Avoid installing native symlinks like: |
30 |
+# /usr/bin/gcc -> ${CTARGET}-gcc |
31 |
+# and keep only |
32 |
+# ${CTARGET}-gcc |
33 |
+USE_NATIVE_LINKS ?= yes |
34 |
+ |
35 |
EPREFIX ?= |
36 |
|
37 |
PN = gcc-config |
38 |
@@ -27,6 +34,7 @@ clean: |
39 |
-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \ |
40 |
-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \ |
41 |
-e 's:@PV@:$(PV):g' \ |
42 |
+ -e 's:@USE_NATIVE_LINKS@:$(USE_NATIVE_LINKS):g' \ |
43 |
$< > $@ |
44 |
chmod a+rx $@ |
45 |
|
46 |
|
47 |
diff --git a/gcc-config b/gcc-config |
48 |
index beeb82a..9dc09e0 100755 |
49 |
--- a/gcc-config |
50 |
+++ b/gcc-config |
51 |
@@ -261,9 +261,10 @@ update_wrappers() { |
52 |
done |
53 |
|
54 |
# For all toolchains, we want to create the fully qualified |
55 |
- # `tuple-foo`. Only native ones do we want the simple `foo`. |
56 |
+ # `tuple-foo`. Only native ones do we want the simple `foo` |
57 |
+ # and only for USE_NATIVE_LINKS=yes mode. |
58 |
local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} ) |
59 |
- if ! is_cross_compiler ; then |
60 |
+ if ! is_cross_compiler && [[ ${USE_NATIVE_LINKS} == yes ]] ; then |
61 |
all_wrappers+=( "${new_wrappers[@]}" ) |
62 |
# There are a few fun extra progs which we have to handle #412319 |
63 |
all_wrappers+=( cc:gcc f77:g77 ) |
64 |
@@ -952,6 +953,7 @@ FORCE="no" |
65 |
CC_COMP= |
66 |
ENV_D="${EROOT}etc/env.d" |
67 |
GCC_ENV_D="${ENV_D}/gcc" |
68 |
+USE_NATIVE_LINKS="@USE_NATIVE_LINKS@" |
69 |
|
70 |
for x in "$@" ; do |
71 |
case "${x}" in |
72 |
@@ -1005,6 +1007,8 @@ for x in "$@" ; do |
73 |
echo "${argv0}: @PV@" |
74 |
exit 0 |
75 |
;; |
76 |
+ --enable-native-links) USE_NATIVE_LINKS="yes" ;; |
77 |
+ --disable-native-links) USE_NATIVE_LINKS="no" ;; |
78 |
-*) |
79 |
die "Invalid switch! Run ${argv0} without parameters for help." |
80 |
;; |