[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] =?UTF-8?q?=5BPATCH=5D=20autotools-multilib=3A=20wrapper=20eclass=20for=20multilib=20bui
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2012-09-22 21:24:46
Message-ID: 1348349086-9859-1-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]

It is a simple eclass using autotools out-of-source builds to build
packages for multiple ABIs when multilib is supported.

Use case: xorg packages, ask Matt.
---
 gx86/eclass/autotools-multilib.eclass | 72 +++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 gx86/eclass/autotools-multilib.eclass

diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass
new file mode 100644
index 0000000..1a345a1
--- /dev/null
+++ b/gx86/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: $
+
+# @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
+}
-- 
1.7.12


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic