/[gentoo-x86]/eclass/libtool.eclass
Gentoo

Diff of /eclass/libtool.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20