mesonbuild / mesonbuild/meson

dependency module requirements based on dependency version.

Open
#4,253 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

We've recently run into a problem in mesa with LLVM as a dependency, if we're building a specific driver (SWR) and the LLVM version is >= 7, then we need to add an extra module requirement. the only way I can think of to do this is somethign like:

```meson
llvm_modules = ['mcjit']
dep_llvm = dependency('llvm', version : $version, required : $required)
if dep_llvm.found()
if dep_llvm.version().version_compare('>= 7')
llvm_modules += ['x86']
endif
dep_llvm = dependency('llvm', modules : llvm_modules, ...)
endif
```

This is pretty gross, and needing to port this sort of logic to multiple build-systems doesn't feel mesonic to me. I'd like to do something to allow encoding the version information in the modules declarations, for example, by using a dict instead of an array:

```meson
dep_llvm = dependency('llvm', modules : {'mcjit' : {}, 'bitwriter' : {'version' : '>= 7'}})
```

I'm asking for feedback on what kind of syntax would be preferred (or if the feature would even be considered), but I'm signing up for doing the work.

Contributor guide

Open the contributing guide

Research direction

Start by reading the issue's dependency('llvm') and modules examples, then trace how Meson represents dependency modules and version constraints. No source file or test is named, and the syntax is explicitly open for feedback; done would require an agreed design and corresponding implementation and tests for version-based module requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.