/[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.23
1#!/bin/bash
2# Copyright 1999-2002 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
3# Distributed under the terms of the GNU General Public License, v2 or later 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.23 2003/04/08 11:34:57 azarah Exp $
4#
4# Author: Martin Schlemmer <azarah@gentoo.org> 5# 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 $ 6#
6# This eclass patches ltmain.sh distributed with libtoolized packages with the 7# This eclass patches ltmain.sh distributed with libtoolized packages with the
7# relink and portage patch 8# relink and portage patch
9
8ECLASS=libtool 10ECLASS=libtool
11INHERITED="$INHERITED $ECLASS"
12
9newdepend sys-devel/libtool 13newdepend "!bootstrap? ( sys-devel/libtool )"
10 14
11DESCRIPTION="Based on the ${ECLASS} eclass" 15DESCRIPTION="Based on the ${ECLASS} eclass"
12 16
17ELIBTOOL_VERSION=1.8.1
13 18
14elibtoolize() { 19elibtoolize() {
15 20
16 local x="" 21 local x=""
17 local y="" 22 local y=""
18 local dopatch="no" 23 local dopatch="no"
19 local dotest="yes" 24 local dotest="yes"
20 local dorelink="yes" 25 local dorelink="yes"
26 local dotmp="yes"
27 local dosed="yes"
21 local doportage="yes" 28 local doportage="yes"
22 local portage="no" 29 local portage="no"
30 local reversedeps="no"
31 local removeinternaldep="no"
32 local deptoremove=""
33 local mylist=""
23 34
35 mylist="$(find_ltmain)"
36 for x in ${*}
37 do
24 # Only apply portage patch, and dont "libtoolize --copy --force" 38 # Only apply portage patch, and dont "libtoolize --copy --force"
25 # if all patches fail. 39 # if all patches fail.
26 if [ "${1}" = "--portage" ] 40 if [ "${x}" = "--portage" ]
27 then 41 then
28 portage="yes" 42 portage="yes"
29 fi 43 fi
44 # Apply the reverse-deps patch
45 #
46 # http://bugzilla.gnome.org/show_bug.cgi?id=75635
47 if [ "${x}" = "--reverse-deps" ]
48 then
49 reversedeps="yes"
50 fi
51 if [ `echo ${x} | grep "^--remove-internal-dep="` ]
52 then
53 removeinternaldep="yes"
54 deptoremove=`echo ${x} | sed -e 's/--remove-internal-dep=//'`
55 fi
56 # Only patch the ltmain.sh in ${S}
57 if [ "${x}" = "--shallow" ]
58 then
59 if [ -f ${S}/ltmain.sh ]
60 then
61 mylist="${S}"
62 else
63 mylist=""
64 fi
65 else
66 mylist="$(find_ltmain)"
67 fi
68 done
30 69
31 for x in $(find_ltmain) 70 for x in ${mylist}
32 do 71 do
33 cd ${x} 72 cd ${x}
34 einfo "Working directory: ${x}..." 73 einfo "Working directory: ${x}..."
35 dopatch="yes" 74 dopatch="yes"
75 dotest="yes"
76 dorelink="yes"
77 dotmp="yes"
78 dosed="yes"
79 doportage="yes"
36 80
37 for y in test_patch relink_patch portage_patch 81 for y in test_patch relink_patch tmp_patch sed_patch portage_patch
38 do 82 do
39 if ! eval ${y} --test $>${T}/libtool.foo 83 if ! eval ${y} --test $>${T}/elibtool.log
40 then 84 then
41 case ${y} in 85 case ${y} in
42 test_patch) 86 test_patch)
43 # non critical patch 87 # non critical patch
44 dotest="no" 88 dotest="no"
49 [ "${portage}" = "no" ] 93 [ "${portage}" = "no" ]
50 then 94 then
51 dopatch="no" 95 dopatch="no"
52 fi 96 fi
53 dorelink="no" 97 dorelink="no"
98 ;;
99 tmp_patch)
100 # non critical patch
101 dotmp="no"
102 ;;
103 sed_patch)
104 # non critical patch
105 dosed="no"
54 ;; 106 ;;
55 portage_patch) 107 portage_patch)
56 # critical patch 108 # critical patch
57 if [ "${portage}" = "yes" ] 109 if [ "${portage}" = "yes" ]
58 then 110 then
65 ;; 117 ;;
66 esac 118 esac
67 fi 119 fi
68 done 120 done
69 121
122# Only apply portage patch ... I think if other can apply, they should.
123# if [ "${portage}" = "yes" ]
124# then
125# dotest="no"
126# dorelink="no"
127# dotmp="no"
128# fi
129
70 for y in test_patch relink_patch portage_patch 130 for y in test_patch relink_patch tmp_patch sed_patch portage_patch
71 do 131 do
72 if [ "${dopatch}" = "yes" ] 132 if [ "${dopatch}" = "yes" ]
73 then 133 then
74 case ${y} in 134 case ${y} in
75 test_patch) 135 test_patch)
82 if [ "${dorelink}" = "no" ] 142 if [ "${dorelink}" = "no" ]
83 then 143 then
84 continue 144 continue
85 fi 145 fi
86 ;; 146 ;;
147 tmp_patch)
148 if [ "${dotmp}" = "no" ]
149 then
150 continue
151 fi
152 ;;
153 sed_patch)
154 if [ "${dosed}" = "no" ]
155 then
156 continue
157 fi
158 ;;
87 portage_patch) 159 portage_patch)
88 if [ "${doportage}" = "no" ] 160 if [ "${doportage}" = "no" ]
89 then 161 then
90 continue 162 continue
91 fi 163 fi
92 ;; 164 ;;
93 esac 165 esac
94 166
95 einfo "Applying libtool-${y/_patch/}.patch..." 167 einfo "Applying libtool-${y/_patch/}.patch..."
96 eval ${y} $>${T}/libtool.foo 168 eval ${y} $>${T}/elibtool.log
97 elif [ "${portage}" = "no" ] 169 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] && [ "${removeinternaldep}" = "no" ]
98 then 170 then
171 # Sometimes ltmain.sh is in a subdirectory ...
172 if [ ! -f ${x}/configure.in -a ! -f ${x}/configure.ac ]
173 then
174 if [ -f ${x}/../configure.in -o -f ${x}/../configure.ac ]
175 then
176 cd ${x}/../
177 fi
178 fi
179
180 ewarn "Cannot apply any patch, running libtoolize..."
99 libtoolize --copy --force 181 libtoolize --copy --force
182 cd ${x}
100 break 183 break
101 fi 184 fi
102 done 185 done
186
187 if [ "${reversedeps}" = "yes" ]
188 then
189 if eval reversedeps_patch --test $>${T}/libtool.foo
190 then
191 einfo "Applying libtool-reverse-deps.patch..."
192 eval reversedeps_patch $>${T}/libtool.foo
193 else
194 ewarn "Not applying libtool-reverse-deps.patch..."
195 fi
196 fi
197
198 if [ "${removeinternaldep}" = "yes" ]
199 then
200 if eval remove_internal_dep_patch $deptoremove --test $>${T}/libtool.foo
201 then
202 einfo "Applying remove-internal-dep.patch (removing $deptoremove)..."
203 eval remove_internal_dep_patch $deptoremove $>${T}/libtool.foo
204 else
205 ewarn "Not applying libtool-remove-internal-dep.patch..."
206 fi
207 fi
103 done 208 done
209
210 if [ -f libtool ]
211 then
212 rm -f libtool
213 fi
214
215 # We need to change the pwd back to $S, as we may be called in
216 # src_compile()
217 cd ${S}
104} 218}
105 219
106# 220#
107# Returns all the directories containing ltmain.sh 221# Returns all the directories containing ltmain.sh
108# 222#
136 fi 250 fi
137 251
138 patch ${opts} -p0 <<-"ENDPATCH" 252 patch ${opts} -p0 <<-"ENDPATCH"
139 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 253 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
140 +++ ltmain.sh Sun May 26 19:50:52 2002 254 +++ ltmain.sh Sun May 26 19:50:52 2002
141 @@ -3940,9 +3940,39 @@ 255 @@ -3940,9 +3940,46 @@
142 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 256 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
143 exit 1 257 exit 1
144 fi 258 fi
145 - newdependency_libs="$newdependency_libs $libdir/$name" 259 - newdependency_libs="$newdependency_libs $libdir/$name"
146 + # We do not want portage's install root ($D) present. Check only for 260 + # We do not want portage's install root ($D) present. Check only for
147 + # this if the .la is being installed. 261 + # this if the .la is being installed.
148 + if test "$installed" = yes; then 262 + if test "$installed" = yes && test "$D"; then
149 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" 263 + eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
150 + else 264 + else
151 + mynewdependency_lib="$libdir/$name" 265 + mynewdependency_lib="$libdir/$name"
152 + fi 266 + fi
153 + # Do not add duplicates 267 + # Do not add duplicates
268 + if test "$mynewdependency_lib"; then
154 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 269 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
155 + then
156 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 270 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
271 + fi
157 + fi 272 + fi
158 + ;; 273 + ;;
159 + *) 274 + *)
160 + if test "$installed" = yes; then 275 + if test "$installed" = yes; then
276 + # Rather use S=WORKDIR if our version of portage supports it.
277 + # This is because some ebuild (gcc) do not use $S as buildroot.
278 + if test "$PWORKDIR"; then
279 + S="$PWORKDIR"
280 + fi
161 + # We do not want portage's build root ($S} present. 281 + # We do not want portage's build root ($S) present.
162 + if test -n "`echo $deplib |grep -e "${S}"`" 282 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
163 + then 283 + mynewdependency_lib=""
164 + newdependency_libs=""
165 + # We do not want portage's install root ($D) present. 284 + # We do not want portage's install root ($D) present.
166 + elif test -n "`echo $deplib |grep -e "${D}"`" 285 + 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'`" 286 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
287 + else
288 + mynewdependency_lib="$deplib"
169 + fi 289 + fi
170 + else 290 + else
171 + mynewdependency_lib="$deplib" 291 + mynewdependency_lib="$deplib"
172 + fi 292 + fi
173 + # Do not add duplicates 293 + # Do not add duplicates
294 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 295 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 296 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
297 + fi
177 + fi 298 + fi
178 ;; 299 ;;
179 - *) newdependency_libs="$newdependency_libs $deplib" ;; 300 - *) newdependency_libs="$newdependency_libs $deplib" ;;
180 esac 301 esac
181 done 302 done
183 @@ -3975,6 +4005,10 @@ 304 @@ -3975,6 +4005,10 @@
184 case $host,$output,$installed,$module,$dlname in 305 case $host,$output,$installed,$module,$dlname in
185 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 306 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
186 esac 307 esac
187 + # Do not add duplicates 308 + # Do not add duplicates
188 + if test "$installed" = yes; then 309 + if test "$installed" = yes && test "$D"; then
189 + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" 310 + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
190 + fi 311 + fi
191 $echo > $output "\ 312 $echo > $output "\
192 # $outputname - a libtool library file 313 # $outputname - a libtool library file
193 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 314 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
194 ENDPATCH 315 ENDPATCH
305 - continue 426 - continue
306 + exit 1 427 + exit 1
307 fi 428 fi
308 fi 429 fi
309 430
431 ENDPATCH
432
433 retval=$?
434
435 # This one dont apply clean to libtool-1.4.2a, so do it manually.
436 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
437 then
438 cp ltmain.sh ltmain.sh.orig
439 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
440 ltmain.sh.orig > ltmain.sh
441 rm -f ltmain.sh.orig
442 fi
443
444 return ${retval}
445}
446
447tmp_patch() {
448
449 local opts=""
450
451 if [ "${1}" = "--test" ]
452 then
453 opts="--force --dry-run"
454 fi
455
456 patch ${opts} -p0 <<-"ENDPATCH"
457 --- ltmain.sh Sun Aug 12 18:08:05 2001
458 +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001
310 @@ -4782,7 +4829,11 @@ 459 @@ -4782,7 +4829,11 @@
311 if test "$finalize" = yes && test -z "$run"; then 460 if test "$finalize" = yes && test -z "$run"; then
312 tmpdir="/tmp" 461 tmpdir="/tmp"
313 test -n "$TMPDIR" && tmpdir="$TMPDIR" 462 test -n "$TMPDIR" && tmpdir="$TMPDIR"
314 - tmpdir="$tmpdir/libtool-$$" 463 - tmpdir="$tmpdir/libtool-$$"
319 + fi 468 + fi
320 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 469 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
321 else 470 else
322 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 471 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
323 ENDPATCH 472 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} 473}
338 474
339test_patch() { 475test_patch() {
340 476
341 local opts="" 477 local opts=""
638 hardcode_libdirs= 774 hardcode_libdirs=
639 dep_rpath= 775 dep_rpath=
640 ENDPATCH 776 ENDPATCH
641} 777}
642 778
779reversedeps_patch() {
780
781 local opts=""
782
783 if [ "${1}" = "--test" ]
784 then
785 opts="--force --dry-run"
786 fi
787
788 patch ${opts} -p0 <<-"ENDPATCH"
789 --- ltmain.sh.orig Sat Mar 23 22:48:45 2002
790 +++ ltmain.sh Sat Mar 23 22:45:38 2002
791 @@ -1553,6 +1553,8 @@
792 convenience="$convenience $ladir/$objdir/$old_library"
793 old_convenience="$old_convenience $ladir/$objdir/$old_library"
794 tmp_libs=
795 + # PKGW
796 + dependency_libs=
797 for deplib in $dependency_libs; do
798 deplibs="$deplib $deplibs"
799 case "$tmp_libs " in
800 @@ -1668,6 +1670,8 @@
801 fi
802
803 tmp_libs=
804 + #PKGW
805 + dependency_libs=
806 for deplib in $dependency_libs; do
807 case $deplib in
808 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
809 @@ -2081,7 +2085,7 @@
810 -L*)
811 case " $tmp_libs " in
812 *" $deplib "*) ;;
813 - *) tmp_libs="$tmp_libs $deplib" ;;
814 + *) tmp_libs="$deplib $tmp_libs" ;;
815 esac
816 ;;
817 *) tmp_libs="$tmp_libs $deplib" ;;
818 ENDPATCH
819}
820
821remove_internal_dep_patch() {
822 local opts=""
823
824 if [ "${2}" = "--test" ]
825 then
826 opts="--force --dry-run"
827 fi
828
829 patch ${opts} -p0 <<-ENDPATCH
830 --- ltmain.sh.orig 2002-11-01 19:56:50.000000000 -0600
831 +++ ltmain.sh 2002-11-01 19:57:03.000000000 -0600
832 @@ -4551,6 +4551,8 @@
833 if test "\$installed" = yes && test "\$D"; then
834 install_libdir="\`echo "\$install_libdir" |sed -e "s:\$D::g" -e 's://:/:g'\`"
835 fi
836 + # Removing $1 from dependency_libs in .la
837 + dependency_libs=\`echo \$dependency_libs | \$Xsed -e 's%\([^ ]*lib${1}\.\(so\|la\|a\)\)\|\(-l${1}\)%%g'\`
838 \$echo > \$output "\\
839 # \$outputname - a libtool library file
840 # Generated by \$PROGRAM - GNU \$PACKAGE \$VERSION\$TIMESTAMP
841 ENDPATCH
842}
843
844sed_patch() {
845
846 local opts=""
847
848 if [ "${1}" = "--test" ]
849 then
850 opts="--force --dry-run"
851 fi
852
853 patch ${opts} -p1 <<-"ENDPATCH"
854 --- libtool-1.4.3/ltmain.sh.ltmain-SED 2003-02-13 14:54:24.000000000 +0100
855 +++ libtool-1.4.3/ltmain.sh 2003-02-13 15:24:49.000000000 +0100
856 @@ -48,6 +48,9 @@ EOF
857 exit 0
858 fi
859
860 +# define SED for historic ltconfig's generated by Libtool 1.3
861 +test -z "$SED" && SED=sed
862 +
863 # The name of this program.
864 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
865 modename="$progname"
866 ENDPATCH
867}
868

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.20