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

Diff of /eclass/libtool.eclass

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

Revision 1.6 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.6 2002/06/18 08:43:28 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=""
23 local mylist="" 30 local mylist=""
24 31
25 mylist="$(find_ltmain)" 32 mylist="$(find_ltmain)"
26 # Only apply portage patch, and dont "libtoolize --copy --force"
27 # if all patches fail.
28 for x in ${*} 33 for x in ${*}
29 do 34 do
35 # Only apply portage patch, and dont "libtoolize --copy --force"
36 # if all patches fail.
30 if [ "${x}" = "--portage" ] 37 if [ "${x}" = "--portage" ]
31 then 38 then
32 portage="yes" 39 portage="yes"
33 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
34 # Only patch the ltmain.sh in ${S} 53 # Only patch the ltmain.sh in ${S}
35 if [ "${x}" = "--shallow" ] 54 if [ "${x}" = "--shallow" ]
36 then 55 then
37 if [ -f ${S}/ltmain.sh ] 56 if [ -f ${S}/ltmain.sh ]
38 then 57 then
50 cd ${x} 69 cd ${x}
51 einfo "Working directory: ${x}..." 70 einfo "Working directory: ${x}..."
52 dopatch="yes" 71 dopatch="yes"
53 dotest="yes" 72 dotest="yes"
54 dorelink="yes" 73 dorelink="yes"
74 dotmp="yes"
55 doportage="yes" 75 doportage="yes"
56 76
57 for y in test_patch relink_patch portage_patch 77 for y in test_patch relink_patch tmp_patch portage_patch
58 do 78 do
59 if ! eval ${y} --test $>${T}/libtool.foo 79 if ! eval ${y} --test $>${T}/elibtool.log
60 then 80 then
61 case ${y} in 81 case ${y} in
62 test_patch) 82 test_patch)
63 # non critical patch 83 # non critical patch
64 dotest="no" 84 dotest="no"
70 then 90 then
71 dopatch="no" 91 dopatch="no"
72 fi 92 fi
73 dorelink="no" 93 dorelink="no"
74 ;; 94 ;;
95 tmp_patch)
96 # non critical patch
97 dotmp="no"
98 ;;
75 portage_patch) 99 portage_patch)
76 # critical patch 100 # critical patch
77 if [ "${portage}" = "yes" ] 101 if [ "${portage}" = "yes" ]
78 then 102 then
79 echo 103 echo
85 ;; 109 ;;
86 esac 110 esac
87 fi 111 fi
88 done 112 done
89 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
90 for y in test_patch relink_patch portage_patch 122 for y in test_patch relink_patch tmp_patch portage_patch
91 do 123 do
92 if [ "${dopatch}" = "yes" ] 124 if [ "${dopatch}" = "yes" ]
93 then 125 then
94 case ${y} in 126 case ${y} in
95 test_patch) 127 test_patch)
102 if [ "${dorelink}" = "no" ] 134 if [ "${dorelink}" = "no" ]
103 then 135 then
104 continue 136 continue
105 fi 137 fi
106 ;; 138 ;;
139 tmp_patch)
140 if [ "${dotmp}" = "no" ]
141 then
142 continue
143 fi
144 ;;
107 portage_patch) 145 portage_patch)
108 if [ "${doportage}" = "no" ] 146 if [ "${doportage}" = "no" ]
109 then 147 then
110 continue 148 continue
111 fi 149 fi
112 ;; 150 ;;
113 esac 151 esac
114 152
115 einfo "Applying libtool-${y/_patch/}.patch..." 153 einfo "Applying libtool-${y/_patch/}.patch..."
116 eval ${y} $>${T}/libtool.foo 154 eval ${y} $>${T}/elibtool.log
117 elif [ "${portage}" = "no" ] 155 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] && [ "${removeinternaldep}" = "no" ]
118 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..."
119 libtoolize --copy --force 167 libtoolize --copy --force
168 cd ${x}
120 break 169 break
121 fi 170 fi
122 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
123 done 194 done
195
196 if [ -f libtool ]
197 then
198 rm -f libtool
199 fi
124 200
125 # We need to change the pwd back to $S, as we may be called in 201 # We need to change the pwd back to $S, as we may be called in
126 # src_compile() 202 # src_compile()
127 cd ${S} 203 cd ${S}
128} 204}
160 fi 236 fi
161 237
162 patch ${opts} -p0 <<-"ENDPATCH" 238 patch ${opts} -p0 <<-"ENDPATCH"
163 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 239 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
164 +++ ltmain.sh Sun May 26 19:50:52 2002 240 +++ ltmain.sh Sun May 26 19:50:52 2002
165 @@ -3940,9 +3940,39 @@ 241 @@ -3940,9 +3940,46 @@
166 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 242 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
167 exit 1 243 exit 1
168 fi 244 fi
169 - newdependency_libs="$newdependency_libs $libdir/$name" 245 - newdependency_libs="$newdependency_libs $libdir/$name"
170 + # 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
171 + # this if the .la is being installed. 247 + # this if the .la is being installed.
172 + if test "$installed" = yes; then 248 + if test "$installed" = yes && test "$D"; then
173 + 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'`"
174 + else 250 + else
175 + mynewdependency_lib="$libdir/$name" 251 + mynewdependency_lib="$libdir/$name"
176 + fi 252 + fi
177 + # Do not add duplicates 253 + # Do not add duplicates
254 + if test "$mynewdependency_lib"; then
178 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 255 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
179 + then
180 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 256 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
257 + fi
181 + fi 258 + fi
182 + ;; 259 + ;;
183 + *) 260 + *)
184 + 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
185 + # We do not want portage's build root ($S} present. 267 + # We do not want portage's build root ($S) present.
186 + if test -n "`echo $deplib |grep -e "${S}"`" 268 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
187 + then 269 + mynewdependency_lib=""
188 + newdependency_libs=""
189 + # We do not want portage's install root ($D) present. 270 + # We do not want portage's install root ($D) present.
190 + elif test -n "`echo $deplib |grep -e "${D}"`" 271 + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
191 + then
192 + 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"
193 + fi 275 + fi
194 + else 276 + else
195 + mynewdependency_lib="$deplib" 277 + mynewdependency_lib="$deplib"
196 + fi 278 + fi
197 + # Do not add duplicates 279 + # Do not add duplicates
280 + if test "$mynewdependency_lib"; then
198 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 281 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
199 + then
200 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 282 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
283 + fi
201 + fi 284 + fi
202 ;; 285 ;;
203 - *) newdependency_libs="$newdependency_libs $deplib" ;; 286 - *) newdependency_libs="$newdependency_libs $deplib" ;;
204 esac 287 esac
205 done 288 done
207 @@ -3975,6 +4005,10 @@ 290 @@ -3975,6 +4005,10 @@
208 case $host,$output,$installed,$module,$dlname in 291 case $host,$output,$installed,$module,$dlname in
209 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 292 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
210 esac 293 esac
211 + # Do not add duplicates 294 + # Do not add duplicates
212 + if test "$installed" = yes; then 295 + if test "$installed" = yes && test "$D"; then
213 + 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'`"
214 + fi 297 + fi
215 $echo > $output "\ 298 $echo > $output "\
216 # $outputname - a libtool library file 299 # $outputname - a libtool library file
217 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 300 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
218 ENDPATCH 301 ENDPATCH
329 - continue 412 - continue
330 + exit 1 413 + exit 1
331 fi 414 fi
332 fi 415 fi
333 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
334 @@ -4782,7 +4829,11 @@ 445 @@ -4782,7 +4829,11 @@
335 if test "$finalize" = yes && test -z "$run"; then 446 if test "$finalize" = yes && test -z "$run"; then
336 tmpdir="/tmp" 447 tmpdir="/tmp"
337 test -n "$TMPDIR" && tmpdir="$TMPDIR" 448 test -n "$TMPDIR" && tmpdir="$TMPDIR"
338 - tmpdir="$tmpdir/libtool-$$" 449 - tmpdir="$tmpdir/libtool-$$"
343 + fi 454 + fi
344 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 455 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
345 else 456 else
346 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 457 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
347 ENDPATCH 458 ENDPATCH
348
349 retval=$?
350
351 # This one dont apply clean to libtool-1.4.2a, so do it manually.
352 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
353 then
354 cp ltmain.sh ltmain.sh.orig
355 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
356 ltmain.sh.orig > ltmain.sh
357 rm -f ltmain.sh.orig
358 fi
359
360 return ${retval}
361} 459}
362 460
363test_patch() { 461test_patch() {
364 462
365 local opts="" 463 local opts=""
662 hardcode_libdirs= 760 hardcode_libdirs=
663 dep_rpath= 761 dep_rpath=
664 ENDPATCH 762 ENDPATCH
665} 763}
666 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.6  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20