Merge pull request #210908 from Yarny0/auto-patchelf

autoPatchelfHook: fix symlink handling
This commit is contained in:
Guillaume Maudoux 2023-01-15 17:18:01 +01:00 committed by GitHub
commit aa7cfc3aed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View file

@ -131,7 +131,14 @@ def populate_cache(initial: List[Path], recursive: bool =False) -> None:
if not path.is_file(): if not path.is_file():
continue continue
# As an optimisation, resolve the symlinks here, as the target is unique
# XXX: (layus, 2022-07-25) is this really an optimisation in all cases ?
# It could make the rpath bigger or break the fragile precedence of $out.
resolved = path.resolve() resolved = path.resolve()
# Do not use resolved paths when names do not match
if resolved.name != path.name:
resolved = path
try: try:
with open_elf(path) as elf: with open_elf(path) as elf:
osabi = get_osabi(elf) osabi = get_osabi(elf)

View file

@ -159,16 +159,6 @@ let
ln --symbolic --force --no-target-directory "$out/$(cut -b 7- <<< "$target")" "$link" ln --symbolic --force --no-target-directory "$out/$(cut -b 7- <<< "$target")" "$link"
done done
''; '';
# since 7b9fd5d1c9802131ca0a01ff08a3ff64379d2df4
# autopatchelf misses to add $out/lib to rpath;
# we have to call autopatchelf manually as it would
# run too late and overwrite our rpath otherwise
dontAutoPatchelf = true;
postFixup = ''
autoPatchelf $out
patchelf --add-rpath $out/lib $out/lib/*
'';
}; };
binPath = lib.makeBinPath ([ acl gnugrep procps ] binPath = lib.makeBinPath ([ acl gnugrep procps ]