| 1 | #!/bin/bash |
1 | #!/bin/bash |
| 2 | # Copyright 1999-2002 Gentoo Technologies, Inc. |
2 | # Copyright 1999-2002 Gentoo Technologies, Inc. |
| 3 | # Distributed under the terms of the GNU General Public License, v2 or later |
3 | # Distributed under the terms of the GNU General Public License, v2 or later |
| 4 | # Author: Martin Schlemmer <azarah@gentoo.org> |
4 | # Author: Martin Schlemmer <azarah@gentoo.org> |
| 5 | # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.3 2002/06/05 23:41:36 azarah Exp $ |
5 | # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.12 2002/07/12 15:25:33 danarmak Exp $ |
| 6 | # This eclass patches ltmain.sh distributed with libtoolized packages with the |
6 | # This eclass patches ltmain.sh distributed with libtoolized packages with the |
| 7 | # relink and portage patch |
7 | # relink and portage patch |
| 8 | ECLASS=libtool |
8 | ECLASS=libtool |
|
|
9 | INHERITED="$INHERITED $ECLASS" |
|
|
10 | |
| 9 | newdepend sys-devel/libtool |
11 | newdepend sys-devel/libtool |
| 10 | |
12 | |
| 11 | DESCRIPTION="Based on the ${ECLASS} eclass" |
13 | DESCRIPTION="Based on the ${ECLASS} eclass" |
| 12 | |
14 | |
|
|
15 | ELIBTOOL_VERSION=1.8.1 |
| 13 | |
16 | |
| 14 | elibtoolize() { |
17 | elibtoolize() { |
| 15 | |
18 | |
| 16 | local x="" |
19 | local x="" |
| 17 | local y="" |
20 | local y="" |
| 18 | local dopatch="no" |
21 | local dopatch="no" |
| 19 | local dotest="yes" |
22 | local dotest="yes" |
| 20 | local dorelink="yes" |
23 | local dorelink="yes" |
|
|
24 | local dotmp="yes" |
| 21 | local doportage="yes" |
25 | local doportage="yes" |
| 22 | local portage="no" |
26 | local portage="no" |
|
|
27 | local reversedeps="no" |
|
|
28 | local mylist="" |
| 23 | |
29 | |
|
|
30 | mylist="$(find_ltmain)" |
|
|
31 | for x in ${*} |
|
|
32 | do |
| 24 | # Only apply portage patch, and dont "libtoolize --copy --force" |
33 | # Only apply portage patch, and dont "libtoolize --copy --force" |
| 25 | # if all patches fail. |
34 | # if all patches fail. |
| 26 | if [ "${1}" = "--portage" ] |
35 | if [ "${x}" = "--portage" ] |
| 27 | then |
36 | then |
| 28 | portage="yes" |
37 | portage="yes" |
| 29 | fi |
38 | fi |
|
|
39 | # Apply the reverse-deps patch |
|
|
40 | # |
|
|
41 | # http://bugzilla.gnome.org/show_bug.cgi?id=75635 |
|
|
42 | if [ "${x}" = "--reverse-deps" ] |
|
|
43 | then |
|
|
44 | reversedeps="yes" |
|
|
45 | fi |
|
|
46 | # Only patch the ltmain.sh in ${S} |
|
|
47 | if [ "${x}" = "--shallow" ] |
|
|
48 | then |
|
|
49 | if [ -f ${S}/ltmain.sh ] |
|
|
50 | then |
|
|
51 | mylist="${S}" |
|
|
52 | else |
|
|
53 | mylist="" |
|
|
54 | fi |
|
|
55 | else |
|
|
56 | mylist="$(find_ltmain)" |
|
|
57 | fi |
|
|
58 | done |
| 30 | |
59 | |
| 31 | for x in $(find_ltmain) |
60 | for x in ${mylist} |
| 32 | do |
61 | do |
| 33 | cd ${x} |
62 | cd ${x} |
| 34 | einfo "Working directory: ${x}..." |
63 | einfo "Working directory: ${x}..." |
| 35 | dopatch="yes" |
64 | dopatch="yes" |
|
|
65 | dotest="yes" |
|
|
66 | dorelink="yes" |
|
|
67 | dotmp="yes" |
|
|
68 | doportage="yes" |
| 36 | |
69 | |
| 37 | for y in test_patch relink_patch portage_patch |
70 | for y in test_patch relink_patch tmp_patch portage_patch |
| 38 | do |
71 | do |
| 39 | if ! eval ${y} --test $>${T}/libtool.foo |
72 | if ! eval ${y} --test $>${T}/libtool.foo |
| 40 | then |
73 | then |
| 41 | case ${y} in |
74 | case ${y} in |
| 42 | test_patch) |
75 | test_patch) |
| … | |
… | |
| 50 | then |
83 | then |
| 51 | dopatch="no" |
84 | dopatch="no" |
| 52 | fi |
85 | fi |
| 53 | dorelink="no" |
86 | dorelink="no" |
| 54 | ;; |
87 | ;; |
|
|
88 | tmp_patch) |
|
|
89 | # non critical patch |
|
|
90 | dotmp="no" |
|
|
91 | ;; |
| 55 | portage_patch) |
92 | portage_patch) |
| 56 | # critical patch |
93 | # critical patch |
| 57 | if [ "${portage}" = "yes" ] |
94 | if [ "${portage}" = "yes" ] |
| 58 | then |
95 | then |
| 59 | echo |
96 | echo |
| … | |
… | |
| 65 | ;; |
102 | ;; |
| 66 | esac |
103 | esac |
| 67 | fi |
104 | fi |
| 68 | done |
105 | done |
| 69 | |
106 | |
|
|
107 | # Only apply portage patch ... I think if other can apply, they should. |
|
|
108 | # if [ "${portage}" = "yes" ] |
|
|
109 | # then |
|
|
110 | # dotest="no" |
|
|
111 | # dorelink="no" |
|
|
112 | # dotmp="no" |
|
|
113 | # fi |
|
|
114 | |
| 70 | for y in test_patch relink_patch portage_patch |
115 | for y in test_patch relink_patch tmp_patch portage_patch |
| 71 | do |
116 | do |
| 72 | if [ "${dopatch}" = "yes" ] |
117 | if [ "${dopatch}" = "yes" ] |
| 73 | then |
118 | then |
| 74 | case ${y} in |
119 | case ${y} in |
| 75 | test_patch) |
120 | test_patch) |
| … | |
… | |
| 82 | if [ "${dorelink}" = "no" ] |
127 | if [ "${dorelink}" = "no" ] |
| 83 | then |
128 | then |
| 84 | continue |
129 | continue |
| 85 | fi |
130 | fi |
| 86 | ;; |
131 | ;; |
|
|
132 | tmp_patch) |
|
|
133 | if [ "${dotmp}" = "no" ] |
|
|
134 | then |
|
|
135 | continue |
|
|
136 | fi |
|
|
137 | ;; |
| 87 | portage_patch) |
138 | portage_patch) |
| 88 | if [ "${doportage}" = "no" ] |
139 | if [ "${doportage}" = "no" ] |
| 89 | then |
140 | then |
| 90 | continue |
141 | continue |
| 91 | fi |
142 | fi |
| 92 | ;; |
143 | ;; |
| 93 | esac |
144 | esac |
| 94 | |
145 | |
| 95 | einfo "Applying libtool-${y/_patch/}.patch..." |
146 | einfo "Applying libtool-${y/_patch/}.patch..." |
| 96 | eval ${y} $>${T}/libtool.foo |
147 | eval ${y} $>${T}/libtool.foo |
| 97 | elif [ "${portage}" = "no" ] |
148 | elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] |
| 98 | then |
149 | then |
|
|
150 | ewarn "Cannot apply any patch, running libtoolize..." |
| 99 | libtoolize --copy --force |
151 | libtoolize --copy --force |
| 100 | break |
152 | break |
| 101 | fi |
153 | fi |
| 102 | done |
154 | done |
|
|
155 | |
|
|
156 | if [ "${reversedeps}" = "yes" ] |
|
|
157 | then |
|
|
158 | if eval reversedeps_patch --test $>${T}/libtool.foo |
|
|
159 | then |
|
|
160 | einfo "Applying libtool-reverse-deps.patch..." |
|
|
161 | eval reversedeps_patch $>${T}/libtool.foo |
|
|
162 | fi |
|
|
163 | fi |
| 103 | done |
164 | done |
|
|
165 | |
|
|
166 | if [ -f libtool ] |
|
|
167 | then |
|
|
168 | rm -f libtool |
|
|
169 | fi |
|
|
170 | |
|
|
171 | # We need to change the pwd back to $S, as we may be called in |
|
|
172 | # src_compile() |
|
|
173 | cd ${S} |
| 104 | } |
174 | } |
| 105 | |
175 | |
| 106 | # |
176 | # |
| 107 | # Returns all the directories containing ltmain.sh |
177 | # Returns all the directories containing ltmain.sh |
| 108 | # |
178 | # |
| … | |
… | |
| 136 | fi |
206 | fi |
| 137 | |
207 | |
| 138 | patch ${opts} -p0 <<-"ENDPATCH" |
208 | patch ${opts} -p0 <<-"ENDPATCH" |
| 139 | --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 |
209 | --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 |
| 140 | +++ ltmain.sh Sun May 26 19:50:52 2002 |
210 | +++ ltmain.sh Sun May 26 19:50:52 2002 |
| 141 | @@ -3940,9 +3940,39 @@ |
211 | @@ -3940,9 +3940,46 @@ |
| 142 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
212 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
| 143 | exit 1 |
213 | exit 1 |
| 144 | fi |
214 | fi |
| 145 | - newdependency_libs="$newdependency_libs $libdir/$name" |
215 | - newdependency_libs="$newdependency_libs $libdir/$name" |
| 146 | + # We do not want portage's install root ($D) present. Check only for |
216 | + # We do not want portage's install root ($D) present. Check only for |
| 147 | + # this if the .la is being installed. |
217 | + # this if the .la is being installed. |
| 148 | + if test "$installed" = yes; then |
218 | + if test "$installed" = yes && test "$D"; then |
| 149 | + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" |
219 | + eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`" |
| 150 | + else |
220 | + else |
| 151 | + mynewdependency_lib="$libdir/$name" |
221 | + mynewdependency_lib="$libdir/$name" |
| 152 | + fi |
222 | + fi |
| 153 | + # Do not add duplicates |
223 | + # Do not add duplicates |
|
|
224 | + if test "$mynewdependency_lib"; then |
| 154 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" |
225 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then |
| 155 | + then |
|
|
| 156 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
226 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
|
|
227 | + fi |
| 157 | + fi |
228 | + fi |
| 158 | + ;; |
229 | + ;; |
| 159 | + *) |
230 | + *) |
| 160 | + if test "$installed" = yes; then |
231 | + if test "$installed" = yes; then |
|
|
232 | + # Rather use S=WORKDIR if our version of portage supports it. |
|
|
233 | + # This is because some ebuild (gcc) do not use $S as buildroot. |
|
|
234 | + if test "$PWORKDIR"; then |
|
|
235 | + S="$PWORKDIR" |
|
|
236 | + fi |
| 161 | + # We do not want portage's build root ($S} present. |
237 | + # We do not want portage's build root ($S) present. |
| 162 | + if test -n "`echo $deplib |grep -e "${S}"`" |
238 | + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then |
| 163 | + then |
239 | + mynewdependency_lib="" |
| 164 | + newdependency_libs="" |
|
|
| 165 | + # We do not want portage's install root ($D) present. |
240 | + # We do not want portage's install root ($D) present. |
| 166 | + elif test -n "`echo $deplib |grep -e "${D}"`" |
241 | + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then |
| 167 | + then |
|
|
| 168 | + mynewdependency_lib="`echo "$deplib" |sed -e "s:${D}::g" -e 's://:/:g'`" |
242 | + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`" |
|
|
243 | + else |
|
|
244 | + mynewdependency_lib="$deplib" |
| 169 | + fi |
245 | + fi |
| 170 | + else |
246 | + else |
| 171 | + mynewdependency_lib="$deplib" |
247 | + mynewdependency_lib="$deplib" |
| 172 | + fi |
248 | + fi |
| 173 | + # Do not add duplicates |
249 | + # Do not add duplicates |
|
|
250 | + if test "$mynewdependency_lib"; then |
| 174 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" |
251 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then |
| 175 | + then |
|
|
| 176 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
252 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
|
|
253 | + fi |
| 177 | + fi |
254 | + fi |
| 178 | ;; |
255 | ;; |
| 179 | - *) newdependency_libs="$newdependency_libs $deplib" ;; |
256 | - *) newdependency_libs="$newdependency_libs $deplib" ;; |
| 180 | esac |
257 | esac |
| 181 | done |
258 | done |
| … | |
… | |
| 183 | @@ -3975,6 +4005,10 @@ |
260 | @@ -3975,6 +4005,10 @@ |
| 184 | case $host,$output,$installed,$module,$dlname in |
261 | case $host,$output,$installed,$module,$dlname in |
| 185 | *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
262 | *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
| 186 | esac |
263 | esac |
| 187 | + # Do not add duplicates |
264 | + # Do not add duplicates |
| 188 | + if test "$installed" = yes; then |
265 | + if test "$installed" = yes && test "$D"; then |
| 189 | + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" |
266 | + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`" |
| 190 | + fi |
267 | + fi |
| 191 | $echo > $output "\ |
268 | $echo > $output "\ |
| 192 | # $outputname - a libtool library file |
269 | # $outputname - a libtool library file |
| 193 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
270 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 194 | ENDPATCH |
271 | ENDPATCH |
| … | |
… | |
| 305 | - continue |
382 | - continue |
| 306 | + exit 1 |
383 | + exit 1 |
| 307 | fi |
384 | fi |
| 308 | fi |
385 | fi |
| 309 | |
386 | |
|
|
387 | ENDPATCH |
|
|
388 | |
|
|
389 | retval=$? |
|
|
390 | |
|
|
391 | # This one dont apply clean to libtool-1.4.2a, so do it manually. |
|
|
392 | if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ] |
|
|
393 | then |
|
|
394 | cp ltmain.sh ltmain.sh.orig |
|
|
395 | sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \ |
|
|
396 | ltmain.sh.orig > ltmain.sh |
|
|
397 | rm -f ltmain.sh.orig |
|
|
398 | fi |
|
|
399 | |
|
|
400 | return ${retval} |
|
|
401 | } |
|
|
402 | |
|
|
403 | tmp_patch() { |
|
|
404 | |
|
|
405 | local opts="" |
|
|
406 | |
|
|
407 | if [ "${1}" = "--test" ] |
|
|
408 | then |
|
|
409 | opts="--force --dry-run" |
|
|
410 | fi |
|
|
411 | |
|
|
412 | patch ${opts} -p0 <<-"ENDPATCH" |
|
|
413 | --- ltmain.sh Sun Aug 12 18:08:05 2001 |
|
|
414 | +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001 |
| 310 | @@ -4782,7 +4829,11 @@ |
415 | @@ -4782,7 +4829,11 @@ |
| 311 | if test "$finalize" = yes && test -z "$run"; then |
416 | if test "$finalize" = yes && test -z "$run"; then |
| 312 | tmpdir="/tmp" |
417 | tmpdir="/tmp" |
| 313 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
418 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
| 314 | - tmpdir="$tmpdir/libtool-$$" |
419 | - tmpdir="$tmpdir/libtool-$$" |
| … | |
… | |
| 319 | + fi |
424 | + fi |
| 320 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
425 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
| 321 | else |
426 | else |
| 322 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
427 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
| 323 | ENDPATCH |
428 | ENDPATCH |
| 324 | |
|
|
| 325 | retval=$? |
|
|
| 326 | |
|
|
| 327 | # This one dont apply clean to libtool-1.4.2a, so do it manually. |
|
|
| 328 | if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ] |
|
|
| 329 | then |
|
|
| 330 | cp ltmain.sh ltmain.sh.orig |
|
|
| 331 | sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \ |
|
|
| 332 | ltmain.sh.orig > ltmain.sh |
|
|
| 333 | rm -f ltmain.sh.orig |
|
|
| 334 | fi |
|
|
| 335 | |
|
|
| 336 | return ${retval} |
|
|
| 337 | } |
429 | } |
| 338 | |
430 | |
| 339 | test_patch() { |
431 | test_patch() { |
| 340 | |
432 | |
| 341 | local opts="" |
433 | local opts="" |
| … | |
… | |
| 638 | hardcode_libdirs= |
730 | hardcode_libdirs= |
| 639 | dep_rpath= |
731 | dep_rpath= |
| 640 | ENDPATCH |
732 | ENDPATCH |
| 641 | } |
733 | } |
| 642 | |
734 | |
|
|
735 | reversedeps_patch() { |
|
|
736 | |
|
|
737 | local opts="" |
|
|
738 | |
|
|
739 | if [ "${1}" = "--test" ] |
|
|
740 | then |
|
|
741 | opts="--force --dry-run" |
|
|
742 | fi |
|
|
743 | |
|
|
744 | patch ${opts} -p0 <<-"ENDPATCH" |
|
|
745 | --- ltmain.sh.orig Sat Mar 23 22:48:45 2002 |
|
|
746 | +++ ltmain.sh Sat Mar 23 22:45:38 2002 |
|
|
747 | @@ -1553,6 +1553,8 @@ |
|
|
748 | convenience="$convenience $ladir/$objdir/$old_library" |
|
|
749 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
|
|
750 | tmp_libs= |
|
|
751 | + # PKGW |
|
|
752 | + dependency_libs= |
|
|
753 | for deplib in $dependency_libs; do |
|
|
754 | deplibs="$deplib $deplibs" |
|
|
755 | case "$tmp_libs " in |
|
|
756 | @@ -1668,6 +1670,8 @@ |
|
|
757 | fi |
|
|
758 | |
|
|
759 | tmp_libs= |
|
|
760 | + #PKGW |
|
|
761 | + dependency_libs= |
|
|
762 | for deplib in $dependency_libs; do |
|
|
763 | case $deplib in |
|
|
764 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test |
|
|
765 | @@ -2081,7 +2085,7 @@ |
|
|
766 | -L*) |
|
|
767 | case " $tmp_libs " in |
|
|
768 | *" $deplib "*) ;; |
|
|
769 | - *) tmp_libs="$tmp_libs $deplib" ;; |
|
|
770 | + *) tmp_libs="$deplib $tmp_libs" ;; |
|
|
771 | esac |
|
|
772 | ;; |
|
|
773 | *) tmp_libs="$tmp_libs $deplib" ;; |
|
|
774 | ENDPATCH |
|
|
775 | } |
|
|
776 | |