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

Diff of /eclass/libtool.eclass

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

Revision 1.3 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.3 2002/06/05 23:41:36 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"
26 local mylist=""
23 27
28 mylist="$(find_ltmain)"
29 for x in ${*}
30 do
24 # Only apply portage patch, and dont "libtoolize --copy --force" 31 # Only apply portage patch, and dont "libtoolize --copy --force"
25 # if all patches fail. 32 # if all patches fail.
26 if [ "${1}" = "--portage" ] 33 if [ "${x}" = "--portage" ]
27 then 34 then
28 portage="yes" 35 portage="yes"
29 fi 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"
43 fi
44 # Only patch the ltmain.sh in ${S}
45 if [ "${x}" = "--shallow" ]
46 then
47 if [ -f ${S}/ltmain.sh ]
48 then
49 mylist="${S}"
50 else
51 mylist=""
52 fi
53 else
54 mylist="$(find_ltmain)"
55 fi
56 done
30 57
31 for x in $(find_ltmain) 58 for x in ${mylist}
32 do 59 do
33 cd ${x} 60 cd ${x}
34 einfo "Working directory: ${x}..." 61 einfo "Working directory: ${x}..."
35 dopatch="yes" 62 dopatch="yes"
63 dotest="yes"
64 dorelink="yes"
65 dotmp="yes"
66 doportage="yes"
36 67
37 for y in test_patch relink_patch portage_patch 68 for y in test_patch relink_patch tmp_patch portage_patch
38 do 69 do
39 if ! eval ${y} --test $>${T}/libtool.foo 70 if ! eval ${y} --test $>${T}/libtool.foo
40 then 71 then
41 case ${y} in 72 case ${y} in
42 test_patch) 73 test_patch)
50 then 81 then
51 dopatch="no" 82 dopatch="no"
52 fi 83 fi
53 dorelink="no" 84 dorelink="no"
54 ;; 85 ;;
86 tmp_patch)
87 # non critical patch
88 dotmp="no"
89 ;;
55 portage_patch) 90 portage_patch)
56 # critical patch 91 # critical patch
57 if [ "${portage}" = "yes" ] 92 if [ "${portage}" = "yes" ]
58 then 93 then
59 echo 94 echo
65 ;; 100 ;;
66 esac 101 esac
67 fi 102 fi
68 done 103 done
69 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
70 for y in test_patch relink_patch portage_patch 113 for y in test_patch relink_patch tmp_patch portage_patch
71 do 114 do
72 if [ "${dopatch}" = "yes" ] 115 if [ "${dopatch}" = "yes" ]
73 then 116 then
74 case ${y} in 117 case ${y} in
75 test_patch) 118 test_patch)
82 if [ "${dorelink}" = "no" ] 125 if [ "${dorelink}" = "no" ]
83 then 126 then
84 continue 127 continue
85 fi 128 fi
86 ;; 129 ;;
130 tmp_patch)
131 if [ "${dotmp}" = "no" ]
132 then
133 continue
134 fi
135 ;;
87 portage_patch) 136 portage_patch)
88 if [ "${doportage}" = "no" ] 137 if [ "${doportage}" = "no" ]
89 then 138 then
90 continue 139 continue
91 fi 140 fi
92 ;; 141 ;;
93 esac 142 esac
94 143
95 einfo "Applying libtool-${y/_patch/}.patch..." 144 einfo "Applying libtool-${y/_patch/}.patch..."
96 eval ${y} $>${T}/libtool.foo 145 eval ${y} $>${T}/libtool.foo
97 elif [ "${portage}" = "no" ] 146 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ]
98 then 147 then
148 ewarn "Cannot apply any patch, running libtoolize..."
99 libtoolize --copy --force 149 libtoolize --copy --force
100 break 150 break
101 fi 151 fi
102 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
103 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}
104} 172}
105 173
106# 174#
107# Returns all the directories containing ltmain.sh 175# Returns all the directories containing ltmain.sh
108# 176#
136 fi 204 fi
137 205
138 patch ${opts} -p0 <<-"ENDPATCH" 206 patch ${opts} -p0 <<-"ENDPATCH"
139 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 207 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
140 +++ ltmain.sh Sun May 26 19:50:52 2002 208 +++ ltmain.sh Sun May 26 19:50:52 2002
141 @@ -3940,9 +3940,39 @@ 209 @@ -3940,9 +3940,46 @@
142 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 210 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
143 exit 1 211 exit 1
144 fi 212 fi
145 - newdependency_libs="$newdependency_libs $libdir/$name" 213 - newdependency_libs="$newdependency_libs $libdir/$name"
146 + # 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
147 + # this if the .la is being installed. 215 + # this if the .la is being installed.
148 + if test "$installed" = yes; then 216 + if test "$installed" = yes && test "$D"; then
149 + 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'`"
150 + else 218 + else
151 + mynewdependency_lib="$libdir/$name" 219 + mynewdependency_lib="$libdir/$name"
152 + fi 220 + fi
153 + # Do not add duplicates 221 + # Do not add duplicates
222 + if test "$mynewdependency_lib"; then
154 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 223 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
155 + then
156 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 224 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
225 + fi
157 + fi 226 + fi
158 + ;; 227 + ;;
159 + *) 228 + *)
160 + 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
161 + # We do not want portage's build root ($S} present. 235 + # We do not want portage's build root ($S) present.
162 + if test -n "`echo $deplib |grep -e "${S}"`" 236 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
163 + then 237 + mynewdependency_lib=""
164 + newdependency_libs=""
165 + # We do not want portage's install root ($D) present. 238 + # We do not want portage's install root ($D) present.
166 + elif test -n "`echo $deplib |grep -e "${D}"`" 239 + 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'`" 240 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
241 + else
242 + mynewdependency_lib="$deplib"
169 + fi 243 + fi
170 + else 244 + else
171 + mynewdependency_lib="$deplib" 245 + mynewdependency_lib="$deplib"
172 + fi 246 + fi
173 + # Do not add duplicates 247 + # Do not add duplicates
248 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 249 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 250 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
251 + fi
177 + fi 252 + fi
178 ;; 253 ;;
179 - *) newdependency_libs="$newdependency_libs $deplib" ;; 254 - *) newdependency_libs="$newdependency_libs $deplib" ;;
180 esac 255 esac
181 done 256 done
183 @@ -3975,6 +4005,10 @@ 258 @@ -3975,6 +4005,10 @@
184 case $host,$output,$installed,$module,$dlname in 259 case $host,$output,$installed,$module,$dlname in
185 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 260 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
186 esac 261 esac
187 + # Do not add duplicates 262 + # Do not add duplicates
188 + if test "$installed" = yes; then 263 + if test "$installed" = yes && test "$D"; then
189 + 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'`"
190 + fi 265 + fi
191 $echo > $output "\ 266 $echo > $output "\
192 # $outputname - a libtool library file 267 # $outputname - a libtool library file
193 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 268 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
194 ENDPATCH 269 ENDPATCH
305 - continue 380 - continue
306 + exit 1 381 + exit 1
307 fi 382 fi
308 fi 383 fi
309 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
310 @@ -4782,7 +4829,11 @@ 413 @@ -4782,7 +4829,11 @@
311 if test "$finalize" = yes && test -z "$run"; then 414 if test "$finalize" = yes && test -z "$run"; then
312 tmpdir="/tmp" 415 tmpdir="/tmp"
313 test -n "$TMPDIR" && tmpdir="$TMPDIR" 416 test -n "$TMPDIR" && tmpdir="$TMPDIR"
314 - tmpdir="$tmpdir/libtool-$$" 417 - tmpdir="$tmpdir/libtool-$$"
319 + fi 422 + fi
320 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 423 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
321 else 424 else
322 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 425 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
323 ENDPATCH 426 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} 427}
338 428
339test_patch() { 429test_patch() {
340 430
341 local opts="" 431 local opts=""
638 hardcode_libdirs= 728 hardcode_libdirs=
639 dep_rpath= 729 dep_rpath=
640 ENDPATCH 730 ENDPATCH
641} 731}
642 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.3  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20