| 1 |
# Copyright 1999-2013 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.2 2012/12/01 16:26:03 mgorny Exp $
|
| 4 |
|
| 5 |
# @ECLASS: autotools-multilib.eclass
|
| 6 |
# @MAINTAINER:
|
| 7 |
# Michał Górny <mgorny@gentoo.org>
|
| 8 |
# @BLURB: autotools-utils wrapper for multilib builds
|
| 9 |
# @DESCRIPTION:
|
| 10 |
# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper
|
| 11 |
# introducing support for building for more than one ABI (multilib).
|
| 12 |
#
|
| 13 |
# Inheriting this eclass sets IUSE=multilib and exports autotools-utils
|
| 14 |
# phase function wrappers which build the package for each supported ABI
|
| 15 |
# if the flag is enabled. Otherwise, it works like regular
|
| 16 |
# autotools-utils.
|
| 17 |
#
|
| 18 |
# Note that the multilib support requires out-of-source builds to be
|
| 19 |
# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with
|
| 20 |
# it.
|
| 21 |
|
| 22 |
case ${EAPI:-0} in
|
| 23 |
2|3|4|5) ;;
|
| 24 |
*) die "EAPI=${EAPI} is not supported" ;;
|
| 25 |
esac
|
| 26 |
|
| 27 |
if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
|
| 28 |
die "${ECLASS}: multilib support requires out-of-source builds."
|
| 29 |
fi
|
| 30 |
|
| 31 |
inherit autotools-utils multilib
|
| 32 |
|
| 33 |
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
|
| 34 |
|
| 35 |
IUSE=multilib
|
| 36 |
|
| 37 |
# @FUNCTION: autotools-multilib_foreach_abi
|
| 38 |
# @USAGE: argv...
|
| 39 |
# @DESCRIPTION:
|
| 40 |
# If multilib support is enabled, sets the toolchain up for each
|
| 41 |
# supported ABI along with the ABI variable and correct BUILD_DIR,
|
| 42 |
# and runs the given commands with them.
|
| 43 |
#
|
| 44 |
# If multilib support is disabled, it just runs the commands. No setup
|
| 45 |
# is done.
|
| 46 |
autotools-multilib_foreach_abi() {
|
| 47 |
local initial_dir=${BUILD_DIR:-${S}}
|
| 48 |
|
| 49 |
if use multilib; then
|
| 50 |
local ABI
|
| 51 |
for ABI in $(get_all_abis); do
|
| 52 |
multilib_toolchain_setup "${ABI}"
|
| 53 |
BUILD_DIR=${initial_dir%%/}-${ABI} "${@}"
|
| 54 |
done
|
| 55 |
else
|
| 56 |
"${@}"
|
| 57 |
fi
|
| 58 |
}
|
| 59 |
|
| 60 |
autotools-multilib_src_configure() {
|
| 61 |
autotools-multilib_foreach_abi autotools-utils_src_configure
|
| 62 |
}
|
| 63 |
|
| 64 |
autotools-multilib_src_compile() {
|
| 65 |
autotools-multilib_foreach_abi autotools-utils_src_compile
|
| 66 |
}
|
| 67 |
|
| 68 |
autotools-multilib_src_test() {
|
| 69 |
autotools-multilib_foreach_abi autotools-utils_src_test
|
| 70 |
}
|
| 71 |
|
| 72 |
autotools-multilib_src_install() {
|
| 73 |
autotools-multilib_foreach_abi autotools-utils_src_install
|
| 74 |
}
|