mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 00:45:07 +03:00
better ld detection
This commit is contained in:
parent
8a59338e83
commit
29cb04dd8b
1 changed files with 15 additions and 4 deletions
|
@ -1,9 +1,20 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
dir=$(dirname "$0")
|
||||||
exe=$(basename "$0")
|
exe=$(basename "$0")
|
||||||
|
|
||||||
if test ! -f /usr/bin/"$exe"; then
|
# Remove us from our path
|
||||||
exe=ld
|
PATH=$(echo "$PATH" | tr ":" "\n" | grep -v "$dir" | tr "\n" ":")
|
||||||
|
|
||||||
|
# If we can find our specific name, e.g. `lld`,
|
||||||
|
# passthrough to that
|
||||||
|
if which "$exe" 2>&1; then
|
||||||
|
exe=$(which "$exe")
|
||||||
|
# Otherwise, fallback to `ld`
|
||||||
|
# NB: this might not have the right invocations, sometimes;
|
||||||
|
# (invoking `ld` as `lld64.ld`) watch for those potential cases
|
||||||
|
elif which ld 2>&1; then
|
||||||
|
exe=$(which ld)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$TEA_PREFIX"
|
if test -z "$TEA_PREFIX"
|
||||||
|
@ -16,8 +27,8 @@ else
|
||||||
# additions.
|
# additions.
|
||||||
for word in "$@"; do
|
for word in "$@"; do
|
||||||
if test "$word" = "-r"; then
|
if test "$word" = "-r"; then
|
||||||
exec /usr/bin/"$exe" "$@"
|
exec "$exe" "$@"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exec /usr/bin/"$exe" "$@" -rpath "$TEA_PREFIX"
|
exec "$exe" "$@" -rpath "$TEA_PREFIX"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue