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

Diff of /eclass/libtool.eclass

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

Revision 1.1 Revision 1.13
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.1 2002/06/05 22:53:11 azarah Exp $ 5# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.13 2002/08/29 23:56:15 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
9INHERITED="$INHERITED $ECLASS"
10
9newdepend sys-devel/libtool 11newdepend sys-devel/libtool
10 12
11DESCRIPTION="Based on the ${ECLASS} eclass" 13DESCRIPTION="Based on the ${ECLASS} eclass"
12 14
15ELIBTOOL_VERSION=1.8.1
13 16
14elibtoolize() { 17elibtoolize() {
15 18
16 local x="" 19 local x=""
17 local y="" 20 local y=""
18 local dopatch="no" 21 local dopatch="no"
22 local dotest="yes"
23 local dorelink="yes"
24 local dotmp="yes"
25 local doportage="yes"
26 local portage="no"
27 local reversedeps="no"
28 local mylist=""
19 29
20 for x in $(find_ltmain) 30 mylist="$(find_ltmain)"
31 for x in ${*}
32 do
33 # Only apply portage patch, and dont "libtoolize --copy --force"
34 # if all patches fail.
35 if [ "${x}" = "--portage" ]
36 then
37 portage="yes"
38 fi
39 # Apply the reverse-deps patch
40 #
41 # http://bugzilla.gnome.org/show_bug.cgi?id=75635
42 if [ "${x}" = "--reverse-deps" ]
43 then
44 reversedeps="yes"
45 fi
46 # Only patch the ltmain.sh in ${S}
47 if [ "${x}" = "--shallow" ]
48 then
49 if [ -f ${S}/ltmain.sh ]
50 then
51 mylist="${S}"
52 else
53 mylist=""
54 fi
55 else
56 mylist="$(find_ltmain)"
57 fi
58 done
59
60 for x in ${mylist}
21 do 61 do
22 cd ${x} 62 cd ${x}
23 einfo "Working directory: ${x}..." 63 einfo "Working directory: ${x}..."
24 dopatch="yes" 64 dopatch="yes"
25 65 dotest="yes"
66 dorelink="yes"
67 dotmp="yes"
68 doportage="yes"
69
26 for y in test_patch relink_patch portage_patch 70 for y in test_patch relink_patch tmp_patch portage_patch
27 do 71 do
28 if ! eval ${y} --test $>${T}/libtool.foo 72 if ! eval ${y} --test $>${T}/elibtool.log
29 then 73 then
74 case ${y} in
75 test_patch)
76 # non critical patch
77 dotest="no"
78 ;;
79 relink_patch)
80 # critical patch, but could be applied
81 if [ -z "$(grep -e "inst_prefix_dir" ltmain.sh)" ] && \
82 [ "${portage}" = "no" ]
83 then
84 dopatch="no"
85 fi
86 dorelink="no"
87 ;;
88 tmp_patch)
89 # non critical patch
90 dotmp="no"
91 ;;
92 portage_patch)
93 # critical patch
94 if [ "${portage}" = "yes" ]
95 then
96 echo
97 eerror "Portage patch requested, but failed to apply!"
98 die
99 fi
30 dopatch="no" 100 dopatch="no"
31 break 101 doportage="no"
102 ;;
103 esac
32 fi 104 fi
33 done 105 done
34 106
107# Only apply portage patch ... I think if other can apply, they should.
108# if [ "${portage}" = "yes" ]
109# then
110# dotest="no"
111# dorelink="no"
112# dotmp="no"
113# fi
114
35 for y in test_patch relink_patch portage_patch 115 for y in test_patch relink_patch tmp_patch portage_patch
36 do 116 do
37 if [ "${dopatch}" = "yes" ] 117 if [ "${dopatch}" = "yes" ]
38 then 118 then
119 case ${y} in
120 test_patch)
121 if [ "${dotest}" = "no" ]
122 then
123 continue
124 fi
125 ;;
126 relink_patch)
127 if [ "${dorelink}" = "no" ]
128 then
129 continue
130 fi
131 ;;
132 tmp_patch)
133 if [ "${dotmp}" = "no" ]
134 then
135 continue
136 fi
137 ;;
138 portage_patch)
139 if [ "${doportage}" = "no" ]
140 then
141 continue
142 fi
143 ;;
144 esac
145
39 einfo "Applying libtool-${y/_patch/}.patch..." 146 einfo "Applying libtool-${y/_patch/}.patch..."
40 eval ${y} $>${T}/libtool.foo 147 eval ${y} $>${T}/elibtool.log
41 else 148 elif [ "${portage}" = "no" ] && [ "${reversedeps}" = "no" ]
149 then
150 ewarn "Cannot apply any patch, running libtoolize..."
42 libtoolize --copy --force 151 libtoolize --copy --force
43 break 152 break
44 fi 153 fi
45 done 154 done
155
156 if [ "${reversedeps}" = "yes" ]
157 then
158 if eval reversedeps_patch --test $>${T}/libtool.foo
159 then
160 einfo "Applying libtool-reverse-deps.patch..."
161 eval reversedeps_patch $>${T}/libtool.foo
162 fi
163 fi
46 done 164 done
165
166 if [ -f libtool ]
167 then
168 rm -f libtool
169 fi
170
171 # We need to change the pwd back to $S, as we may be called in
172 # src_compile()
173 cd ${S}
47} 174}
48 175
49# 176#
50# Returns all the directories containing ltmain.sh 177# Returns all the directories containing ltmain.sh
51# 178#
79 fi 206 fi
80 207
81 patch ${opts} -p0 <<-"ENDPATCH" 208 patch ${opts} -p0 <<-"ENDPATCH"
82 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002 209 --- ltmain.sh.orig Wed Apr 3 01:19:37 2002
83 +++ ltmain.sh Sun May 26 19:50:52 2002 210 +++ ltmain.sh Sun May 26 19:50:52 2002
84 @@ -3940,9 +3940,39 @@ 211 @@ -3940,9 +3940,46 @@
85 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 212 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
86 exit 1 213 exit 1
87 fi 214 fi
88 - newdependency_libs="$newdependency_libs $libdir/$name" 215 - newdependency_libs="$newdependency_libs $libdir/$name"
89 + # We do not want portage's install root ($D) present. Check only for 216 + # We do not want portage's install root ($D) present. Check only for
90 + # this if the .la is being installed. 217 + # this if the .la is being installed.
91 + if test "$installed" = yes; then 218 + if test "$installed" = yes && test "$D"; then
92 + mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:${D}::g" -e 's://:/:g'`" 219 + eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
93 + else 220 + else
94 + mynewdependency_lib="$libdir/$name" 221 + mynewdependency_lib="$libdir/$name"
95 + fi 222 + fi
96 + # Do not add duplicates 223 + # Do not add duplicates
224 + if test "$mynewdependency_lib"; then
97 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 225 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
98 + then
99 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 226 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
227 + fi
100 + fi 228 + fi
101 + ;; 229 + ;;
102 + *) 230 + *)
103 + if test "$installed" = yes; then 231 + if test "$installed" = yes; then
232 + # Rather use S=WORKDIR if our version of portage supports it.
233 + # This is because some ebuild (gcc) do not use $S as buildroot.
234 + if test "$PWORKDIR"; then
235 + S="$PWORKDIR"
236 + fi
104 + # We do not want portage's build root ($S} present. 237 + # We do not want portage's build root ($S) present.
105 + if test -n "`echo $deplib |grep -e "${S}"`" 238 + if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
106 + then 239 + mynewdependency_lib=""
107 + newdependency_libs=""
108 + # We do not want portage's install root ($D) present. 240 + # We do not want portage's install root ($D) present.
109 + elif test -n "`echo $deplib |grep -e "${D}"`" 241 + elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
110 + then
111 + mynewdependency_lib="`echo "$deplib" |sed -e "s:${D}::g" -e 's://:/:g'`" 242 + eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
243 + else
244 + mynewdependency_lib="$deplib"
112 + fi 245 + fi
113 + else 246 + else
114 + mynewdependency_lib="$deplib" 247 + mynewdependency_lib="$deplib"
115 + fi 248 + fi
116 + # Do not add duplicates 249 + # Do not add duplicates
250 + if test "$mynewdependency_lib"; then
117 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`" 251 + if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
118 + then
119 + newdependency_libs="$newdependency_libs $mynewdependency_lib" 252 + newdependency_libs="$newdependency_libs $mynewdependency_lib"
253 + fi
120 + fi 254 + fi
121 ;; 255 ;;
122 - *) newdependency_libs="$newdependency_libs $deplib" ;; 256 - *) newdependency_libs="$newdependency_libs $deplib" ;;
123 esac 257 esac
124 done 258 done
126 @@ -3975,6 +4005,10 @@ 260 @@ -3975,6 +4005,10 @@
127 case $host,$output,$installed,$module,$dlname in 261 case $host,$output,$installed,$module,$dlname in
128 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 262 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
129 esac 263 esac
130 + # Do not add duplicates 264 + # Do not add duplicates
131 + if test "$installed" = yes; then 265 + if test "$installed" = yes && test "$D"; then
132 + install_libdir="`echo "$install_libdir" |sed -e "s:${D}::g" -e 's://:/:g'`" 266 + install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
133 + fi 267 + fi
134 $echo > $output "\ 268 $echo > $output "\
135 # $outputname - a libtool library file 269 # $outputname - a libtool library file
136 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 270 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
137 ENDPATCH 271 ENDPATCH
248 - continue 382 - continue
249 + exit 1 383 + exit 1
250 fi 384 fi
251 fi 385 fi
252 386
387 ENDPATCH
388
389 retval=$?
390
391 # This one dont apply clean to libtool-1.4.2a, so do it manually.
392 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
393 then
394 cp ltmain.sh ltmain.sh.orig
395 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
396 ltmain.sh.orig > ltmain.sh
397 rm -f ltmain.sh.orig
398 fi
399
400 return ${retval}
401}
402
403tmp_patch() {
404
405 local opts=""
406
407 if [ "${1}" = "--test" ]
408 then
409 opts="--force --dry-run"
410 fi
411
412 patch ${opts} -p0 <<-"ENDPATCH"
413 --- ltmain.sh Sun Aug 12 18:08:05 2001
414 +++ ltmain-relinkable.sh Tue Aug 28 18:55:13 2001
253 @@ -4782,7 +4829,11 @@ 415 @@ -4782,7 +4829,11 @@
254 if test "$finalize" = yes && test -z "$run"; then 416 if test "$finalize" = yes && test -z "$run"; then
255 tmpdir="/tmp" 417 tmpdir="/tmp"
256 test -n "$TMPDIR" && tmpdir="$TMPDIR" 418 test -n "$TMPDIR" && tmpdir="$TMPDIR"
257 - tmpdir="$tmpdir/libtool-$$" 419 - tmpdir="$tmpdir/libtool-$$"
262 + fi 424 + fi
263 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 425 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
264 else 426 else
265 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 427 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
266 ENDPATCH 428 ENDPATCH
267
268 retval=$?
269
270 # This one dont apply clean to libtool-1.4.2a, so do it manually.
271 if [ "${1}" != "--test" ] && [ "${retval}" -eq 0 ]
272 then
273 cp ltmain.sh ltmain.sh.orig
274 sed -e 's:cd `pwd`; $SHELL $0 --mode=relink $libtool_args:cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@:' \
275 ltmain.sh.orig > ltmain.sh
276 rm -f ltmain.sh.orig
277 fi
278
279 return ${retval}
280} 429}
281 430
282test_patch() { 431test_patch() {
283 432
284 local opts="" 433 local opts=""
581 hardcode_libdirs= 730 hardcode_libdirs=
582 dep_rpath= 731 dep_rpath=
583 ENDPATCH 732 ENDPATCH
584} 733}
585 734
735reversedeps_patch() {
736
737 local opts=""
738
739 if [ "${1}" = "--test" ]
740 then
741 opts="--force --dry-run"
742 fi
743
744 patch ${opts} -p0 <<-"ENDPATCH"
745 --- ltmain.sh.orig Sat Mar 23 22:48:45 2002
746 +++ ltmain.sh Sat Mar 23 22:45:38 2002
747 @@ -1553,6 +1553,8 @@
748 convenience="$convenience $ladir/$objdir/$old_library"
749 old_convenience="$old_convenience $ladir/$objdir/$old_library"
750 tmp_libs=
751 + # PKGW
752 + dependency_libs=
753 for deplib in $dependency_libs; do
754 deplibs="$deplib $deplibs"
755 case "$tmp_libs " in
756 @@ -1668,6 +1670,8 @@
757 fi
758
759 tmp_libs=
760 + #PKGW
761 + dependency_libs=
762 for deplib in $dependency_libs; do
763 case $deplib in
764 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
765 @@ -2081,7 +2085,7 @@
766 -L*)
767 case " $tmp_libs " in
768 *" $deplib "*) ;;
769 - *) tmp_libs="$tmp_libs $deplib" ;;
770 + *) tmp_libs="$deplib $tmp_libs" ;;
771 esac
772 ;;
773 *) tmp_libs="$tmp_libs $deplib" ;;
774 ENDPATCH
775}
776

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.20