commit: e15db890808f276f1b4283bd3b12d153a0239fc6
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 19:09:44 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 19:09:44 2022 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e15db890
lib/portage/util: make getlibpaths the same for Prefix/non-Prefix
ld.so.conf is available on every platform, and it actually contains the
toolchain path (gcc_s, stdc++, etc.) so much better than using a static
set. Cater for Darwin although using *_LIBRARY_PATH is questionable.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
lib/portage/util/__init__.py | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
index 4e9cef66f..6855a87f1 100644
--- a/lib/portage/util/__init__.py
+++ b/lib/portage/util/__init__.py
@@ -2016,22 +2016,15 @@ def getlibpaths(root, env=None):
if env is None:
env = os.environ
# BEGIN PREFIX LOCAL:
- # LD_LIBRARY_PATH isn't portable, and considered harmfull, so better
- # not use it. We don't need any host OS lib paths either, so do
- # Prefix case.
- if EPREFIX != '':
- rval = []
- rval.append(EPREFIX + "/usr/lib")
- rval.append(EPREFIX + "/lib")
- # we don't know the CHOST here, so it's a bit hard to guess
- # where GCC's and ld's libs are. Though, GCC's libs should be
- # in lib and usr/lib, binutils' libs are rarely used
- else:
+ # For Darwin, match LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.
+ # We don't need any host OS lib paths in Prefix, so just going with
+ # the prefixed one is fine.
+ # the following is based on the information from ld.so(8)
+ rval = env.get("LD_LIBRARY_PATH", "").split(":")
+ rval.extend(env.get("DYLD_LIBRARY_PATH", "").split(":"))
+ rval.extend(read_ld_so_conf(os.path.join(root, EPREFIX, "etc",
"ld.so.conf")))
+ rval.append(f"{EPREFIX}/usr/lib")
+ rval.append(f"{EPREFIX}/lib")
# END PREFIX LOCAL
- # the following is based on the information from ld.so(8)
- rval = env.get("LD_LIBRARY_PATH", "").split(":")
- rval.extend(read_ld_so_conf(os.path.join(root, "etc", "ld.so.conf")))
- rval.append("/usr/lib")
- rval.append("/lib")
return [normalize_path(x) for x in rval if x]