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

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 8/8] fftw: example use of multibuild in ebuild.
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2013-02-27 21:43:25
Message-ID: 1362001405-25636-8-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]

Just a quick, dirty example. Not even tested thoroughly ;).
---
 gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild | 38 +++++++++++++--------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild b/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild
index 18554f0..ddca8e4 100644
--- a/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild
+++ b/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild
@@ -7,7 +7,7 @@ EAPI=5
 #AUTOTOOLS_AUTORECONF=1
 FORTRAN_NEEDED=fortran
 
-inherit autotools-multilib eutils flag-o-matic fortran-2 toolchain-funcs versionator
+inherit autotools-multilib eutils flag-o-matic fortran-2 multibuild toolchain-funcs versionator
 
 DESCRIPTION="Fast C library for the Discrete Fourier Transform"
 HOMEPAGE="http://www.fftw.org/"
@@ -24,6 +24,8 @@ DEPEND="${RDEPEND}
 	test? ( dev-lang/perl )"
 
 pkg_setup() {
+	# XXX: this looks like it should be used with BUILD_TYPE!=binary
+
 	if use openmp; then
 		if [[ $(tc-getCC) == *gcc ]] && ! tc-has-openmp; then
 			ewarn "OpenMP is not available in your current selected gcc"
@@ -32,13 +34,13 @@ pkg_setup() {
 		FORTRAN_NEED_OPENMP=1
 	fi
 	fortran-2_pkg_setup
-	FFTW_DIRS="single double longdouble"
+	MULTIBUILD_VARIANTS=( single double longdouble )
 	if use quad; then
 		if [[ $(tc-getCC) == *gcc ]] && ! version_is_at_least 4.6 $(gcc-version); then
 			ewarn "quad precision only available for gcc >= 4.6"
 			die "need quad precision capable gcc"
 		fi
-		FFTW_DIRS+=" quad"
+		MULTIBUILD_VARIANTS+=( quad )
 	fi
 }
 
@@ -57,7 +59,9 @@ src_configure() {
 	# filter -Os according to docs
 	replace-flags -Os -O2
 
-	for x in ${FFTW_DIRS}; do
+	my_configure() {
+		local x=${MULTIBUILD_VARIANT}
+
 		myeconfargs=(
 			$(use_enable fma)
 			$(use_enable fortran)
@@ -93,42 +97,30 @@ src_configure() {
 			die "${x} precision not implemented in this ebuild"
 		fi
 
-		einfo "Configuring for ${x} precision"
-		BUILD_DIR="${S}-${x}" \
-			autotools-multilib_src_configure
-	done
+		autotools-multilib_src_configure
+	}
+
+	multibuild_foreach my_configure
 }
 
 src_compile() {
-	for x in ${FFTW_DIRS}; do
-		einfo "Compiling for ${x} precision"
-		BUILD_DIR="${S}-${x}" \
-			autotools-multilib_src_compile
-	done
+	multibuild_foreach autotools-multilib_src_compile
 }
 
 src_test () {
-	do_smalltest() { cd "${BUILD_DIR}" && emake -C tests smallcheck; }
 	# We want this to be a reasonably quick test, but that is still hard...
 	ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
 	# Do not increase the number of threads, it will not help your performance
 	#local testbase="perl check.pl --nthreads=1 --estimate"
 	#		${testbase} -${p}d || die "Failure: $n"
-	for x in ${FFTW_DIRS}; do
-		einfo "Testing ${x} precision"
-		BUILD_DIR="${S}-${x}" \
-			multilib_foreach_abi do_smalltest
-	done
+	multibuild_foreach autotools-multilib_src_compile -C tests smallcheck
 }
 
 src_install () {
 	local u x
 	DOCS=( AUTHORS ChangeLog NEWS README TODO COPYRIGHT CONVENTIONS )
 	HTML_DOCS=( doc/html/ )
-	for x in ${FFTW_DIRS}; do
-		BUILD_DIR="${S}-${x}" \
-			autotools-multilib_src_install
-	done
+	multibuild_foreach autotools-multilib_src_install
 
 	if use doc; then
 		dodoc doc/*.pdf
-- 
1.8.1.4


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

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