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

Diff of /eclass/multilib.eclass

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

Revision 1.66 Revision 1.76
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 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.eclass,v 1.66 2008/06/01 01:38:09 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.76 2009/10/08 19:56:14 grobian Exp $
4 4
5# @ECLASS: multilib.eclass 5# @ECLASS: multilib.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# amd64@gentoo.org 7# amd64@gentoo.org
8# toolchain@gentoo.org 8# toolchain@gentoo.org
337 done 337 done
338 338
339 if is_final_abi; then 339 if is_final_abi; then
340 base=${T}/gentoo-multilib 340 base=${T}/gentoo-multilib
341 pushd "${base}" 341 pushd "${base}"
342 find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C ${D} 342 find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C "${D}"
343 popd 343 popd
344 344
345 # This 'set' stuff is required by mips profiles to properly pass 345 # This 'set' stuff is required by mips profiles to properly pass
346 # CDEFINE's (which have spaces) to sub-functions 346 # CDEFINE's (which have spaces) to sub-functions
347 set -- 347 set --
481 dodir ${dest} 481 dodir ${dest}
482 482
483 local basedir 483 local basedir
484 for basedir in ${basedirs}; do 484 for basedir in ${basedirs}; do
485 local dir 485 local dir
486 for dir in $(find ${D}/${basedir} -type d); do 486 for dir in $(find "${D}"/${basedir} -type d); do
487 dodir ${dest}/${dir/${D}\/${basedir}/} 487 dodir ${dest}/${dir/${D}\/${basedir}/}
488 done 488 done
489 done 489 done
490} 490}
491 491
516} 516}
517 517
518# @FUNCTION: get_libname 518# @FUNCTION: get_libname
519# @USAGE: [version] 519# @USAGE: [version]
520# @DESCRIPTION: 520# @DESCRIPTION:
521# Returns libname with proper suffix {.so,.dylib} and optionally supplied version 521# Returns libname with proper suffix {.so,.dylib,.dll,etc} and optionally
522# for ELF/MACH-O shared objects 522# supplied version for the current platform identified by CHOST.
523# 523#
524# Example: 524# Example:
525# get_libname libfoo ${PV} 525# get_libname ${PV}
526# Returns: libfoo.so.${PV} (ELF) || libfoo.${PV}.dylib (MACH) 526# Returns: .so.${PV} (ELF) || .${PV}.dylib (MACH) || ...
527get_libname() { 527get_libname() {
528 local libname 528 local libname
529 local ver=$1 529 local ver=$1
530 case ${CHOST} in 530 case ${CHOST} in
531 mingw*|*-mingw*) libname="dll";; 531 *-cygwin|mingw*|*-mingw*) libname="dll";;
532 *-darwin*) libname="dylib";; 532 *-darwin*) libname="dylib";;
533 *-aix*) libname="a";;
534 *-mint*) libname="irrelevant";;
535 hppa*-hpux*) libname="sl";;
533 *) libname="so";; 536 *) libname="so";;
534 esac 537 esac
535 538
536 if [[ -z $* ]] ; then 539 if [[ -z $* ]] ; then
537 echo ".${libname}" 540 echo ".${libname}"
538 else 541 else
539 for ver in "$@" ; do 542 for ver in "$@" ; do
540 case ${CHOST} in 543 case ${CHOST} in
541 *-darwin*) echo ".${ver}.${libname}";; 544 *-darwin*) echo ".${ver}.${libname}";;
545 *-aix*) echo ".${libname}";;
546 *-mint*) echo ".${libname}";;
542 *) echo ".${libname}.${ver}";; 547 *) echo ".${libname}.${ver}";;
543 esac 548 esac
544 done 549 done
545 fi 550 fi
551}
552
553# @FUNCTION: get_modname
554# @USAGE:
555# @DESCRIPTION:
556# Returns modulename with proper suffix {.so,.bundle,etc} for the current
557# platform identified by CHOST.
558#
559# Example:
560# libfoo$(get_modname)
561# Returns: libfoo.so (ELF) || libfoo.bundle (MACH) || ...
562get_modname() {
563 local modname
564 local ver=$1
565 case ${CHOST} in
566 *-darwin*) modname="bundle";;
567 *) modname="so";;
568 esac
569
570 echo ".${modname}"
546} 571}
547 572
548# This is for the toolchain to setup profile variables when pulling in 573# This is for the toolchain to setup profile variables when pulling in
549# a crosscompiler (and thus they aren't set in the profile) 574# a crosscompiler (and thus they aren't set in the profile)
550multilib_env() { 575multilib_env() {
619 export LIBDIR_s390x="lib64" 644 export LIBDIR_s390x="lib64"
620 645
621 export MULTILIB_ABIS="s390x s390" 646 export MULTILIB_ABIS="s390x s390"
622 export DEFAULT_ABI="s390x" 647 export DEFAULT_ABI="s390x"
623 ;; 648 ;;
624 sparc64*) 649 sparc*)
625 export CFLAGS_sparc32=${CFLAGS_sparc32--m32} 650 export CFLAGS_sparc32=${CFLAGS_sparc32}
626 export CHOST_sparc32=${CTARGET/sparc64/sparc} 651 export CHOST_sparc32=${CTARGET/sparc64/sparc}
627 export CTARGET_sparc32=${CHOST_sparc32} 652 export CTARGET_sparc32=${CHOST_sparc32}
628 export CDEFINE_sparc32="!__arch64__" 653 export CDEFINE_sparc32="!__arch64__"
629 export LIBDIR_sparc32="lib" 654 export LIBDIR_sparc32="lib"
630 655
632 export CHOST_sparc64=${CTARGET} 657 export CHOST_sparc64=${CTARGET}
633 export CTARGET_sparc64=${CHOST_sparc64} 658 export CTARGET_sparc64=${CHOST_sparc64}
634 export CDEFINE_sparc64="__arch64__" 659 export CDEFINE_sparc64="__arch64__"
635 export LIBDIR_sparc64="lib64" 660 export LIBDIR_sparc64="lib64"
636 661
637 export MULTILIB_ABIS="sparc64 sparc32" 662 export MULTILIB_ABIS="${MULTILIB_ABIS-sparc64 sparc32}"
638 export DEFAULT_ABI="sparc64" 663 export DEFAULT_ABI="${DEFAULT_ABI-sparc64}"
639 ;; 664 ;;
640 *) 665 *)
641 export MULTILIB_ABIS="default" 666 export MULTILIB_ABIS="default"
642 export DEFAULT_ABI="default" 667 export DEFAULT_ABI="default"
643 ;; 668 ;;
647# @FUNCTION: multilib_toolchain_setup 672# @FUNCTION: multilib_toolchain_setup
648# @DESCRIPTION: 673# @DESCRIPTION:
649# Hide multilib details here for packages which are forced to be compiled for a 674# Hide multilib details here for packages which are forced to be compiled for a
650# specific ABI when run on another ABI (like x86-specific packages on amd64) 675# specific ABI when run on another ABI (like x86-specific packages on amd64)
651multilib_toolchain_setup() { 676multilib_toolchain_setup() {
677 local v vv
678
652 export ABI=$1 679 export ABI=$1
653 680
654 if has_version app-admin/eselect-compiler ; then 681 # We want to avoid the behind-the-back magic of gcc-config as it
655 # Binutils doesn't have wrappers for ld and as (yet). Eventually it 682 # screws up ccache and distcc. See #196243 for more info.
656 # will, and all this can just be handled with CHOST. 683 if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
657 export LD="ld $(get_abi_LDFLAGS $1)" 684 if [[ ${DEFAULT_ABI_SAVED} != "true" ]] ; then
685 for v in CHOST CBUILD AS CC CXX LD ; do
686 export __abi_saved_${v}="${!v}"
687 done
688 export DEFAULT_ABI_SAVED="true"
689 fi
690
691 # Set the CHOST native first so that we pick up the native
692 # toolchain and not a cross-compiler by accident #202811.
693 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI})
658 export AS="as $(get_abi_ASFLAGS $1)" 694 export AS="$(tc-getAS) $(get_abi_ASFLAGS)"
659 695 export CC="$(tc-getCC) $(get_abi_CFLAGS)"
696 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)"
697 export LD="$(tc-getLD) $(get_abi_LDFLAGS)"
660 export CHOST=$(get_abi_CHOST $1) 698 export CHOST=$(get_abi_CHOST $1)
661 export CBUILD=$(get_abi_CHOST $1) 699 export CBUILD=$(get_abi_CHOST $1)
662 else 700
663 tc-export CC 701 elif [[ ${DEFAULT_ABI_SAVED} == "true" ]] ; then
702 for v in CHOST CBUILD AS CC CXX LD ; do
703 vv="__abi_saved_${v}"
704 export ${v}=${!vv}
705 done
664 fi 706 fi
665} 707}

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.76

  ViewVC Help
Powered by ViewVC 1.1.20