Skip to content

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

@avsm

Description

@avsm

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

  • ocaml-version: Merlin needs to select a module based on the current switch
  • arch: C bindings need to select arm/x86 specific modules (nocrypto)
  • os: platform bindings (e.g. mirage-xen/mirage-unix)

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions