/[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.8
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.3 2002/06/05 23:41:36 azarah Exp $ 5# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.8 2002/06/26 20:17:53 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
16 local x="" 16 local x=""
17 local y="" 17 local y=""
18 local dopatch="no" 18 local dopatch="no"
19 local dotest="yes" 19 local dotest="yes"
20 local dorelink="yes" 20 local dorelink="yes"
21 local dotmp="yes"
21 local doportage="yes" 22 local doportage="yes"
22 local portage="no" 23 local portage="no"
24 local mylist=""
23 25
26 mylist="$(find_ltmain)"
24 # Only apply portage patch, and dont "libtoolize --copy --force" 27 # Only apply portage patch, and dont "libtoolize --copy --force"
25 # if all patches fail. 28 # if all patches fail.
29 for x in ${*}
30 do
26 if [ "${1}" = "--portage" ] 31 if [ "${x}" = "--portage" ]
27 then 32 then
28 portage="yes" 33 portage="yes"
29 fi 34 fi
35 # Only patch the ltmain.sh in ${S}
36 if [ "${x}" = "--shallow" ]
37 then
38 if [ -f ${S}/ltmain.sh ]
39 then
40 mylist="${S}"
41 else
42 mylist=""
43 fi
44 else
45 mylist="$(find_ltmain)"
46 fi
47 done
30 48
31 for x in $(find_ltmain) 49 for x in ${mylist}
32 do 50 do
33 cd ${x} 51 cd ${x}
34 einfo "Working directory: ${x}..." 52 einfo "Working directory: ${x}..."
35 dopatch="yes" 53 dopatch="yes"
54 dotest="yes"
55 dorelink="yes"
56 dotmp="yes"
57 doportage="yes"
36 58
37 for y in test_patch relink_patch portage_patch 59 for y in test_patch relink_patch tmp_patch portage_patch
38 do 60 do
39 if ! eval ${y} --test $>${T}/libtool.foo 61 if ! eval ${y} --test $>${T}/libtool.foo
40 then 62 then
41 case ${y} in 63 case ${y} in
42 test_patch) 64 test_patch)
49 [ "${portage}" = "no" ] 71 [ "${portage}" = "no" ]
50 then 72 then
51 dopatch="no" 73 dopatch="no"
52 fi 74 fi
53 dorelink="no" 75 dorelink="no"
76 ;;
77 tmp_patch)
78 # non critical patch
79 dotmp="no"
54 ;; 80 ;;
55 portage_patch) 81 portage_patch)
56 # critical patch 82 # critical patch
57 if [ "${portage}" = "yes" ] 83 if [ "${portage}" = "yes" ]
58 then 84 then
65 ;; 91 ;;
66 esac 92 esac
67 fi 93 fi
68 done 94 done
69 95
70 for y in test_patch relink_patch portage_patch 96 for y in test_patch relink_patch tmp_patch portage_patch
71 do 97 do
72 if [ "${dopatch}" = "yes" ] 98 if [ "${dopatch}" = "yes" ]
73 then 99 then
74 case ${y} in 100 case ${y} in
75 test_patch) 101 test_patch)
78 continue 104 continue
79 fi 105 fi
80 ;; 106 ;;
81 relink_patch) 107 relink_patch)
82 if [ "${dorelink}" = "no" ] 108 if [ "${dorelink}" = "no" ]
109 then
110 continue
111 fi
112 ;;
113 tmp_patch)
114 if [ "${dotmp}" = "no" ]
83 then 115 then
84 continue 116 continue
85 fi 117 fi
86 ;; 118 ;;
87 portage_patch) 119 portage_patch)
99 libtoolize --copy --force 131 libtoolize --copy --force
100 break 132 break
101 fi 133 fi
102 done 134 done
103 done 135 done
136
137 if [ -f libtool ]
138 then
139 rm -f libtool
140 fi
141
142 # We need to change the pwd back to $S, as we may be called in
143 # src_compile()
144 cd ${S}
104} 145}
105 146
106# 147#
107# Returns all the directories containing ltmain.sh 148# Returns all the directories containing ltmain.sh
108# 149#
136 fi 177 fi
137 178
138 patch ${opts} -p0 <<-"ENDPATCH" 179 patch ${opts} -p0 <<-"ENDPATCH"
139 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 180 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
140 +++ ltmain.sh Sun May 26 19:50:52 2002 181 +++ ltmain.sh Sun May 26 19:50:52 2002
141 @@ -3940,9 +3940,39 @@ 182 @@ -3940,9 +3940,40 @@
142 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 183 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
143 exit 1 184 exit 1
144 fi 185 fi
145 - newdependency_libs="$newdependency_libs $libdir/$name" 186 - newdependency_libs="$newdependency_libs $libdir/$name"
146 + # We do not want portage's install root ($D) present. Check only for 187 + # We do not want portage's install root ($D) present. Check only for
147 + # this if the .la is being installed. 188 + # this if the .la is being installed.
148 + if test "$installed" = yes; then 189 + if test "$installed" = yes && test "$D"; then
149 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" 190 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
150 + else 191 + else
151 + mynewdependency_lib="$libdir/$name" 192 + mynewdependency_lib="$libdir/$name"
152 + fi 193 + fi
153 + # Do not add duplicates 194 + # Do not add duplicates
195 + if test "$mynewdependency_lib"; then
154 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 196 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
155 + then
156 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 197 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
198 + fi
157 + fi 199 + fi
158 + ;; 200 + ;;
159 + *) 201 + *)
160 + if test "$installed" = yes; then 202 + if test "$installed" = yes && test "$S"; then
161 + # We do not want portage's build root ($S} present. 203 + # We do not want portage's build root ($S) present.
162 + if test -n "`echo $deplib |grep -e "${S}"`" 204 + if test -n "`echo $deplib |grep -e "$S"`"
163 + then 205 + then
164 + newdependency_libs="" 206 + newdependency_libs=""
165 + # We do not want portage's install root ($D) present. 207 + # We do not want portage's install root ($D) present.
166 + elif test -n "`echo $deplib |grep -e "${D}"`" 208 + 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'`" 209 + mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
169 + fi 210 + fi
170 + else 211 + else
171 + mynewdependency_lib="$deplib" 212 + mynewdependency_lib="$deplib"
172 + fi 213 + fi
173 + # Do not add duplicates 214 + # Do not add duplicates
215 + if test "$mynewdependency_lib"; then
174 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 216 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
175 + then
176 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 217 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
218 + fi
177 + fi 219 + fi
178 ;; 220 ;;
179 - *) newdependency_libs="$newdependency_libs $deplib" ;; 221 - *) newdependency_libs="$newdependency_libs $deplib" ;;
180 esac 222 esac
181 done 223 done
183 @@ -3975,6 +4005,10 @@ 225 @@ -3975,6 +4005,10 @@
184 case $host,$output,$installed,$module,$dlname in 226 case $host,$output,$installed,$module,$dlname in
185 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 227 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
186 esac 228 esac
187 + # Do not add duplicates 229 + # Do not add duplicates
188 + if test "$installed" = yes; then 230 + if test "$installed" = yes && test "$D"; then
189 + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" 231 + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
190 + fi 232 + fi
191 $echo > $output "\ 233 $echo > $output "\
192 # $outputname - a libtool library file 234 # $outputname - a libtool library file
193 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 235 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
194 ENDPATCH 236 ENDPATCH
305 - continue 347 - continue
306 + exit 1 348 + exit 1
307 fi 349 fi
308 fi 350 fi
309 351
352 ENDPATCH
353
354 retval=$?
355
356 # This one dont apply clean to libtool-1.4.2a, so do it manually.
357 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
358 then
359 cp ltmain.sh ltmain.sh.orig
360 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
361 ltmain.sh.orig > ltmain.sh
362 rm -f ltmain.sh.orig
363 fi
364
365 return ${retval}
366}
367
368tmp_patch() {
369
370 local opts=""
371
372 if [ "${1}" = "--test" ]
373 then
374 opts="--force --dry-run"
375 fi
376
377 patch ${opts} -p0 <<-"ENDPATCH"
378 --- ltmain.sh Sun Aug 12 18:08:05 2001
379 +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001
310 @@ -4782,7 +4829,11 @@ 380 @@ -4782,7 +4829,11 @@
311 if test "$finalize" = yes && test -z "$run"; then 381 if test "$finalize" = yes && test -z "$run"; then
312 tmpdir="/tmp" 382 tmpdir="/tmp"
313 test -n "$TMPDIR" && tmpdir="$TMPDIR" 383 test -n "$TMPDIR" && tmpdir="$TMPDIR"
314 - tmpdir="$tmpdir/libtool-$$" 384 - tmpdir="$tmpdir/libtool-$$"
319 + fi 389 + fi
320 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 390 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
321 else 391 else
322 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 392 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
323 ENDPATCH 393 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} 394}
338 395
339test_patch() { 396test_patch() {
340 397
341 local opts="" 398 local opts=""

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20