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

Diff of /eclass/multilib.eclass

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

Revision 1.43 Revision 1.60
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.43 2005/10/12 22:39:07 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.60 2007/03/27 01:46:50 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
10___ECLASS_RECUR_MULTILIB="yes"
11[[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs
9 12
10DESCRIPTION="Based on the ${ECLASS} eclass" 13DESCRIPTION="Based on the ${ECLASS} eclass"
11 14
12# has_multilib_profile: 15# has_multilib_profile:
13# Return true if the current profile is a multilib profile and lists more than 16# Return true if the current profile is a multilib profile and lists more than
100export LDFLAGS_default 103export LDFLAGS_default
101export CHOST_default=${CHOST_default:-${CHOST}} 104export CHOST_default=${CHOST_default:-${CHOST}}
102export CTARGET_default=${CTARGET_default:-${CTARGET:-${CHOST_default}}} 105export CTARGET_default=${CTARGET_default:-${CTARGET:-${CHOST_default}}}
103export LIBDIR_default=${CONF_LIBDIR:-"lib"} 106export LIBDIR_default=${CONF_LIBDIR:-"lib"}
104export CDEFINE_default="__unix__" 107export CDEFINE_default="__unix__"
108export KERNEL_ABI=${KERNEL_ABI:-${DEFAULT_ABI}}
105 109
106# has_multilib_profile() 110# has_multilib_profile()
107has_multilib_profile() { 111has_multilib_profile() {
108 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] 112 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
109} 113}
190 local var="${flag}_${abi}" 194 local var="${flag}_${abi}"
191 echo ${!var} 195 echo ${!var}
192} 196}
193 197
194get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; } 198get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; }
199get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; }
195get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; } 200get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; }
196get_abi_CHOST() { get_abi_var CHOST "$@"; } 201get_abi_CHOST() { get_abi_var CHOST "$@"; }
197get_abi_CTARGET() { get_abi_var CTARGET "$@"; } 202get_abi_CTARGET() { get_abi_var CTARGET "$@"; }
198get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; } 203get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; }
199get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; } 204get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; }
266get_all_libdirs() { 271get_all_libdirs() {
267 local libdirs="lib" 272 local libdirs="lib"
268 local abi 273 local abi
269 local dir 274 local dir
270 275
271 if has_multilib_profile; then
272 for abi in ${MULTILIB_ABIS}; do 276 for abi in ${MULTILIB_ABIS}; do
273 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" 277 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"
274 done 278 done
275 elif [ -n "${CONF_LIBDIR}" ]; then
276 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:-lib32}; do
277 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}"
278 done
279 fi
280 279
281 echo "${libdirs}" 280 echo "${libdirs}"
282} 281}
283 282
284# Return true if ${ABI} is the last ABI on our list (or if we're not 283# Return true if ${ABI} is the last ABI on our list (or if we're not
388# Ideas for this code came from debian's sparc-linux headers package. 387# Ideas for this code came from debian's sparc-linux headers package.
389# 388#
390# Example: 389# Example:
391# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64 390# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64
392# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64 391# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
392#
393# Warning: Be careful with the ordering here. The default ABI has to be the
394# last, because it is always defined (by GCC)
393create_ml_includes() { 395create_ml_includes() {
394 local dest=$1 396 local dest=$1
395 shift 397 shift
396 local basedirs=$(create_ml_includes-listdirs "$@") 398 local basedirs=$(create_ml_includes-listdirs "$@")
397 399
531 # exit because we'll likely be called from a subshell 533 # exit because we'll likely be called from a subshell
532 exit 1 534 exit 1
533} 535}
534 536
535get_libname() { 537get_libname() {
538 local libname
536 local ver=$1 539 local ver=$1
537 if use userland_Darwin ; then 540 case ${CHOST} in
541 *-darwin*) libname="dylib";;
542 *) libname="so";;
543 esac
544
538 if [ -z ${ver} ] ; then 545 if [[ -z $@ ]] ; then
539 echo ".dylib" 546 echo ".${libname}"
540 else
541 echo ".${ver}.dylib"
542 fi
543 else 547 else
544 if [ -z ${ver} ] ; then 548 for ver in "$@" ; do
545 echo ".so" 549 case ${CHOST} in
546 else 550 *-darwin*) echo ".${ver}.${libname}";;
547 echo ".so.${ver}" 551 *) echo ".${libname}.${ver}";;
548 fi 552 esac
553 done
549 fi 554 fi
550} 555}
551 556
552# This is for the toolchain to setup profile variables when pulling in 557# This is for the toolchain to setup profile variables when pulling in
553# a crosscompiler (and thus they aren't set in the profile) 558# a crosscompiler (and thus they aren't set in the profile)
562 export CDEFINE_x86="__i386__" 567 export CDEFINE_x86="__i386__"
563 export LIBDIR_x86="lib" 568 export LIBDIR_x86="lib"
564 569
565 export CFLAGS_amd64=${CFLAGS_amd64--m64} 570 export CFLAGS_amd64=${CFLAGS_amd64--m64}
566 export CHOST_amd64=${CTARGET} 571 export CHOST_amd64=${CTARGET}
567 export CTARGET_amd64=${CTARGET_amd64} 572 export CTARGET_amd64=${CHOST_amd64}
568 export CDEFINE_amd64="__x86_64__" 573 export CDEFINE_amd64="__x86_64__"
569 export LIBDIR_amd64="lib64" 574 export LIBDIR_amd64="lib64"
570 575
571 export MULTILIB_ABIS="amd64 x86" 576 export MULTILIB_ABIS="amd64 x86"
572 export DEFAULT_ABI="amd64" 577 export DEFAULT_ABI="amd64"
588 export CHOST_n64=${CTARGET} 593 export CHOST_n64=${CTARGET}
589 export CTARGET_n64=${CHOST_n64} 594 export CTARGET_n64=${CHOST_n64}
590 export CDEFINE_n64="_MIPS_SIM == _ABI64" 595 export CDEFINE_n64="_MIPS_SIM == _ABI64"
591 export LIBDIR_n64="lib64" 596 export LIBDIR_n64="lib64"
592 597
593 export MULTILIB_ABIS="n64 n32" # o32 598 export MULTILIB_ABIS="n64 n32 o32"
594 export DEFAULT_ABI="n32" 599 export DEFAULT_ABI="n32"
595 ;; 600 ;;
596 powerpc64*) 601 powerpc64*)
597 export CFLAGS_ppc=${CFLAGS_ppc--m32} 602 export CFLAGS_ppc=${CFLAGS_ppc--m32}
598 export CHOST_ppc=${CTARGET/powerpc64/powerpc} 603 export CHOST_ppc=${CTARGET/powerpc64/powerpc}
599 export CTARGET_ppc=${CHOST_ppc} 604 export CTARGET_ppc=${CHOST_ppc}
645 export MULTILIB_ABIS="default" 650 export MULTILIB_ABIS="default"
646 export DEFAULT_ABI="default" 651 export DEFAULT_ABI="default"
647 ;; 652 ;;
648 esac 653 esac
649} 654}
655
656# Hide multilib details here for packages which are forced to be compiled for a
657# specific ABI when run on another ABI (like x86-specific packages on amd64)
658multilib_toolchain_setup() {
659 export ABI=$1
660
661 if has_version app-admin/eselect-compiler ; then
662 # Binutils doesn't have wrappers for ld and as (yet). Eventually it
663 # will, and all this can just be handled with CHOST.
664 export LD="ld $(get_abi_LDFLAGS $1)"
665 export AS="as $(get_abi_ASFLAGS $1)"
666
667 export CHOST=$(get_abi_CHOST $1)
668 export CBUILD=$(get_abi_CHOST $1)
669 else
670 tc-export CC
671 fi
672}

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.60

  ViewVC Help
Powered by ViewVC 1.1.20