| 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.7 2002/06/24 02:06:01 azarah 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 | newdepend sys-devel/libtool |
9 | newdepend sys-devel/libtool |
| 10 | |
10 | |
| … | |
… | |
| 16 | local x="" |
16 | local x="" |
| 17 | local y="" |
17 | local y="" |
| 18 | local dopatch="no" |
18 | local dopatch="no" |
| 19 | local dotest="yes" |
19 | local dotest="yes" |
| 20 | local dorelink="yes" |
20 | local dorelink="yes" |
|
|
21 | local dotmp="yes" |
| 21 | local doportage="yes" |
22 | local doportage="yes" |
| 22 | local portage="no" |
23 | local portage="no" |
|
|
24 | local mylist="" |
| 23 | |
25 | |
|
|
26 | mylist="$(find_ltmain)" |
| 24 | # Only apply portage patch, and dont "libtoolize --copy --force" |
27 | # Only apply portage patch, and dont "libtoolize --copy --force" |
| 25 | # if all patches fail. |
28 | # if all patches fail. |
|
|
29 | for x in ${*} |
|
|
30 | do |
| 26 | if [ "${1}" = "--portage" ] |
31 | if [ "${x}" = "--portage" ] |
| 27 | then |
32 | then |
| 28 | portage="yes" |
33 | portage="yes" |
| 29 | fi |
34 | fi |
|
|
35 | # Only patch the ltmain.sh in ${S} |
|
|
36 | if [ "${x}" = "--shallow" ] |
|
|
37 | then |
|
|
38 | if [ -f ${S}/ltmain.sh ] |
|
|
39 | then |
|
|
40 | mylist="${S}" |
|
|
41 | else |
|
|
42 | mylist="" |
|
|
43 | fi |
|
|
44 | else |
|
|
45 | mylist="$(find_ltmain)" |
|
|
46 | fi |
|
|
47 | done |
| 30 | |
48 | |
| 31 | for x in $(find_ltmain) |
49 | for x in ${mylist} |
| 32 | do |
50 | do |
| 33 | cd ${x} |
51 | cd ${x} |
| 34 | einfo "Working directory: ${x}..." |
52 | einfo "Working directory: ${x}..." |
| 35 | dopatch="yes" |
53 | dopatch="yes" |
|
|
54 | dotest="yes" |
|
|
55 | dorelink="yes" |
|
|
56 | dotmp="yes" |
|
|
57 | doportage="yes" |
| 36 | |
58 | |
| 37 | for y in test_patch relink_patch portage_patch |
59 | for y in test_patch relink_patch tmp_patch portage_patch |
| 38 | do |
60 | do |
| 39 | if ! eval ${y} --test $>${T}/libtool.foo |
61 | if ! eval ${y} --test $>${T}/libtool.foo |
| 40 | then |
62 | then |
| 41 | case ${y} in |
63 | case ${y} in |
| 42 | test_patch) |
64 | test_patch) |
| … | |
… | |
| 49 | [ "${portage}" = "no" ] |
71 | [ "${portage}" = "no" ] |
| 50 | then |
72 | then |
| 51 | dopatch="no" |
73 | dopatch="no" |
| 52 | fi |
74 | fi |
| 53 | dorelink="no" |
75 | dorelink="no" |
|
|
76 | ;; |
|
|
77 | tmp_patch) |
|
|
78 | # non critical patch |
|
|
79 | dotmp="no" |
| 54 | ;; |
80 | ;; |
| 55 | portage_patch) |
81 | portage_patch) |
| 56 | # critical patch |
82 | # critical patch |
| 57 | if [ "${portage}" = "yes" ] |
83 | if [ "${portage}" = "yes" ] |
| 58 | then |
84 | then |
| … | |
… | |
| 65 | ;; |
91 | ;; |
| 66 | esac |
92 | esac |
| 67 | fi |
93 | fi |
| 68 | done |
94 | done |
| 69 | |
95 | |
| 70 | for y in test_patch relink_patch portage_patch |
96 | for y in test_patch relink_patch tmp_patch portage_patch |
| 71 | do |
97 | do |
| 72 | if [ "${dopatch}" = "yes" ] |
98 | if [ "${dopatch}" = "yes" ] |
| 73 | then |
99 | then |
| 74 | case ${y} in |
100 | case ${y} in |
| 75 | test_patch) |
101 | test_patch) |
| … | |
… | |
| 78 | continue |
104 | continue |
| 79 | fi |
105 | fi |
| 80 | ;; |
106 | ;; |
| 81 | relink_patch) |
107 | relink_patch) |
| 82 | if [ "${dorelink}" = "no" ] |
108 | if [ "${dorelink}" = "no" ] |
|
|
109 | then |
|
|
110 | continue |
|
|
111 | fi |
|
|
112 | ;; |
|
|
113 | tmp_patch) |
|
|
114 | if [ "${dotmp}" = "no" ] |
| 83 | then |
115 | then |
| 84 | continue |
116 | continue |
| 85 | fi |
117 | fi |
| 86 | ;; |
118 | ;; |
| 87 | portage_patch) |
119 | portage_patch) |
| … | |
… | |
| 99 | libtoolize --copy --force |
131 | libtoolize --copy --force |
| 100 | break |
132 | break |
| 101 | fi |
133 | fi |
| 102 | done |
134 | done |
| 103 | done |
135 | done |
|
|
136 | |
|
|
137 | if [ -f libtool ] |
|
|
138 | then |
|
|
139 | rm -f libtool |
|
|
140 | fi |
|
|
141 | |
|
|
142 | # We need to change the pwd back to $S, as we may be called in |
|
|
143 | # src_compile() |
|
|
144 | cd ${S} |
| 104 | } |
145 | } |
| 105 | |
146 | |
| 106 | # |
147 | # |
| 107 | # Returns all the directories containing ltmain.sh |
148 | # Returns all the directories containing ltmain.sh |
| 108 | # |
149 | # |
| … | |
… | |
| 305 | - continue |
346 | - continue |
| 306 | + exit 1 |
347 | + exit 1 |
| 307 | fi |
348 | fi |
| 308 | fi |
349 | fi |
| 309 | |
350 | |
|
|
351 | ENDPATCH |
|
|
352 | |
|
|
353 | retval=$? |
|
|
354 | |
|
|
355 | # This one dont apply clean to libtool-1.4.2a, so do it manually. |
|
|
356 | if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ] |
|
|
357 | then |
|
|
358 | cp ltmain.sh ltmain.sh.orig |
|
|
359 | sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \ |
|
|
360 | ltmain.sh.orig > ltmain.sh |
|
|
361 | rm -f ltmain.sh.orig |
|
|
362 | fi |
|
|
363 | |
|
|
364 | return ${retval} |
|
|
365 | } |
|
|
366 | |
|
|
367 | tmp_patch() { |
|
|
368 | |
|
|
369 | local opts="" |
|
|
370 | |
|
|
371 | if [ "${1}" = "--test" ] |
|
|
372 | then |
|
|
373 | opts="--force --dry-run" |
|
|
374 | fi |
|
|
375 | |
|
|
376 | patch ${opts} -p0 <<-"ENDPATCH" |
|
|
377 | --- ltmain.sh Sun Aug 12 18:08:05 2001 |
|
|
378 | +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001 |
| 310 | @@ -4782,7 +4829,11 @@ |
379 | @@ -4782,7 +4829,11 @@ |
| 311 | if test "$finalize" = yes && test -z "$run"; then |
380 | if test "$finalize" = yes && test -z "$run"; then |
| 312 | tmpdir="/tmp" |
381 | tmpdir="/tmp" |
| 313 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
382 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
| 314 | - tmpdir="$tmpdir/libtool-$$" |
383 | - tmpdir="$tmpdir/libtool-$$" |
| … | |
… | |
| 319 | + fi |
388 | + fi |
| 320 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
389 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
| 321 | else |
390 | else |
| 322 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
391 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
| 323 | ENDPATCH |
392 | 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 | } |
393 | } |
| 338 | |
394 | |
| 339 | test_patch() { |
395 | test_patch() { |
| 340 | |
396 | |
| 341 | local opts="" |
397 | local opts="" |