/[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.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.3 2002/06/05 23:41:36 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"
29 local mylist=""
23 30
31 mylist="$(find_ltmain)"
32 for x in ${*}
33 do
24 # Only apply portage patch, and dont "libtoolize --copy --force" 34 # Only apply portage patch, and dont "libtoolize --copy --force"
25 # if all patches fail. 35 # if all patches fail.
26 if [ "${1}" = "--portage" ] 36 if [ "${x}" = "--portage" ]
27 then 37 then
28 portage="yes" 38 portage="yes"
29 fi 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"
46 fi
47 # Only patch the ltmain.sh in ${S}
48 if [ "${x}" = "--shallow" ]
49 then
50 if [ -f ${S}/ltmain.sh ]
51 then
52 mylist="${S}"
53 else
54 mylist=""
55 fi
56 else
57 mylist="$(find_ltmain)"
58 fi
59 done
30 60
31 for x in $(find_ltmain) 61 for x in ${mylist}
32 do 62 do
33 cd ${x} 63 cd ${x}
34 einfo "Working directory: ${x}..." 64 einfo "Working directory: ${x}..."
35 dopatch="yes" 65 dopatch="yes"
66 dotest="yes"
67 dorelink="yes"
68 dotmp="yes"
69 doportage="yes"
36 70
37 for y in test_patch relink_patch portage_patch 71 for y in test_patch relink_patch tmp_patch portage_patch
38 do 72 do
39 if ! eval ${y} --test $>${T}/libtool.foo 73 if ! eval ${y} --test $>${T}/elibtool.log
40 then 74 then
41 case ${y} in 75 case ${y} in
42 test_patch) 76 test_patch)
43 # non critical patch 77 # non critical patch
44 dotest="no" 78 dotest="no"
50 then 84 then
51 dopatch="no" 85 dopatch="no"
52 fi 86 fi
53 dorelink="no" 87 dorelink="no"
54 ;; 88 ;;
89 tmp_patch)
90 # non critical patch
91 dotmp="no"
92 ;;
55 portage_patch) 93 portage_patch)
56 # critical patch 94 # critical patch
57 if [ "${portage}" = "yes" ] 95 if [ "${portage}" = "yes" ]
58 then 96 then
59 echo 97 echo
65 ;; 103 ;;
66 esac 104 esac
67 fi 105 fi
68 done 106 done
69 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
70 for y in test_patch relink_patch portage_patch 116 for y in test_patch relink_patch tmp_patch portage_patch
71 do 117 do
72 if [ "${dopatch}" = "yes" ] 118 if [ "${dopatch}" = "yes" ]
73 then 119 then
74 case ${y} in 120 case ${y} in
75 test_patch) 121 test_patch)
82 if [ "${dorelink}" = "no" ] 128 if [ "${dorelink}" = "no" ]
83 then 129 then
84 continue 130 continue
85 fi 131 fi
86 ;; 132 ;;
133 tmp_patch)
134 if [ "${dotmp}" = "no" ]
135 then
136 continue
137 fi
138 ;;
87 portage_patch) 139 portage_patch)
88 if [ "${doportage}" = "no" ] 140 if [ "${doportage}" = "no" ]
89 then 141 then
90 continue 142 continue
91 fi 143 fi
92 ;; 144 ;;
93 esac 145 esac
94 146
95 einfo "Applying libtool-${y/_patch/}.patch..." 147 einfo "Applying libtool-${y/_patch/}.patch..."
96 eval ${y} $>${T}/libtool.foo 148 eval ${y} $>${T}/elibtool.log
97 elif [ "${portage}" = "no" ] 149 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ]
98 then 150 then
151 ewarn "Cannot apply any patch, running libtoolize..."
99 libtoolize --copy --force 152 libtoolize --copy --force
100 break 153 break
101 fi 154 fi
102 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
103 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}
104} 175}
105 176
106# 177#
107# Returns all the directories containing ltmain.sh 178# Returns all the directories containing ltmain.sh
108# 179#
136 fi 207 fi
137 208
138 patch ${opts} -p0 <<-"ENDPATCH" 209 patch ${opts} -p0 <<-"ENDPATCH"
139 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 210 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
140 +++ ltmain.sh Sun May 26 19:50:52 2002 211 +++ ltmain.sh Sun May 26 19:50:52 2002
141 @@ -3940,9 +3940,39 @@ 212 @@ -3940,9 +3940,46 @@
142 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 213 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
143 exit 1 214 exit 1
144 fi 215 fi
145 - newdependency_libs="$newdependency_libs $libdir/$name" 216 - newdependency_libs="$newdependency_libs $libdir/$name"
146 + # 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
147 + # this if the .la is being installed. 218 + # this if the .la is being installed.
148 + if test "$installed" = yes; then 219 + if test "$installed" = yes && test "$D"; then
149 + 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'`"
150 + else 221 + else
151 + mynewdependency_lib="$libdir/$name" 222 + mynewdependency_lib="$libdir/$name"
152 + fi 223 + fi
153 + # Do not add duplicates 224 + # Do not add duplicates
225 + if test "$mynewdependency_lib"; then
154 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 226 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
155 + then
156 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 227 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
228 + fi
157 + fi 229 + fi
158 + ;; 230 + ;;
159 + *) 231 + *)
160 + 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
161 + # We do not want portage's build root ($S} present. 238 + # We do not want portage's build root ($S) present.
162 + if test -n "`echo $deplib |grep -e "${S}"`" 239 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
163 + then 240 + mynewdependency_lib=""
164 + newdependency_libs=""
165 + # We do not want portage's install root ($D) present. 241 + # We do not want portage's install root ($D) present.
166 + elif test -n "`echo $deplib |grep -e "${D}"`" 242 + 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'`" 243 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
244 + else
245 + mynewdependency_lib="$deplib"
169 + fi 246 + fi
170 + else 247 + else
171 + mynewdependency_lib="$deplib" 248 + mynewdependency_lib="$deplib"
172 + fi 249 + fi
173 + # Do not add duplicates 250 + # Do not add duplicates
251 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 252 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 253 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
254 + fi
177 + fi 255 + fi
178 ;; 256 ;;
179 - *) newdependency_libs="$newdependency_libs $deplib" ;; 257 - *) newdependency_libs="$newdependency_libs $deplib" ;;
180 esac 258 esac
181 done 259 done
183 @@ -3975,6 +4005,10 @@ 261 @@ -3975,6 +4005,10 @@
184 case $host,$output,$installed,$module,$dlname in 262 case $host,$output,$installed,$module,$dlname in
185 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 263 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
186 esac 264 esac
187 + # Do not add duplicates 265 + # Do not add duplicates
188 + if test "$installed" = yes; then 266 + if test "$installed" = yes && test "$D"; then
189 + 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'`"
190 + fi 268 + fi
191 $echo > $output "\ 269 $echo > $output "\
192 # $outputname - a libtool library file 270 # $outputname - a libtool library file
193 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 271 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
194 ENDPATCH 272 ENDPATCH
305 - continue 383 - continue
306 + exit 1 384 + exit 1
307 fi 385 fi
308 fi 386 fi
309 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
310 @@ -4782,7 +4829,11 @@ 416 @@ -4782,7 +4829,11 @@
311 if test "$finalize" = yes && test -z "$run"; then 417 if test "$finalize" = yes && test -z "$run"; then
312 tmpdir="/tmp" 418 tmpdir="/tmp"
313 test -n "$TMPDIR" && tmpdir="$TMPDIR" 419 test -n "$TMPDIR" && tmpdir="$TMPDIR"
314 - tmpdir="$tmpdir/libtool-$$" 420 - tmpdir="$tmpdir/libtool-$$"
319 + fi 425 + fi
320 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 426 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
321 else 427 else
322 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 428 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
323 ENDPATCH 429 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} 430}
338 431
339test_patch() { 432test_patch() {
340 433
341 local opts="" 434 local opts=""
638 hardcode_libdirs= 731 hardcode_libdirs=
639 dep_rpath= 732 dep_rpath=
640 ENDPATCH 733 ENDPATCH
641} 734}
642 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.3  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20