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

Diff of /eclass/multilib.eclass

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

Revision 1.19 Revision 1.28
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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.19 2005/02/09 03:22:25 eradicator Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.28 2005/07/06 20:20:04 agriffis Exp $
4# 4#
5# Author: Jeremy Huddleston <eradicator@gentoo.org> 5# Author: Jeremy Huddleston <eradicator@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
10ECLASS=multilib
11INHERITED="$INHERITED $ECLASS" 10INHERITED="$INHERITED $ECLASS"
12 11
13DESCRIPTION="Based on the ${ECLASS} eclass" 12DESCRIPTION="Based on the ${ECLASS} eclass"
14 13
15# has_multilib_profile: 14# has_multilib_profile:
87# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64 86# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
88 87
89### END DOCUMENTATION ### 88### END DOCUMENTATION ###
90 89
91# Defaults: 90# Defaults:
92CFLAGS_default="" 91export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"}
92export DEFAULT_ABI=${DEFAULT_ABI:-"default"}
93# This causes econf to set --libdir=/usr/lib where it didn't before
94#export ABI=${ABI:-"default"}
95export CFLAGS_default
96export LDFLAGS_default
97export CHOST_default=${CHOST_default:-${CHOST}}
93LIBDIR_default="${CONF_LIBDIR:-lib}" 98export LIBDIR_default=${CONF_LIBDIR:-"lib"}
94CDEFINE_default="__unix__" 99export CDEFINE_default="__unix__"
95 100
96# has_multilib_profile() 101# has_multilib_profile()
97has_multilib_profile() { 102has_multilib_profile() {
98 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] 103 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
99} 104}
179 184
180 local var="${flag}_${abi}" 185 local var="${flag}_${abi}"
181 echo ${!var} 186 echo ${!var}
182} 187}
183 188
184get_abi_CFLAGS() { get_abi_var CFLAGS ${@}; } 189get_abi_CFLAGS() { get_abi_var CFLAGS "${@}"; }
190get_abi_LDFLAGS() { get_abi_var LDFLAGS "${@}"; }
191get_abi_CHOST() { get_abi_var CHOST "${@}"; }
192get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "${@}"; }
185get_abi_CDEFINE() { get_abi_var CDEFINE ${@}; } 193get_abi_CDEFINE() { get_abi_var CDEFINE "${@}"; }
186get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; } 194get_abi_LIBDIR() { get_abi_var LIBDIR "${@}"; }
187 195
188# Return a list of the ABIs we want to install for with 196# Return a list of the ABIs we want to install for with
189# the last one in the list being the default. 197# the last one in the list being the default.
190get_install_abis() { 198get_install_abis() {
191 local order="" 199 local order=""
269 277
270# Return true if ${ABI} is the last ABI on our list (or if we're not 278# Return true if ${ABI} is the last ABI on our list (or if we're not
271# using the new multilib configuration. This can be used to determine 279# using the new multilib configuration. This can be used to determine
272# if we're in the last (or only) run through src_{unpack,compile,install} 280# if we're in the last (or only) run through src_{unpack,compile,install}
273is_final_abi() { 281is_final_abi() {
274 ! has_multilib_profile && return 0 282 has_multilib_profile || return 0
275 local ALL_ABIS=$(get_install_abis) 283 local ALL_ABIS=$(get_install_abis)
276 local LAST_ABI=${ALL_ABIS/* /} 284 local LAST_ABI=${ALL_ABIS/* /}
277 [ "${LAST_ABI}" = "${ABI}" ] 285 [[ ${LAST_ABI} == ${ABI} ]]
278} 286}
279 287
280# echo the number of ABIs we will be installing for 288# echo the number of ABIs we will be installing for
281number_abis() { 289number_abis() {
282 get_install_abis | wc -w 290 get_install_abis | wc -w
296 if [[ -z "${MULTILIB_ABIS}" ]]; then 304 if [[ -z "${MULTILIB_ABIS}" ]]; then
297 echo ${incdir} 305 echo ${incdir}
298 return 0 306 return 0
299 fi 307 fi
300 308
301 local abi=${ABI:-${DEFAULT_ABI}} 309 local abi=${ABI-${DEFAULT_ABI}}
302 if [[ ${#} -gt 0 ]]; then 310 if [[ ${#} -gt 0 ]]; then
303 abi=${1} 311 abi=${1}
304 shift 312 shift
305 fi 313 fi
306 314
384 local file 392 local file
385 for file in $(create_ml_includes-allfiles ${basedirs}); do 393 for file in $(create_ml_includes-allfiles ${basedirs}); do
386 local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')" 394 local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')"
387 { 395 {
388 echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */" 396 echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */"
389 #echo "#ifndef __CREATE_ML_INCLUDES_STUB_${name}__"
390 #echo "#define __CREATE_ML_INCLUDES_STUB_${name}__"
391 #echo ""
392 397
393 local dir 398 local dir
394 for dir in ${basedirs}; do 399 for dir in ${basedirs}; do
395 if [ -f "${D}/${dir}/${file}" ]; then 400 if [ -f "${D}/${dir}/${file}" ]; then
396 echo "#ifdef $(create_ml_includes-sym_for_dir ${dir} ${mlinfo})" 401 local sym=$(create_ml_includes-sym_for_dir ${dir} ${mlinfo})
397 echo "#include \"$(create_ml_includes-relative_between ${dest}/$(dirname ${file}) ${dir}/${file})\"" 402 if [[ ${sym::1} == "!" ]]; then
398 echo "#endif /* $(create_ml_includes-sym_for_dir ${dir} ${mlinfo}) */" 403 echo "#ifndef ${sym:1}"
404 else
405 echo "#ifdef ${sym}"
406 fi
407 echo "#include <$(create_ml_includes-absolute ${dir}/${file})>"
408 echo "#endif /* ${sym} */"
399 echo "" 409 echo ""
400 fi 410 fi
401 done 411 done
402 412
403 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */" 413 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */"
404 } > ${D}/${dest}/${file} 414 } > ${D}/${dest}/${file}
405 done 415 done
406} 416}
407 417
408# Helper function for create_ml_includes 418# Helper function for create_ml_includes
409create_ml_includes-relative_between() { 419create_ml_includes-absolute() {
410 local src="$(create_ml_includes-tidy_path ${1})"
411 local dst="$(create_ml_includes-tidy_path ${2})" 420 local dst="$(create_ml_includes-tidy_path ${1})"
412 421
413 src=(${src//\// })
414 dst=(${dst//\// }) 422 dst=(${dst//\// })
415 423
416 local i 424 local i
417 for ((i=0; i<${#src[*]}; i++)); do 425 for ((i=0; i<${#dst[*]}; i++)); do
418 [ "${dst[i]}" != "${src[i]}" ] && break 426 [ "${dst[i]}" == "include" ] && break
419 done 427 done
420 428
421 local common=$i 429 local strip_upto=$i
422 430
423 for ((i=${#src[*]}; i>common; i--)); do
424 echo -n ../
425 done
426
427 for ((i=common; i<${#dst[*]}-1; i++)); do 431 for ((i=strip_upto+1; i<${#dst[*]}-1; i++)); do
428 echo -n ${dst[i]}/ 432 echo -n ${dst[i]}/
429 done 433 done
430 434
431 echo -n ${dst[i]} 435 echo -n ${dst[i]}
432} 436}

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20