meson: Use feature options
Many moons ago we added feature values to our combo features, and deprecated the old values. The time has finally come to remove those deprecated values, and use features.
I've bumped the meson requirement to 0.59 here, to get some of the helper methods for features. These make the code much easier to work with in general, and if the diff is any indication, a lot less code.
We can replace code like
_feat = get_option('feat')
feat = false
if _feat.allowed()
if not foo
if feat.enabled()
error(...)
else
feat = true
endif
endif
endif
with
feat = get_option('feat').require(foo, error_message : ...).allowed()
which does exactly the same thing, in a ton less code. These can even be chained together like:
feat = get_option('feat') \
.require(...) \
.require(...) \
.require(...) \
.allowed()
An additional helper allows replacing this:
_feat = get_option('feat')
if _feat.auto()
feat = foo and bar != 'thing'
else
feat = foo.enabled()
endif
with
feat = get_option('feat').disable_auto_if(not foo or bar == 'thing').allowed()
Edit: Also, because it's relevant. It's not currently possible to simplify our LLVM dependency handling. I've opened an upstream meson PR to add the necessary methods for that. The simplified LLVM handling looks like this