[SciPy-Dev] Numpy and Scipy build with bento

Pauli Virtanen pav@iki...
Fri Jun 17 18:47:20 CDT 2011


On Fri, 17 Jun 2011 08:12:48 +0900, David Cournapeau wrote:
[clip]
> To try it, just get the bento_waf_build branch of scipy (on
> github.com/cournape/scipy.git), and follow the instructions in
> BENTO_BUILD.txt

Seems to work nicely. Strange to see how much faster the compilation
feels with four cores :)

    ***

Some questions on waf integration and general strategy of Bento:


(i)

Can it be made work so that I can type

    ./waf <some-command>

This probably could be done with shipping some stuff in bento providing
a boilerplate wscript, and would probably also solve the issue of
supplying WAF_DIR.


(ii)

Do you think it would make sense to make the bscript part of Bento
stupider, and invert the control flow?

That is, one could have the build driven by wscripts instead of bscripts.
The wscripts would then just have something like:

    # scipy/wscript:

    import bento.bentowaf as bentowaf

    def configure(ctx):
        bentowaf.do_configure(ctx)
        # custom stuff ...

    def build(ctx):
        bentowaf.do_build(ctx)

    def install(ctx):
        bentowaf.do_install(ctx)


    # scipy/optimize/wscript:

    import bento.bentowaf as bentowaf

    def build(ctx):
        items = bentowaf.get_items(ctx)

        # here, we need to do some nonstandard stuff with the builders
        for name in ['_lbfgsb', '_cobyla', 'minpack2', '_nnls', '_slsqp']:
            item = items.pop(name)
            ctx(features="c pyext bento cshlib f2py",
                source=item.sources,
                target=item.name,
                use="minpack rootfind FLAPACK CLIB")

        # the rest are to be built with default options
        bentowaf.build_items(ctx, items)

Similarly, one could imagine a Makefile-driven build:

    # Makefile

    configure: configure-stamp

    configure-stamp:
        bentomaker configure $(CONFIGURE_ARGS)
        touch configure-stamp

    build: build-stamp

    build-stamp: configure-stamp some_extension.so
        touch build-stamp

    install: build-stamp
        bentomaker install $(INSTALL_ARGS)

    build_egg: build-stamp
        bentomaker build_egg

    some_extension.so: $(shell bentomaker get-sources some_extension)
        gcc $(shell bentomaker get-python-cflags) -o $@ $^
        cp -f $@ $(shell bentomaker get-target some_extensions)

    .PHONY: configure build install build_egg

I'm shooting from the hip. Do I forget something (you've obviously
put more thought into this)?

	Pauli



More information about the SciPy-Dev mailing list