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

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

  ViewVC Help
Powered by ViewVC 1.1.20