]> git.pld-linux.org Git - packages/crossppc-binutils.git/blame - binutils-libtool-relink.patch
- updated for 2.17.50.0.2
[packages/crossppc-binutils.git] / binutils-libtool-relink.patch
CommitLineData
4dd51e3c
JB
1--- binutils-2.14.90.0.4/ltmain.sh.orig 2002-03-22 23:06:16.000000000 +0100
2+++ binutils-2.14.90.0.4/ltmain.sh 2003-06-01 10:44:39.000000000 +0200
3@@ -829,6 +829,7 @@
4 linker_flags=
5 dllsearchpath=
6 lib_search_path=`pwd`
7+ inst_prefix_dir=
8
9 avoid_version=no
10 dlfiles=
11@@ -961,6 +962,11 @@
12 prev=
13 continue
14 ;;
15+ inst_prefix)
16+ inst_prefix_dir="$arg"
17+ prev=
18+ continue
19+ ;;
20 release)
21 release="-$arg"
22 prev=
23@@ -1169,6 +1175,11 @@
24 continue
25 ;;
26
27+ -inst-prefix-dir)
28+ prev=inst_prefix
29+ continue
30+ ;;
31+
32 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
33 # so, if we see these flags be careful not to treat them like -L
34 -L[A-Z][A-Z]*:*)
35@@ -2135,6 +2146,14 @@
36 add="$dir/$linklib"
37 elif test "$hardcode_minus_L" = yes; then
38 add_dir="-L$dir"
39+ # Try looking first in the location we're being installed to.
40+ if test -n "$inst_prefix_dir"; then
41+ case "$libdir" in
42+ [\\/]*)
43+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
44+ ;;
45+ esac
46+ fi
47 add="-l$name"
48 elif test "$hardcode_shlibpath_var" = yes; then
49 add_shlibpath="$dir"
50@@ -2176,6 +2195,7 @@
51
52 if test $linkmode = prog || test "$mode" = relink; then
53 add_shlibpath=
54+ add_prefix_dir=
55 add_dir=
56 add=
57 # Finalize command for both is simple: just hardcode it.
58@@ -2193,13 +2213,33 @@
59 else
60 # We cannot seem to hardcode it, guess we'll fake it.
61 add_dir="-L$libdir"
62+ # Try looking first in the location we're being installed to.
63+ if test -n "$inst_prefix_dir"; then
64+ case "$libdir" in
65+ [\\/]*)
66+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
67+ ;;
68+ esac
69+ fi
70 add="-l$name"
71 fi
72
73+ if test -n "$inst_prefix_dir"; then
74+ case "$libdir" in
75+ [\\/]*)
76+ add_prefix_dir="-L$inst_prefix_dir$libdir"
77+ ;;
78+ esac
79+ fi
80+
81+ # add_prefix_dir must be appended instead, otherwise it can
82+ # possibly be overrided by any hardcoded -L/... path in deplibs
83 if test $linkmode = prog; then
84+ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
85 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
86 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
87 else
88+ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
89 test -n "$add_dir" && deplibs="$add_dir $deplibs"
90 test -n "$add" && deplibs="$add $deplibs"
91 fi
92@@ -4312,7 +4352,7 @@
93 for tag in $taglist; do
94 tagopts="$tagopts --tag $tag"
95 done
96- relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
97+ relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
98 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
99
100 # Only create the output if not a dry run.
101@@ -4613,6 +4653,27 @@
102 dir="$dir$objdir"
103
104 if test -n "$relink_command"; then
105+ # Determine the prefix the user has applied to our future dir.
106+ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
107+
108+ # Don't allow the user to place us outside of our expected
109+ # location b/c this prevents finding dependent libraries that
110+ # are installed to the same prefix.
111+ # At present, this check doesn't affect windows .dll's that
112+ # are installed into $libdir/../bin (currently, that works fine)
113+ # but it's something to keep an eye on.
114+ if test "$inst_prefix_dir" = "$destdir"; then
115+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
116+ exit 1
117+ fi
118+
119+ if test -n "$inst_prefix_dir"; then
120+ # Stick the inst_prefix_dir data into the link command.
121+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
122+ else
123+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
124+ fi
125+
126 $echo "$modename: warning: relinking \`$file'" 1>&2
127 $show "$relink_command"
128 if $run eval "$relink_command"; then :
This page took 0.083809 seconds and 4 git commands to generate.