ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 404 forks source link

variables for selecting builds based on compiler/arch/os #838

Open avsm opened 6 years ago

avsm commented 6 years ago

It would be useful to be able to select build rules based on some variables other than the presence of libraries. For example:

For each of these, it is possible to do a configurator/jbuild-generation pass, but the big advantage of having variable rules directly is that they work when embedded in a Duniverse of related packages. For example, with a manually assembled Mirage duniverse, the default dune build rule doesnt work as it selects the Linux- and macOS-only packages simultaneously. If Dune could handle these parameters as part of the build scanning process, then package embedding works great.

As a longer term consideration, this also expands our ability to generate accurate package management scripts as well -- for example, opam files could have accurate available: constraints added based on these build rules as well.

dra27 commented 6 years ago

Related to #397

avsm commented 6 years ago

The code from opam-depext could be vendored in to help with the os variables -- there's a lot of fairly clean code there that generates the variables in opam2.