Re: build systems



On Sat, 2007-11-10 at 00:32 +0100, Olav Vitters wrote:
> In this case there is an easy solution. Convert a few GNOME projects
> to
> the new build system and show the result. Don't agree that if someone
> proposes something new, it is up to others to try it ('sell the thing'
> you propose).

I wanted to give waf a try today, so I got down to convert Clutter to
use waf instead of autotools to build.

After several hours (partially because I never used waf before) I was
some minutes ago able to compile the clutter library and use it with
some little application which was built against the autotooled clutter.
No symbol issues for now.

Anyway, some thoughts:
- Waf also needs *major* documentation work, on the user side (ie not
internals, as I hope I shouldn't ever see them...). I've been reading
quite a lot of the waf source code to be able to get everything working.
- Being able to use Python in your configure script natively is A Good
Thing (except if you hate Python, obviously). It allows to do real
programming in your configure stage, which is also possible in autoconf
but sometimes somewhat more challenging.
- Several autoconf macro's have no waf equivalent, which forces you to
write several lines of code. An examples:
AC_C_CONST becomes

    const_code = '''
    int main() { const char a = 'a'; return 0; }
    '''
    const = conf.try_build(const_code)
    conf.check_message('C keyword', 'const', not (const is False))
    if not const:
        fatal('C compiler doesn\'t support \'const\' keyword')

AC_CHECK_HEADERS:

    headers = []
    for header in ['fcntl.h', 'stdlib.h', 'string.h', 'unistd.h',
'sys/mman.h']:
        if not conf.check_header(header):
            fatal('Header file %s is necessary to build %s' % (header,
CLUTTER_NAME))
        else:
            headers.append(header)

AC_FUNC_* and AC_CHECK_FUNCS:

    for function in ['malloc', 'mmap', 'memset', 'munmap', 'strcasecmp',
'strdup']:
        e = conf.create_function_enumerator()
        e.mandatory = True
        e.headers = headers
        e.function = function
        e.define = "HAVE_%s" % function.upper()
        e.run()

Same for AC_HEADER_STDC

- The "options" system, based on Python's built-in optionparser module,
is kinda neat to use compared to AC_ARG_*. It does need more
documentation though, especially on grouping support.
- When adding simple options, they get lost between the waf built-in
options.

- I had to add all source files in one big string in the main
wscript_build file, unable to add them per-directory and in the end link
in la's from subdirectories. It is possible waf does support this, I
just did not find how to do this.

- No make check target AFAIK.

- Clutter ships several backends. During configure stage the correct
backend is selected and build during build stage. In a dist tarball all
backends should be shipped though, which is why we got DIST_SUBDIRS. I
didn't figure out (yet) how to do this using waf.
- I should find out how to add extra files (README, AUTHORS,...) to the
dist tarball.

- Waf does not detect when you changed your some of your wscript or
wscript_build files, at least in my testing.

- Built-in .so versioning would be nice

I did not implement file generation yet (glib-genmarshal stuff), and
obviously non-glx backend support is a must too.

You can find my waf-enabled clutter tree here[1]. Actually only 2 (3 if
you include the waf script itself) are new: [2] and [3].

I want to repeat this was my first experience with Waf ever, so if I
- did something stupid in any of the scripts,
- didn't find a feature and list it above,
- ...
don't blame me ;-)

Nicolas

[1] http://git.nicolast.be/?p=clutter.git;a=summary
[2]
http://git.nicolast.be/?p=clutter.git;a=blob;f=clutter/wscript;h=ef8c4b8e25817b834b271a2da3f0aeee5c98f1bf;hb=waf
[3]
http://git.nicolast.be/?p=clutter.git;a=blob;f=clutter/clutter/wscript_build;h=f013064f3f1fb6fa8861b24993cbfb681e36309b;hb=waf

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]