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

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.20