The eclass does:

- export proper USE flags to control the built ABIs,

- provide MULTILIB_USEDEP to write proper USE dependencies,

- provide utility functions to run commands for each ABI.
---
 gx86/eclass/multilib-build.eclass | 103 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)
 create mode 100644 gx86/eclass/multilib-build.eclass

diff --git a/gx86/eclass/multilib-build.eclass 
b/gx86/eclass/multilib-build.eclass
new file mode 100644
index 0000000..d8bd5ab
--- /dev/null
+++ b/gx86/eclass/multilib-build.eclass
@@ -0,0 +1,103 @@
+# 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.7 
2013/01/26 11:39:41 mgorny Exp $
+
+# @ECLASS: multilib-build.eclass
+# @MAINTAINER:
+# Michał Górny <mgo...@gentoo.org>
+# @BLURB: flags and utility functions for building multilib packages
+# @DESCRIPTION:
+# The multilib-build.eclass exports USE flags and utility functions
+# necessary to build packages for multilib in a clean and uniform
+# manner.
+#
+# Please note that dependency specifications for multilib-capable
+# dependencies shall use the USE dependency string in ${MULTILIB_USEDEP}
+# to properly request multilib enabled.
+
+if [[ ! ${_MULTILIB_BUILD} ]]; then
+
+# EAPI=5 is required for meaningful MULTILIB_USEDEP.
+case ${EAPI:-0} in
+       5) ;;
+       *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+inherit multilib multiprocessing
+
+IUSE=multilib
+
+# @ECLASS-VARIABLE: MULTILIB_USEDEP
+# @DESCRIPTION:
+# The USE-dependency to be used on dependencies (libraries) needing
+# to support multilib as well.
+#
+# Example use:
+# @CODE
+# RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}]
+#      net-libs/libbar[ssl,${MULTILIB_USEDEP}]"
+# @CODE
+MULTILIB_USEDEP='multilib(-)?'
+
+# @FUNCTION: 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 BUILD_DIR,
+# and runs the given commands with them.
+#
+# If multilib support is disabled, it just runs the commands. No setup
+# is done.
+multilib_foreach_abi() {
+       local initial_dir=${BUILD_DIR:-${S}}
+
+       if use multilib; then
+               local ABI
+               for ABI in $(get_all_abis); do
+                       multilib_toolchain_setup "${ABI}"
+                       BUILD_DIR=${initial_dir%%/}-${ABI} "${@}"
+               done
+       else
+               "${@}"
+       fi
+}
+
+# @FUNCTION: 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.
+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
+}
+
+_MULTILIB_BUILD=1
+fi
-- 
1.8.1.1


Reply via email to