1 |
Hello, |
2 |
|
3 |
As per bug #333911, I'm working on a new eclass, providing some basic |
4 |
functions common to most of the ebuilds using the SCons build system. |
5 |
|
6 |
The basic reason for the new eclass is that a growing number of ebuilds |
7 |
is calling SCons directly, and reimplementing the same ideas. This is |
8 |
especially important with MAKEOPTS, as SCons implements only a subset |
9 |
of GNU make options. |
10 |
|
11 |
Currently, you can find a set of ebuilds which mangle the MAKEOPTS using |
12 |
a copypaste sed expression (poor though), many other ebuilds which |
13 |
don't mangle it at all (and thus risk passing unsupported options like |
14 |
--load-average or --jobs without an argument), and even some which |
15 |
ignore MAKEOPTS at all. |
16 |
|
17 |
The eclass addresses the issue through providing scons-clean-makeopts() |
18 |
function in a manner similar to flag-o-matic.eclass strip-flags() |
19 |
function. This function, supposedly called within the package's |
20 |
pkg_setup() phase function, makes sure MAKEOPTS contains a clean set of |
21 |
options suitable for passing to scons. |
22 |
|
23 |
Another issue the eclass addresses is passing USE-controlled options. |
24 |
PMS provides use_with and use_enable calls, suitable for |
25 |
autotools-based build systems; SCons uses make-like 'var=value' syntax |
26 |
instead. This is where use-scons() comes in handy -- it outputs such a |
27 |
variable definition, based on the state a particular USEflag. |
28 |
|
29 |
The last thing the eclass does is simply adding the DEPEND for SCons. I |
30 |
don't think that needs any explanation. |
31 |
|
32 |
I'm attaching the eclass draft (the same which is attached to bug |
33 |
#333911), and inlining a simple use example below: |
34 |
|
35 |
#v+ |
36 |
inherit scons |
37 |
|
38 |
# ... |
39 |
|
40 |
pkg_setup() { |
41 |
scons-clean-makeopts |
42 |
} |
43 |
|
44 |
src_compile() { |
45 |
scons \ |
46 |
$(scons-use unicode) \ |
47 |
$(scons-use gnutls ssl gnutls openssl) \ |
48 |
${MAKEOPTS} || die |
49 |
# expands into: |
50 |
# scons unicode={1|0} ssl={gnutls|openssl} -jN || die |
51 |
} |
52 |
#v- |
53 |
|
54 |
-- |
55 |
Best regards, |
56 |
Michał Górny |
57 |
|
58 |
<http://mgorny.alt.pl> |
59 |
<xmpp:mgorny@××××××.ru> |