| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 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.93 2011/10/14 22:54:35 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.96 2011/12/10 19:41:51 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 |
| 9 | # @BLURB: This eclass is for all functions pertaining to handling multilib configurations. |
9 | # @BLURB: This eclass is for all functions pertaining to handling multilib configurations. |
| 10 | # @DESCRIPTION: |
10 | # @DESCRIPTION: |
| 11 | # This eclass is for all functions pertaining to handling multilib configurations. |
11 | # This eclass is for all functions pertaining to handling multilib configurations. |
| 12 | |
12 | |
| 13 | ___ECLASS_RECUR_MULTILIB="yes" |
13 | if [[ ${___ECLASS_ONCE_MULTILIB} != "recur -_+^+_- spank" ]] ; then |
| 14 | [[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs |
14 | ___ECLASS_ONCE_MULTILIB="recur -_+^+_- spank" |
|
|
15 | |
|
|
16 | inherit toolchain-funcs |
| 15 | |
17 | |
| 16 | # Defaults: |
18 | # Defaults: |
| 17 | export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"} |
19 | export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"} |
| 18 | export DEFAULT_ABI=${DEFAULT_ABI:-"default"} |
20 | export DEFAULT_ABI=${DEFAULT_ABI:-"default"} |
| 19 | export CFLAGS_default |
21 | export CFLAGS_default |
| … | |
… | |
| 71 | # If <ABI> is not specified, ${ABI} is used. |
73 | # If <ABI> is not specified, ${ABI} is used. |
| 72 | # If <ABI> is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used. |
74 | # If <ABI> is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used. |
| 73 | # If <ABI> is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string. |
75 | # If <ABI> is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string. |
| 74 | get_abi_var() { |
76 | get_abi_var() { |
| 75 | local flag=$1 |
77 | local flag=$1 |
| 76 | local abi |
78 | local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}} |
| 77 | if [ $# -gt 1 ]; then |
|
|
| 78 | abi=${2} |
|
|
| 79 | elif [ -n "${ABI}" ]; then |
|
|
| 80 | abi=${ABI} |
|
|
| 81 | elif [ -n "${DEFAULT_ABI}" ]; then |
|
|
| 82 | abi=${DEFAULT_ABI} |
|
|
| 83 | else |
|
|
| 84 | abi="default" |
|
|
| 85 | fi |
|
|
| 86 | |
|
|
| 87 | local var="${flag}_${abi}" |
79 | local var="${flag}_${abi}" |
| 88 | echo ${!var} |
80 | echo ${!var} |
| 89 | } |
81 | } |
| 90 | |
82 | |
| 91 | # @FUNCTION: get_abi_CFLAGS |
83 | # @FUNCTION: get_abi_CFLAGS |
| … | |
… | |
| 407 | export __DEFAULT_ABI_SAVED="true" |
399 | export __DEFAULT_ABI_SAVED="true" |
| 408 | |
400 | |
| 409 | # Set the CHOST native first so that we pick up the native |
401 | # Set the CHOST native first so that we pick up the native |
| 410 | # toolchain and not a cross-compiler by accident #202811. |
402 | # toolchain and not a cross-compiler by accident #202811. |
| 411 | export CHOST=$(get_abi_CHOST ${DEFAULT_ABI}) |
403 | export CHOST=$(get_abi_CHOST ${DEFAULT_ABI}) |
| 412 | export AS="$(tc-getAS) $(get_abi_ASFLAGS)" |
|
|
| 413 | export CC="$(tc-getCC) $(get_abi_CFLAGS)" |
404 | export CC="$(tc-getCC) $(get_abi_CFLAGS)" |
| 414 | export CXX="$(tc-getCXX) $(get_abi_CFLAGS)" |
405 | export CXX="$(tc-getCXX) $(get_abi_CFLAGS)" |
| 415 | export LD="$(tc-getLD) $(get_abi_LDFLAGS)" |
406 | export LD="$(tc-getLD) $(get_abi_LDFLAGS)" |
| 416 | export CHOST=$(get_abi_CHOST $1) |
407 | export CHOST=$(get_abi_CHOST $1) |
| 417 | export CBUILD=$(get_abi_CHOST $1) |
408 | export CBUILD=$(get_abi_CHOST $1) |
| 418 | fi |
409 | fi |
| 419 | } |
410 | } |
|
|
411 | |
|
|
412 | fi |