summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-01-26 11:35:38 +0000
committerMichał Górny <mgorny@gentoo.org>2013-01-26 11:35:38 +0000
commitee7412ac8a731ecf99349ed3a7044050034680d8 (patch)
tree7732ed75d897eee94197a705dcef04bdef1cefc3 /eclass
parentIntroduce MULTILIB_USEDEP to enforce correct dependencies. (diff)
downloadgentoo-2-ee7412ac8a731ecf99349ed3a7044050034680d8.tar.gz
gentoo-2-ee7412ac8a731ecf99349ed3a7044050034680d8.tar.bz2
gentoo-2-ee7412ac8a731ecf99349ed3a7044050034680d8.zip
Support running commands in parallel and use it to run configure scripts.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/autotools-multilib.eclass43
2 files changed, 44 insertions, 4 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 6884414db9b9..22867474ca73 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.637 2013/01/26 11:34:16 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.638 2013/01/26 11:35:38 mgorny Exp $
+
+ 26 Jan 2013; Michał Górny <mgorny@gentoo.org> autotools-multilib.eclass:
+ Support running commands in parallel and use it to run configure scripts.
26 Jan 2013; Michał Górny <mgorny@gentoo.org> autotools-multilib.eclass:
Introduce MULTILIB_USEDEP to enforce correct dependencies.
diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass
index 44002c5b875f..d09701e4521e 100644
--- a/eclass/autotools-multilib.eclass
+++ b/eclass/autotools-multilib.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.4 2013/01/26 11:34:16 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.5 2013/01/26 11:35:38 mgorny Exp $
# @ECLASS: autotools-multilib.eclass
# @MAINTAINER:
@@ -28,7 +28,7 @@ if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
die "${ECLASS}: multilib support requires out-of-source builds."
fi
-inherit autotools-utils multilib
+inherit autotools-utils multilib multiprocessing
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
@@ -69,8 +69,45 @@ autotools-multilib_foreach_abi() {
fi
}
+# @FUNCTION: autotools-multilib_parallel_foreach_abi
+# @USAGE: argv...
+# @DESCRIPTION:
+# If multilib support is enabled, sets the toolchain up for each
+# supported ABI along with the ABI variable and correct BUILD_DIR,
+# and runs the given commands with them. The commands are run
+# in parallel with number of jobs being determined from MAKEOPTS.
+#
+# If multilib support is disabled, it just runs the commands. No setup
+# is done.
+#
+# Useful for running configure scripts.
+autotools-multilib_parallel_foreach_abi() {
+ local initial_dir=${BUILD_DIR:-${S}}
+
+ if use multilib; then
+ multijob_init
+
+ local ABI
+ for ABI in $(get_all_abis); do
+ (
+ multijob_child_init
+
+ multilib_toolchain_setup "${ABI}"
+ BUILD_DIR=${initial_dir%%/}-${ABI}
+ "${@}"
+ ) &
+
+ multijob_post_fork
+ done
+
+ multijob_finish
+ else
+ "${@}"
+ fi
+}
+
autotools-multilib_src_configure() {
- autotools-multilib_foreach_abi autotools-utils_src_configure
+ autotools-multilib_parallel_foreach_abi autotools-utils_src_configure
}
autotools-multilib_src_compile() {