Gentoo Archives: gentoo-dev

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