Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   New eclass: scons.eclass (http://www.linux-archive.org/gentoo-development/416415-new-eclass-scons-eclass.html)

Alex Alexander 08-22-2010 10:26 AM

New eclass: scons.eclass
 
On Sun, Aug 22, 2010 at 12:04:52PM +0200, Michał Górny wrote:
> Hello,
>
> 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.
>
> [...]
>
> I'm attaching the eclass draft (the same which is attached to bug
> #333911), and inlining a simple use example below:
>
> #v+
> inherit scons
>
> # ...
>
> pkg_setup() {
> scons-clean-makeopts
> }
>
> src_compile() {
> scons
> $(scons-use unicode)
> $(scons-use gnutls ssl gnutls openssl)
> ${MAKEOPTS} || die
> # expands into:
> # scons unicode={1|0} ssl={gnutls|openssl} -jN || die
> }
> #v-

Looks nice :)

You could avoid having to define pkg_setup in every ebuild by defining a
default one in your eclass:

--- scons.eclass.old 2010-08-22 13:11:57.000000000 +0300
+++ scons.eclass 2010-08-22 13:15:57.000000000 +0300
@@ -39,6 +39,15 @@
DEPEND="dev-util/scons"
fi

+# -- phase functions --
+
+# @FUNCTION: scons_pkg_setup
+# @DESCRIPTION:
+# default pkg_setup, runs scons-clean-makeopts
+scons_pkg_setup() {
+ scons-clean-makeopts
+}
+
# -- public functions --

# @FUNCTION: scons-clean-makeopts
@@ -185,3 +194,5 @@
_scons-clean-makeopts-perform-test '-j2 HOME=/tmp' '-j2'
_scons-clean-makeopts-perform-test '--jobs funnystuff -k' "--jobs=${jc} -k"
}
+
+EXPORT_FUNCTIONS pkg_setup

> --
> Best regards,
> Michał Górny
>
> <http://mgorny.alt.pl>
> <xmpp:mgorny@jabber.ru>

--
Alex Alexander -=- wired
Gentoo Linux Developer -=- Council / Qt / Chromium / KDE / more
www.linuxized.com

David Leverton 08-22-2010 11:03 AM

New eclass: scons.eclass
 
2010/8/22 Michał Górny <gentoo@mgorny.alt.pl>:
> src_compile() {
> * * * *scons
> * * * * * * * *$(scons-use unicode)
> * * * * * * * *$(scons-use gnutls ssl gnutls openssl)
> * * * * * * * *${MAKEOPTS} || die
> * * * *# expands into:
> * * * *# scons unicode={1|0} ssl={gnutls|openssl} -jN || die
> }

It might be slightly nicer to have an escons function that adds the
modified MAKEOPTS to the command line and calls die by itself.
Besides making it easier to use, that would provide a single place to
add additional functionality (perhaps an EXTRA_ESCONS user variable
analogous to EXTRA_ECONF, for example).

Michał Górny 08-22-2010 06:00 PM

New eclass: scons.eclass
 
On Sun, 22 Aug 2010 13:26:18 +0300
Alex Alexander <wired@gentoo.org> wrote:

> You could avoid having to define pkg_setup in every ebuild by
> defining a default one in your eclass:

Yeah, I am considering that. I am considering adding a default
src_compile() too.

--
Best regards,
Michał Górny

<http://mgorny.alt.pl>
<xmpp:mgorny@jabber.ru>

Michał Górny 08-22-2010 06:02 PM

New eclass: scons.eclass
 
On Sun, 22 Aug 2010 12:03:10 +0100
David Leverton <levertond@googlemail.com> wrote:

> 2010/8/22 Michał Górny <gentoo@mgorny.alt.pl>:
> > src_compile() {
> > * * * *scons
> > * * * * * * * *$(scons-use unicode)
> > * * * * * * * *$(scons-use gnutls ssl gnutls openssl)
> > * * * * * * * *${MAKEOPTS} || die
> > * * * *# expands into:
> > * * * *# scons unicode={1|0} ssl={gnutls|openssl} -jN || die
> > }
>
> It might be slightly nicer to have an escons function that adds the
> modified MAKEOPTS to the command line and calls die by itself.
> Besides making it easier to use, that would provide a single place to
> add additional functionality (perhaps an EXTRA_ESCONS user variable
> analogous to EXTRA_ECONF, for example).

I may add an escons() function but I think the MAKEOPTS mangling still
matches pkg_setup() better. And I don't like the idea of keeping a
MAKEOPTS_ALREADY_MANGLED kind of variable to avoid re-mangling on next
call to escons().

--
Best regards,
Michał Górny

<http://mgorny.alt.pl>
<xmpp:mgorny@jabber.ru>

Michał Górny 08-22-2010 06:39 PM

New eclass: scons.eclass
 
