/[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.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.5 2002/06/10 18:25:04 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=""
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 ewarn "Cannot apply any patch, running libtoolize..."
119 libtoolize --copy --force 158 libtoolize --copy --force
120 break 159 break
121 fi 160 fi
122 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
123 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}
124} 194}
125 195
126# 196#
127# Returns all the directories containing ltmain.sh 197# Returns all the directories containing ltmain.sh
128# 198#
156 fi 226 fi
157 227
158 patch ${opts} -p0 <<-"ENDPATCH" 228 patch ${opts} -p0 <<-"ENDPATCH"
159 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 229 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
160 +++ ltmain.sh Sun May 26 19:50:52 2002 230 +++ ltmain.sh Sun May 26 19:50:52 2002
161 @@ -3940,9 +3940,39 @@ 231 @@ -3940,9 +3940,46 @@
162 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 232 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
163 exit 1 233 exit 1
164 fi 234 fi
165 - newdependency_libs="$newdependency_libs $libdir/$name" 235 - newdependency_libs="$newdependency_libs $libdir/$name"
166 + # 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
167 + # this if the .la is being installed. 237 + # this if the .la is being installed.
168 + if test "$installed" = yes; then 238 + if test "$installed" = yes && test "$D"; then
169 + 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'`"
170 + else 240 + else
171 + mynewdependency_lib="$libdir/$name" 241 + mynewdependency_lib="$libdir/$name"
172 + fi 242 + fi
173 + # Do not add duplicates 243 + # Do not add duplicates
244 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 245 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 246 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
247 + fi
177 + fi 248 + fi
178 + ;; 249 + ;;
179 + *) 250 + *)
180 + 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
181 + # We do not want portage's build root ($S} present. 257 + # We do not want portage's build root ($S) present.
182 + if test -n "`echo $deplib |grep -e "${S}"`" 258 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
183 + then 259 + mynewdependency_lib=""
184 + newdependency_libs=""
185 + # We do not want portage's install root ($D) present. 260 + # We do not want portage's install root ($D) present.
186 + elif test -n "`echo $deplib |grep -e "${D}"`" 261 + 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'`" 262 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
263 + else
264 + mynewdependency_lib="$deplib"
189 + fi 265 + fi
190 + else 266 + else
191 + mynewdependency_lib="$deplib" 267 + mynewdependency_lib="$deplib"
192 + fi 268 + fi
193 + # Do not add duplicates 269 + # Do not add duplicates
270 + if test "$mynewdependency_lib"; then
194 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 271 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
195 + then
196 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 272 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
273 + fi
197 + fi 274 + fi
198 ;; 275 ;;
199 - *) newdependency_libs="$newdependency_libs $deplib" ;; 276 - *) newdependency_libs="$newdependency_libs $deplib" ;;
200 esac 277 esac
201 done 278 done
203 @@ -3975,6 +4005,10 @@ 280 @@ -3975,6 +4005,10 @@
204 case $host,$output,$installed,$module,$dlname in 281 case $host,$output,$installed,$module,$dlname in
205 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 282 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
206 esac 283 esac
207 + # Do not add duplicates 284 + # Do not add duplicates
208 + if test "$installed" = yes; then 285 + if test "$installed" = yes && test "$D"; then
209 + 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'`"
210 + fi 287 + fi
211 $echo > $output "\ 288 $echo > $output "\
212 # $outputname - a libtool library file 289 # $outputname - a libtool library file
213 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 290 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
214 ENDPATCH 291 ENDPATCH
325 - continue 402 - continue
326 + exit 1 403 + exit 1
327 fi 404 fi
328 fi 405 fi
329 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
330 @@ -4782,7 +4829,11 @@ 435 @@ -4782,7 +4829,11 @@
331 if test "$finalize" = yes && test -z "$run"; then 436 if test "$finalize" = yes && test -z "$run"; then
332 tmpdir="/tmp" 437 tmpdir="/tmp"
333 test -n "$TMPDIR" && tmpdir="$TMPDIR" 438 test -n "$TMPDIR" && tmpdir="$TMPDIR"
334 - tmpdir="$tmpdir/libtool-$$" 439 - tmpdir="$tmpdir/libtool-$$"
339 + fi 444 + fi
340 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 445 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
341 else 446 else
342 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 447 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
343 ENDPATCH 448 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} 449}
358 450
359test_patch() { 451test_patch() {
360 452
361 local opts="" 453 local opts=""
658 hardcode_libdirs= 750 hardcode_libdirs=
659 dep_rpath= 751 dep_rpath=
660 ENDPATCH 752 ENDPATCH
661} 753}
662 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.5  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20