/[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.18
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.18 2002/12/16 02:36: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 ewarn "Cannot apply any patch, running libtoolize..."
99 libtoolize --copy --force 158 libtoolize --copy --force
100 break 159 break
101 fi 160 fi
102 done 161 done
162
163 if [ "${reversedeps}" = "yes" ]
164 then
165 if eval reversedeps_patch --test $>${T}/libtool.foo
166 then
167 einfo "Applying libtool-reverse-deps.patch..."
168 eval reversedeps_patch $>${T}/libtool.foo
169 else
170 ewarn "Not applying libtool-reverse-deps.patch..."
171 fi
172 fi
173
174 if [ "${removeinternaldep}" = "yes" ]
175 then
176 if eval remove_internal_dep_patch $deptoremove --test $>${T}/libtool.foo
177 then
178 einfo "Applying remove-internal-dep.patch (removing $deptoremove)..."
179 eval remove_internal_dep_patch $deptoremove $>${T}/libtool.foo
180 else
181 ewarn "Not applying libtool-remove-internal-dep.patch..."
182 fi
183 fi
103 done 184 done
185
186 if [ -f libtool ]
187 then
188 rm -f libtool
189 fi
190
191 # We need to change the pwd back to $S, as we may be called in
192 # src_compile()
193 cd ${S}
104} 194}
105 195
106# 196#
107# Returns all the directories containing ltmain.sh 197# Returns all the directories containing ltmain.sh
108# 198#
136 fi 226 fi
137 227
138 patch ${opts} -p0 <<-"ENDPATCH" 228 patch ${opts} -p0 <<-"ENDPATCH"
139 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 229 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
140 +++ ltmain.sh Sun May 26 19:50:52 2002 230 +++ ltmain.sh Sun May 26 19:50:52 2002
141 @@ -3940,9 +3940,39 @@ 231 @@ -3940,9 +3940,46 @@
142 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 232 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
143 exit 1 233 exit 1
144 fi 234 fi
145 - newdependency_libs="$newdependency_libs $libdir/$name" 235 - newdependency_libs="$newdependency_libs $libdir/$name"
146 + # We do not want portage's install root ($D) present. Check only for 236 + # We do not want portage's install root ($D) present. Check only for
147 + # this if the .la is being installed. 237 + # this if the .la is being installed.
148 + if test "$installed" = yes; then 238 + if test "$installed" = yes && test "$D"; then
149 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" 239 + eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
150 + else 240 + else
151 + mynewdependency_lib="$libdir/$name" 241 + mynewdependency_lib="$libdir/$name"
152 + fi 242 + fi
153 + # Do not add duplicates 243 + # Do not add duplicates
244 + if test "$mynewdependency_lib"; then
154 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 245 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
155 + then
156 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 246 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
247 + fi
157 + fi 248 + fi
158 + ;; 249 + ;;
159 + *) 250 + *)
160 + if test "$installed" = yes; then 251 + if test "$installed" = yes; then
252 + # Rather use S=WORKDIR if our version of portage supports it.
253 + # This is because some ebuild (gcc) do not use $S as buildroot.
254 + if test "$PWORKDIR"; then
255 + S="$PWORKDIR"
256 + fi
161 + # We do not want portage's build root ($S} present. 257 + # We do not want portage's build root ($S) present.
162 + if test -n "`echo $deplib |grep -e "${S}"`" 258 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
163 + then 259 + mynewdependency_lib=""
164 + newdependency_libs=""
165 + # We do not want portage's install root ($D) present. 260 + # We do not want portage's install root ($D) present.
166 + elif test -n "`echo $deplib |grep -e "${D}"`" 261 + 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'`" 262 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
263 + else
264 + mynewdependency_lib="$deplib"
169 + fi 265 + fi
170 + else 266 + else
171 + mynewdependency_lib="$deplib" 267 + mynewdependency_lib="$deplib"
172 + fi 268 + fi
173 + # Do not add duplicates 269 + # Do not add duplicates
270 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 271 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 272 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
273 + fi
177 + fi 274 + fi
178 ;; 275 ;;
179 - *) newdependency_libs="$newdependency_libs $deplib" ;; 276 - *) newdependency_libs="$newdependency_libs $deplib" ;;
180 esac 277 esac
181 done 278 done
183 @@ -3975,6 +4005,10 @@ 280 @@ -3975,6 +4005,10 @@
184 case $host,$output,$installed,$module,$dlname in 281 case $host,$output,$installed,$module,$dlname in
185 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 282 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
186 esac 283 esac
187 + # Do not add duplicates 284 + # Do not add duplicates
188 + if test "$installed" = yes; then 285 + if test "$installed" = yes && test "$D"; then
189 + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" 286 + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
190 + fi 287 + fi
191 $echo > $output "\ 288 $echo > $output "\
192 # $outputname - a libtool library file 289 # $outputname - a libtool library file
193 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 290 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
194 ENDPATCH 291 ENDPATCH
305 - continue 402 - continue
306 + exit 1 403 + exit 1
307 fi 404 fi
308 fi 405 fi
309 406
407 ENDPATCH
408
409 retval=$?
410
411 # This one dont apply clean to libtool-1.4.2a, so do it manually.
412 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
413 then
414 cp ltmain.sh ltmain.sh.orig
415 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
416 ltmain.sh.orig > ltmain.sh
417 rm -f ltmain.sh.orig
418 fi
419
420 return ${retval}
421}
422
423tmp_patch() {
424
425 local opts=""
426
427 if [ "${1}" = "--test" ]
428 then
429 opts="--force --dry-run"
430 fi
431
432 patch ${opts} -p0 <<-"ENDPATCH"
433 --- ltmain.sh Sun Aug 12 18:08:05 2001
434 +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001
310 @@ -4782,7 +4829,11 @@ 435 @@ -4782,7 +4829,11 @@
311 if test "$finalize" = yes && test -z "$run"; then 436 if test "$finalize" = yes && test -z "$run"; then
312 tmpdir="/tmp" 437 tmpdir="/tmp"
313 test -n "$TMPDIR" && tmpdir="$TMPDIR" 438 test -n "$TMPDIR" && tmpdir="$TMPDIR"
314 - tmpdir="$tmpdir/libtool-$$" 439 - tmpdir="$tmpdir/libtool-$$"
319 + fi 444 + fi
320 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 445 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
321 else 446 else
322 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 447 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
323 ENDPATCH 448 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} 449}
338 450
339test_patch() { 451test_patch() {
340 452
341 local opts="" 453 local opts=""
638 hardcode_libdirs= 750 hardcode_libdirs=
639 dep_rpath= 751 dep_rpath=
640 ENDPATCH 752 ENDPATCH
641} 753}
642 754
755reversedeps_patch() {
756
757 local opts=""
758
759 if [ "${1}" = "--test" ]
760 then
761 opts="--force --dry-run"
762 fi
763
764 patch ${opts} -p0 <<-"ENDPATCH"
765 --- ltmain.sh.orig Sat Mar 23 22:48:45 2002
766 +++ ltmain.sh Sat Mar 23 22:45:38 2002
767 @@ -1553,6 +1553,8 @@
768 convenience="$convenience $ladir/$objdir/$old_library"
769 old_convenience="$old_convenience $ladir/$objdir/$old_library"
770 tmp_libs=
771 + # PKGW
772 + dependency_libs=
773 for deplib in $dependency_libs; do
774 deplibs="$deplib $deplibs"
775 case "$tmp_libs " in
776 @@ -1668,6 +1670,8 @@
777 fi
778
779 tmp_libs=
780 + #PKGW
781 + dependency_libs=
782 for deplib in $dependency_libs; do
783 case $deplib in
784 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
785 @@ -2081,7 +2085,7 @@
786 -L*)
787 case " $tmp_libs " in
788 *" $deplib "*) ;;
789 - *) tmp_libs="$tmp_libs $deplib" ;;
790 + *) tmp_libs="$deplib $tmp_libs" ;;
791 esac
792 ;;
793 *) tmp_libs="$tmp_libs $deplib" ;;
794 ENDPATCH
795}
796
797remove_internal_dep_patch() {
798 local opts=""
799
800 if [ "${2}" = "--test" ]
801 then
802 opts="--force --dry-run"
803 fi
804
805 patch ${opts} -p0 <<-ENDPATCH
806 --- ltmain.sh.orig 2002-11-01 19:56:50.000000000 -0600
807 +++ ltmain.sh 2002-11-01 19:57:03.000000000 -0600
808 @@ -4551,6 +4551,8 @@
809 if test "\$installed" = yes && test "\$D"; then
810 install_libdir="\`echo "\$install_libdir" |sed -e "s:\$D::g" -e 's://:/:g'\`"
811 fi
812 + # Removing $1 from dependency_libs in .la
813 + dependency_libs=\`echo \$dependency_libs | \$Xsed -e 's%\([^ ]*lib${1}\.\(so\|la\|a\)\)\|\(-l${1}\)%%g'\`
814 \$echo > \$output "\\
815 # \$outputname - a libtool library file
816 # Generated by \$PROGRAM - GNU \$PACKAGE \$VERSION\$TIMESTAMP
817 ENDPATCH
818}
819

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

  ViewVC Help
Powered by ViewVC 1.1.20