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

Diff of /eclass/multilib.eclass

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

Revision 1.93 Revision 1.100
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.100 2012/08/27 15:04:08 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" 13if [[ ${___ECLASS_ONCE_MULTILIB} != "recur -_+^+_- spank" ]] ; then
14[[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs 14___ECLASS_ONCE_MULTILIB="recur -_+^+_- spank"
15
16inherit toolchain-funcs
15 17
16# Defaults: 18# Defaults:
17export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"} 19export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"}
18export DEFAULT_ABI=${DEFAULT_ABI:-"default"} 20export DEFAULT_ABI=${DEFAULT_ABI:-"default"}
19export CFLAGS_default 21export 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.
74get_abi_var() { 76get_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
127# @FUNCTION: get_install_abis 119# @FUNCTION: get_install_abis
128# @DESCRIPTION: 120# @DESCRIPTION:
129# Return a list of the ABIs we want to install for with 121# Return a list of the ABIs we want to install for with
130# the last one in the list being the default. 122# the last one in the list being the default.
131get_install_abis() { 123get_install_abis() {
132 local order="" 124 local x order=""
133 125
134 if [[ -z ${MULTILIB_ABIS} ]] ; then 126 if [[ -z ${MULTILIB_ABIS} ]] ; then
135 echo "default" 127 echo "default"
136 return 0 128 return 0
137 fi 129 fi
168# @FUNCTION: get_all_abis 160# @FUNCTION: get_all_abis
169# @DESCRIPTION: 161# @DESCRIPTION:
170# Return a list of the ABIs supported by this profile. 162# Return a list of the ABIs supported by this profile.
171# the last one in the list being the default. 163# the last one in the list being the default.
172get_all_abis() { 164get_all_abis() {
173 local order="" 165 local x order="" mvar dvar
174 166
175 if [[ -z ${MULTILIB_ABIS} ]] ; then 167 mvar="MULTILIB_ABIS"
168 dvar="DEFAULT_ABI"
169 if [[ -n $1 ]] ; then
170 mvar="$1_${mvar}"
171 dvar="$1_${dvar}"
172 fi
173
174 if [[ -z ${!mvar} ]] ; then
176 echo "default" 175 echo "default"
177 return 0 176 return 0
178 fi 177 fi
179 178
180 for x in ${MULTILIB_ABIS}; do 179 for x in ${!mvar}; do
181 if [[ ${x} != ${DEFAULT_ABI} ]] ; then 180 if [[ ${x} != ${!dvar} ]] ; then
182 order="${order:+${order} }${x}" 181 order="${order:+${order} }${x}"
183 fi 182 fi
184 done 183 done
185 order="${order:+${order} }${DEFAULT_ABI}" 184 order="${order:+${order} }${!dvar}"
186 185
187 echo ${order} 186 echo ${order}
188 return 0 187 return 0
189} 188}
190 189
192# @DESCRIPTION: 191# @DESCRIPTION:
193# Returns a list of all the libdirs used by this profile. This includes 192# Returns a list of all the libdirs used by this profile. This includes
194# those that might not be touched by the current ebuild and always includes 193# those that might not be touched by the current ebuild and always includes
195# "lib". 194# "lib".
196get_all_libdirs() { 195get_all_libdirs() {
197 local libdirs 196 local libdirs abi
198 local abi
199 local dir
200 197
201 for abi in ${MULTILIB_ABIS}; do 198 for abi in ${MULTILIB_ABIS}; do
202 libdirs+=" $(get_abi_LIBDIR ${abi})" 199 libdirs+=" $(get_abi_LIBDIR ${abi})"
203 done 200 done
204 [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib" 201 [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib"
286 283
287 case ${CTARGET} in 284 case ${CTARGET} in
288 x86_64*) 285 x86_64*)
289 export CFLAGS_x86=${CFLAGS_x86--m32} 286 export CFLAGS_x86=${CFLAGS_x86--m32}
290 export CHOST_x86=${CTARGET/x86_64/i686} 287 export CHOST_x86=${CTARGET/x86_64/i686}
288 CHOST_x86=${CHOST_x86/%-gnux32/-gnu}
291 export CTARGET_x86=${CHOST_x86} 289 export CTARGET_x86=${CHOST_x86}
292 if [[ ${SYMLINK_LIB} == "yes" ]] ; then 290 if [[ ${SYMLINK_LIB} == "yes" ]] ; then
293 export LIBDIR_x86="lib32" 291 export LIBDIR_x86="lib32"
294 else 292 else
295 export LIBDIR_x86="lib" 293 export LIBDIR_x86="lib"
296 fi 294 fi
297 295
298 export CFLAGS_amd64=${CFLAGS_amd64--m64} 296 export CFLAGS_amd64=${CFLAGS_amd64--m64}
299 export CHOST_amd64=${CTARGET} 297 export CHOST_amd64=${CTARGET/%-gnux32/-gnu}
300 export CTARGET_amd64=${CHOST_amd64} 298 export CTARGET_amd64=${CHOST_amd64}
301 export LIBDIR_amd64="lib64" 299 export LIBDIR_amd64="lib64"
302 300
303 export CFLAGS_x32=${CFLAGS_x32--mx32} 301 export CFLAGS_x32=${CFLAGS_x32--mx32}
304 export CHOST_x32=${CTARGET} 302 export CHOST_x32=${CTARGET/%-gnu/-gnux32}
305 export CTARGET_x32=${CHOST_x32} 303 export CTARGET_x32=${CHOST_x32}
306 export LIBDIR_x32="libx32" 304 export LIBDIR_x32="libx32"
307 305
306 case ${CTARGET} in
307 *-gnux32)
308 : ${MULTILIB_ABIS=x32 amd64 x86}
309 : ${DEFAULT_ABI=x32}
310 ;;
311 *)
308 : ${MULTILIB_ABIS=amd64 x86} 312 : ${MULTILIB_ABIS=amd64 x86}
309 : ${DEFAULT_ABI=amd64} 313 : ${DEFAULT_ABI=amd64}
314 ;;
315 esac
310 ;; 316 ;;
311 mips64*) 317 mips64*)
312 export CFLAGS_o32=${CFLAGS_o32--mabi=32} 318 export CFLAGS_o32=${CFLAGS_o32--mabi=32}
313 export CHOST_o32=${CTARGET/mips64/mips} 319 export CHOST_o32=${CTARGET/mips64/mips}
314 export CTARGET_o32=${CHOST_o32} 320 export CTARGET_o32=${CHOST_o32}
354 360
355 : ${MULTILIB_ABIS=s390x s390} 361 : ${MULTILIB_ABIS=s390x s390}
356 : ${DEFAULT_ABI=s390x} 362 : ${DEFAULT_ABI=s390x}
357 ;; 363 ;;
358 sparc*) 364 sparc*)
359 export CFLAGS_sparc32=${CFLAGS_sparc32} 365 export CFLAGS_sparc32=${CFLAGS_sparc32--m32}
360 export CHOST_sparc32=${CTARGET/sparc64/sparc} 366 export CHOST_sparc32=${CTARGET/sparc64/sparc}
361 export CTARGET_sparc32=${CHOST_sparc32} 367 export CTARGET_sparc32=${CHOST_sparc32}
362 export LIBDIR_sparc32="lib" 368 export LIBDIR_sparc32="lib"
363 369
364 export CFLAGS_sparc64=${CFLAGS_sparc64--m64} 370 export CFLAGS_sparc64=${CFLAGS_sparc64--m64}
407 export __DEFAULT_ABI_SAVED="true" 413 export __DEFAULT_ABI_SAVED="true"
408 414
409 # Set the CHOST native first so that we pick up the native 415 # Set the CHOST native first so that we pick up the native
410 # toolchain and not a cross-compiler by accident #202811. 416 # toolchain and not a cross-compiler by accident #202811.
411 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI}) 417 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI})
412 export AS="$(tc-getAS) $(get_abi_ASFLAGS)"
413 export CC="$(tc-getCC) $(get_abi_CFLAGS)" 418 export CC="$(tc-getCC) $(get_abi_CFLAGS)"
414 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)" 419 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)"
415 export LD="$(tc-getLD) $(get_abi_LDFLAGS)" 420 export LD="$(tc-getLD) $(get_abi_LDFLAGS)"
416 export CHOST=$(get_abi_CHOST $1) 421 export CHOST=$(get_abi_CHOST $1)
417 export CBUILD=$(get_abi_CHOST $1) 422 export CBUILD=$(get_abi_CHOST $1)
418 fi 423 fi
419} 424}
425
426fi

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.100

  ViewVC Help
Powered by ViewVC 1.1.20