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

Diff of /eclass/libtool.eclass

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

Revision 1.10 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.10 2002/06/29 23:50:56 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
13ELIBTOOL_VERSION=1.8.1 17ELIBTOOL_VERSION=1.8.1
14 18
21 local dorelink="yes" 25 local dorelink="yes"
22 local dotmp="yes" 26 local dotmp="yes"
23 local doportage="yes" 27 local doportage="yes"
24 local portage="no" 28 local portage="no"
25 local reversedeps="no" 29 local reversedeps="no"
30 local removeinternaldep="no"
31 local deptoremove=""
26 local mylist="" 32 local mylist=""
27 33
28 mylist="$(find_ltmain)" 34 mylist="$(find_ltmain)"
29 for x in ${*} 35 for x in ${*}
30 do 36 do
39 # http://bugzilla.gnome.org/show_bug.cgi?id=75635 45 # http://bugzilla.gnome.org/show_bug.cgi?id=75635
40 if [ "${x}" = "--reverse-deps" ] 46 if [ "${x}" = "--reverse-deps" ]
41 then 47 then
42 reversedeps="yes" 48 reversedeps="yes"
43 fi 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
44 # Only patch the ltmain.sh in ${S} 55 # Only patch the ltmain.sh in ${S}
45 if [ "${x}" = "--shallow" ] 56 if [ "${x}" = "--shallow" ]
46 then 57 then
47 if [ -f ${S}/ltmain.sh ] 58 if [ -f ${S}/ltmain.sh ]
48 then 59 then
65 dotmp="yes" 76 dotmp="yes"
66 doportage="yes" 77 doportage="yes"
67 78
68 for y in test_patch relink_patch tmp_patch portage_patch 79 for y in test_patch relink_patch tmp_patch portage_patch
69 do 80 do
70 if ! eval ${y} --test $>${T}/libtool.foo 81 if ! eval ${y} --test $>${T}/elibtool.log
71 then 82 then
72 case ${y} in 83 case ${y} in
73 test_patch) 84 test_patch)
74 # non critical patch 85 # non critical patch
75 dotest="no" 86 dotest="no"
100 ;; 111 ;;
101 esac 112 esac
102 fi 113 fi
103 done 114 done
104 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
105 for y in test_patch relink_patch tmp_patch portage_patch 124 for y in test_patch relink_patch tmp_patch portage_patch
106 do 125 do
107 if [ "${dopatch}" = "yes" ] 126 if [ "${dopatch}" = "yes" ]
108 then 127 then
109 case ${y} in 128 case ${y} in
132 fi 151 fi
133 ;; 152 ;;
134 esac 153 esac
135 154
136 einfo "Applying libtool-${y/_patch/}.patch..." 155 einfo "Applying libtool-${y/_patch/}.patch..."
137 eval ${y} $>${T}/libtool.foo 156 eval ${y} $>${T}/elibtool.log
138 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] 157 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ] && [ "${removeinternaldep}" = "no" ]
139 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
140 ewarn "Cannot apply any patch, running libtoolize..." 168 ewarn "Cannot apply any patch, running libtoolize..."
141 libtoolize --copy --force 169 libtoolize --copy --force
170 cd ${x}
142 break 171 break
143 fi 172 fi
144 done 173 done
145 174
146 if [ "${reversedeps}" = "yes" ] 175 if [ "${reversedeps}" = "yes" ]
147 then 176 then
148 if eval reversedeps_patch --test $>${T}/libtool.foo 177 if eval reversedeps_patch --test $>${T}/libtool.foo
149 then 178 then
150 einfo "Applying libtool-reverse-deps.patch..." 179 einfo "Applying libtool-reverse-deps.patch..."
151 eval reversedeps_patch $>${T}/libtool.foo 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..."
152 fi 194 fi
153 fi 195 fi
154 done 196 done
155 197
156 if [ -f libtool ] 198 if [ -f libtool ]
196 fi 238 fi
197 239
198 patch ${opts} -p0 <<-"ENDPATCH" 240 patch ${opts} -p0 <<-"ENDPATCH"
199 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 241 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
200 +++ ltmain.sh Sun May 26 19:50:52 2002 242 +++ ltmain.sh Sun May 26 19:50:52 2002
201 @@ -3940,9 +3940,41 @@ 243 @@ -3940,9 +3940,46 @@
202 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 244 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
203 exit 1 245 exit 1
204 fi 246 fi
205 - newdependency_libs="$newdependency_libs $libdir/$name" 247 - newdependency_libs="$newdependency_libs $libdir/$name"
206 + # 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
207 + # this if the .la is being installed. 249 + # this if the .la is being installed.
208 + if test "$installed" = yes && test "$D"; then 250 + if test "$installed" = yes && test "$D"; then
209 + 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'`"
210 + else 252 + else
211 + mynewdependency_lib="$libdir/$name" 253 + mynewdependency_lib="$libdir/$name"
212 + fi 254 + fi
213 + # Do not add duplicates 255 + # Do not add duplicates
214 + if test "$mynewdependency_lib"; then 256 + if test "$mynewdependency_lib"; then
215 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then 257 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
216 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 258 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
217 + fi 259 + fi
218 + fi 260 + fi
219 + ;; 261 + ;;
220 + *) 262 + *)
221 + 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
222 + # We do not want portage's build root ($S) present. 269 + # We do not want portage's build root ($S) present.
223 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then 270 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
224 + newdependency_libs="" 271 + mynewdependency_lib=""
225 + # We do not want portage's install root ($D) present. 272 + # We do not want portage's install root ($D) present.
226 + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then 273 + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
227 + 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'`"
228 + else 275 + else
229 + mynewdependency_lib="$deplib" 276 + mynewdependency_lib="$deplib"
230 + fi 277 + fi
231 + else 278 + else
232 + mynewdependency_lib="$deplib" 279 + mynewdependency_lib="$deplib"
233 + fi 280 + fi
234 + # Do not add duplicates 281 + # Do not add duplicates
235 + if test "$mynewdependency_lib"; then 282 + if test "$mynewdependency_lib"; then
236 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then 283 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
237 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 284 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
238 + fi 285 + fi
239 + fi 286 + fi
240 ;; 287 ;;
241 - *) newdependency_libs="$newdependency_libs $deplib" ;; 288 - *) newdependency_libs="$newdependency_libs $deplib" ;;
242 esac 289 esac
369 fi 416 fi
370 fi 417 fi
371 418
372 ENDPATCH 419 ENDPATCH
373 420
374 retval=$? 421 retval=$?
375 422
376 # This one dont apply clean to libtool-1.4.2a, so do it manually. 423 # This one dont apply clean to libtool-1.4.2a, so do it manually.
377 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ] 424 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
378 then 425 then
379 cp ltmain.sh ltmain.sh.orig 426 cp ltmain.sh ltmain.sh.orig
380 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \ 427 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
381 ltmain.sh.orig > ltmain.sh 428 ltmain.sh.orig > ltmain.sh
382 rm -f ltmain.sh.orig 429 rm -f ltmain.sh.orig
383 fi 430 fi
384 431
385 return ${retval} 432 return ${retval}
386} 433}
387 434
388tmp_patch() { 435tmp_patch() {
389 436
390 local opts="" 437 local opts=""
757 ;; 804 ;;
758 *) tmp_libs="$tmp_libs $deplib" ;; 805 *) tmp_libs="$tmp_libs $deplib" ;;
759 ENDPATCH 806 ENDPATCH
760} 807}
761 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.10  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20