/[gentoo-x86]/eclass/multilib-build.eclass
Gentoo

Diff of /eclass/multilib-build.eclass

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

Revision 1.51 Revision 1.52
1# Copyright 1999-2014 Gentoo Foundation 1# Copyright 1999-2014 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/multilib-build.eclass,v 1.51 2014/05/23 07:39:26 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.52 2014/05/23 07:47:39 mgorny Exp $
4 4
5# @ECLASS: multilib-build.eclass 5# @ECLASS: multilib-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# gx86-multilib team <multilib@gentoo.org> 7# gx86-multilib team <multilib@gentoo.org>
8# @AUTHOR: 8# @AUTHOR:
409 ln -s "${CHOST}-${fn}" "${root}/${f}" || die 409 ln -s "${CHOST}-${fn}" "${root}/${f}" || die
410 fi 410 fi
411 done 411 done
412 412
413 if [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then 413 if [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
414 # XXX: get abi_* directly
415 local abi_flag
416 case "${ABI}" in
417 amd64|amd64_fbsd)
418 abi_flag=abi_x86_64;;
419 x86|x86_fbsd)
420 abi_flag=abi_x86_32;;
421 x32)
422 abi_flag=abi_x86_x32;;
423 n32)
424 abi_flag=abi_mips_n32;;
425 n64)
426 abi_flag=abi_mips_n64;;
427 o32)
428 abi_flag=abi_mips_o32;;
429 esac
430
431 # If abi_flag is unset, then header wrapping is unsupported 414 # If abi_flag is unset, then header wrapping is unsupported on
432 # on this ABI. This could mean either that: 415 # this ABI. This means the arch doesn't support multilib at all
433 # 416 # -- in this case, the headers are not wrapped and everything
434 # 1) the arch doesn't support multilib at all -- in this case, 417 # works as expected.
435 # the headers are not wrapped and everything works as expected,
436 #
437 # 2) someone added new ABI and forgot to update the function --
438 # in this case, the header consistency check will notice one of
439 # those ABIs has an extra header (compared to the header moved
440 # for wrapping) and will fail.
441 418
442 if [[ ${abi_flag} ]]; then 419 if [[ ${MULTILIB_ABI_FLAG} ]]; then
443 for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do 420 for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
444 # drop leading slash if it's there 421 # drop leading slash if it's there
445 f=${f#/} 422 f=${f#/}
446 423
447 if [[ ${f} != usr/include/* ]]; then 424 if [[ ${f} != usr/include/* ]]; then
452 429
453 local dir=${f%/*} 430 local dir=${f%/*}
454 431
455 # Some ABIs may have install less files than others. 432 # Some ABIs may have install less files than others.
456 if [[ -f ${root}/usr/include${f} ]]; then 433 if [[ -f ${root}/usr/include${f} ]]; then
434 local wrapper=${ED}/tmp/multilib-include${f}
435
457 if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then 436 if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
458 dodir "/tmp/multilib-include${dir}" 437 dodir "/tmp/multilib-include${dir}"
459 # a generic template 438 # a generic template
460 cat > "${ED}/tmp/multilib-include${f}" <<_EOF_ 439 cat > "${wrapper}" <<_EOF_
461/* This file is auto-generated by multilib-build.eclass 440/* This file is auto-generated by multilib-build.eclass
462 * as a multilib-friendly wrapper. For the original content, 441 * as a multilib-friendly wrapper. For the original content,
463 * please see the files that are #included below. 442 * please see the files that are #included below.
464 */ 443 */
465 444
483# error "No ABI matched, please report a bug to bugs.gentoo.org" 462# error "No ABI matched, please report a bug to bugs.gentoo.org"
484#endif 463#endif
485_EOF_ 464_EOF_
486 fi 465 fi
487 466
467 if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"
468 then
469 die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org."
470 fi
471
488 # $CHOST shall be set by multilib_toolchain_setup 472 # $CHOST shall be set by multilib_toolchain_setup
489 dodir "/tmp/multilib-include/${CHOST}${dir}" 473 dodir "/tmp/multilib-include/${CHOST}${dir}"
490 mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die 474 mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
491 475
492 # Note: match a space afterwards to avoid collision potential. 476 # Note: match a space afterwards to avoid collision potential.
493 sed -e "/${abi_flag} /s&error.*&include <${CHOST}${f}>&" \ 477 sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
494 -i "${ED}/tmp/multilib-include${f}" || die 478 -i "${wrapper}" || die
495 479
496 # Hack for emul-linux-x86 compatibility. 480 # Hack for emul-linux-x86 compatibility.
497 # It assumes amd64 will come after x86, and will use amd64 481 # It assumes amd64 will come after x86, and will use amd64
498 # headers if no specific x86 headers were installed. 482 # headers if no specific x86 headers were installed.
499 if [[ ${ABI} == amd64 ]]; then 483 if [[ ${ABI} == amd64 ]]; then
500 sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \ 484 sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
501 -i "${ED}/tmp/multilib-include${f}" || die 485 -i "${wrapper}" || die
502 fi 486 fi
503 fi 487 fi
504 done 488 done
505 fi 489 fi
506 fi 490 fi

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

  ViewVC Help
Powered by ViewVC 1.1.20