Gentoo Archives: gentoo-dev

From: Vaeth <vaeth@××××××××××××××××××××××××.de>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Ability to pass arguments to src_configure/src_compile
Date: Sun, 07 Sep 2008 15:31:47
Message-Id: Pine.LNX.4.64.0809071559210.4374@wmax001.mathematik.uni-wuerzburg.de
1 Santiago M. Mola wrote:
2 > Alec Warner <antarus@g.o> wrote:
3 > > Thomas Anderson <gentoofan23@g.o> wrote:
4 > >> DEFAULT_SRC_CONFIGURE_USE_{WITHS,ENABLES}
5 > >> DEFAULT_SRC_CONFIGURE_EXTRA_PARAMS
6
7 Essentially, this is the suggestion to replace the flexible shell code
8 by some static variables. Besides being less intuitive and less readable
9 (you have to know the meaning of all the variables to understand it)
10 it also works only for fixed cases, e.g. if it is only ./configure
11 (and not ./autogen.sh or something else) which has to be called,
12 and only if it has to be called exactly once in the main directory
13 For all other cases, either *everything* has to be done manually,
14 or you have to introduce even more variables to cover more cases.
15
16 Your second example shows no advantage either since you could just
17 have rewritten it by standard means anyway:
18
19 > src_compile() {
20 > local myconf="
21 > --sysconfdir=/etc/${PN}
22 > --without-xgrid
23 > --enable-pretty-print-stacktrace
24 > --enable-orterun-prefix-by-default
25 > --without-slurm"
26 >
27 > if use threads; then
28 > myconf="${myconf}
29 > --enable-mpi-threads
30 > --with-progress-threads
31 > fi
32 >
33 > econf ${myconf} \
34 > $(use_enable !nocxx mpi-cxx) \
35 > $(use_enable romio io-romio) \
36 > $(use_enable heterogeneous) \
37 > $(use_with pbs tm) \
38 > $(use_enable ipv6) \
39 > || die "econf failed"
40 >
41 > emake || die "emake failed"
42 > }
43
44 With EAPI=2 you would probably do the above in src_configure which means
45 that you omit the last line anyway. Moreover, if you dislike using a
46 temporary variable and just want to collect options you could have
47 written it this way:
48
49 src_configure() {
50 econf --sysconfdir=/etc/"${PN}" \
51 --without-xgrid ... \
52 --without-slurm \
53 $(use threads && echo \
54 --enable-mpi-threads \
55 --with-progress-threads) \
56 $(use_enable !nocxx mpi-cxx) ... \
57 $(use_enable ipv6) \
58 || die "econf failed"
59 }
60
61 This is simply more intuitive and readable than your suggestion,
62 and moreover, this can also be used if in the "use threads" part
63 you have other options than --enable-* or --with-* (e.g. some --disable-*
64 or even more options in which case your suggestion would become a mess
65 more and more).

Replies

Subject Author
Re: [gentoo-dev] [RFC] Ability to pass arguments to src_configure/src_compile Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>