summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAlexis Ballier <aballier@gentoo.org>2013-06-17 17:31:30 +0000
committerAlexis Ballier <aballier@gentoo.org>2013-06-17 17:31:30 +0000
commitcc6101ccf34976269d56d7613b5cb1c31cec2488 (patch)
tree3262271d3272da9ae5f3c13d117d2f8f16522446 /eclass
parentVersion bump (bug 470720), multilib build, preparations for netsurf eclass. (diff)
downloadgentoo-2-cc6101ccf34976269d56d7613b5cb1c31cec2488.tar.gz
gentoo-2-cc6101ccf34976269d56d7613b5cb1c31cec2488.tar.bz2
gentoo-2-cc6101ccf34976269d56d7613b5cb1c31cec2488.zip
Add a freebsd_multilib_multibuild_wrapper function to use it together with multibuild and multilib eclasses in order to simplify multilib handling.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/freebsd.eclass47
1 files changed, 46 insertions, 1 deletions
diff --git a/eclass/freebsd.eclass b/eclass/freebsd.eclass
index efbb7d4fdfae..613c67aa2666 100644
--- a/eclass/freebsd.eclass
+++ b/eclass/freebsd.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/freebsd.eclass,v 1.24 2012/11/24 11:22:44 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/freebsd.eclass,v 1.25 2013/06/17 17:31:30 aballier Exp $
#
# Diego Pettenò <flameeyes@gentoo.org>
@@ -120,6 +120,51 @@ freebsd_src_compile() {
bsdmk_src_compile
}
+# Helper function to make a multilib build with FreeBSD Makefiles.
+# Usage:
+# MULTIBUILD_VARIANTS=( $(get_all_abis) )
+# multibuild_foreach_variant freebsd_multilib_multibuild_wrapper my_function
+#
+# Important note: To use this function you _have_ to:
+# - inherit multilib.eclass and multibuild.eclass
+# - set MULTILIB_VARIANTS
+# - have a multilib useflag in IUSE
+
+freebsd_multilib_multibuild_wrapper() {
+ # Get the ABI from multibuild.eclass
+ # This assumes MULTILIB_VARIANTS contains only valid ABIs.
+ local ABI=${MULTIBUILD_VARIANT}
+
+ # First, save the variables: CFLAGS, CXXFLAGS, LDFLAGS and mymakeopts.
+ for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do
+ export ${i}_SAVE="${!i}"
+ done
+
+ # Setup the variables specific to this ABI.
+ multilib_toolchain_setup "${ABI}"
+
+ local target="$(tc-arch-kernel ${CHOST})"
+ mymakeopts="${mymakeopts} TARGET=${target} MACHINE=${target} MACHINE_ARCH=${target} SHLIBDIR=/usr/$(get_libdir) LIBDIR=/usr/$(get_libdir)"
+ if use multilib && [ "${ABI}" != "${DEFAULT_ABI}" ] ; then
+ mymakeopts="${mymakeopts} COMPAT_32BIT="
+ fi
+
+ einfo "Building for ABI=${ABI} and TARGET=${target}"
+
+ export MAKEOBJDIRPREFIX="${BUILD_DIR}"
+ if [ ! -d "${MAKEOBJDIRPREFIX}" ] ; then
+ mkdir "${MAKEOBJDIRPREFIX}" || die "Could not create ${MAKEOBJDIRPREFIX}."
+ fi
+
+ CTARGET="${CHOST}" "$@"
+
+ # Restore the variables now.
+ for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do
+ ii="${i}_SAVE"
+ export ${i}="${!ii}"
+ done
+}
+
freebsd_src_install() {
use profile || mymakeopts="${mymakeopts} NO_PROFILE= "