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

  ViewVC Help
Powered by ViewVC 1.1.20