Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Cc: pgsql-bugs@g.o, base-system@g.o, toolchain@g.o, Sam James <sam@g.o>
Subject: [gentoo-dev] [PATCH 1/4] toolchain-funcs.eclass: stop using which(1)
Date: Mon, 05 Dec 2022 10:52:11
Message-Id: 20221205105153.634699-1-sam@gentoo.org
1 It's non-portable and we're looking to remove it from @system.
2
3 Bug: https://bugs.gentoo.org/487696
4 Bug: https://bugs.gentoo.org/646588
5 Signed-off-by: Sam James <sam@g.o>
6 ---
7 eclass/toolchain-funcs.eclass | 4 ++--
8 1 file changed, 2 insertions(+), 2 deletions(-)
9
10 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
11 index fea2a6885c46..6fa103fc110e 100644
12 --- a/eclass/toolchain-funcs.eclass
13 +++ b/eclass/toolchain-funcs.eclass
14 @@ -609,7 +609,7 @@ tc-ld-force-bfd() {
15 # to its value (like multilib). #545218
16 local ld=$(tc-getLD "$@")
17 local bfd_ld="${ld%% *}.bfd"
18 - local path_ld=$(which "${bfd_ld}" 2>/dev/null)
19 + local path_ld=$(type -P "${bfd_ld}" 2>/dev/null)
20 [[ -e ${path_ld} ]] && export LD=${bfd_ld}
21
22 # Set up LDFLAGS to select bfd based on the gcc / clang version.
23 @@ -1154,7 +1154,7 @@ gen_usr_ldscript() {
24 # If they're using gold, manually invoke the old bfd. #487696
25 local d="${T}/bfd-linker"
26 mkdir -p "${d}"
27 - ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld
28 + ln -sf $(type -P ${CHOST}-ld.bfd) "${d}"/ld
29 flags+=( -B"${d}" )
30 fi
31 output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
32 --
33 2.38.1

Replies