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

Diff of /eclass/libtool.eclass

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

Revision 1.74 Revision 1.98
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.74 2007/03/01 18:48:02 grobian Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.98 2011/12/21 21:21:04 vapier Exp $
4# 4
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# @ECLASS: libtool.eclass
6# 6# @MAINTAINER:
7# base-system@gentoo.org
8# @BLURB: quickly update bundled libtool code
9# @DESCRIPTION:
7# This eclass patches ltmain.sh distributed with libtoolized packages with the 10# This eclass patches ltmain.sh distributed with libtoolized packages with the
8# relink and portage patch among others 11# relink and portage patch among others
12#
13# Note, this eclass does not require libtool as it only applies patches to
14# generated libtool files. We do not run the libtoolize program because that
15# requires a regeneration of the main autotool files in order to work properly.
9 16
17if [[ ${___ECLASS_ONCE_LIBTOOL} != "recur -_+^+_- spank" ]] ; then
18___ECLASS_ONCE_LIBTOOL="recur -_+^+_- spank"
10 19
11# 2004.09.25 rac 20# If an overlay has eclass overrides, but doesn't actually override the
12# i have verified that at least one package can use this eclass and 21# libtool.eclass, we'll have ECLASSDIR pointing to the active overlay's
13# build properly even without libtool installed yet, probably using 22# eclass/ dir, but libtool.eclass is still in the main Gentoo tree. So
14# the files in the distribution. eliminating this dependency fixes 23# add a check to locate the ELT-patches/ regardless of what's going on.
15# bug 65209, which is a showstopper for people doing installs using 24ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*}
16# stageballs <3. if anybody decides to revert this, please attempt 25elt_patch_dir() {
17# to find an alternate way of resolving that bug at the same time. 26 local d="${ECLASSDIR}/ELT-patches"
27 if [[ ! -d ${d} ]] ; then
28 d="${ECLASSDIR_LOCAL}/ELT-patches"
29 fi
30 echo "${d}"
31}
18 32
19DESCRIPTION="Based on the ${ECLASS} eclass" 33DESCRIPTION="Based on the ${ECLASS} eclass"
20 34
21ELIBTOOL_VERSION="2.0.2" 35inherit multilib toolchain-funcs
22
23ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
24ELT_APPLIED_PATCHES=
25ELT_LTMAIN_SH=
26
27#
28# Returns all the directories containing ltmain.sh
29#
30ELT_find_ltmain_sh() {
31 local x=
32 local dirlist=
33
34 for x in $(find "${S}" -name 'ltmain.sh') ; do
35 dirlist="${dirlist} ${x%/*}"
36 done
37
38 echo "${dirlist}"
39}
40 36
41# 37#
42# See if we can apply $2 on $1, and if so, do it 38# See if we can apply $2 on $1, and if so, do it
43# 39#
44ELT_try_and_apply_patch() { 40ELT_try_and_apply_patch() {
45 local ret=0 41 local ret=0
46 local file=$1 42 local file=$1
47 local patch=$2 43 local patch=$2
44 local src=$3
45 local disp="${src} patch"
46 local log="${T}/elibtool.log"
47
48 if [[ -z ${__ELT_NOTED_TMP} ]] ; then
49 __ELT_NOTED_TMP=true
50 printf 'temp patch: %s\n' "${patch}" > "${log}"
51 fi
52 printf '\nTrying %s\n' "${disp}" >> "${log}"
48 53
49 # We only support patchlevel of 0 - why worry if its static patches? 54 # We only support patchlevel of 0 - why worry if its static patches?
50 if patch -p0 --dry-run "${file}" "${patch}" &> "${T}/elibtool.log" ; then 55 if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
51 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..." 56 einfo " Applying ${disp} ..."
52 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" \ 57 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
53 &> "${T}/elibtool.log"
54 ret=$? 58 ret=$?
55 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}" 59 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
56 else 60 else
57 ret=1 61 ret=1
58 fi 62 fi
59 63
60 return "${ret}" 64 return "${ret}"
62 66
63# 67#
64# Get string version of ltmain.sh or ltconfig (passed as $1) 68# Get string version of ltmain.sh or ltconfig (passed as $1)
65# 69#
66ELT_libtool_version() { 70ELT_libtool_version() {
67 local ltmain_sh=$1 71 (
68 local version= 72 unset VERSION
69
70 version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \ 73 eval $(grep -e '^[[:space:]]*VERSION=' "$1")
71 echo "${VERSION}") 74 echo "${VERSION:-0}"
72 [[ -z ${version} ]] && version="0" 75 )
73
74 echo "${version}"
75} 76}
76 77
77# 78#
78# Run through the patches in $2 and see if any 79# Run through the patches in $2 and see if any
79# apply to $1 ... 80# apply to $1 ...
80# 81#
81ELT_walk_patches() { 82ELT_walk_patches() {
82 local x= 83 local patch tmp
83 local y=
84 local ret=1 84 local ret=1
85 local file=$1 85 local file=$1
86 local patch_set=$2 86 local patch_set=$2
87 local patch_dir= 87 local patch_dir="$(elt_patch_dir)/${patch_set}"
88 local rem_int_dep=$3 88 local rem_int_dep=$3
89 89
90 if [[ -n ${patch_set} ]] ; then 90 [[ -z ${patch_set} ]] && return 1
91 if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then 91 [[ ! -d ${patch_dir} ]] && return 1
92 patch_dir="${ELT_PATCH_DIR}/${patch_set}" 92
93 else 93 # Allow patches to use @GENTOO_LIBDIR@ replacements
94 return "${ret}" 94 local sed_args=( -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" )
95 if [[ -n ${rem_int_dep} ]] ; then
96 # replace @REM_INT_DEP@ with what was passed
97 # to --remove-internal-dep
98 sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
99 fi
100
101 pushd "$(elt_patch_dir)" >/dev/null || die
102
103 # Go through the patches in reverse order (newer version to older)
104 for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
105 tmp="${T}/libtool-elt.patch"
106 sed "${sed_args[@]}" "${patch}" > "${tmp}" || die
107 if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then
108 # Break to unwind w/popd rather than return directly
109 ret=0
110 break
95 fi 111 fi
96
97 # Go through the patches in reverse order (large to small)
98 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do
99 if [[ -n ${x} && -f ${x} ]] ; then
100 # For --remove-internal-dep ...
101 if [[ -n ${rem_int_dep} ]] ; then
102 # For replace @REM_INT_DEP@ with what was passed
103 # to --remove-internal-dep
104 sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \
105 "${T}/$$.rem_int_deps.patch"
106
107 x="${T}/$$.rem_int_deps.patch"
108 fi
109
110 if ELT_try_and_apply_patch "${file}" "${x}" ; then
111 ret=0
112 break
113 fi
114 fi
115 done 112 done
116 fi
117 113
114 popd >/dev/null
118 return "${ret}" 115 return ${ret}
119} 116}
120 117
118# @FUNCTION: elibtoolize
119# @USAGE: [dirs] [--portage] [--reverse-deps] [--patch-only] [--remove-internal-dep=xxx] [--shallow] [--no-uclibc]
120# @DESCRIPTION:
121# Apply a smorgasbord of patches to bundled libtool files. This function
122# should always be safe to run. If no directories are specified, then
123# ${S} will be searched for appropriate files.
124#
125# If the --shallow option is used, then only ${S}/ltmain.sh will be patched.
126#
127# The other options should be avoided in general unless you know what's going on.
121elibtoolize() { 128elibtoolize() {
122 local x= 129 local x
123 local y=
124 local do_portage="no" 130 local do_portage="no"
125 local do_reversedeps="no" 131 local do_reversedeps="no"
126 local do_only_patches="no" 132 local do_only_patches="no"
127 local do_uclibc="yes" 133 local do_uclibc="yes"
128 local deptoremove= 134 local deptoremove=
129 local my_dirlist= 135 local do_shallow="no"
136 local force="false"
130 local elt_patches="portage relink max_cmd_len sed test tmp" 137 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed"
131 local start_dir=${PWD}
132
133 my_dirlist=$(ELT_find_ltmain_sh)
134 138
135 for x in "$@" ; do 139 for x in "$@" ; do
136 case "${x}" in 140 case ${x} in
137 "--portage") 141 --portage)
138 # Only apply portage patch, and don't 142 # Only apply portage patch, and don't
139 # 'libtoolize --copy --force' if all patches fail. 143 # 'libtoolize --copy --force' if all patches fail.
140 do_portage="yes" 144 do_portage="yes"
141 ;; 145 ;;
142 "--reverse-deps") 146 --reverse-deps)
143 # Apply the reverse-deps patch 147 # Apply the reverse-deps patch
144 # http://bugzilla.gnome.org/show_bug.cgi?id=75635 148 # http://bugzilla.gnome.org/show_bug.cgi?id=75635
145 do_reversedeps="yes" 149 do_reversedeps="yes"
146 elt_patches="${elt_patches} fix-relink" 150 elt_patches+=" fix-relink"
147 ;; 151 ;;
148 "--patch-only") 152 --patch-only)
149 # Do not run libtoolize if none of the patches apply .. 153 # Do not run libtoolize if none of the patches apply ..
150 do_only_patches="yes" 154 do_only_patches="yes"
151 ;; 155 ;;
152 "^--remove-internal-dep="*) 156 --remove-internal-dep=*)
153 # We will replace @REM_INT_DEP@ with what is needed 157 # We will replace @REM_INT_DEP@ with what is needed
154 # in ELT_walk_patches() ... 158 # in ELT_walk_patches() ...
155 deptoremove=$(echo "${x}" | sed -e 's|--remove-internal-dep=||') 159 deptoremove=${x#--remove-internal-dep=}
156 160
157 # Add the patch for this ... 161 # Add the patch for this ...
158 [[ -n ${deptoremove} ]] && elt_patches="${elt_patches} rem-int-dep" 162 [[ -n ${deptoremove} ]] && elt_patches+=" rem-int-dep"
159 ;; 163 ;;
160 "--shallow") 164 --shallow)
161 # Only patch the ltmain.sh in ${S} 165 # Only patch the ltmain.sh in ${S}
162 if [[ -f ${S}/ltmain.sh ]] ; then 166 do_shallow="yes"
163 my_dirlist=${S}
164 else
165 my_dirlist=
166 fi
167 ;; 167 ;;
168 "--no-uclibc") 168 --no-uclibc)
169 do_uclibc="no" 169 do_uclibc="no"
170 ;;
171 --force)
172 force="true"
170 ;; 173 ;;
171 *) 174 *)
172 eerror "Invalid elibtoolize option: ${x}" 175 eerror "Invalid elibtoolize option: ${x}"
173 die "elibtoolize called with ${x} ??" 176 die "elibtoolize called with ${x} ??"
174 esac 177 esac
175 done 178 done
176 179
177 [[ ${do_uclibc} == "yes" ]] && \ 180 [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf"
178 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf"
179 181
180 [[ ${CHOST} == *"-freebsd"* ]] && \ 182 case ${CHOST} in
181 elt_patches="${elt_patches} fbsd-conf fbsd-ltconf" 183 *-aix*) elt_patches+=" hardcode aixrtl aix-noundef" ;; #213277
184 *-darwin*) elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf" ;;
185 *-freebsd*) elt_patches+=" fbsd-conf fbsd-ltconf" ;;
186 *-hpux*) elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc" ;;
187 *-irix*) elt_patches+=" irix-ltmain" ;;
188 *-mint*) elt_patches+=" mint-conf" ;;
189 esac
182 190
183 [[ ${CHOST} == *"-darwin"* ]] && \ 191 if $(tc-getLD) --version 2>&1 | grep -qs 'GNU gold'; then
184 elt_patches="${elt_patches} darwin-ltconf darwin-ltmain" 192 elt_patches+=" gold-conf"
193 fi
185 194
186 for x in ${my_dirlist} ; do 195 # Reuse "$@" for dirs to patch
187 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") 196 set --
197 if [[ ${do_shallow} == "yes" ]] ; then
198 [[ -f ${S}/ltmain.sh ]] && set -- "${S}"
199 else
200 set -- $(find "${S}" -name ltmain.sh -printf '%h ')
201 fi
202
203 local d p
204 for d in "$@" ; do
188 export ELT_APPLIED_PATCHES= 205 export ELT_APPLIED_PATCHES=
189 export ELT_LTMAIN_SH="${x}/ltmain.sh"
190 206
207 if [[ -f ${d}/.elibtoolized ]] ; then
208 ${force} || continue
209 fi
210
211 local outfunc="einfo"
191 [[ -f ${x}/.elibtoolized ]] && continue 212 [[ -f ${d}/.elibtoolized ]] && outfunc="ewarn"
213 ${outfunc} "Running elibtoolize in: ${d#${WORKDIR}/}/"
214 if [[ ${outfunc} == "ewarn" ]] ; then
215 ewarn " We've already been run in this tree; you should"
216 ewarn " avoid this if possible (perhaps by filing a bug)"
217 fi
192 218
193 cd ${x}
194 einfo "Running elibtoolize in: $(echo "/${tmp}" | sed -e 's|//|/|g; s|^/||')"
195
196 for y in ${elt_patches} ; do 219 for p in ${elt_patches} ; do
197 local ret=0 220 local ret=0
198 221
199 case "${y}" in 222 case ${p} in
200 "portage") 223 portage)
201 # Stupid test to see if its already applied ... 224 # Stupid test to see if its already applied ...
202 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 225 if ! grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
203 ELT_walk_patches "${x}/ltmain.sh" "${y}" 226 ELT_walk_patches "${d}/ltmain.sh" "${p}"
204 ret=$? 227 ret=$?
205 fi 228 fi
206 ;; 229 ;;
207 "rem-int-dep") 230 rem-int-dep)
208 ELT_walk_patches "${x}/ltmain.sh" "${y}" "${deptoremove}" 231 ELT_walk_patches "${d}/ltmain.sh" "${p}" "${deptoremove}"
209 ret=$? 232 ret=$?
210 ;; 233 ;;
211 "fix-relink") 234 fix-relink)
212 # Do not apply if we do not have the relink patch applied ... 235 # Do not apply if we do not have the relink patch applied ...
213 if [[ -n $(grep 'inst_prefix_dir' "${x}/ltmain.sh") ]] ; then 236 if grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" ; then
214 ELT_walk_patches "${x}/ltmain.sh" "${y}" 237 ELT_walk_patches "${d}/ltmain.sh" "${p}"
215 ret=$? 238 ret=$?
216 fi 239 fi
217 ;; 240 ;;
218 "max_cmd_len") 241 max_cmd_len)
219 # Do not apply if $max_cmd_len is not used ... 242 # Do not apply if $max_cmd_len is not used ...
220 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then 243 if grep -qs 'max_cmd_len' "${d}/ltmain.sh" ; then
221 ELT_walk_patches "${x}/ltmain.sh" "${y}" 244 ELT_walk_patches "${d}/ltmain.sh" "${p}"
245 ret=$?
246 fi
247 ;;
248 as-needed)
249 ELT_walk_patches "${d}/ltmain.sh" "${p}"
222 ret=$? 250 ret=$?
223 fi
224 ;; 251 ;;
225 "uclibc-conf") 252 uclibc-conf)
226 if [[ -e ${x}/configure && \
227 -n $(grep 'Transform linux' "${x}/configure") ]] ; then 253 if grep -qs 'Transform linux' "${d}/configure" ; then
228 ELT_walk_patches "${x}/configure" "${y}" 254 ELT_walk_patches "${d}/configure" "${p}"
229 ret=$? 255 ret=$?
230 # ltmain.sh and co might be in a subdirectory ... 256 # ltmain.sh and co might be in a subdirectory ...
231 elif [[ ! -e ${x}/configure && -e ${x}/../configure && \ 257 elif [[ ! -e ${d}/configure ]] && \
232 -n $(grep 'Transform linux' "${x}/../configure") ]] ; then 258 grep -qs 'Transform linux' "${d}/../configure" ; then
233 ELT_walk_patches "${x}/../configure" "${y}" 259 ELT_walk_patches "${d}/../configure" "${p}"
234 ret=$? 260 ret=$?
235 fi 261 fi
236 ;; 262 ;;
237 "uclibc-ltconf") 263 uclibc-ltconf)
238 # Newer libtoolize clears ltconfig, as not used anymore 264 # Newer libtoolize clears ltconfig, as not used anymore
239 if [[ -s ${x}/ltconfig ]] ; then 265 if [[ -s ${d}/ltconfig ]] ; then
240 ELT_walk_patches "${x}/ltconfig" "${y}" 266 ELT_walk_patches "${d}/ltconfig" "${p}"
241 ret=$? 267 ret=$?
242 fi 268 fi
243 ;; 269 ;;
244 "fbsd-conf") 270 fbsd-conf)
245 if [[ -e ${x}/configure && \
246 -n $(grep 'version_type=freebsd-' "${x}/configure") ]] ; then 271 if grep -qs 'version_type=freebsd-' "${d}/configure" ; then
247 ELT_walk_patches "${x}/configure" "${y}" 272 ELT_walk_patches "${d}/configure" "${p}"
248 ret=$? 273 ret=$?
249 # ltmain.sh and co might be in a subdirectory ... 274 # ltmain.sh and co might be in a subdirectory ...
250 elif [[ ! -e ${x}/configure && -e ${x}/../configure && \ 275 elif [[ ! -e ${d}/configure ]] && \
251 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then 276 grep -qs 'version_type=freebsd-' "${d}/../configure" ; then
252 ELT_walk_patches "${x}/../configure" "${y}" 277 ELT_walk_patches "${d}/../configure" "${p}"
253 ret=$? 278 ret=$?
254 fi 279 fi
255 ;; 280 ;;
256 "fbsd-ltconf") 281 fbsd-ltconf)
257 if [[ -s ${x}/ltconfig ]] ; then 282 if [[ -s ${d}/ltconfig ]] ; then
258 ELT_walk_patches "${x}/ltconfig" "${y}" 283 ELT_walk_patches "${d}/ltconfig" "${p}"
259 ret=$? 284 ret=$?
260 fi 285 fi
261 ;; 286 ;;
287 darwin-conf)
288 if grep -qs '&& echo \.so ||' "${d}/configure" ; then
289 ELT_walk_patches "${d}/configure" "${p}"
290 ret=$?
291 # ltmain.sh and co might be in a subdirectory ...
292 elif [[ ! -e ${d}/configure ]] && \
293 grep -qs '&& echo \.so ||' "${d}/../configure" ; then
294 ELT_walk_patches "${d}/../configure" "${p}"
295 ret=$?
296 fi
297 ;;
262 "darwin-ltconf") 298 darwin-ltconf)
263 # Newer libtoolize clears ltconfig, as not used anymore 299 # Newer libtoolize clears ltconfig, as not used anymore
264 if [[ -s ${x}/ltconfig ]] ; then 300 if [[ -s ${d}/ltconfig ]] ; then
265 ELT_walk_patches "${x}/ltconfig" "${y}" 301 ELT_walk_patches "${d}/ltconfig" "${p}"
302 ret=$?
303 fi
304 ;;
305 darwin-ltmain)
306 # special case to avoid false positives (failing to apply
307 # ltmain.sh path message), newer libtools have this patch
308 # built in, so not much to patch around then
309 if [[ -e ${d}/ltmain.sh ]] && \
310 ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh" ; then
311 ELT_walk_patches "${d}/ltmain.sh" "${p}"
312 ret=$?
313 fi
314 ;;
315 aixrtl|hpux-conf)
316 ret=1
317 local subret=0
318 # apply multiple patches as often as they match
319 while [[ $subret -eq 0 ]]; do
320 subret=1
321 if [[ -e ${d}/configure ]]; then
322 ELT_walk_patches "${d}/configure" "${p}"
323 subret=$?
324 # ltmain.sh and co might be in a subdirectory ...
325 elif [[ ! -e ${d}/configure && -e ${d}/../configure ]] ; then
326 ELT_walk_patches "${d}/../configure" "${p}"
327 subret=$?
328 fi
329 if [[ $subret -eq 0 ]]; then
330 # have at least one patch succeeded.
331 ret=0
332 fi
333 done
334 ;;
335 mint-conf|gold-conf)
336 ret=1
337 local subret=1
338 if [[ -e ${d}/configure ]]; then
339 ELT_walk_patches "${d}/configure" "${p}"
340 subret=$?
341 # ltmain.sh and co might be in a subdirectory ...
342 elif [[ -e ${d}/../configure ]] ; then
343 ELT_walk_patches "${d}/../configure" "${p}"
344 subret=$?
345 elif [[ -e ${d}/../../configure ]] ; then
346 ELT_walk_patches "${d}/../../configure" "${p}"
347 subret=$?
348 fi
349 if [[ $subret -eq 0 ]]; then
350 # have at least one patch succeeded.
351 ret=0
352 fi
353 ;;
354 install-sh)
355 ELT_walk_patches "${d}/install-sh" "${p}"
356 ret=$?
357 ;;
358 cross)
359 if tc-is-cross-compiler ; then
360 ELT_walk_patches "${d}/ltmain.sh" "${p}"
266 ret=$? 361 ret=$?
267 fi 362 fi
268 ;; 363 ;;
269 *) 364 *)
270 ELT_walk_patches "${x}/ltmain.sh" "${y}" 365 ELT_walk_patches "${d}/ltmain.sh" "${p}"
271 ret=$? 366 ret=$?
272 ;; 367 ;;
273 esac 368 esac
274 369
275 if [[ ${ret} -ne 0 ]] ; then 370 if [[ ${ret} -ne 0 ]] ; then
276 case ${y} in 371 case ${p} in
277 "relink") 372 relink)
278 local version=$(ELT_libtool_version "${x}/ltmain.sh") 373 local version=$(ELT_libtool_version "${d}/ltmain.sh")
279 # Critical patch, but could be applied ... 374 # Critical patch, but could be applied ...
280 # FIXME: Still need a patch for ltmain.sh > 1.4.0 375 # FIXME: Still need a patch for ltmain.sh > 1.4.0
281 if [[ -z $(grep 'inst_prefix_dir' "${x}/ltmain.sh") && \ 376 if ! grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" && \
282 $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]] ; then 377 [[ $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]] ; then
283 ewarn " Could not apply relink.patch!" 378 ewarn " Could not apply relink.patch!"
284 fi 379 fi
285 ;; 380 ;;
286 "portage") 381 portage)
287 # Critical patch - for this one we abort, as it can really 382 # Critical patch - for this one we abort, as it can really
288 # cause breakage without it applied! 383 # cause breakage without it applied!
289 if [[ ${do_portage} == "yes" ]] ; then 384 if [[ ${do_portage} == "yes" ]] ; then
290 # Stupid test to see if its already applied ... 385 # Stupid test to see if its already applied ...
291 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 386 if ! grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
292 echo 387 echo
293 eerror "Portage patch requested, but failed to apply!" 388 eerror "Portage patch requested, but failed to apply!"
294 eerror "Please bug azarah or vapier to add proper patch." 389 eerror "Please file a bug report to add a proper patch."
295 die "Portage patch requested, but failed to apply!" 390 die "Portage patch requested, but failed to apply!"
296 fi 391 fi
297 else 392 else
298 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 393 if grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
299 # ewarn " Portage patch seems to be already applied." 394 # ewarn " Portage patch seems to be already applied."
300 # ewarn " Please verify that it is not needed." 395 # ewarn " Please verify that it is not needed."
301 : 396 :
302 else 397 else
303 local version=$( \ 398 local version=$(ELT_libtool_version "${d}"/ltmain.sh)
304 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \
305 echo "${VERSION}")
306
307 echo 399 echo
308 eerror "Portage patch failed to apply (ltmain.sh version ${version})!" 400 eerror "Portage patch failed to apply (ltmain.sh version ${version})!"
309 eerror "Please bug azarah or vapier to add proper patch." 401 eerror "Please file a bug report to add a proper patch."
310 die "Portage patch failed to apply!" 402 die "Portage patch failed to apply!"
311 fi 403 fi
312 # We do not want to run libtoolize ... 404 # We do not want to run libtoolize ...
313 ELT_APPLIED_PATCHES="portage" 405 ELT_APPLIED_PATCHES="portage"
314 fi 406 fi
315 ;; 407 ;;
316 "uclibc-"*) 408 uclibc-*)
317 [[ ${CHOST} == *"-uclibc" ]] && \
318 ewarn " uClibc patch set '${y}' failed to apply!" 409 [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
319 ;; 410 ;;
320 "fbsd-"*) 411 fbsd-*)
321 if [[ ${CHOST} == *"-freebsd"* ]] ; then 412 if [[ ${CHOST} == *-freebsd* ]] ; then
322 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \ 413 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \
323 "${x}/configure" "${x}/../configure" 2>/dev/null) ]]; then 414 "${d}/configure" "${d}/../configure" 2>/dev/null) ]]; then
324 eerror " FreeBSD patch set '${y}' failed to apply!" 415 eerror " FreeBSD patch set '${p}' failed to apply!"
325 die "FreeBSD patch set '${y}' failed to apply!" 416 die "FreeBSD patch set '${p}' failed to apply!"
326 fi 417 fi
327 fi 418 fi
328 ;; 419 ;;
329 "darwin-"*) 420 darwin-*)
330 [[ ${CHOST} == *"-darwin"* ]] && \
331 ewarn " Darwin patch set '${y}' failed to apply!" 421 [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
332 ;; 422 ;;
333 esac 423 esac
334 fi 424 fi
335 done 425 done
336 426
339 ${do_reversedeps} == "no" && \ 429 ${do_reversedeps} == "no" && \
340 ${do_only_patches} == "no" && \ 430 ${do_only_patches} == "no" && \
341 ${deptoremove} == "" ]] 431 ${deptoremove} == "" ]]
342 then 432 then
343 ewarn "Cannot apply any patches, please file a bug about this" 433 ewarn "Cannot apply any patches, please file a bug about this"
344 break
345
346 # Sometimes ltmain.sh is in a subdirectory ...
347 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then
348 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then
349 cd "${x}"/../
350 fi
351 fi 434 die
352
353 if type -p libtoolize &> /dev/null ; then
354 ewarn "Cannot apply any patches, running libtoolize..."
355 libtoolize --copy --force
356 fi
357 cd "${x}"
358 break
359 fi 435 fi
360 fi 436 fi
361 437
362 [[ -f ${x}/libtool ]] && rm -f "${x}/libtool" 438 rm -f "${d}/libtool"
363 439
364 touch "${x}/.elibtoolized" 440 > "${d}/.elibtoolized"
365 done 441 done
366
367 cd "${start_dir}"
368} 442}
369 443
370uclibctoolize() { 444uclibctoolize() { die "Use elibtoolize"; }
371 ewarn "uclibctoolize() is depreciated, please just use elibtoolize()!" 445darwintoolize() { die "Use elibtoolize"; }
372 elibtoolize
373}
374
375darwintoolize() {
376 ewarn "darwintoolize() is depreciated, please just use elibtoolize()!"
377 elibtoolize
378}
379 446
380# char *VER_major(string) 447# char *VER_major(string)
381# 448#
382# Return the Major (X of X.Y.Z) version 449# Return the Major (X of X.Y.Z) version
383# 450#
433 fi 500 fi
434 501
435 echo 1 502 echo 1
436 return 1 503 return 1
437} 504}
505
506fi

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.98

  ViewVC Help
Powered by ViewVC 1.1.20