/[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.15
1#!/bin/bash 1#!/bin/bash
2# Copyright 1999-2002 Gentoo Technologies, Inc. 2# Copyright 1999-2002 Gentoo Technologies, Inc.
3# Distributed under the terms of the GNU General Public License, v2 or later 3# Distributed under the terms of the GNU General Public License v2
4# Author: Martin Schlemmer <azarah@gentoo.org> 4# 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 $ 5# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.15 2002/10/25 19:55:52 vapier Exp $
6# This eclass patches ltmain.sh distributed with libtoolized packages with the 6# This eclass patches ltmain.sh distributed with libtoolized packages with the
7# relink and portage patch 7# relink and portage patch
8
8ECLASS=libtool 9ECLASS=libtool
10INHERITED="$INHERITED $ECLASS"
11
9newdepend sys-devel/libtool 12newdepend sys-devel/libtool
10 13
11DESCRIPTION="Based on the ${ECLASS} eclass" 14DESCRIPTION="Based on the ${ECLASS} eclass"
12 15
16ELIBTOOL_VERSION=1.8.1
13 17
14elibtoolize() { 18elibtoolize() {
15 19
16 local x="" 20 local x=""
17 local y="" 21 local y=""
18 local dopatch="no" 22 local dopatch="no"
19 local dotest="yes" 23 local dotest="yes"
20 local dorelink="yes" 24 local dorelink="yes"
25 local dotmp="yes"
21 local doportage="yes" 26 local doportage="yes"
22 local portage="no" 27 local portage="no"
28 local reversedeps="no"
23 local mylist="" 29 local mylist=""
24 30
25 mylist="$(find_ltmain)" 31 mylist="$(find_ltmain)"
26 # Only apply portage patch, and dont "libtoolize --copy --force"
27 # if all patches fail.
28 for x in ${*} 32 for x in ${*}
29 do 33 do
34 # Only apply portage patch, and dont "libtoolize --copy --force"
35 # if all patches fail.
30 if [ "${x}" = "--portage" ] 36 if [ "${x}" = "--portage" ]
31 then 37 then
32 portage="yes" 38 portage="yes"
39 fi
40 # Apply the reverse-deps patch
41 #
42 # http://bugzilla.gnome.org/show_bug.cgi?id=75635
43 if [ "${x}" = "--reverse-deps" ]
44 then
45 reversedeps="yes"
33 fi 46 fi
34 # Only patch the ltmain.sh in ${S} 47 # Only patch the ltmain.sh in ${S}
35 if [ "${x}" = "--shallow" ] 48 if [ "${x}" = "--shallow" ]
36 then 49 then
37 if [ -f ${S}/ltmain.sh ] 50 if [ -f ${S}/ltmain.sh ]
50 cd ${x} 63 cd ${x}
51 einfo "Working directory: ${x}..." 64 einfo "Working directory: ${x}..."
52 dopatch="yes" 65 dopatch="yes"
53 dotest="yes" 66 dotest="yes"
54 dorelink="yes" 67 dorelink="yes"
68 dotmp="yes"
55 doportage="yes" 69 doportage="yes"
56 70
57 for y in test_patch relink_patch portage_patch 71 for y in test_patch relink_patch tmp_patch portage_patch
58 do 72 do
59 if ! eval ${y} --test $>${T}/libtool.foo 73 if ! eval ${y} --test $>${T}/elibtool.log
60 then 74 then
61 case ${y} in 75 case ${y} in
62 test_patch) 76 test_patch)
63 # non critical patch 77 # non critical patch
64 dotest="no" 78 dotest="no"
70 then 84 then
71 dopatch="no" 85 dopatch="no"
72 fi 86 fi
73 dorelink="no" 87 dorelink="no"
74 ;; 88 ;;
89 tmp_patch)
90 # non critical patch
91 dotmp="no"
92 ;;
75 portage_patch) 93 portage_patch)
76 # critical patch 94 # critical patch
77 if [ "${portage}" = "yes" ] 95 if [ "${portage}" = "yes" ]
78 then 96 then
79 echo 97 echo
85 ;; 103 ;;
86 esac 104 esac
87 fi 105 fi
88 done 106 done
89 107
108# Only apply portage patch ... I think if other can apply, they should.
109# if [ "${portage}" = "yes" ]
110# then
111# dotest="no"
112# dorelink="no"
113# dotmp="no"
114# fi
115
90 for y in test_patch relink_patch portage_patch 116 for y in test_patch relink_patch tmp_patch portage_patch
91 do 117 do
92 if [ "${dopatch}" = "yes" ] 118 if [ "${dopatch}" = "yes" ]
93 then 119 then
94 case ${y} in 120 case ${y} in
95 test_patch) 121 test_patch)
102 if [ "${dorelink}" = "no" ] 128 if [ "${dorelink}" = "no" ]
103 then 129 then
104 continue 130 continue
105 fi 131 fi
106 ;; 132 ;;
133 tmp_patch)
134 if [ "${dotmp}" = "no" ]
135 then
136 continue
137 fi
138 ;;
107 portage_patch) 139 portage_patch)
108 if [ "${doportage}" = "no" ] 140 if [ "${doportage}" = "no" ]
109 then 141 then
110 continue 142 continue
111 fi 143 fi
112 ;; 144 ;;
113 esac 145 esac
114 146
115 einfo "Applying libtool-${y/_patch/}.patch..." 147 einfo "Applying libtool-${y/_patch/}.patch..."
116 eval ${y} $>${T}/libtool.foo 148 eval ${y} $>${T}/elibtool.log
117 elif [ "${portage}" = "no" ] 149 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ]
118 then 150 then
151 ewarn "Cannot apply any patch, running libtoolize..."
119 libtoolize --copy --force 152 libtoolize --copy --force
120 break 153 break
121 fi 154 fi
122 done 155 done
156
157 if [ "${reversedeps}" = "yes" ]
158 then
159 if eval reversedeps_patch --test $>${T}/libtool.foo
160 then
161 einfo "Applying libtool-reverse-deps.patch..."
162 eval reversedeps_patch $>${T}/libtool.foo
163 fi
164 fi
123 done 165 done
166
167 if [ -f libtool ]
168 then
169 rm -f libtool
170 fi
171
172 # We need to change the pwd back to $S, as we may be called in
173 # src_compile()
174 cd ${S}
124} 175}
125 176
126# 177#
127# Returns all the directories containing ltmain.sh 178# Returns all the directories containing ltmain.sh
128# 179#
156 fi 207 fi
157 208
158 patch ${opts} -p0 <<-"ENDPATCH" 209 patch ${opts} -p0 <<-"ENDPATCH"
159 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 210 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
160 +++ ltmain.sh Sun May 26 19:50:52 2002 211 +++ ltmain.sh Sun May 26 19:50:52 2002
161 @@ -3940,9 +3940,39 @@ 212 @@ -3940,9 +3940,46 @@
162 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 213 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
163 exit 1 214 exit 1
164 fi 215 fi
165 - newdependency_libs="$newdependency_libs $libdir/$name" 216 - newdependency_libs="$newdependency_libs $libdir/$name"
166 + # We do not want portage's install root ($D) present. Check only for 217 + # We do not want portage's install root ($D) present. Check only for
167 + # this if the .la is being installed. 218 + # this if the .la is being installed.
168 + if test "$installed" = yes; then 219 + if test "$installed" = yes && test "$D"; then
169 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" 220 + eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
170 + else 221 + else
171 + mynewdependency_lib="$libdir/$name" 222 + mynewdependency_lib="$libdir/$name"
172 + fi 223 + fi
173 + # Do not add duplicates 224 + # Do not add duplicates
225 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 226 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 227 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
228 + fi
177 + fi 229 + fi
178 + ;; 230 + ;;
179 + *) 231 + *)
180 + if test "$installed" = yes; then 232 + if test "$installed" = yes; then
233 + # Rather use S=WORKDIR if our version of portage supports it.
234 + # This is because some ebuild (gcc) do not use $S as buildroot.
235 + if test "$PWORKDIR"; then
236 + S="$PWORKDIR"
237 + fi
181 + # We do not want portage's build root ($S} present. 238 + # We do not want portage's build root ($S) present.
182 + if test -n "`echo $deplib |grep -e "${S}"`" 239 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
183 + then 240 + mynewdependency_lib=""
184 + newdependency_libs=""
185 + # We do not want portage's install root ($D) present. 241 + # We do not want portage's install root ($D) present.
186 + elif test -n "`echo $deplib |grep -e "${D}"`" 242 + 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'`" 243 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
244 + else
245 + mynewdependency_lib="$deplib"
189 + fi 246 + fi
190 + else 247 + else
191 + mynewdependency_lib="$deplib" 248 + mynewdependency_lib="$deplib"
192 + fi 249 + fi
193 + # Do not add duplicates 250 + # Do not add duplicates
251 + if test "$mynewdependency_lib"; then
194 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 252 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
195 + then
196 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 253 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
254 + fi
197 + fi 255 + fi
198 ;; 256 ;;
199 - *) newdependency_libs="$newdependency_libs $deplib" ;; 257 - *) newdependency_libs="$newdependency_libs $deplib" ;;
200 esac 258 esac
201 done 259 done
203 @@ -3975,6 +4005,10 @@ 261 @@ -3975,6 +4005,10 @@
204 case $host,$output,$installed,$module,$dlname in 262 case $host,$output,$installed,$module,$dlname in
205 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 263 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
206 esac 264 esac
207 + # Do not add duplicates 265 + # Do not add duplicates
208 + if test "$installed" = yes; then 266 + if test "$installed" = yes && test "$D"; then
209 + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" 267 + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
210 + fi 268 + fi
211 $echo > $output "\ 269 $echo > $output "\
212 # $outputname - a libtool library file 270 # $outputname - a libtool library file
213 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 271 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
214 ENDPATCH 272 ENDPATCH
325 - continue 383 - continue
326 + exit 1 384 + exit 1
327 fi 385 fi
328 fi 386 fi
329 387
388 ENDPATCH
389
390 retval=$?
391
392 # This one dont apply clean to libtool-1.4.2a, so do it manually.
393 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
394 then
395 cp ltmain.sh ltmain.sh.orig
396 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
397 ltmain.sh.orig > ltmain.sh
398 rm -f ltmain.sh.orig
399 fi
400
401 return ${retval}
402}
403
404tmp_patch() {
405
406 local opts=""
407
408 if [ "${1}" = "--test" ]
409 then
410 opts="--force --dry-run"
411 fi
412
413 patch ${opts} -p0 <<-"ENDPATCH"
414 --- ltmain.sh Sun Aug 12 18:08:05 2001
415 +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001
330 @@ -4782,7 +4829,11 @@ 416 @@ -4782,7 +4829,11 @@
331 if test "$finalize" = yes && test -z "$run"; then 417 if test "$finalize" = yes && test -z "$run"; then
332 tmpdir="/tmp" 418 tmpdir="/tmp"
333 test -n "$TMPDIR" && tmpdir="$TMPDIR" 419 test -n "$TMPDIR" && tmpdir="$TMPDIR"
334 - tmpdir="$tmpdir/libtool-$$" 420 - tmpdir="$tmpdir/libtool-$$"
339 + fi 425 + fi
340 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 426 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
341 else 427 else
342 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 428 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
343 ENDPATCH 429 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} 430}
358 431
359test_patch() { 432test_patch() {
360 433
361 local opts="" 434 local opts=""
658 hardcode_libdirs= 731 hardcode_libdirs=
659 dep_rpath= 732 dep_rpath=
660 ENDPATCH 733 ENDPATCH
661} 734}
662 735
736reversedeps_patch() {
737
738 local opts=""
739
740 if [ "${1}" = "--test" ]
741 then
742 opts="--force --dry-run"
743 fi
744
745 patch ${opts} -p0 <<-"ENDPATCH"
746 --- ltmain.sh.orig Sat Mar 23 22:48:45 2002
747 +++ ltmain.sh Sat Mar 23 22:45:38 2002
748 @@ -1553,6 +1553,8 @@
749 convenience="$convenience $ladir/$objdir/$old_library"
750 old_convenience="$old_convenience $ladir/$objdir/$old_library"
751 tmp_libs=
752 + # PKGW
753 + dependency_libs=
754 for deplib in $dependency_libs; do
755 deplibs="$deplib $deplibs"
756 case "$tmp_libs " in
757 @@ -1668,6 +1670,8 @@
758 fi
759
760 tmp_libs=
761 + #PKGW
762 + dependency_libs=
763 for deplib in $dependency_libs; do
764 case $deplib in
765 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
766 @@ -2081,7 +2085,7 @@
767 -L*)
768 case " $tmp_libs " in
769 *" $deplib "*) ;;
770 - *) tmp_libs="$tmp_libs $deplib" ;;
771 + *) tmp_libs="$deplib $tmp_libs" ;;
772 esac
773 ;;
774 *) tmp_libs="$tmp_libs $deplib" ;;
775 ENDPATCH
776}
777

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20