Here goes the second revision. A short changelog:

83678d1 Export a default pkg_setup() and src_compile().
7f9b565 Introduce escons() function (similar to emake).
19b7e14 Use underscores instead of dashes in function names.

Attaching both the new rev and a diff against the first one.

--
Best regards,
Michał Górny

<http://mgorny.alt.pl>
<xmpp:mgorny@jabber.ru>

Luca Barbato 08-22-2010 08:44 PM

New eclass: scons.eclass
 
On 08/22/2010 08:39 PM, Michał Górny wrote:
> Here goes the second revision. A short changelog:
>
> 83678d1 Export a default pkg_setup() and src_compile().
> 7f9b565 Introduce escons() function (similar to emake).
> 19b7e14 Use underscores instead of dashes in function names.
>
> Attaching both the new rev and a diff against the first one.

What about having a SCONSOPTS and leave MAKEOPTS unmangled?

lu

--

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

Maciej Mrozowski 08-22-2010 09:03 PM

New eclass: scons.eclass
 
On Sunday 22 of August 2010 20:39:23 Michał Górny wrote:
> Here goes the second revision. A short changelog:
>
> 83678d1 Export a default pkg_setup() and src_compile().
> 7f9b565 Introduce escons() function (similar to emake).
> 19b7e14 Use underscores instead of dashes in function names.
>
> Attaching both the new rev and a diff against the first one.

I'd suggest providing all src_* phases except src_unpack.
Even src_prepare that calls base_src_prepare - to get PATCHES and epatch_user
support - for simplicity requiring EAPI-2 as providing src_unpack in
buildsystem eclasses is a bad design (like providing src_prepare in scm
eclasses - this one is yet to be fixed).
Also calling base_src_install in scons_src_install if possible would be nice
(DOCS, HTML_DOCS support) - to make it resemble cmake-utils, autotools-utils,
and a bit of distutils, qt4-edge and gnome2 eclasses.

--
regards
MM

Mike Frysinger 08-22-2010 09:06 PM

New eclass: scons.eclass
 
> # @CODE
> # Michał Górny <gentoo@mgorny.alt.pl>
> # @CODE

this is not what @code is designed for. punt it.

> : ${SCONS_MIN_VERSION}

useless statement. punt it.

> : ${EXTRA_ESCONS:=}

replace with @DEFAULT_UNSET

> scons ${MAKEOPTS} ${EXTRA_ESCONS} "${@}"

this should be echoed just like emake and econf and other things do now.
set -- scons $(scons_makeopts) ${EXTRA_ESCONS} "$@"
echo "$@"
"$@"

> scons_clean_makeopts

better to do this on the fly and inline. otherwise you prevent the ebuild
from being used in conjunction with standard make builds.

i.e. have it parse ${MAKEOPTS} and echo the result, then change escons to call
it all by itself. this isnt something ebuild maintainers should be bothered
with. `escons` should be sufficient.

> scons_use()

keep the use_xxx style ... so rename it to "use_scons()"

> local varname=${2:-${flag}}

should be stripping possible leading ! so that people can do `use_scons !foo
moo` just like they can today with `use_with $foo moo`
-mike

Tomáš Chvátal 08-22-2010 09:10 PM

New eclass: scons.eclass
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 22.8.2010 23:06, Mike Frysinger napsal(a):
>
>> scons_use()
>
> keep the use_xxx style ... so rename it to "use_scons()"
>
>> local varname=${2:-${flag}}
>
> should be stripping possible leading ! so that people can do `use_scons !foo
> moo` just like they can today with `use_with $foo moo`
> -mike

Hmm we use
cmake-utils_use_*

i think use_cmake-utils-*

also if renamed to cmake_use-* it would look more sane than use_cmake-*

but if we make agreement other way we can replace it in cmake utils
quite easily :)

Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxxkkgACgkQHB6c3gNBRYdOGQCgsp5TP/cfE4ijE7lYuC14XwX8
VNwAoLEXUuAR2djw7j+dUZ6XrvxnkaLI
=ta36
-----END PGP SIGNATURE-----

Mike Frysinger 08-22-2010 09:18 PM

New eclass: scons.eclass
 
On Sunday, August 22, 2010 17:10:32 Tomáš Chvátal wrote:
> Dne 22.8.2010 23:06, Mike Frysinger napsal(a):
> >> scons_use()
> >
> > keep the use_xxx style ... so rename it to "use_scons()"
>
> Hmm we use
> cmake-utils_use_*
>
> i think use_cmake-utils-*
>
> also if renamed to cmake_use-* it would look more sane than use_cmake-*
>
> but if we make agreement other way we can replace it in cmake utils
> quite easily :)

changing eclass style to match the older-than-PMS style sounds more feasible.
so i'd go with use_cmake-xxx.
-mike


All times are GMT. The time now is 08:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.