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

Diff of /eclass/libtool.eclass

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

Revision 1.4 Revision 1.20
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.20 2003/02/16 04:26:21 vapier 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.4 2002/06/10 18:23:49 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"
21 local doportage="yes" 27 local doportage="yes"
22 local portage="no" 28 local portage="no"
29 local reversedeps="no"
30 local removeinternaldep="no"
31 local deptoremove=""
23 local mylist="" 32 local mylist=""
24 33
25 mylist="$(find_ltmain)" 34 mylist="$(find_ltmain)"
26 # Only apply portage patch, and dont "libtoolize --copy --force"
27 # if all patches fail.
28 for x in ${*} 35 for x in ${*}
29 do 36 do
37 # Only apply portage patch, and dont "libtoolize --copy --force"
38 # if all patches fail.
30 if [ "${1}" = "--portage" ] 39 if [ "${x}" = "--portage" ]
31 then 40 then
32 portage="yes" 41 portage="yes"
33 fi 42 fi
43 # Apply the reverse-deps patch
44 #
45 # http://bugzilla.gnome.org/show_bug.cgi?id=75635
46 if [ "${x}" = "--reverse-deps" ]
47 then
48 reversedeps="yes"
49 fi
50 if [ `echo ${x} | grep "^--remove-internal-dep="` ]
51 then
52 removeinternaldep="yes"
53 deptoremove=`echo ${x} | sed -e 's/--remove-internal-dep=//'`
54 fi
34 # Only patch the ltmain.sh in ${S} 55 # Only patch the ltmain.sh in ${S}
35 if [ "${1}" = "--shallow" ] 56 if [ "${x}" = "--shallow" ]
36 then 57 then
37 if [ -f ${S}/ltmain.sh ] 58 if [ -f ${S}/ltmain.sh ]
38 then 59 then
39 mylist="${S}" 60 mylist="${S}"
40 else 61 else
50 cd ${x} 71 cd ${x}
51 einfo "Working directory: ${x}..." 72 einfo "Working directory: ${x}..."
52 dopatch="yes" 73 dopatch="yes"
53 dotest="yes" 74 dotest="yes"
54 dorelink="yes" 75 dorelink="yes"
76 dotmp="yes"
55 doportage="yes" 77 doportage="yes"
56 78
57 for y in test_patch relink_patch portage_patch 79 for y in test_patch relink_patch tmp_patch portage_patch
58 do 80 do
59 if ! eval ${y} --test $>${T}/libtool.foo 81 if ! eval ${y} --test $>${T}/elibtool.log
60 then 82 then
61 case ${y} in 83 case ${y} in
62 test_patch) 84 test_patch)
63 # non critical patch 85 # non critical patch
64 dotest="no" 86 dotest="no"
70 then 92 then
71 dopatch="no" 93 dopatch="no"
72 fi 94 fi
73 dorelink="no" 95 dorelink="no"
74 ;; 96 ;;
97 tmp_patch)
98 # non critical patch
99 dotmp="no"
100 ;;
75 portage_patch) 101 portage_patch)
76 # critical patch 102 # critical patch
77 if [ "${portage}" = "yes" ] 103 if [ "${portage}" = "yes" ]
78 then 104 then
79 echo 105 echo
85 ;; 111 ;;
86 esac 112 esac
87 fi 113 fi
88 done 114 done
89 115
116# Only apply portage patch ... I think if other can apply, they should.
117# if [ "${portage}" = "yes" ]
118# then
119# dotest="no"
120# dorelink="no"
121# dotmp="no"
122# fi
123
90 for y in test_patch relink_patch portage_patch 124 for y in test_patch relink_patch tmp_patch portage_patch
91 do 125 do
92 if [ "${dopatch}" = "yes" ] 126 if [ "${dopatch}" = "yes" ]
93 then 127 then
94 case ${y} in 128 case ${y} in
95 test_patch) 129 test_patch)
102 if [ "${dorelink}" = "no" ] 136 if [ "${dorelink}" = "no" ]
103 then 137 then
104 continue 138 continue
105 fi 139 fi
106 ;; 140 ;;
141 tmp_patch)
142 if [ "${dotmp}" = "no" ]
143 then
144 continue
145 fi
146 ;;
107 portage_patch) 147 portage_patch)
108 if [ "${doportage}" = "no" ] 148 if [ "${doportage}" = "no" ]
109 then 149 then
110 continue 150 continue
111 fi 151 fi
112 ;; 152 ;;
113 esac 153 esac
114 154
115 einfo "Applying libtool-${y/_patch/}.patch..." 155 einfo "Applying libtool-${y/_patch/}.patch..."
116 eval ${y} $>${T}/libtool.foo 156 eval ${y} $>${T}/elibtool.log
117 elif [ "${portage}" = "no" ] 157 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] && [ "${removeinternaldep}" = "no" ]
118 then 158 then
159 # Sometimes ltmain.sh is in a subdirectory ...
160 if [ ! -f ${x}/configure.in -a ! -f ${x}/configure.ac ]
161 then
162 if [ -f ${x}/../configure.in -o -f ${x}/../configure.ac ]
163 then
164 cd ${x}/../
165 fi
166 fi
167
168 ewarn "Cannot apply any patch, running libtoolize..."
119 libtoolize --copy --force 169 libtoolize --copy --force
170 cd ${x}
120 break 171 break
121 fi 172 fi
122 done 173 done
174
175 if [ "${reversedeps}" = "yes" ]
176 then
177 if eval reversedeps_patch --test $>${T}/libtool.foo
178 then
179 einfo "Applying libtool-reverse-deps.patch..."
180 eval reversedeps_patch $>${T}/libtool.foo
181 else
182 ewarn "Not applying libtool-reverse-deps.patch..."
183 fi
184 fi
185
186 if [ "${removeinternaldep}" = "yes" ]
187 then
188 if eval remove_internal_dep_patch $deptoremove --test $>${T}/libtool.foo
189 then
190 einfo "Applying remove-internal-dep.patch (removing $deptoremove)..."
191 eval remove_internal_dep_patch $deptoremove $>${T}/libtool.foo
192 else
193 ewarn "Not applying libtool-remove-internal-dep.patch..."
194 fi
195 fi
123 done 196 done
197
198 if [ -f libtool ]
199 then
200 rm -f libtool
201 fi
202
203 # We need to change the pwd back to $S, as we may be called in
204 # src_compile()
205 cd ${S}
124} 206}
125 207
126# 208#
127# Returns all the directories containing ltmain.sh 209# Returns all the directories containing ltmain.sh
128# 210#
156 fi 238 fi
157 239
158 patch ${opts} -p0 <<-"ENDPATCH" 240 patch ${opts} -p0 <<-"ENDPATCH"
159 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 241 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
160 +++ ltmain.sh Sun May 26 19:50:52 2002 242 +++ ltmain.sh Sun May 26 19:50:52 2002
161 @@ -3940,9 +3940,39 @@ 243 @@ -3940,9 +3940,46 @@
162 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 244 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
163 exit 1 245 exit 1
164 fi 246 fi
165 - newdependency_libs="$newdependency_libs $libdir/$name" 247 - newdependency_libs="$newdependency_libs $libdir/$name"
166 + # We do not want portage's install root ($D) present. Check only for 248 + # We do not want portage's install root ($D) present. Check only for
167 + # this if the .la is being installed. 249 + # this if the .la is being installed.
168 + if test "$installed" = yes; then 250 + if test "$installed" = yes && test "$D"; then
169 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" 251 + eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
170 + else 252 + else
171 + mynewdependency_lib="$libdir/$name" 253 + mynewdependency_lib="$libdir/$name"
172 + fi 254 + fi
173 + # Do not add duplicates 255 + # Do not add duplicates
256 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 257 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 258 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
259 + fi
177 + fi 260 + fi
178 + ;; 261 + ;;
179 + *) 262 + *)
180 + if test "$installed" = yes; then 263 + if test "$installed" = yes; then
264 + # Rather use S=WORKDIR if our version of portage supports it.
265 + # This is because some ebuild (gcc) do not use $S as buildroot.
266 + if test "$PWORKDIR"; then
267 + S="$PWORKDIR"
268 + fi
181 + # We do not want portage's build root ($S} present. 269 + # We do not want portage's build root ($S) present.
182 + if test -n "`echo $deplib |grep -e "${S}"`" 270 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
183 + then 271 + mynewdependency_lib=""
184 + newdependency_libs=""
185 + # We do not want portage's install root ($D) present. 272 + # We do not want portage's install root ($D) present.
186 + elif test -n "`echo $deplib |grep -e "${D}"`" 273 + 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'`" 274 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
275 + else
276 + mynewdependency_lib="$deplib"
189 + fi 277 + fi
190 + else 278 + else
191 + mynewdependency_lib="$deplib" 279 + mynewdependency_lib="$deplib"
192 + fi 280 + fi
193 + # Do not add duplicates 281 + # Do not add duplicates
282 + if test "$mynewdependency_lib"; then
194 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 283 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
195 + then
196 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 284 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
285 + fi
197 + fi 286 + fi
198 ;; 287 ;;
199 - *) newdependency_libs="$newdependency_libs $deplib" ;; 288 - *) newdependency_libs="$newdependency_libs $deplib" ;;
200 esac 289 esac
201 done 290 done
203 @@ -3975,6 +4005,10 @@ 292 @@ -3975,6 +4005,10 @@
204 case $host,$output,$installed,$module,$dlname in 293 case $host,$output,$installed,$module,$dlname in
205 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 294 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
206 esac 295 esac
207 + # Do not add duplicates 296 + # Do not add duplicates
208 + if test "$installed" = yes; then 297 + if test "$installed" = yes && test "$D"; then
209 + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" 298 + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
210 + fi 299 + fi
211 $echo > $output "\ 300 $echo > $output "\
212 # $outputname - a libtool library file 301 # $outputname - a libtool library file
213 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 302 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
214 ENDPATCH 303 ENDPATCH
325 - continue 414 - continue
326 + exit 1 415 + exit 1
327 fi 416 fi
328 fi 417 fi
329 418
419 ENDPATCH
420
421 retval=$?
422
423 # This one dont apply clean to libtool-1.4.2a, so do it manually.
424 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
425 then
426 cp ltmain.sh ltmain.sh.orig
427 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
428 ltmain.sh.orig > ltmain.sh
429 rm -f ltmain.sh.orig
430 fi
431
432 return ${retval}
433}
434
435tmp_patch() {
436
437 local opts=""
438
439 if [ "${1}" = "--test" ]
440 then
441 opts="--force --dry-run"
442 fi
443
444 patch ${opts} -p0 <<-"ENDPATCH"
445 --- ltmain.sh Sun Aug 12 18:08:05 2001
446 +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001
330 @@ -4782,7 +4829,11 @@ 447 @@ -4782,7 +4829,11 @@
331 if test "$finalize" = yes && test -z "$run"; then 448 if test "$finalize" = yes && test -z "$run"; then
332 tmpdir="/tmp" 449 tmpdir="/tmp"
333 test -n "$TMPDIR" && tmpdir="$TMPDIR" 450 test -n "$TMPDIR" && tmpdir="$TMPDIR"
334 - tmpdir="$tmpdir/libtool-$$" 451 - tmpdir="$tmpdir/libtool-$$"
339 + fi 456 + fi
340 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 457 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
341 else 458 else
342 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 459 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
343 ENDPATCH 460 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} 461}
358 462
359test_patch() { 463test_patch() {
360 464
361 local opts="" 465 local opts=""
658 hardcode_libdirs= 762 hardcode_libdirs=
659 dep_rpath= 763 dep_rpath=
660 ENDPATCH 764 ENDPATCH
661} 765}
662 766
767reversedeps_patch() {
768
769 local opts=""
770
771 if [ "${1}" = "--test" ]
772 then
773 opts="--force --dry-run"
774 fi
775
776 patch ${opts} -p0 <<-"ENDPATCH"
777 --- ltmain.sh.orig Sat Mar 23 22:48:45 2002
778 +++ ltmain.sh Sat Mar 23 22:45:38 2002
779 @@ -1553,6 +1553,8 @@
780 convenience="$convenience $ladir/$objdir/$old_library"
781 old_convenience="$old_convenience $ladir/$objdir/$old_library"
782 tmp_libs=
783 + # PKGW
784 + dependency_libs=
785 for deplib in $dependency_libs; do
786 deplibs="$deplib $deplibs"
787 case "$tmp_libs " in
788 @@ -1668,6 +1670,8 @@
789 fi
790
791 tmp_libs=
792 + #PKGW
793 + dependency_libs=
794 for deplib in $dependency_libs; do
795 case $deplib in
796 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
797 @@ -2081,7 +2085,7 @@
798 -L*)
799 case " $tmp_libs " in
800 *" $deplib "*) ;;
801 - *) tmp_libs="$tmp_libs $deplib" ;;
802 + *) tmp_libs="$deplib $tmp_libs" ;;
803 esac
804 ;;
805 *) tmp_libs="$tmp_libs $deplib" ;;
806 ENDPATCH
807}
808
809remove_internal_dep_patch() {
810 local opts=""
811
812 if [ "${2}" = "--test" ]
813 then
814 opts="--force --dry-run"
815 fi
816
817 patch ${opts} -p0 <<-ENDPATCH
818 --- ltmain.sh.orig 2002-11-01 19:56:50.000000000 -0600
819 +++ ltmain.sh 2002-11-01 19:57:03.000000000 -0600
820 @@ -4551,6 +4551,8 @@
821 if test "\$installed" = yes && test "\$D"; then
822 install_libdir="\`echo "\$install_libdir" |sed -e "s:\$D::g" -e 's://:/:g'\`"
823 fi
824 + # Removing $1 from dependency_libs in .la
825 + dependency_libs=\`echo \$dependency_libs | \$Xsed -e 's%\([^ ]*lib${1}\.\(so\|la\|a\)\)\|\(-l${1}\)%%g'\`
826 \$echo > \$output "\\
827 # \$outputname - a libtool library file
828 # Generated by \$PROGRAM - GNU \$PACKAGE \$VERSION\$TIMESTAMP
829 ENDPATCH
830}
831

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20