| 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.9 2002/06/26 22:38:07 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 | |
| 11 | DESCRIPTION="Based on the ${ECLASS} eclass" |
11 | DESCRIPTION="Based on the ${ECLASS} eclass" |
| 12 | |
12 | |
|
|
13 | ELIBTOOL_VERSION=1.8.1 |
| 13 | |
14 | |
| 14 | elibtoolize() { |
15 | elibtoolize() { |
| 15 | |
16 | |
| 16 | local x="" |
17 | local x="" |
| 17 | local y="" |
18 | local y="" |
| 18 | local dopatch="no" |
19 | local dopatch="no" |
| 19 | local dotest="yes" |
20 | local dotest="yes" |
| 20 | local dorelink="yes" |
21 | local dorelink="yes" |
|
|
22 | local dotmp="yes" |
| 21 | local doportage="yes" |
23 | local doportage="yes" |
| 22 | local portage="no" |
24 | local portage="no" |
|
|
25 | local mylist="" |
| 23 | |
26 | |
|
|
27 | mylist="$(find_ltmain)" |
| 24 | # Only apply portage patch, and dont "libtoolize --copy --force" |
28 | # Only apply portage patch, and dont "libtoolize --copy --force" |
| 25 | # if all patches fail. |
29 | # if all patches fail. |
|
|
30 | for x in ${*} |
|
|
31 | do |
| 26 | if [ "${1}" = "--portage" ] |
32 | if [ "${x}" = "--portage" ] |
| 27 | then |
33 | then |
| 28 | portage="yes" |
34 | portage="yes" |
| 29 | fi |
35 | fi |
|
|
36 | # Only patch the ltmain.sh in ${S} |
|
|
37 | if [ "${x}" = "--shallow" ] |
|
|
38 | then |
|
|
39 | if [ -f ${S}/ltmain.sh ] |
|
|
40 | then |
|
|
41 | mylist="${S}" |
|
|
42 | else |
|
|
43 | mylist="" |
|
|
44 | fi |
|
|
45 | else |
|
|
46 | mylist="$(find_ltmain)" |
|
|
47 | fi |
|
|
48 | done |
| 30 | |
49 | |
| 31 | for x in $(find_ltmain) |
50 | for x in ${mylist} |
| 32 | do |
51 | do |
| 33 | cd ${x} |
52 | cd ${x} |
| 34 | einfo "Working directory: ${x}..." |
53 | einfo "Working directory: ${x}..." |
| 35 | dopatch="yes" |
54 | dopatch="yes" |
|
|
55 | dotest="yes" |
|
|
56 | dorelink="yes" |
|
|
57 | dotmp="yes" |
|
|
58 | doportage="yes" |
| 36 | |
59 | |
| 37 | for y in test_patch relink_patch portage_patch |
60 | for y in test_patch relink_patch tmp_patch portage_patch |
| 38 | do |
61 | do |
| 39 | if ! eval ${y} --test $>${T}/libtool.foo |
62 | if ! eval ${y} --test $>${T}/libtool.foo |
| 40 | then |
63 | then |
| 41 | case ${y} in |
64 | case ${y} in |
| 42 | test_patch) |
65 | test_patch) |
| … | |
… | |
| 50 | then |
73 | then |
| 51 | dopatch="no" |
74 | dopatch="no" |
| 52 | fi |
75 | fi |
| 53 | dorelink="no" |
76 | dorelink="no" |
| 54 | ;; |
77 | ;; |
|
|
78 | tmp_patch) |
|
|
79 | # non critical patch |
|
|
80 | dotmp="no" |
|
|
81 | ;; |
| 55 | portage_patch) |
82 | portage_patch) |
| 56 | # critical patch |
83 | # critical patch |
| 57 | if [ "${portage}" = "yes" ] |
84 | if [ "${portage}" = "yes" ] |
| 58 | then |
85 | then |
| 59 | echo |
86 | echo |
| … | |
… | |
| 65 | ;; |
92 | ;; |
| 66 | esac |
93 | esac |
| 67 | fi |
94 | fi |
| 68 | done |
95 | done |
| 69 | |
96 | |
| 70 | for y in test_patch relink_patch portage_patch |
97 | for y in test_patch relink_patch tmp_patch portage_patch |
| 71 | do |
98 | do |
| 72 | if [ "${dopatch}" = "yes" ] |
99 | if [ "${dopatch}" = "yes" ] |
| 73 | then |
100 | then |
| 74 | case ${y} in |
101 | case ${y} in |
| 75 | test_patch) |
102 | test_patch) |
| … | |
… | |
| 78 | continue |
105 | continue |
| 79 | fi |
106 | fi |
| 80 | ;; |
107 | ;; |
| 81 | relink_patch) |
108 | relink_patch) |
| 82 | if [ "${dorelink}" = "no" ] |
109 | if [ "${dorelink}" = "no" ] |
|
|
110 | then |
|
|
111 | continue |
|
|
112 | fi |
|
|
113 | ;; |
|
|
114 | tmp_patch) |
|
|
115 | if [ "${dotmp}" = "no" ] |
| 83 | then |
116 | then |
| 84 | continue |
117 | continue |
| 85 | fi |
118 | fi |
| 86 | ;; |
119 | ;; |
| 87 | portage_patch) |
120 | portage_patch) |
| … | |
… | |
| 99 | libtoolize --copy --force |
132 | libtoolize --copy --force |
| 100 | break |
133 | break |
| 101 | fi |
134 | fi |
| 102 | done |
135 | done |
| 103 | done |
136 | done |
|
|
137 | |
|
|
138 | if [ -f libtool ] |
|
|
139 | then |
|
|
140 | rm -f libtool |
|
|
141 | fi |
|
|
142 | |
|
|
143 | # We need to change the pwd back to $S, as we may be called in |
|
|
144 | # src_compile() |
|
|
145 | cd ${S} |
| 104 | } |
146 | } |
| 105 | |
147 | |
| 106 | # |
148 | # |
| 107 | # Returns all the directories containing ltmain.sh |
149 | # Returns all the directories containing ltmain.sh |
| 108 | # |
150 | # |
| … | |
… | |
| 136 | fi |
178 | fi |
| 137 | |
179 | |
| 138 | patch ${opts} -p0 <<-"ENDPATCH" |
180 | patch ${opts} -p0 <<-"ENDPATCH" |
| 139 | --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 |
181 | --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 |
| 140 | +++ ltmain.sh Sun May 26 19:50:52 2002 |
182 | +++ ltmain.sh Sun May 26 19:50:52 2002 |
| 141 | @@ -3940,9 +3940,39 @@ |
183 | @@ -3940,9 +3940,41 @@ |
| 142 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
184 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
| 143 | exit 1 |
185 | exit 1 |
| 144 | fi |
186 | fi |
| 145 | - newdependency_libs="$newdependency_libs $libdir/$name" |
187 | - newdependency_libs="$newdependency_libs $libdir/$name" |
| 146 | + # We do not want portage's install root ($D) present. Check only for |
188 | + # We do not want portage's install root ($D) present. Check only for |
| 147 | + # this if the .la is being installed. |
189 | + # this if the .la is being installed. |
| 148 | + if test "$installed" = yes; then |
190 | + if test "$installed" = yes && test "$D"; then |
| 149 | + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" |
191 | + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`" |
| 150 | + else |
192 | + else |
| 151 | + mynewdependency_lib="$libdir/$name" |
193 | + mynewdependency_lib="$libdir/$name" |
| 152 | + fi |
194 | + fi |
| 153 | + # Do not add duplicates |
195 | + # Do not add duplicates |
|
|
196 | + if test "$mynewdependency_lib"; then |
| 154 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" |
197 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then |
| 155 | + then |
|
|
| 156 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
198 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
|
|
199 | + fi |
| 157 | + fi |
200 | + fi |
| 158 | + ;; |
201 | + ;; |
| 159 | + *) |
202 | + *) |
| 160 | + if test "$installed" = yes; then |
203 | + if test "$installed" = yes; then |
| 161 | + # We do not want portage's build root ($S} present. |
204 | + # We do not want portage's build root ($S) present. |
| 162 | + if test -n "`echo $deplib |grep -e "${S}"`" |
205 | + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then |
| 163 | + then |
|
|
| 164 | + newdependency_libs="" |
206 | + newdependency_libs="" |
| 165 | + # We do not want portage's install root ($D) present. |
207 | + # We do not want portage's install root ($D) present. |
| 166 | + elif test -n "`echo $deplib |grep -e "${D}"`" |
208 | + 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'`" |
209 | + mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`" |
|
|
210 | + else |
|
|
211 | + mynewdependency_lib="$deplib" |
| 169 | + fi |
212 | + fi |
| 170 | + else |
213 | + else |
| 171 | + mynewdependency_lib="$deplib" |
214 | + mynewdependency_lib="$deplib" |
| 172 | + fi |
215 | + fi |
| 173 | + # Do not add duplicates |
216 | + # Do not add duplicates |
|
|
217 | + if test "$mynewdependency_lib"; then |
| 174 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" |
218 | + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then |
| 175 | + then |
|
|
| 176 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
219 | + newdependency_libs="$newdependency_libs $mynewdependency_lib" |
|
|
220 | + fi |
| 177 | + fi |
221 | + fi |
| 178 | ;; |
222 | ;; |
| 179 | - *) newdependency_libs="$newdependency_libs $deplib" ;; |
223 | - *) newdependency_libs="$newdependency_libs $deplib" ;; |
| 180 | esac |
224 | esac |
| 181 | done |
225 | done |
| … | |
… | |
| 183 | @@ -3975,6 +4005,10 @@ |
227 | @@ -3975,6 +4005,10 @@ |
| 184 | case $host,$output,$installed,$module,$dlname in |
228 | case $host,$output,$installed,$module,$dlname in |
| 185 | *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
229 | *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
| 186 | esac |
230 | esac |
| 187 | + # Do not add duplicates |
231 | + # Do not add duplicates |
| 188 | + if test "$installed" = yes; then |
232 | + if test "$installed" = yes && test "$D"; then |
| 189 | + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" |
233 | + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`" |
| 190 | + fi |
234 | + fi |
| 191 | $echo > $output "\ |
235 | $echo > $output "\ |
| 192 | # $outputname - a libtool library file |
236 | # $outputname - a libtool library file |
| 193 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
237 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 194 | ENDPATCH |
238 | ENDPATCH |
| … | |
… | |
| 305 | - continue |
349 | - continue |
| 306 | + exit 1 |
350 | + exit 1 |
| 307 | fi |
351 | fi |
| 308 | fi |
352 | fi |
| 309 | |
353 | |
|
|
354 | ENDPATCH |
|
|
355 | |
|
|
356 | retval=$? |
|
|
357 | |
|
|
358 | # This one dont apply clean to libtool-1.4.2a, so do it manually. |
|
|
359 | if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ] |
|
|
360 | then |
|
|
361 | cp ltmain.sh ltmain.sh.orig |
|
|
362 | sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \ |
|
|
363 | ltmain.sh.orig > ltmain.sh |
|
|
364 | rm -f ltmain.sh.orig |
|
|
365 | fi |
|
|
366 | |
|
|
367 | return ${retval} |
|
|
368 | } |
|
|
369 | |
|
|
370 | tmp_patch() { |
|
|
371 | |
|
|
372 | local opts="" |
|
|
373 | |
|
|
374 | if [ "${1}" = "--test" ] |
|
|
375 | then |
|
|
376 | opts="--force --dry-run" |
|
|
377 | fi |
|
|
378 | |
|
|
379 | patch ${opts} -p0 <<-"ENDPATCH" |
|
|
380 | --- ltmain.sh Sun Aug 12 18:08:05 2001 |
|
|
381 | +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001 |
| 310 | @@ -4782,7 +4829,11 @@ |
382 | @@ -4782,7 +4829,11 @@ |
| 311 | if test "$finalize" = yes && test -z "$run"; then |
383 | if test "$finalize" = yes && test -z "$run"; then |
| 312 | tmpdir="/tmp" |
384 | tmpdir="/tmp" |
| 313 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
385 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
| 314 | - tmpdir="$tmpdir/libtool-$$" |
386 | - tmpdir="$tmpdir/libtool-$$" |
| … | |
… | |
| 319 | + fi |
391 | + fi |
| 320 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
392 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
| 321 | else |
393 | else |
| 322 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
394 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
| 323 | ENDPATCH |
395 | 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 | } |
396 | } |
| 338 | |
397 | |
| 339 | test_patch() { |
398 | test_patch() { |
| 340 | |
399 | |
| 341 | local opts="" |
400 | local opts="" |