summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-10-08 18:44:30 +0000
committerMichał Górny <mgorny@gentoo.org>2012-10-08 18:44:30 +0000
commit7aef0335c9261a1e88252a34a3ac5e2893a50f4e (patch)
treea7af654213e3f09fc6bdafa181d8bf2da64a9023 /eclass
parentAdd in IPv6 and Kerberos support from uw-imap. (diff)
downloadgentoo-2-7aef0335c9261a1e88252a34a3ac5e2893a50f4e.tar.gz
gentoo-2-7aef0335c9261a1e88252a34a3ac5e2893a50f4e.tar.bz2
gentoo-2-7aef0335c9261a1e88252a34a3ac5e2893a50f4e.zip
Introduce autotools-multilib, to simplify building multilib packages with autotools-utils.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/autotools-multilib.eclass72
2 files changed, 77 insertions, 1 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index ad8b4656bcb8..0ba5de2009d2 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.433 2012/10/07 14:53:43 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.434 2012/10/08 18:44:30 mgorny Exp $
+
+ 08 Oct 2012; Michał Górny <mgorny@gentoo.org> +autotools-multilib.eclass:
+ Introduce autotools-multilib, to simplify building multilib packages with
+ autotools-utils.
07 Oct 2012; Justin Lecher <jlec@gentoo.org> fortran-2.eclass:
Revert virtual/fortran depends again, because not only USE=fortran controlls
diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass
new file mode 100644
index 000000000000..f6d1feb3051c
--- /dev/null
+++ b/eclass/autotools-multilib.eclass
@@ -0,0 +1,72 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.1 2012/10/08 18:44:30 mgorny Exp $
+
+# @ECLASS: autotools-multilib.eclass
+# @MAINTAINER:
+# Michał Górny <mgorny@gentoo.org>
+# @BLURB: autotools-utils wrapper for multilib builds
+# @DESCRIPTION:
+# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper
+# introducing support for building for more than one ABI (multilib).
+#
+# Inheriting this eclass sets IUSE=multilib and exports autotools-utils
+# phase function wrappers which build the package for each supported ABI
+# if the flag is enabled. Otherwise, it works like regular
+# autotools-utils.
+#
+# Note that the multilib support requires out-of-source builds to be
+# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with
+# it.
+
+case ${EAPI:-0} in
+ 2|3|4) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
+ die "${ECLASS}: multilib support requires out-of-source builds."
+fi
+
+inherit autotools-utils multilib
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+
+IUSE=multilib
+
+# @FUNCTION: autotools-multilib_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
+# AUTOTOOLS_BUILD_DIR, and runs the given commands with them.
+#
+# If multilib support is disabled, it just runs the commands. No setup
+# is done.
+autotools-multilib_foreach_abi() {
+ if use multilib; then
+ local ABI
+ for ABI in $(get_all_abis); do
+ multilib_toolchain_setup "${ABI}"
+ AUTOTOOLS_BUILD_DIR=${S%%/}-${ABI} "${@}"
+ done
+ else
+ "${@}"
+ fi
+}
+
+autotools-multilib_src_configure() {
+ autotools-multilib_foreach_abi autotools-utils_src_configure
+}
+
+autotools-multilib_src_compile() {
+ autotools-multilib_foreach_abi autotools-utils_src_compile
+}
+
+autotools-multilib_src_test() {
+ autotools-multilib_foreach_abi autotools-utils_src_test
+}
+
+autotools-multilib_src_install() {
+ autotools-multilib_foreach_abi autotools-utils_src_install
+}