meson options vs AC options:

tlaronde at kergis.com tlaronde at kergis.com
Sun Mar 3 20:06:47 UTC 2024


[I'm back to working on Xorg stuff].

When writing a meson.build, I realize that all the options settable
with GNU AC are not available in meson built-ins. This does mean
that one has to add a meson_options.txt for everything used that is
not a built-in options in meson?

I take the example of xorg-sgml-doctools. I think there are two bugs:

1) meson.build defines:

datarootdir = get_option('prefix') / get_option('datadir')
sgmlrootdir = datarootdir / 'sgml'

and generates the pkgconfig file from the template with:

pc_conf = configuration_data({
    'prefix': get_option('prefix'),
    'datarootdir': '${prefix}/share',
    'sgmlrootdir': '${datarootdir}/sgml',
    'PACKAGE_VERSION': meson.project_version()
})
configure_file(input: 'xorg-sgml-doctools.pc.in',
               output: 'xorg-sgml-doctools.pc',
               install_dir: get_option('datadir') / 'pkgconfig',
               configuration: pc_conf)

Above, for the pkgconfig file, datarootdir is reset with something
that can be different from the first definition if 'datadir' (a meson
built-in option) is something else than the default 'share'.

Later, the sgml stuff is put with the first definition of datadir.

It seems to me there is an inconsistency.

2) In the pkgconfig template, there are:

prefix=@prefix@
datarootdir=@datarootdir@
sgmlrootdir=@sgmlrootdir@

These can all be set, if I'm not mistaken, with AC, independantly. But
with the meson file, since there are no meson_options.txt, not exactly
the same thing can be achieved (for example, sgmlrootdir can not be
set independantly).

So:

- I think 1) is clearly a bug (the same variable is defined
differently in the same package depending on the path taken in
meson.build).

- 2) is the question: do we need to provide exactly the same
flexibility as the AC framework when it comes to options---I think:
yes; one can not foresee all needs to put the data in some dedicated
places, specially if one wants to install two distinct versions, for
whatever reason.

What do others think?
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


More information about the xorg-devel mailing list