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

Diff of /eclass/multilib.eclass

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

Revision 1.1.1.1 Revision 1.64
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.1.1.1 2005/11/30 09:59:17 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.64 2008/05/02 04:07:38 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
10DESCRIPTION="Based on the ${ECLASS} eclass" 10___ECLASS_RECUR_MULTILIB="yes"
11[[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs
11 12
12# has_multilib_profile: 13# has_multilib_profile:
13# Return true if the current profile is a multilib profile and lists more than 14# 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 15# one abi in ${MULTILIB_ABIS}. When has_multilib_profile returns true, that
15# 'use multilib || has_multilib_profile' until all profiles utilizing the 16# profile should enable the 'multilib' use flag. This is so you can DEPEND on
16# 'multilib' use flag are removed from portage 17# a package only for multilib or not multilib.
17 18
18# is_final_abi: 19# is_final_abi:
19# Return true if ${ABI} is the final abi to be installed (and thus we are 20# Return true if ${ABI} is the final abi to be installed (and thus we are
20# on our last run through a src_* function. 21# on our last run through a src_* function.
21 22
100export LDFLAGS_default 101export LDFLAGS_default
101export CHOST_default=${CHOST_default:-${CHOST}} 102export CHOST_default=${CHOST_default:-${CHOST}}
102export CTARGET_default=${CTARGET_default:-${CTARGET:-${CHOST_default}}} 103export CTARGET_default=${CTARGET_default:-${CTARGET:-${CHOST_default}}}
103export LIBDIR_default=${CONF_LIBDIR:-"lib"} 104export LIBDIR_default=${CONF_LIBDIR:-"lib"}
104export CDEFINE_default="__unix__" 105export CDEFINE_default="__unix__"
106export KERNEL_ABI=${KERNEL_ABI:-${DEFAULT_ABI}}
105 107
106# has_multilib_profile() 108# has_multilib_profile()
107has_multilib_profile() { 109has_multilib_profile() {
108 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] 110 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
109} 111}
190 local var="${flag}_${abi}" 192 local var="${flag}_${abi}"
191 echo ${!var} 193 echo ${!var}
192} 194}
193 195
194get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; } 196get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; }
197get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; }
195get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; } 198get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; }
196get_abi_CHOST() { get_abi_var CHOST "$@"; } 199get_abi_CHOST() { get_abi_var CHOST "$@"; }
197get_abi_CTARGET() { get_abi_var CTARGET "$@"; } 200get_abi_CTARGET() { get_abi_var CTARGET "$@"; }
198get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; } 201get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; }
199get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; } 202get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; }
207 if [[ -z ${MULTILIB_ABIS} ]] ; then 210 if [[ -z ${MULTILIB_ABIS} ]] ; then
208 echo "default" 211 echo "default"
209 return 0 212 return 0
210 fi 213 fi
211 214
212 if hasq multilib-pkg-force ${RESTRICT} || 215 if [[ ${EMULTILIB_PKG} == "true" ]] ; then
213 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then
214 for x in ${MULTILIB_ABIS} ; do 216 for x in ${MULTILIB_ABIS} ; do
215 if [[ ${x} != "${DEFAULT_ABI}" ]] ; then 217 if [[ ${x} != "${DEFAULT_ABI}" ]] ; then
216 hasq ${x} ${ABI_DENY} || ordera="${ordera} ${x}" 218 hasq ${x} ${ABI_DENY} || ordera="${ordera} ${x}"
217 fi 219 fi
218 done 220 done
266get_all_libdirs() { 268get_all_libdirs() {
267 local libdirs="lib" 269 local libdirs="lib"
268 local abi 270 local abi
269 local dir 271 local dir
270 272
271 if has_multilib_profile; then
272 for abi in ${MULTILIB_ABIS}; do 273 for abi in ${MULTILIB_ABIS}; do
273 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" 274 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"
274 done 275 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 276
281 echo "${libdirs}" 277 echo "${libdirs}"
282} 278}
283 279
284# Return true if ${ABI} is the last ABI on our list (or if we're not 280# 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. 384# Ideas for this code came from debian's sparc-linux headers package.
389# 385#
390# Example: 386# Example:
391# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64 387# 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 388# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
389#
390# Warning: Be careful with the ordering here. The default ABI has to be the
391# last, because it is always defined (by GCC)
393create_ml_includes() { 392create_ml_includes() {
394 local dest=$1 393 local dest=$1
395 shift 394 shift
396 local basedirs=$(create_ml_includes-listdirs "$@") 395 local basedirs=$(create_ml_includes-listdirs "$@")
397 396
534 533
535get_libname() { 534get_libname() {
536 local libname 535 local libname
537 local ver=$1 536 local ver=$1
538 case ${CHOST} in 537 case ${CHOST} in
538 mingw*|*-mingw*) libname="dll";;
539 *-darwin*) libname="dylib";; 539 *-darwin*) libname="dylib";;
540 *) libname="so";; 540 *) libname="so";;
541 esac 541 esac
542 542
543 if [[ -z $@ ]] ; then 543 if [[ -z $* ]] ; then
544 echo ".${libname}" 544 echo ".${libname}"
545 else 545 else
546 for ver in "$@" ; do 546 for ver in "$@" ; do
547 case ${CHOST} in 547 case ${CHOST} in
548 *-darwin*) echo ".${ver}.${libname}";; 548 *-darwin*) echo ".${ver}.${libname}";;
565 export CDEFINE_x86="__i386__" 565 export CDEFINE_x86="__i386__"
566 export LIBDIR_x86="lib" 566 export LIBDIR_x86="lib"
567 567
568 export CFLAGS_amd64=${CFLAGS_amd64--m64} 568 export CFLAGS_amd64=${CFLAGS_amd64--m64}
569 export CHOST_amd64=${CTARGET} 569 export CHOST_amd64=${CTARGET}
570 export CTARGET_amd64=${CTARGET_amd64} 570 export CTARGET_amd64=${CHOST_amd64}
571 export CDEFINE_amd64="__x86_64__" 571 export CDEFINE_amd64="__x86_64__"
572 export LIBDIR_amd64="lib64" 572 export LIBDIR_amd64="lib64"
573 573
574 export MULTILIB_ABIS="amd64 x86" 574 export MULTILIB_ABIS="amd64 x86"
575 export DEFAULT_ABI="amd64" 575 export DEFAULT_ABI="amd64"
648 export MULTILIB_ABIS="default" 648 export MULTILIB_ABIS="default"
649 export DEFAULT_ABI="default" 649 export DEFAULT_ABI="default"
650 ;; 650 ;;
651 esac 651 esac
652} 652}
653
654# Hide multilib details here for packages which are forced to be compiled for a
655# specific ABI when run on another ABI (like x86-specific packages on amd64)
656multilib_toolchain_setup() {
657 export ABI=$1
658
659 if has_version app-admin/eselect-compiler ; then
660 # Binutils doesn't have wrappers for ld and as (yet). Eventually it
661 # will, and all this can just be handled with CHOST.
662 export LD="ld $(get_abi_LDFLAGS $1)"
663 export AS="as $(get_abi_ASFLAGS $1)"
664
665 export CHOST=$(get_abi_CHOST $1)
666 export CBUILD=$(get_abi_CHOST $1)
667 else
668 tc-export CC
669 fi
670}

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.64

  ViewVC Help
Powered by ViewVC 1.1.20