Making the ld-wrapper2.sh much faster, when having lots of '-L' parameters,
breaking a double loop we had. svn path=/nixpkgs/trunk/; revision=21583
This commit is contained in:
parent
d2237f9912
commit
4b44717b1d
@ -82,6 +82,11 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
|
|||||||
rpath="$rpath $1 "
|
rpath="$rpath $1 "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
libs=""
|
||||||
|
addToLibs() {
|
||||||
|
libs="$libs $1"
|
||||||
|
}
|
||||||
|
|
||||||
rpath=""
|
rpath=""
|
||||||
|
|
||||||
# First, find all -L... switches.
|
# First, find all -L... switches.
|
||||||
@ -95,6 +100,11 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
|
|||||||
elif test "$p" = "-L"; then
|
elif test "$p" = "-L"; then
|
||||||
addToLibPath ${p2}
|
addToLibPath ${p2}
|
||||||
n=$((n + 1))
|
n=$((n + 1))
|
||||||
|
elif test "$p" = "-l"; then
|
||||||
|
addToLibs ${p2}
|
||||||
|
n=$((n + 1))
|
||||||
|
elif test "${p:0:2}" = "-l"; then
|
||||||
|
addToLibs ${p:2}
|
||||||
elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then
|
elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then
|
||||||
# This is a direct reference to a shared library, so add
|
# This is a direct reference to a shared library, so add
|
||||||
# its directory to the rpath.
|
# its directory to the rpath.
|
||||||
@ -108,22 +118,13 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
|
|||||||
# see if it contains a dynamic library used by a -l... flag. If
|
# see if it contains a dynamic library used by a -l... flag. If
|
||||||
# so, add the directory to the rpath.
|
# so, add the directory to the rpath.
|
||||||
|
|
||||||
for i in $libPath; do
|
for i in $libs; do
|
||||||
n=0
|
for j in $libPath; do
|
||||||
while test $n -lt ${#allParams[*]}; do
|
if test -f "$j/lib$i.so"; then
|
||||||
p=${allParams[n]}
|
addToRPath $j
|
||||||
p2=${allParams[$((n+1))]}
|
|
||||||
if test "${p:0:2}" = "-l" -a -f "$i/lib${p:2}.so"; then
|
|
||||||
addToRPath $i
|
|
||||||
break
|
|
||||||
elif test "$p" = "-l" -a -f "$i/lib${p2}"; then
|
|
||||||
# I haven't seen `-l foo', but you never know...
|
|
||||||
addToRPath $i
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
n=$((n + 1))
|
|
||||||
done
|
done
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user