Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev-announce@l.g.o
Cc: gentoo-dev@l.g.o
Subject: [gentoo-dev] New eclass: scons-utils.eclass
Date: Thu, 07 Oct 2010 19:36:53
Message-Id: 20101007213513.3a66c214@pomiocik.lan
1 Hello devs,
2
3 I've just committed a new eclass to gx86 -- it's called scons-utils
4 and it's supposed to help creating clean ebuilds for packages using
5 the SCons buildsystem.
6
7 Right now, the eclass addresses the two following important issues:
8
9 ${MAKEOPTS} cleaning
10 --------------------
11
12 Currently the ebuilds either ignore MAKEOPTS completely, pass it
13 unmodified or clean it up a little using a copy-paste sed expression.
14
15 The scons-utils eclass introduces scons_clean_makeopts() function which
16 is able to nicely adjust MAKEOPTS to fit SCons. But in fact, you
17 probably won't ever need to call it -- escons() does it for you.
18
19 use_scons()
20 -----------
21
22 Right now, ebuilds use complex variable mangling in order to prepare
23 SCons variable assignments based on USEflags. Consider the following
24 code snippet (from media-sound/mixxx):
25
26 use hifieq && mysconsargs+=" hifieq=1" || mysconsargs+=" hifieq=0"
27
28 With scons-utils you can move this into actual `mysconsargs`
29 declaration, putting it like that:
30
31 $(use_scons hifieq)
32
33
34 Trivial use example
35 -------------------
36
37 Well, enough talking. Now a simple example on how to use it:
38
39
40 inherit scons-utils
41
42 src_compile() {
43 escons \
44 $(use_scons nls gettext) \
45 $(use_scons ssl)
46 }
47
48
49 `escons` here is similar to emake. It simply calls scons, passing
50 appropriate flags to it. If SCONSOPTS is set (optional, supposed to be
51 set in make.conf, never mangle it in ebuilds!), it will be used;
52 otherwise, scons-utils will use cleaned up version of MAKEOPTS.
53
54 `use_scons <flag>` outputs either `<flag>=0` or `<flag>=1` depending on
55 whether the <flag> flag is set.
56
57 `use_scons !<flag>` would output: `no<flag>=1` or `no<flag>=0`.
58
59 `use_scons <flag> <var>` outputs: `<var>=0` or `<var>=1`, checking
60 <flag> flag.
61
62 For a few more tricks, please take a look at the eclass docs.
63
64 Thank you for your attention. If you have any questions, I'll be happy
65 to answer them.
66
67 --
68 Best regards,
69 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] New eclass: scons-utils.eclass Jeroen Roovers <jer@g.o>