| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2007 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.50 2006/06/20 08:48:24 eradicator Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.58 2007/03/27 01:10:05 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Jeremy Huddleston <eradicator@gentoo.org> |
5 | # Maintainer: amd64@gentoo.org / toolchain@gentoo.org |
| 6 | # |
6 | # |
| 7 | # This eclass is for all functions pertaining to handling multilib. |
7 | # This eclass is for all functions pertaining to handling multilib. |
| 8 | # configurations. |
8 | # configurations. |
| 9 | |
9 | |
| 10 | DESCRIPTION="Based on the ${ECLASS} eclass" |
10 | DESCRIPTION="Based on the ${ECLASS} eclass" |
|
|
11 | |
|
|
12 | inherit toolchain-funcs |
| 11 | |
13 | |
| 12 | # has_multilib_profile: |
14 | # has_multilib_profile: |
| 13 | # Return true if the current profile is a multilib profile and lists more than |
15 | # Return true if the current profile is a multilib profile and lists more than |
| 14 | # one abi in ${MULTILIB_ABIS}. You might want to use this like |
16 | # one abi in ${MULTILIB_ABIS}. You might want to use this like |
| 15 | # 'use multilib || has_multilib_profile' until all profiles utilizing the |
17 | # 'use multilib || has_multilib_profile' until all profiles utilizing the |
| … | |
… | |
| 194 | |
196 | |
| 195 | get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; } |
197 | get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; } |
| 196 | get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; } |
198 | get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; } |
| 197 | get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; } |
199 | get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; } |
| 198 | get_abi_CHOST() { get_abi_var CHOST "$@"; } |
200 | get_abi_CHOST() { get_abi_var CHOST "$@"; } |
|
|
201 | get_abi_CTARGET() { get_abi_var CTARGET "$@"; } |
| 199 | get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; } |
202 | get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; } |
| 200 | get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; } |
203 | get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; } |
| 201 | get_abi_LIBDIR() { get_abi_var LIBDIR "$@"; } |
204 | get_abi_LIBDIR() { get_abi_var LIBDIR "$@"; } |
| 202 | |
205 | |
| 203 | # Return a list of the ABIs we want to install for with |
206 | # Return a list of the ABIs we want to install for with |
| … | |
… | |
| 267 | get_all_libdirs() { |
270 | get_all_libdirs() { |
| 268 | local libdirs="lib" |
271 | local libdirs="lib" |
| 269 | local abi |
272 | local abi |
| 270 | local dir |
273 | local dir |
| 271 | |
274 | |
| 272 | # Remove when amd64's 2004.3 is purged. |
|
|
| 273 | if [[ -n "${CONF_LIBDIR}" ]]; then |
|
|
| 274 | for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:-lib32}; do |
|
|
| 275 | [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}" |
|
|
| 276 | done |
|
|
| 277 | else |
|
|
| 278 | for abi in ${MULTILIB_ABIS}; do |
275 | for abi in ${MULTILIB_ABIS}; do |
| 279 | [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" |
276 | [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" |
| 280 | done |
277 | done |
| 281 | fi |
|
|
| 282 | |
278 | |
| 283 | echo "${libdirs}" |
279 | echo "${libdirs}" |
| 284 | } |
280 | } |
| 285 | |
281 | |
| 286 | # Return true if ${ABI} is the last ABI on our list (or if we're not |
282 | # Return true if ${ABI} is the last ABI on our list (or if we're not |
| … | |
… | |
| 570 | export CDEFINE_x86="__i386__" |
566 | export CDEFINE_x86="__i386__" |
| 571 | export LIBDIR_x86="lib" |
567 | export LIBDIR_x86="lib" |
| 572 | |
568 | |
| 573 | export CFLAGS_amd64=${CFLAGS_amd64--m64} |
569 | export CFLAGS_amd64=${CFLAGS_amd64--m64} |
| 574 | export CHOST_amd64=${CTARGET} |
570 | export CHOST_amd64=${CTARGET} |
| 575 | export CTARGET_amd64=${CTARGET_amd64} |
571 | export CTARGET_amd64=${CHOST_amd64} |
| 576 | export CDEFINE_amd64="__x86_64__" |
572 | export CDEFINE_amd64="__x86_64__" |
| 577 | export LIBDIR_amd64="lib64" |
573 | export LIBDIR_amd64="lib64" |
| 578 | |
574 | |
| 579 | export MULTILIB_ABIS="amd64 x86" |
575 | export MULTILIB_ABIS="amd64 x86" |
| 580 | export DEFAULT_ABI="amd64" |
576 | export DEFAULT_ABI="amd64" |
| … | |
… | |
| 654 | export DEFAULT_ABI="default" |
650 | export DEFAULT_ABI="default" |
| 655 | ;; |
651 | ;; |
| 656 | esac |
652 | esac |
| 657 | } |
653 | } |
| 658 | |
654 | |
| 659 | # This is for the single package in the tree whose maintainer believes it is so important to |
655 | # Hide multilib details here for packages which are forced to be compiled for a |
| 660 | # provide a compiled-from-source version before portage is able to support it (app-emul/wine) |
656 | # specific ABI when run on another ABI (like x86-specific packages on amd64) |
| 661 | multilib_toolchain_setup() { |
657 | multilib_toolchain_setup() { |
| 662 | export ABI=$1 |
658 | export ABI=$1 |
| 663 | |
659 | |
|
|
660 | if has_version app-admin/eselect-compiler ; then |
| 664 | # Binutils doesn't have wrappers for ld and as (yet). Eventually it |
661 | # Binutils doesn't have wrappers for ld and as (yet). Eventually it |
| 665 | # will, and all this can just be handled with CHOST. |
662 | # will, and all this can just be handled with CHOST. |
| 666 | export LD="ld $(get_abi_LDFLAGS)" |
663 | export LD="ld $(get_abi_LDFLAGS $1)" |
| 667 | export AS="as $(get_abi_ASFLAGS)" |
664 | export AS="as $(get_abi_ASFLAGS $1)" |
| 668 | |
665 | |
| 669 | export CHOST=$(get_abi_CHOST) |
666 | export CHOST=$(get_abi_CHOST $1) |
| 670 | export CBUILD=$(get_abi_CHOST) |
667 | export CBUILD=$(get_abi_CHOST $1) |
|
|
668 | else |
|
|
669 | tc-export CC |
|
|
670 | fi |
| 671 | } |
671 | } |