Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] autotools-multilib: wrapper eclass for multilib builds.
Date: Sat, 22 Sep 2012 21:26:04
Message-Id: 1348349086-9859-1-git-send-email-mgorny@gentoo.org
1 It is a simple eclass using autotools out-of-source builds to build
2 packages for multiple ABIs when multilib is supported.
3
4 Use case: xorg packages, ask Matt.
5 ---
6 gx86/eclass/autotools-multilib.eclass | 72 +++++++++++++++++++++++++++++++++++
7 1 file changed, 72 insertions(+)
8 create mode 100644 gx86/eclass/autotools-multilib.eclass
9
10 diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass
11 new file mode 100644
12 index 0000000..1a345a1
13 --- /dev/null
14 +++ b/gx86/eclass/autotools-multilib.eclass
15 @@ -0,0 +1,72 @@
16 +# Copyright 1999-2012 Gentoo Foundation
17 +# Distributed under the terms of the GNU General Public License v2
18 +# $Header: $
19 +
20 +# @ECLASS: autotools-multilib.eclass
21 +# @MAINTAINER:
22 +# Michał Górny <mgorny@g.o>
23 +# @BLURB: autotools-utils wrapper for multilib builds
24 +# @DESCRIPTION:
25 +# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper
26 +# introducing support for building for more than one ABI (multilib).
27 +#
28 +# Inheriting this eclass sets IUSE=multilib and exports autotools-utils
29 +# phase function wrappers which build the package for each supported ABI
30 +# if the flag is enabled. Otherwise, it works like regular
31 +# autotools-utils.
32 +#
33 +# Note that the multilib support requires out-of-source builds to be
34 +# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with
35 +# it.
36 +
37 +case ${EAPI:-0} in
38 + 2|3|4) ;;
39 + *) die "EAPI=${EAPI} is not supported" ;;
40 +esac
41 +
42 +if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
43 + die "${ECLASS}: multilib support requires out-of-source builds."
44 +fi
45 +
46 +inherit autotools-utils multilib
47 +
48 +EXPORT_FUNCTIONS src_configure src_compile src_test src_install
49 +
50 +IUSE=multilib
51 +
52 +# @FUNCTION: autotools-multilib_foreach_abi
53 +# @USAGE: argv...
54 +# @DESCRIPTION:
55 +# If multilib support is enabled, sets the toolchain up for each
56 +# supported ABI along with the ABI variable and correct
57 +# AUTOTOOLS_BUILD_DIR, and runs the given commands with them.
58 +#
59 +# If multilib support is disabled, it just runs the commands. No setup
60 +# is done.
61 +autotools-multilib_foreach_abi() {
62 + if use multilib; then
63 + local ABI
64 + for ABI in $(get_all_abis); do
65 + multilib_toolchain_setup "${ABI}"
66 + AUTOTOOLS_BUILD_DIR=${S%%/}-${ABI} "${@}"
67 + done
68 + else
69 + "${@}"
70 + fi
71 +}
72 +
73 +autotools-multilib_src_configure() {
74 + autotools-multilib_foreach_abi autotools-utils_src_configure
75 +}
76 +
77 +autotools-multilib_src_compile() {
78 + autotools-multilib_foreach_abi autotools-utils_src_compile
79 +}
80 +
81 +autotools-multilib_src_test() {
82 + autotools-multilib_foreach_abi autotools-utils_src_test
83 +}
84 +
85 +autotools-multilib_src_install() {
86 + autotools-multilib_foreach_abi autotools-utils_src_install
87 +}
88 --
89 1.7.12

Replies