Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 8/8] fftw: example use of multibuild in ebuild.
Date: Wed, 27 Feb 2013 21:47:19
Message-Id: 1362001405-25636-8-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [RFC] multibuild.eclass -- a generic pluggable framework to handle multi-variant builds by "Michał Górny"
1 Just a quick, dirty example. Not even tested thoroughly ;).
2 ---
3 gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild | 38 +++++++++++++--------------------
4 1 file changed, 15 insertions(+), 23 deletions(-)
5
6 diff --git a/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild b/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild
7 index 18554f0..ddca8e4 100644
8 --- a/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild
9 +++ b/gx86/sci-libs/fftw/fftw-3.3.3-r1.ebuild
10 @@ -7,7 +7,7 @@ EAPI=5
11 #AUTOTOOLS_AUTORECONF=1
12 FORTRAN_NEEDED=fortran
13
14 -inherit autotools-multilib eutils flag-o-matic fortran-2 toolchain-funcs versionator
15 +inherit autotools-multilib eutils flag-o-matic fortran-2 multibuild toolchain-funcs versionator
16
17 DESCRIPTION="Fast C library for the Discrete Fourier Transform"
18 HOMEPAGE="http://www.fftw.org/"
19 @@ -24,6 +24,8 @@ DEPEND="${RDEPEND}
20 test? ( dev-lang/perl )"
21
22 pkg_setup() {
23 + # XXX: this looks like it should be used with BUILD_TYPE!=binary
24 +
25 if use openmp; then
26 if [[ $(tc-getCC) == *gcc ]] && ! tc-has-openmp; then
27 ewarn "OpenMP is not available in your current selected gcc"
28 @@ -32,13 +34,13 @@ pkg_setup() {
29 FORTRAN_NEED_OPENMP=1
30 fi
31 fortran-2_pkg_setup
32 - FFTW_DIRS="single double longdouble"
33 + MULTIBUILD_VARIANTS=( single double longdouble )
34 if use quad; then
35 if [[ $(tc-getCC) == *gcc ]] && ! version_is_at_least 4.6 $(gcc-version); then
36 ewarn "quad precision only available for gcc >= 4.6"
37 die "need quad precision capable gcc"
38 fi
39 - FFTW_DIRS+=" quad"
40 + MULTIBUILD_VARIANTS+=( quad )
41 fi
42 }
43
44 @@ -57,7 +59,9 @@ src_configure() {
45 # filter -Os according to docs
46 replace-flags -Os -O2
47
48 - for x in ${FFTW_DIRS}; do
49 + my_configure() {
50 + local x=${MULTIBUILD_VARIANT}
51 +
52 myeconfargs=(
53 $(use_enable fma)
54 $(use_enable fortran)
55 @@ -93,42 +97,30 @@ src_configure() {
56 die "${x} precision not implemented in this ebuild"
57 fi
58
59 - einfo "Configuring for ${x} precision"
60 - BUILD_DIR="${S}-${x}" \
61 - autotools-multilib_src_configure
62 - done
63 + autotools-multilib_src_configure
64 + }
65 +
66 + multibuild_foreach my_configure
67 }
68
69 src_compile() {
70 - for x in ${FFTW_DIRS}; do
71 - einfo "Compiling for ${x} precision"
72 - BUILD_DIR="${S}-${x}" \
73 - autotools-multilib_src_compile
74 - done
75 + multibuild_foreach autotools-multilib_src_compile
76 }
77
78 src_test () {
79 - do_smalltest() { cd "${BUILD_DIR}" && emake -C tests smallcheck; }
80 # We want this to be a reasonably quick test, but that is still hard...
81 ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
82 # Do not increase the number of threads, it will not help your performance
83 #local testbase="perl check.pl --nthreads=1 --estimate"
84 # ${testbase} -${p}d || die "Failure: $n"
85 - for x in ${FFTW_DIRS}; do
86 - einfo "Testing ${x} precision"
87 - BUILD_DIR="${S}-${x}" \
88 - multilib_foreach_abi do_smalltest
89 - done
90 + multibuild_foreach autotools-multilib_src_compile -C tests smallcheck
91 }
92
93 src_install () {
94 local u x
95 DOCS=( AUTHORS ChangeLog NEWS README TODO COPYRIGHT CONVENTIONS )
96 HTML_DOCS=( doc/html/ )
97 - for x in ${FFTW_DIRS}; do
98 - BUILD_DIR="${S}-${x}" \
99 - autotools-multilib_src_install
100 - done
101 + multibuild_foreach autotools-multilib_src_install
102
103 if use doc; then
104 dodoc doc/*.pdf
105 --
106 1.8.1.4

Replies

Subject Author
Re: [gentoo-dev] [PATCH 8/8] fftw: example use of multibuild in ebuild. Christoph Junghans <ottxor@g.o>