Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: x11@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] Support running commands in parallel if desirable.
Date: Sun, 20 Jan 2013 11:43:41
Message-Id: 1358682195-20240-1-git-send-email-mgorny@gentoo.org
1 ...and use if for src_configure().
2 ---
3 gx86/eclass/autotools-multilib.eclass | 41 +++++++++++++++++++++++++++++++++--
4 1 file changed, 39 insertions(+), 2 deletions(-)
5
6 diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass
7 index fe6372d..3aa5f27 100644
8 --- a/gx86/eclass/autotools-multilib.eclass
9 +++ b/gx86/eclass/autotools-multilib.eclass
10 @@ -28,7 +28,7 @@ if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
11 die "${ECLASS}: multilib support requires out-of-source builds."
12 fi
13
14 -inherit autotools-utils multilib
15 +inherit autotools-utils multilib multiprocessing
16
17 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
18
19 @@ -57,8 +57,45 @@ autotools-multilib_foreach_abi() {
20 fi
21 }
22
23 +# @FUNCTION: autotools-multilib_parallel_foreach_abi
24 +# @USAGE: argv...
25 +# @DESCRIPTION:
26 +# If multilib support is enabled, sets the toolchain up for each
27 +# supported ABI along with the ABI variable and correct BUILD_DIR,
28 +# and runs the given commands with them. The commands are run
29 +# in parallel with number of jobs being determined from MAKEOPTS.
30 +#
31 +# If multilib support is disabled, it just runs the commands. No setup
32 +# is done.
33 +#
34 +# Useful for running configure scripts.
35 +autotools-multilib_parallel_foreach_abi() {
36 + local initial_dir=${BUILD_DIR:-${S}}
37 +
38 + if use multilib; then
39 + multijob_init
40 +
41 + local ABI
42 + for ABI in $(get_all_abis); do
43 + (
44 + multijob_child_init
45 +
46 + multilib_toolchain_setup "${ABI}"
47 + BUILD_DIR=${initial_dir%%/}-${ABI}
48 + "${@}"
49 + ) &
50 +
51 + multijob_post_fork
52 + done
53 +
54 + multijob_finish
55 + else
56 + "${@}"
57 + fi
58 +}
59 +
60 autotools-multilib_src_configure() {
61 - autotools-multilib_foreach_abi autotools-utils_src_configure
62 + autotools-multilib_parallel_foreach_abi autotools-utils_src_configure
63 }
64
65 autotools-multilib_src_compile() {
66 --
67 1.8.1.1