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

Diff of /eclass/multilib.eclass

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

Revision 1.72 Revision 1.81
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.72 2009/02/20 23:20:22 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.81 2011/03/10 01:52:22 vapier 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
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 *-cygwin|mingw*|*-mingw*) libname="dll";; 533 *-cygwin|mingw*|*-mingw*) libname="dll";;
532 *-darwin*) libname="dylib";; 534 *-darwin*) libname="dylib";;
535 *-mint*) libname="irrelevant";;
536 hppa*-hpux*) libname="sl";;
533 *) libname="so";; 537 *) libname="so";;
534 esac 538 esac
535 539
536 if [[ -z $* ]] ; then 540 if [[ -z $* ]] ; then
537 echo ".${libname}" 541 echo ".${libname}"
538 else 542 else
539 for ver in "$@" ; do 543 for ver in "$@" ; do
540 case ${CHOST} in 544 case ${CHOST} in
541 *-darwin*) echo ".${ver}.${libname}";; 545 *-darwin*) echo ".${ver}.${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() {
554 x86_64*) 579 x86_64*)
555 export CFLAGS_x86=${CFLAGS_x86--m32} 580 export CFLAGS_x86=${CFLAGS_x86--m32}
556 export CHOST_x86=${CTARGET/x86_64/i686} 581 export CHOST_x86=${CTARGET/x86_64/i686}
557 export CTARGET_x86=${CHOST_x86} 582 export CTARGET_x86=${CHOST_x86}
558 export CDEFINE_x86="__i386__" 583 export CDEFINE_x86="__i386__"
559 export LIBDIR_x86="lib" 584 export LIBDIR_x86="lib32"
560 585
561 export CFLAGS_amd64=${CFLAGS_amd64--m64} 586 export CFLAGS_amd64=${CFLAGS_amd64--m64}
562 export CHOST_amd64=${CTARGET} 587 export CHOST_amd64=${CTARGET}
563 export CTARGET_amd64=${CHOST_amd64} 588 export CTARGET_amd64=${CHOST_amd64}
564 export CDEFINE_amd64="__x86_64__" 589 export CDEFINE_amd64="__x86_64__"
651multilib_toolchain_setup() { 676multilib_toolchain_setup() {
652 local v vv 677 local v vv
653 678
654 export ABI=$1 679 export ABI=$1
655 680
681 # First restore any saved state we have laying around.
682 if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
683 for v in CHOST CBUILD AS CC CXX LD ; do
684 vv="__abi_saved_${v}"
685 export ${v}="${!vv}"
686 unset ${vv}
687 done
688 unset __DEFAULT_ABI_SAVED
689 fi
690
656 # We want to avoid the behind-the-back magic of gcc-config as it 691 # We want to avoid the behind-the-back magic of gcc-config as it
657 # screws up ccache and distcc. See #196243 for more info. 692 # screws up ccache and distcc. See #196243 for more info.
658 if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then 693 if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
659 if [[ ${DEFAULT_ABI_SAVED} != "true" ]] ; then 694 # Back that multilib-ass up so we can restore it later
660 for v in CHOST CBUILD AS CC CXX LD ; do 695 for v in CHOST CBUILD AS CC CXX LD ; do
661 export __abi_saved_${v}="${!v}" 696 export __abi_saved_${v}="${!v}"
662 done 697 done
663 export DEFAULT_ABI_SAVED="true" 698 export __DEFAULT_ABI_SAVED="true"
664 fi
665 699
666 # Set the CHOST native first so that we pick up the native 700 # Set the CHOST native first so that we pick up the native
667 # toolchain and not a cross-compiler by accident #202811. 701 # toolchain and not a cross-compiler by accident #202811.
668 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI}) 702 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI})
669 export AS="$(tc-getAS) $(get_abi_ASFLAGS)" 703 export AS="$(tc-getAS) $(get_abi_ASFLAGS)"
670 export CC="$(tc-getCC) $(get_abi_CFLAGS)" 704 export CC="$(tc-getCC) $(get_abi_CFLAGS)"
671 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)" 705 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)"
672 export LD="$(tc-getLD) $(get_abi_LDFLAGS)" 706 export LD="$(tc-getLD) $(get_abi_LDFLAGS)"
673 export CHOST=$(get_abi_CHOST $1) 707 export CHOST=$(get_abi_CHOST $1)
674 export CBUILD=$(get_abi_CHOST $1) 708 export CBUILD=$(get_abi_CHOST $1)
675
676 elif [[ ${DEFAULT_ABI_SAVED} == "true" ]] ; then
677 for v in CHOST CBUILD AS CC CXX LD ; do
678 vv="__abi_saved_${v}"
679 export ${v}=${!vv}
680 done
681 fi 709 fi
682} 710}

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.81

  ViewVC Help
Powered by ViewVC 1.1.20