/[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.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.5 2002/06/10 18:25:04 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=""
23 local mylist="" 33 local mylist=""
24 34
25 mylist="$(find_ltmain)" 35 mylist="$(find_ltmain)"
26 # Only apply portage patch, and dont "libtoolize --copy --force"
27 # if all patches fail.
28 for x in ${*} 36 for x in ${*}
29 do 37 do
38 # Only apply portage patch, and dont "libtoolize --copy --force"
39 # if all patches fail.
30 if [ "${x}" = "--portage" ] 40 if [ "${x}" = "--portage" ]
31 then 41 then
32 portage="yes" 42 portage="yes"
33 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
34 # Only patch the ltmain.sh in ${S} 56 # Only patch the ltmain.sh in ${S}
35 if [ "${x}" = "--shallow" ] 57 if [ "${x}" = "--shallow" ]
36 then 58 then
37 if [ -f ${S}/ltmain.sh ] 59 if [ -f ${S}/ltmain.sh ]
38 then 60 then
50 cd ${x} 72 cd ${x}
51 einfo "Working directory: ${x}..." 73 einfo "Working directory: ${x}..."
52 dopatch="yes" 74 dopatch="yes"
53 dotest="yes" 75 dotest="yes"
54 dorelink="yes" 76 dorelink="yes"
77 dotmp="yes"
78 dosed="yes"
55 doportage="yes" 79 doportage="yes"
56 80
57 for y in test_patch relink_patch portage_patch 81 for y in test_patch relink_patch tmp_patch sed_patch portage_patch
58 do 82 do
59 if ! eval ${y} --test $>${T}/libtool.foo 83 if ! eval ${y} --test $>${T}/elibtool.log
60 then 84 then
61 case ${y} in 85 case ${y} in
62 test_patch) 86 test_patch)
63 # non critical patch 87 # non critical patch
64 dotest="no" 88 dotest="no"
69 [ "${portage}" = "no" ] 93 [ "${portage}" = "no" ]
70 then 94 then
71 dopatch="no" 95 dopatch="no"
72 fi 96 fi
73 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"
74 ;; 106 ;;
75 portage_patch) 107 portage_patch)
76 # critical patch 108 # critical patch
77 if [ "${portage}" = "yes" ] 109 if [ "${portage}" = "yes" ]
78 then 110 then
85 ;; 117 ;;
86 esac 118 esac
87 fi 119 fi
88 done 120 done
89 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
90 for y in test_patch relink_patch portage_patch 130 for y in test_patch relink_patch tmp_patch sed_patch portage_patch
91 do 131 do
92 if [ "${dopatch}" = "yes" ] 132 if [ "${dopatch}" = "yes" ]
93 then 133 then
94 case ${y} in 134 case ${y} in
95 test_patch) 135 test_patch)
102 if [ "${dorelink}" = "no" ] 142 if [ "${dorelink}" = "no" ]
103 then 143 then
104 continue 144 continue
105 fi 145 fi
106 ;; 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 ;;
107 portage_patch) 159 portage_patch)
108 if [ "${doportage}" = "no" ] 160 if [ "${doportage}" = "no" ]
109 then 161 then
110 continue 162 continue
111 fi 163 fi
112 ;; 164 ;;
113 esac 165 esac
114 166
115 einfo "Applying libtool-${y/_patch/}.patch..." 167 einfo "Applying libtool-${y/_patch/}.patch..."
116 eval ${y} $>${T}/libtool.foo 168 eval ${y} $>${T}/elibtool.log
117 elif [ "${portage}" = "no" ] 169 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] && [ "${removeinternaldep}" = "no" ]
118 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..."
119 libtoolize --copy --force 181 libtoolize --copy --force
182 cd ${x}
120 break 183 break
121 fi 184 fi
122 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
123 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}
124} 218}
125 219
126# 220#
127# Returns all the directories containing ltmain.sh 221# Returns all the directories containing ltmain.sh
128# 222#
156 fi 250 fi
157 251
158 patch ${opts} -p0 <<-"ENDPATCH" 252 patch ${opts} -p0 <<-"ENDPATCH"
159 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 253 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
160 +++ ltmain.sh Sun May 26 19:50:52 2002 254 +++ ltmain.sh Sun May 26 19:50:52 2002
161 @@ -3940,9 +3940,39 @@ 255 @@ -3940,9 +3940,46 @@
162 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 256 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
163 exit 1 257 exit 1
164 fi 258 fi
165 - newdependency_libs="$newdependency_libs $libdir/$name" 259 - newdependency_libs="$newdependency_libs $libdir/$name"
166 + # 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
167 + # this if the .la is being installed. 261 + # this if the .la is being installed.
168 + if test "$installed" = yes; then 262 + if test "$installed" = yes && test "$D"; then
169 + 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'`"
170 + else 264 + else
171 + mynewdependency_lib="$libdir/$name" 265 + mynewdependency_lib="$libdir/$name"
172 + fi 266 + fi
173 + # Do not add duplicates 267 + # Do not add duplicates
268 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 269 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 270 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
271 + fi
177 + fi 272 + fi
178 + ;; 273 + ;;
179 + *) 274 + *)
180 + 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
181 + # We do not want portage's build root ($S} present. 281 + # We do not want portage's build root ($S) present.
182 + if test -n "`echo $deplib |grep -e "${S}"`" 282 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
183 + then 283 + mynewdependency_lib=""
184 + newdependency_libs=""
185 + # We do not want portage's install root ($D) present. 284 + # We do not want portage's install root ($D) present.
186 + elif test -n "`echo $deplib |grep -e "${D}"`" 285 + 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'`" 286 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
287 + else
288 + mynewdependency_lib="$deplib"
189 + fi 289 + fi
190 + else 290 + else
191 + mynewdependency_lib="$deplib" 291 + mynewdependency_lib="$deplib"
192 + fi 292 + fi
193 + # Do not add duplicates 293 + # Do not add duplicates
294 + if test "$mynewdependency_lib"; then
194 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 295 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
195 + then
196 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 296 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
297 + fi
197 + fi 298 + fi
198 ;; 299 ;;
199 - *) newdependency_libs="$newdependency_libs $deplib" ;; 300 - *) newdependency_libs="$newdependency_libs $deplib" ;;
200 esac 301 esac
201 done 302 done
203 @@ -3975,6 +4005,10 @@ 304 @@ -3975,6 +4005,10 @@
204 case $host,$output,$installed,$module,$dlname in 305 case $host,$output,$installed,$module,$dlname in
205 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 306 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
206 esac 307 esac
207 + # Do not add duplicates 308 + # Do not add duplicates
208 + if test "$installed" = yes; then 309 + if test "$installed" = yes && test "$D"; then
209 + 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'`"
210 + fi 311 + fi
211 $echo > $output "\ 312 $echo > $output "\
212 # $outputname - a libtool library file 313 # $outputname - a libtool library file
213 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 314 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
214 ENDPATCH 315 ENDPATCH
325 - continue 426 - continue
326 + exit 1 427 + exit 1
327 fi 428 fi
328 fi 429 fi
329 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
330 @@ -4782,7 +4829,11 @@ 459 @@ -4782,7 +4829,11 @@
331 if test "$finalize" = yes && test -z "$run"; then 460 if test "$finalize" = yes && test -z "$run"; then
332 tmpdir="/tmp" 461 tmpdir="/tmp"
333 test -n "$TMPDIR" && tmpdir="$TMPDIR" 462 test -n "$TMPDIR" && tmpdir="$TMPDIR"
334 - tmpdir="$tmpdir/libtool-$$" 463 - tmpdir="$tmpdir/libtool-$$"
339 + fi 468 + fi
340 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 469 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
341 else 470 else
342 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 471 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
343 ENDPATCH 472 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} 473}
358 474
359test_patch() { 475test_patch() {
360 476
361 local opts="" 477 local opts=""
658 hardcode_libdirs= 774 hardcode_libdirs=
659 dep_rpath= 775 dep_rpath=
660 ENDPATCH 776 ENDPATCH
661} 777}
662 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.5  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.20