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

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

  ViewVC Help
Powered by ViewVC 1.1.20