Skip to content

Commit 24596d7

Browse files
dezgegdomenkozar
authored andcommitted
binutils-wrapper: Try to avoid adding unnecessary -L flags
(cherry picked from commit f375825) Signed-off-by: Domen Kožar <domen@dev.si>
1 parent 37273af commit 24596d7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pkgs/build-support/bintools-wrapper/setup-hook.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ bintoolsWrapper_addLDVars () {
2020
fi
2121

2222
if [[ -d "$1/lib" ]]; then
23-
export NIX_${role_pre}LDFLAGS+=" -L$1/lib"
23+
# Don't add the /lib directory if it actually doesn't contain any libraries. For instance,
24+
# Python and Haskell packages often only have directories like $out/lib/ghc-8.4.3/ or
25+
# $out/lib/python3.6/, so having them in LDFLAGS just makes the linker search unnecessary
26+
# directories and bloats the size of the environment variable space.
27+
if [[ -n "$(echo $1/lib/lib*)" ]]; then
28+
export NIX_${role_pre}LDFLAGS+=" -L$1/lib"
29+
fi
2430
fi
2531
}
2632

0 commit comments

Comments
 (0)