From: Jeremy Huddleston Date: Wed, 12 Jan 2005 00:21:53 +0000 (+0000) Subject: Breaking multilib code off to a separate eclass to keep things clean. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c2ca5614dbe2ef49ee46c105500afa6b8157e0be;p=gentoo.git Breaking multilib code off to a separate eclass to keep things clean. --- diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index ed31d33674df..0320c9a7db8b 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.140 2005/01/11 04:24:39 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.141 2005/01/12 00:21:53 eradicator Exp $ # # Author: Martin Schlemmer # @@ -9,6 +9,7 @@ # # NB: If you add anything, please comment it! +inherit multilib ECLASS=eutils INHERITED="$INHERITED $ECLASS" @@ -1601,123 +1602,3 @@ epunt_cxx() { done eend 0 } - -# This function simply returns the desired lib directory. With portage -# 2.0.51, we now have support for installing libraries to lib32/lib64 -# to accomidate the needs of multilib systems. It's no longer a good idea -# to assume all libraries will end up in lib. Replace any (sane) instances -# where lib is named directly with $(get_libdir) if possible. -# -# Travis Tilley (24 Aug 2004) -# -# Jeremy Huddleston (23 Dec 2004): -# Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set, -# fall back on old behavior. Any profile that has these set should also -# depend on a newer version of portage (not yet released) which uses these -# over CONF_LIBDIR in econf, dolib, etc... -get_libdir() { - LIBDIR_TEST=$(type econf) - if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then - # if there is an override, we want to use that... always. - CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" - # We don't need to know the verison of portage. We only need to know - # if there is support for CONF_LIBDIR in econf and co. - # Danny van Dyk 2004/17/09 - #elif portageq has_version / ' approach... - CONF_LIBDIR="$(get_abi_LIBDIR)" - elif [ "${LIBDIR_TEST/CONF_LIBDIR}" == "${LIBDIR_TEST}" ]; then # we don't have CONF_LIBDIR support - # will be (31 Aug 2004) -get_libdir_override() { - if [ -n "$(get_abi_LIBDIR)" ]; then - eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org" - exit 1 - fi - CONF_LIBDIR="$1" - CONF_LIBDIR_OVERRIDE="$1" -} - -# get_abi_var [] -# returns the value of ${_} which should be set in make.defaults -# -# ex: -# CFLAGS=$(get_abi_var CFLAGS sparc32) # CFLAGS=-m32 -# -# Note that the prefered method is to set CC="$(tc-getCC) $(get_abi_CFLAGS)" -# This will hopefully be added to portage soon... -# -# If is not specified, ${ABI} is used. -# If is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used. -# If is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string. -# -# Jeremy Huddleston -get_abi_var() { - local flag=${1} - local abi - if [ $# -gt 1 ]; then - abi=${2} - elif [ -n "${ABI}" ]; then - abi=${ABI} - elif [ -n "${DEFAULT_ABI}" ]; then - abi=${DEFAULT_ABI} - else - return 1 - fi - - local var="${flag}_${abi}" - echo ${!var} -} - -get_abi_CFLAGS() { get_abi_var CFLAGS ${@}; } -get_abi_CXXFLAGS() { get_abi_var CXXFLAGS ${@}; } -get_abi_ASFLAGS() { get_abi_var ASFLAGS ${@}; } -get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; } - -# get_all_libdir() -# Returns a list of all the libdirs used by this profile -get_all_libdirs() { - local libdirs - if [ -n "${MULTILIB_ABIS}" ]; then - for abi in ${MULTILIB_ABIS}; do - libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" - done - libdirs="${libdirs:1}" - elif [ -n "${CONF_LIBDIR}" ]; then - libdirs="${CONF_LIBDIR} ${CONF_MULTILIBDIR:=lib32}" - else - libdirs="lib" - fi - - echo "${libdirs}" -} diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass new file mode 100644 index 000000000000..aa065b22feff --- /dev/null +++ b/eclass/multilib.eclass @@ -0,0 +1,133 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.1 2005/01/12 00:21:53 eradicator Exp $ +# +# Author: Jeremy Huddleston +# +# This eclass is for all functions pertaining to handling multilib. +# configurations. + +ECLASS=multilib +INHERITED="$INHERITED $ECLASS" + +DESCRIPTION="Based on the ${ECLASS} eclass" + +# This function simply returns the desired lib directory. With portage +# 2.0.51, we now have support for installing libraries to lib32/lib64 +# to accomidate the needs of multilib systems. It's no longer a good idea +# to assume all libraries will end up in lib. Replace any (sane) instances +# where lib is named directly with $(get_libdir) if possible. +# +# Travis Tilley (24 Aug 2004) +# +# Jeremy Huddleston (23 Dec 2004): +# Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set, +# fall back on old behavior. Any profile that has these set should also +# depend on a newer version of portage (not yet released) which uses these +# over CONF_LIBDIR in econf, dolib, etc... +get_libdir() { + LIBDIR_TEST=$(type econf) + if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then + # if there is an override, we want to use that... always. + CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" + # We don't need to know the verison of portage. We only need to know + # if there is support for CONF_LIBDIR in econf and co. + # Danny van Dyk 2004/17/09 + #elif portageq has_version / ' approach... + CONF_LIBDIR="$(get_abi_LIBDIR)" + elif [ "${LIBDIR_TEST/CONF_LIBDIR}" == "${LIBDIR_TEST}" ]; then # we don't have CONF_LIBDIR support + # will be (31 Aug 2004) +get_libdir_override() { + if [ -n "$(get_abi_LIBDIR)" ]; then + eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org" + exit 1 + fi + CONF_LIBDIR="$1" + CONF_LIBDIR_OVERRIDE="$1" +} + +# get_abi_var [] +# returns the value of ${_} which should be set in make.defaults +# +# ex: +# CFLAGS=$(get_abi_var CFLAGS sparc32) # CFLAGS=-m32 +# +# Note that the prefered method is to set CC="$(tc-getCC) $(get_abi_CFLAGS)" +# This will hopefully be added to portage soon... +# +# If is not specified, ${ABI} is used. +# If is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used. +# If is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string. +# +# Jeremy Huddleston +get_abi_var() { + local flag=${1} + local abi + if [ $# -gt 1 ]; then + abi=${2} + elif [ -n "${ABI}" ]; then + abi=${ABI} + elif [ -n "${DEFAULT_ABI}" ]; then + abi=${DEFAULT_ABI} + else + return 1 + fi + + local var="${flag}_${abi}" + echo ${!var} +} + +get_abi_CFLAGS() { get_abi_var CFLAGS ${@}; } +get_abi_CXXFLAGS() { get_abi_var CXXFLAGS ${@}; } +get_abi_ASFLAGS() { get_abi_var ASFLAGS ${@}; } +get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; } + +# get_all_libdir() +# Returns a list of all the libdirs used by this profile +get_all_libdirs() { + local libdirs + if [ -n "${MULTILIB_ABIS}" ]; then + for abi in ${MULTILIB_ABIS}; do + libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" + done + libdirs="${libdirs:1}" + elif [ -n "${CONF_LIBDIR}" ]; then + libdirs="${CONF_LIBDIR} ${CONF_MULTILIBDIR:=lib32}" + else + libdirs="lib" + fi + + echo "${libdirs}" +}