/[gentoo-x86]/eclass/libtool.eclass
Gentoo

Diff of /eclass/libtool.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.8 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.8 2002/06/26 20:17:53 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=""
19 local dotest="yes" 23 local dotest="yes"
20 local dorelink="yes" 24 local dorelink="yes"
21 local dotmp="yes" 25 local dotmp="yes"
22 local doportage="yes" 26 local doportage="yes"
23 local portage="no" 27 local portage="no"
28 local reversedeps="no"
24 local mylist="" 29 local mylist=""
25 30
26 mylist="$(find_ltmain)" 31 mylist="$(find_ltmain)"
27 # Only apply portage patch, and dont "libtoolize --copy --force"
28 # if all patches fail.
29 for x in ${*} 32 for x in ${*}
30 do 33 do
34 # Only apply portage patch, and dont "libtoolize --copy --force"
35 # if all patches fail.
31 if [ "${x}" = "--portage" ] 36 if [ "${x}" = "--portage" ]
32 then 37 then
33 portage="yes" 38 portage="yes"
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"
34 fi 46 fi
35 # Only patch the ltmain.sh in ${S} 47 # Only patch the ltmain.sh in ${S}
36 if [ "${x}" = "--shallow" ] 48 if [ "${x}" = "--shallow" ]
37 then 49 then
38 if [ -f ${S}/ltmain.sh ] 50 if [ -f ${S}/ltmain.sh ]
56 dotmp="yes" 68 dotmp="yes"
57 doportage="yes" 69 doportage="yes"
58 70
59 for y in test_patch relink_patch tmp_patch portage_patch 71 for y in test_patch relink_patch tmp_patch portage_patch
60 do 72 do
61 if ! eval ${y} --test $>${T}/libtool.foo 73 if ! eval ${y} --test $>${T}/elibtool.log
62 then 74 then
63 case ${y} in 75 case ${y} in
64 test_patch) 76 test_patch)
65 # non critical patch 77 # non critical patch
66 dotest="no" 78 dotest="no"
91 ;; 103 ;;
92 esac 104 esac
93 fi 105 fi
94 done 106 done
95 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
96 for y in test_patch relink_patch tmp_patch portage_patch 116 for y in test_patch relink_patch tmp_patch portage_patch
97 do 117 do
98 if [ "${dopatch}" = "yes" ] 118 if [ "${dopatch}" = "yes" ]
99 then 119 then
100 case ${y} in 120 case ${y} in
123 fi 143 fi
124 ;; 144 ;;
125 esac 145 esac
126 146
127 einfo "Applying libtool-${y/_patch/}.patch..." 147 einfo "Applying libtool-${y/_patch/}.patch..."
128 eval ${y} $>${T}/libtool.foo 148 eval ${y} $>${T}/elibtool.log
129 elif [ "${portage}" = "no" ] 149 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ]
130 then 150 then
151 ewarn "Cannot apply any patch, running libtoolize..."
131 libtoolize --copy --force 152 libtoolize --copy --force
132 break 153 break
133 fi 154 fi
134 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
135 done 165 done
136 166
137 if [ -f libtool ] 167 if [ -f libtool ]
138 then 168 then
139 rm -f libtool 169 rm -f libtool
177 fi 207 fi
178 208
179 patch ${opts} -p0 <<-"ENDPATCH" 209 patch ${opts} -p0 <<-"ENDPATCH"
180 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 210 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
181 +++ ltmain.sh Sun May 26 19:50:52 2002 211 +++ ltmain.sh Sun May 26 19:50:52 2002
182 @@ -3940,9 +3940,40 @@ 212 @@ -3940,9 +3940,46 @@
183 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 213 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
184 exit 1 214 exit 1
185 fi 215 fi
186 - newdependency_libs="$newdependency_libs $libdir/$name" 216 - newdependency_libs="$newdependency_libs $libdir/$name"
187 + # 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
188 + # this if the .la is being installed. 218 + # this if the .la is being installed.
189 + if test "$installed" = yes && test "$D"; then 219 + if test "$installed" = yes && test "$D"; then
190 + 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'`"
191 + else 221 + else
192 + mynewdependency_lib="$libdir/$name" 222 + mynewdependency_lib="$libdir/$name"
193 + fi 223 + fi
194 + # Do not add duplicates 224 + # Do not add duplicates
195 + if test "$mynewdependency_lib"; then 225 + if test "$mynewdependency_lib"; then
196 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then 226 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
197 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 227 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
198 + fi 228 + fi
199 + fi 229 + fi
200 + ;; 230 + ;;
201 + *) 231 + *)
202 + if test "$installed" = yes && test "$S"; 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
203 + # We do not want portage's build root ($S) present. 238 + # We do not want portage's build root ($S) present.
204 + if test -n "`echo $deplib |grep -e "$S"`" 239 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
205 + then
206 + newdependency_libs="" 240 + mynewdependency_lib=""
207 + # We do not want portage's install root ($D) present. 241 + # We do not want portage's install root ($D) present.
208 + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then 242 + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
209 + 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"
210 + fi 246 + fi
211 + else 247 + else
212 + mynewdependency_lib="$deplib" 248 + mynewdependency_lib="$deplib"
213 + fi 249 + fi
214 + # Do not add duplicates 250 + # Do not add duplicates
215 + if test "$mynewdependency_lib"; then 251 + if test "$mynewdependency_lib"; then
216 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then 252 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
217 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 253 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
218 + fi 254 + fi
219 + fi 255 + fi
220 ;; 256 ;;
221 - *) newdependency_libs="$newdependency_libs $deplib" ;; 257 - *) newdependency_libs="$newdependency_libs $deplib" ;;
222 esac 258 esac
349 fi 385 fi
350 fi 386 fi
351 387
352 ENDPATCH 388 ENDPATCH
353 389
354 retval=$? 390 retval=$?
355 391
356 # This one dont apply clean to libtool-1.4.2a, so do it manually. 392 # This one dont apply clean to libtool-1.4.2a, so do it manually.
357 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ] 393 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
358 then 394 then
359 cp ltmain.sh ltmain.sh.orig 395 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@:' \ 396 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 397 ltmain.sh.orig > ltmain.sh
362 rm -f ltmain.sh.orig 398 rm -f ltmain.sh.orig
363 fi 399 fi
364 400
365 return ${retval} 401 return ${retval}
366} 402}
367 403
368tmp_patch() { 404tmp_patch() {
369 405
370 local opts="" 406 local opts=""
695 hardcode_libdirs= 731 hardcode_libdirs=
696 dep_rpath= 732 dep_rpath=
697 ENDPATCH 733 ENDPATCH
698} 734}
699 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.8  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20