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

Diff of /eclass/libtool.eclass

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

Revision 1.100 Revision 1.107
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 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.100 2012/05/06 11:42:07 grobian Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.107 2013/11/22 09:05:55 haubi Exp $
4 4
5# @ECLASS: libtool.eclass 5# @ECLASS: libtool.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: quickly update bundled libtool code 8# @BLURB: quickly update bundled libtool code
28 d="${ECLASSDIR_LOCAL}/ELT-patches" 28 d="${ECLASSDIR_LOCAL}/ELT-patches"
29 fi 29 fi
30 echo "${d}" 30 echo "${d}"
31} 31}
32 32
33DESCRIPTION="Based on the ${ECLASS} eclass"
34
35inherit multilib toolchain-funcs 33inherit multilib toolchain-funcs
36 34
37# 35#
38# See if we can apply $2 on $1, and if so, do it 36# See if we can apply $2 on $1, and if so, do it
39# 37#
49 __ELT_NOTED_TMP=true 47 __ELT_NOTED_TMP=true
50 printf 'temp patch: %s\n' "${patch}" > "${log}" 48 printf 'temp patch: %s\n' "${patch}" > "${log}"
51 fi 49 fi
52 printf '\nTrying %s\n' "${disp}" >> "${log}" 50 printf '\nTrying %s\n' "${disp}" >> "${log}"
53 51
52 if [[ ! -e ${file} ]] ; then
53 echo "File not found: ${file}" >> "${log}"
54 return 1
55 fi
56
57 # Save file for permission restoration. `patch` sometimes resets things.
58 # Ideally we'd want 'stat -c %a', but stat is highly non portable and we are
59 # guaranted to have GNU find, so use that instead.
60 local perms="$(find ${file} -maxdepth 0 -printf '%m')"
54 # We only support patchlevel of 0 - why worry if its static patches? 61 # We only support patchlevel of 0 - why worry if its static patches?
55 if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then 62 if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
56 einfo " Applying ${disp} ..." 63 einfo " Applying ${disp} ..."
57 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1 64 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
58 ret=$? 65 ret=$?
59 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}" 66 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
60 else 67 else
61 ret=1 68 ret=1
62 fi 69 fi
70 chmod "${perms}" "${file}"
63 71
64 return "${ret}" 72 return "${ret}"
65} 73}
66 74
67# 75#
132 local do_only_patches="no" 140 local do_only_patches="no"
133 local do_uclibc="yes" 141 local do_uclibc="yes"
134 local deptoremove= 142 local deptoremove=
135 local do_shallow="no" 143 local do_shallow="no"
136 local force="false" 144 local force="false"
137 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed" 145 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm"
138 146
139 for x in "$@" ; do 147 for x in "$@" ; do
140 case ${x} in 148 case ${x} in
141 --portage) 149 --portage)
142 # Only apply portage patch, and don't 150 # Only apply portage patch, and don't
180 [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf" 188 [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf"
181 189
182 case ${CHOST} in 190 case ${CHOST} in
183 *-aix*) elt_patches+=" hardcode aixrtl aix-noundef" ;; #213277 191 *-aix*) elt_patches+=" hardcode aixrtl aix-noundef" ;; #213277
184 *-darwin*) elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf" ;; 192 *-darwin*) elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf" ;;
185 *-solaris*) elt_patches+=" sol2-conf" ;; 193 *-solaris*) elt_patches+=" sol2-conf sol2-ltmain" ;;
186 *-freebsd*) elt_patches+=" fbsd-conf fbsd-ltconf" ;; 194 *-freebsd*) elt_patches+=" fbsd-conf fbsd-ltconf" ;;
187 *-hpux*) elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc" ;; 195 *-hpux*) elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc" ;;
188 *-irix*) elt_patches+=" irix-ltmain" ;; 196 *-irix*) elt_patches+=" irix-ltmain" ;;
189 *-mint*) elt_patches+=" mint-conf" ;; 197 *-mint*) elt_patches+=" mint-conf" ;;
190 esac 198 esac
194 fi 202 fi
195 203
196 # Reuse "$@" for dirs to patch 204 # Reuse "$@" for dirs to patch
197 set -- 205 set --
198 if [[ ${do_shallow} == "yes" ]] ; then 206 if [[ ${do_shallow} == "yes" ]] ; then
199 [[ -f ${S}/ltmain.sh ]] && set -- "${S}" 207 [[ -f ${S}/ltmain.sh || -f ${S}/configure ]] && set -- "${S}"
200 else 208 else
201 set -- $(find "${S}" -name ltmain.sh -printf '%h ') 209 set -- $(find "${S}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u)
202 fi 210 fi
203 211
204 local d p 212 local d p
205 for d in "$@" ; do 213 for d in "$@" ; do
206 export ELT_APPLIED_PATCHES= 214 export ELT_APPLIED_PATCHES=
215 if [[ ${outfunc} == "ewarn" ]] ; then 223 if [[ ${outfunc} == "ewarn" ]] ; then
216 ewarn " We've already been run in this tree; you should" 224 ewarn " We've already been run in this tree; you should"
217 ewarn " avoid this if possible (perhaps by filing a bug)" 225 ewarn " avoid this if possible (perhaps by filing a bug)"
218 fi 226 fi
219 227
228 local ret
229
230 # patching ltmain.sh
231 [[ -f ${d}/ltmain.sh ]] &&
220 for p in ${elt_patches} ; do 232 for p in ${elt_patches} ; do
221 local ret=0 233 ret=0
222 234
223 case ${p} in 235 case ${p} in
224 portage) 236 portage)
225 # Stupid test to see if its already applied ... 237 # Stupid test to see if its already applied ...
226 if ! grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then 238 if ! grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
248 ;; 260 ;;
249 as-needed) 261 as-needed)
250 ELT_walk_patches "${d}/ltmain.sh" "${p}" 262 ELT_walk_patches "${d}/ltmain.sh" "${p}"
251 ret=$? 263 ret=$?
252 ;; 264 ;;
253 uclibc-conf)
254 if grep -qs 'Transform linux' "${d}/configure" ; then
255 ELT_walk_patches "${d}/configure" "${p}"
256 ret=$?
257 # ltmain.sh and co might be in a subdirectory ...
258 elif [[ ! -e ${d}/configure ]] && \
259 grep -qs 'Transform linux' "${d}/../configure" ; then
260 ELT_walk_patches "${d}/../configure" "${p}"
261 ret=$?
262 fi
263 ;;
264 uclibc-ltconf) 265 uclibc-ltconf)
265 # Newer libtoolize clears ltconfig, as not used anymore 266 # Newer libtoolize clears ltconfig, as not used anymore
266 if [[ -s ${d}/ltconfig ]] ; then 267 if [[ -s ${d}/ltconfig ]] ; then
267 ELT_walk_patches "${d}/ltconfig" "${p}" 268 ELT_walk_patches "${d}/ltconfig" "${p}"
268 ret=$? 269 ret=$?
269 fi 270 fi
270 ;; 271 ;;
271 fbsd-conf)
272 if grep -qs 'version_type=freebsd-' "${d}/configure" ; then
273 ELT_walk_patches "${d}/configure" "${p}"
274 ret=$?
275 # ltmain.sh and co might be in a subdirectory ...
276 elif [[ ! -e ${d}/configure ]] && \
277 grep -qs 'version_type=freebsd-' "${d}/../configure" ; then
278 ELT_walk_patches "${d}/../configure" "${p}"
279 ret=$?
280 fi
281 ;;
282 fbsd-ltconf) 272 fbsd-ltconf)
283 if [[ -s ${d}/ltconfig ]] ; then 273 if [[ -s ${d}/ltconfig ]] ; then
284 ELT_walk_patches "${d}/ltconfig" "${p}" 274 ELT_walk_patches "${d}/ltconfig" "${p}"
285 ret=$?
286 fi
287 ;;
288 darwin-conf)
289 if grep -qs '&& echo \.so ||' "${d}/configure" ; then
290 ELT_walk_patches "${d}/configure" "${p}"
291 ret=$?
292 # ltmain.sh and co might be in a subdirectory ...
293 elif [[ ! -e ${d}/configure ]] && \
294 grep -qs '&& echo \.so ||' "${d}/../configure" ; then
295 ELT_walk_patches "${d}/../configure" "${p}"
296 ret=$? 275 ret=$?
297 fi 276 fi
298 ;; 277 ;;
299 darwin-ltconf) 278 darwin-ltconf)
300 # Newer libtoolize clears ltconfig, as not used anymore 279 # Newer libtoolize clears ltconfig, as not used anymore
309 # built in, so not much to patch around then 288 # built in, so not much to patch around then
310 if [[ -e ${d}/ltmain.sh ]] && \ 289 if [[ -e ${d}/ltmain.sh ]] && \
311 ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh" ; then 290 ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh" ; then
312 ELT_walk_patches "${d}/ltmain.sh" "${p}" 291 ELT_walk_patches "${d}/ltmain.sh" "${p}"
313 ret=$? 292 ret=$?
314 fi
315 ;;
316 aixrtl|hpux-conf)
317 ret=1
318 local subret=0
319 # apply multiple patches as often as they match
320 while [[ $subret -eq 0 ]]; do
321 subret=1
322 if [[ -e ${d}/configure ]]; then
323 ELT_walk_patches "${d}/configure" "${p}"
324 subret=$?
325 # ltmain.sh and co might be in a subdirectory ...
326 elif [[ ! -e ${d}/configure && -e ${d}/../configure ]] ; then
327 ELT_walk_patches "${d}/../configure" "${p}"
328 subret=$?
329 fi
330 if [[ $subret -eq 0 ]]; then
331 # have at least one patch succeeded.
332 ret=0
333 fi
334 done
335 ;;
336 mint-conf|gold-conf|sol2-conf)
337 ret=1
338 local subret=1
339 if [[ -e ${d}/configure ]]; then
340 ELT_walk_patches "${d}/configure" "${p}"
341 subret=$?
342 # ltmain.sh and co might be in a subdirectory ...
343 elif [[ -e ${d}/../configure ]] ; then
344 ELT_walk_patches "${d}/../configure" "${p}"
345 subret=$?
346 elif [[ -e ${d}/../../configure ]] ; then
347 ELT_walk_patches "${d}/../../configure" "${p}"
348 subret=$?
349 fi
350 if [[ $subret -eq 0 ]]; then
351 # have at least one patch succeeded.
352 ret=0
353 fi 293 fi
354 ;; 294 ;;
355 install-sh) 295 install-sh)
356 ELT_walk_patches "${d}/install-sh" "${p}" 296 ELT_walk_patches "${d}/install-sh" "${p}"
357 ret=$? 297 ret=$?
407 fi 347 fi
408 ;; 348 ;;
409 uclibc-*) 349 uclibc-*)
410 [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!" 350 [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
411 ;; 351 ;;
412 fbsd-*)
413 if [[ ${CHOST} == *-freebsd* ]] ; then
414 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \
415 "${d}/configure" "${d}/../configure" 2>/dev/null) ]]; then
416 eerror " FreeBSD patch set '${p}' failed to apply!"
417 die "FreeBSD patch set '${p}' failed to apply!"
418 fi
419 fi
420 ;;
421 darwin-*) 352 darwin-*)
422 [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!" 353 [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
423 ;; 354 ;;
424 esac 355 esac
425 fi 356 fi
426 done 357 done
427 358
359 # makes sense for ltmain.sh patches only
360 [[ -f ${d}/ltmain.sh ]] &&
428 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then 361 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then
429 if [[ ${do_portage} == "no" && \ 362 if [[ ${do_portage} == "no" && \
430 ${do_reversedeps} == "no" && \ 363 ${do_reversedeps} == "no" && \
431 ${do_only_patches} == "no" && \ 364 ${do_only_patches} == "no" && \
432 ${deptoremove} == "" ]] 365 ${deptoremove} == "" ]]
434 ewarn "Cannot apply any patches, please file a bug about this" 367 ewarn "Cannot apply any patches, please file a bug about this"
435 die 368 die
436 fi 369 fi
437 fi 370 fi
438 371
372 # patching configure
373 [[ -f ${d}/configure ]] &&
374 for p in ${elt_patches} ; do
375 ret=0
376
377 case ${p} in
378 uclibc-conf)
379 if grep -qs 'Transform linux' "${d}/configure" ; then
380 ELT_walk_patches "${d}/configure" "${p}"
381 ret=$?
382 fi
383 ;;
384 fbsd-conf)
385 if grep -qs 'version_type=freebsd-' "${d}/configure" ; then
386 ELT_walk_patches "${d}/configure" "${p}"
387 ret=$?
388 fi
389 ;;
390 darwin-conf)
391 if grep -qs '&& echo \.so ||' "${d}/configure" ; then
392 ELT_walk_patches "${d}/configure" "${p}"
393 ret=$?
394 fi
395 ;;
396 aixrtl|hpux-conf)
397 ret=1
398 local subret=0
399 # apply multiple patches as often as they match
400 while [[ $subret -eq 0 ]]; do
401 subret=1
402 if [[ -e ${d}/configure ]]; then
403 ELT_walk_patches "${d}/configure" "${p}"
404 subret=$?
405 fi
406 if [[ $subret -eq 0 ]]; then
407 # have at least one patch succeeded.
408 ret=0
409 fi
410 done
411 ;;
412 mint-conf|gold-conf|sol2-conf)
413 ELT_walk_patches "${d}/configure" "${p}"
414 ret=$?
415 ;;
416 target-nm)
417 ELT_walk_patches "${d}/configure" "${p}"
418 ret=$?
419 ;;
420 *)
421 # ltmain.sh patches are applied above
422 ;;
423 esac
424
425 if [[ ${ret} -ne 0 ]] ; then
426 case ${p} in
427 uclibc-*)
428 [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
429 ;;
430 fbsd-*)
431 if [[ ${CHOST} == *-freebsd* ]] ; then
432 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \
433 "${d}/configure" 2>/dev/null) ]]; then
434 eerror " FreeBSD patch set '${p}' failed to apply!"
435 die "FreeBSD patch set '${p}' failed to apply!"
436 fi
437 fi
438 ;;
439 darwin-*)
440 [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
441 ;;
442 esac
443 fi
444 done
445
439 rm -f "${d}/libtool" 446 rm -f "${d}/libtool"
440 447
441 > "${d}/.elibtoolized" 448 > "${d}/.elibtoolized"
442 done 449 done
443} 450}

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.107

  ViewVC Help
Powered by ViewVC 1.1.20