Gentoo Archives: gentoo-dev

From: Alex Alexander <wired@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New eclass: scons.eclass
Date: Sun, 22 Aug 2010 10:26:04
Message-Id: 20100822102618.GA29822@linuxized.com
In Reply to: [gentoo-dev] New eclass: scons.eclass by "Michał Górny"
1 On Sun, Aug 22, 2010 at 12:04:52PM +0200, Michał Górny wrote:
2 > Hello,
3 >
4 > As per bug #333911, I'm working on a new eclass, providing some basic
5 > functions common to most of the ebuilds using the SCons build system.
6 >
7 > [...]
8 >
9 > I'm attaching the eclass draft (the same which is attached to bug
10 > #333911), and inlining a simple use example below:
11 >
12 > #v+
13 > inherit scons
14 >
15 > # ...
16 >
17 > pkg_setup() {
18 > scons-clean-makeopts
19 > }
20 >
21 > src_compile() {
22 > scons \
23 > $(scons-use unicode) \
24 > $(scons-use gnutls ssl gnutls openssl) \
25 > ${MAKEOPTS} || die
26 > # expands into:
27 > # scons unicode={1|0} ssl={gnutls|openssl} -jN || die
28 > }
29 > #v-
30
31 Looks nice :)
32
33 You could avoid having to define pkg_setup in every ebuild by defining a
34 default one in your eclass:
35
36 --- scons.eclass.old 2010-08-22 13:11:57.000000000 +0300
37 +++ scons.eclass 2010-08-22 13:15:57.000000000 +0300
38 @@ -39,6 +39,15 @@
39 DEPEND="dev-util/scons"
40 fi
41
42 +# -- phase functions --
43 +
44 +# @FUNCTION: scons_pkg_setup
45 +# @DESCRIPTION:
46 +# default pkg_setup, runs scons-clean-makeopts
47 +scons_pkg_setup() {
48 + scons-clean-makeopts
49 +}
50 +
51 # -- public functions --
52
53 # @FUNCTION: scons-clean-makeopts
54 @@ -185,3 +194,5 @@
55 _scons-clean-makeopts-perform-test '-j2 HOME=/tmp' '-j2'
56 _scons-clean-makeopts-perform-test '--jobs funnystuff -k' "--jobs=${jc} -k"
57 }
58 +
59 +EXPORT_FUNCTIONS pkg_setup
60
61 > --
62 > Best regards,
63 > Michał Górny
64 >
65 > <http://mgorny.alt.pl>
66 > <xmpp:mgorny@××××××.ru>
67
68 --
69 Alex Alexander -=- wired
70 Gentoo Linux Developer -=- Council / Qt / Chromium / KDE / more
71 www.linuxized.com

Replies

Subject Author
Re: [gentoo-dev] New eclass: scons.eclass "Michał Górny" <gentoo@××××××××××.pl>