As per bug #333911, I'm working on a new eclass, providing some basic
functions common to most of the ebuilds using the SCons build system.
The basic reason for the new eclass is that a growing number of ebuilds
is calling SCons directly, and reimplementing the same ideas. This is
especially important with MAKEOPTS, as SCons implements only a subset
of GNU make options.
Currently, you can find a set of ebuilds which mangle the MAKEOPTS using
a copypaste sed expression (poor though), many other ebuilds which
don't mangle it at all (and thus risk passing unsupported options like
--load-average or --jobs without an argument), and even some which
ignore MAKEOPTS at all.
The eclass addresses the issue through providing scons-clean-makeopts()
function in a manner similar to flag-o-matic.eclass strip-flags()
function. This function, supposedly called within the package's
pkg_setup() phase function, makes sure MAKEOPTS contains a clean set of
options suitable for passing to scons.
Another issue the eclass addresses is passing USE-controlled options.
PMS provides use_with and use_enable calls, suitable for
autotools-based build systems; SCons uses make-like 'var=value' syntax
instead. This is where use-scons() comes in handy -- it outputs such a
variable definition, based on the state a particular USEflag.
The last thing the eclass does is simply adding the DEPEND for SCons. I
don't think that needs any explanation.
I'm attaching the eclass draft (the same which is attached to bug
#333911), and inlining a simple use example below: