Skip to content

Bump required meson to 0.52 and make use of new features

Dylan Baker requested to merge dbaker/mesa:meson-0.52-updates into master

Meson 0.46 (our previously required version) is quite old at this point, and there are quite a few cases in our code of "if meson_version >= X". There's also a good deal of open coding things that meson has gained builtins for since then. Using these generally requires less code and means that the functionality is being tested upstream.

For the most part I don't think the changes here are going to be at all contentious.

After (and in part because of) mesa's "auto" options meson gained an upstream supported version called "features". These work somewhat like our "auto" options but are considerably more powerful. They can be passed directly into dependency() calls, and do fancy things like short circuit dependency to return not found if they're disabled. This means we can replace code like:

_opt = get_option('option')
if _opt != 'false'
  dep_opt = dependency('opt', required : _opt == 'true')
else
  dep_opt = dep_null
endif

with

dep_opt = dependency('opt', required : get_option('option')

and get the same behavior.

This also provides nice behavior for distros, as meson provides a switch (--auto-features) that can be used to force such features to on or off. This allow distros to be confident that there is no autodetection going on, and they have configured mesa exactly the way they want. It also means that mesa's build system looks more like everyone else's build system, which is a nice feature for everyone.

To get to that point, I've deprecated "true" and "false" while adding "enabled" and "disabled", so that in the future we can switch to those.

Edited by Dylan Baker

Merge request reports