/[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.77
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.77 2009/10/08 20:10:56 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 --
475# Helper function for create_ml_includes 475# Helper function for create_ml_includes
476create_ml_includes-makedestdirs() { 476create_ml_includes-makedestdirs() {
477 local dest=$1 477 local dest=$1
478 shift 478 shift
479 local basedirs=$@ 479 local basedirs=$@
480 [[ -z ${ED} ]] && local ED=${D}
480 481
481 dodir ${dest} 482 dodir ${dest}
482 483
483 local basedir 484 local basedir
484 for basedir in ${basedirs}; do 485 for basedir in ${basedirs}; do
485 local dir 486 local dir
486 for dir in $(find ${D}/${basedir} -type d); do 487 for dir in $(find "${ED}"/${basedir} -type d); do
487 dodir ${dest}/${dir/${D}\/${basedir}/} 488 dodir ${dest}/${dir/${ED}\/${basedir}/}
488 done 489 done
489 done 490 done
490} 491}
491 492
492# Helper function for create_ml_includes 493# Helper function for create_ml_includes
493create_ml_includes-allfiles() { 494create_ml_includes-allfiles() {
495 [[ -z ${ED} ]] && local ED=${D}
494 local basedir file 496 local basedir file
495 for basedir in "$@" ; do 497 for basedir in "$@" ; do
496 for file in $(find "${D}"/${basedir} -type f); do 498 for file in $(find "${ED}"/${basedir} -type f); do
497 echo ${file/${D}\/${basedir}\//} 499 echo ${file/${ED}\/${basedir}\//}
498 done 500 done
499 done | sort | uniq 501 done | sort | uniq
500} 502}
501 503
502# Helper function for create_ml_includes 504# Helper function for create_ml_includes
516} 518}
517 519
518# @FUNCTION: get_libname 520# @FUNCTION: get_libname
519# @USAGE: [version] 521# @USAGE: [version]
520# @DESCRIPTION: 522# @DESCRIPTION:
521# Returns libname with proper suffix {.so,.dylib} and optionally supplied version 523# Returns libname with proper suffix {.so,.dylib,.dll,etc} and optionally
522# for ELF/MACH-O shared objects 524# supplied version for the current platform identified by CHOST.
523# 525#
524# Example: 526# Example:
525# get_libname libfoo ${PV} 527# get_libname ${PV}
526# Returns: libfoo.so.${PV} (ELF) || libfoo.${PV}.dylib (MACH) 528# Returns: .so.${PV} (ELF) || .${PV}.dylib (MACH) || ...
527get_libname() { 529get_libname() {
528 local libname 530 local libname
529 local ver=$1 531 local ver=$1
530 case ${CHOST} in 532 case ${CHOST} in
531 mingw*|*-mingw*) libname="dll";; 533 *-cygwin|mingw*|*-mingw*) libname="dll";;
532 *-darwin*) libname="dylib";; 534 *-darwin*) libname="dylib";;
535 *-aix*) libname="a";;
536 *-mint*) libname="irrelevant";;
537 hppa*-hpux*) libname="sl";;
533 *) libname="so";; 538 *) libname="so";;
534 esac 539 esac
535 540
536 if [[ -z $* ]] ; then 541 if [[ -z $* ]] ; then
537 echo ".${libname}" 542 echo ".${libname}"
538 else 543 else
539 for ver in "$@" ; do 544 for ver in "$@" ; do
540 case ${CHOST} in 545 case ${CHOST} in
541 *-darwin*) echo ".${ver}.${libname}";; 546 *-darwin*) echo ".${ver}.${libname}";;
547 *-aix*) echo ".${libname}";;
548 *-mint*) echo ".${libname}";;
542 *) echo ".${libname}.${ver}";; 549 *) echo ".${libname}.${ver}";;
543 esac 550 esac
544 done 551 done
545 fi 552 fi
553}
554
555# @FUNCTION: get_modname
556# @USAGE:
557# @DESCRIPTION:
558# Returns modulename with proper suffix {.so,.bundle,etc} for the current
559# platform identified by CHOST.
560#
561# Example:
562# libfoo$(get_modname)
563# Returns: libfoo.so (ELF) || libfoo.bundle (MACH) || ...
564get_modname() {
565 local modname
566 local ver=$1
567 case ${CHOST} in
568 *-darwin*) modname="bundle";;
569 *) modname="so";;
570 esac
571
572 echo ".${modname}"
546} 573}
547 574
548# This is for the toolchain to setup profile variables when pulling in 575# This is for the toolchain to setup profile variables when pulling in
549# a crosscompiler (and thus they aren't set in the profile) 576# a crosscompiler (and thus they aren't set in the profile)
550multilib_env() { 577multilib_env() {
619 export LIBDIR_s390x="lib64" 646 export LIBDIR_s390x="lib64"
620 647
621 export MULTILIB_ABIS="s390x s390" 648 export MULTILIB_ABIS="s390x s390"
622 export DEFAULT_ABI="s390x" 649 export DEFAULT_ABI="s390x"
623 ;; 650 ;;
624 sparc64*) 651 sparc*)
625 export CFLAGS_sparc32=${CFLAGS_sparc32--m32} 652 export CFLAGS_sparc32=${CFLAGS_sparc32}
626 export CHOST_sparc32=${CTARGET/sparc64/sparc} 653 export CHOST_sparc32=${CTARGET/sparc64/sparc}
627 export CTARGET_sparc32=${CHOST_sparc32} 654 export CTARGET_sparc32=${CHOST_sparc32}
628 export CDEFINE_sparc32="!__arch64__" 655 export CDEFINE_sparc32="!__arch64__"
629 export LIBDIR_sparc32="lib" 656 export LIBDIR_sparc32="lib"
630 657
632 export CHOST_sparc64=${CTARGET} 659 export CHOST_sparc64=${CTARGET}
633 export CTARGET_sparc64=${CHOST_sparc64} 660 export CTARGET_sparc64=${CHOST_sparc64}
634 export CDEFINE_sparc64="__arch64__" 661 export CDEFINE_sparc64="__arch64__"
635 export LIBDIR_sparc64="lib64" 662 export LIBDIR_sparc64="lib64"
636 663
637 export MULTILIB_ABIS="sparc64 sparc32" 664 export MULTILIB_ABIS="${MULTILIB_ABIS-sparc64 sparc32}"
638 export DEFAULT_ABI="sparc64" 665 export DEFAULT_ABI="${DEFAULT_ABI-sparc64}"
639 ;; 666 ;;
640 *) 667 *)
641 export MULTILIB_ABIS="default" 668 export MULTILIB_ABIS="default"
642 export DEFAULT_ABI="default" 669 export DEFAULT_ABI="default"
643 ;; 670 ;;
647# @FUNCTION: multilib_toolchain_setup 674# @FUNCTION: multilib_toolchain_setup
648# @DESCRIPTION: 675# @DESCRIPTION:
649# Hide multilib details here for packages which are forced to be compiled for a 676# 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) 677# specific ABI when run on another ABI (like x86-specific packages on amd64)
651multilib_toolchain_setup() { 678multilib_toolchain_setup() {
679 local v vv
680
652 export ABI=$1 681 export ABI=$1
653 682
654 if has_version app-admin/eselect-compiler ; then 683 # 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 684 # screws up ccache and distcc. See #196243 for more info.
656 # will, and all this can just be handled with CHOST. 685 if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
657 export LD="ld $(get_abi_LDFLAGS $1)" 686 if [[ ${DEFAULT_ABI_SAVED} != "true" ]] ; then
687 for v in CHOST CBUILD AS CC CXX LD ; do
688 export __abi_saved_${v}="${!v}"
689 done
690 export DEFAULT_ABI_SAVED="true"
691 fi
692
693 # Set the CHOST native first so that we pick up the native
694 # toolchain and not a cross-compiler by accident #202811.
695 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI})
658 export AS="as $(get_abi_ASFLAGS $1)" 696 export AS="$(tc-getAS) $(get_abi_ASFLAGS)"
659 697 export CC="$(tc-getCC) $(get_abi_CFLAGS)"
698 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)"
699 export LD="$(tc-getLD) $(get_abi_LDFLAGS)"
660 export CHOST=$(get_abi_CHOST $1) 700 export CHOST=$(get_abi_CHOST $1)
661 export CBUILD=$(get_abi_CHOST $1) 701 export CBUILD=$(get_abi_CHOST $1)
662 else 702
663 tc-export CC 703 elif [[ ${DEFAULT_ABI_SAVED} == "true" ]] ; then
704 for v in CHOST CBUILD AS CC CXX LD ; do
705 vv="__abi_saved_${v}"
706 export ${v}=${!vv}
707 done
664 fi 708 fi
665} 709}

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

  ViewVC Help
Powered by ViewVC 1.1.20