According to the documentation of the %{system} variable (https://dune.readthedocs.io/en/stable/concepts.html#variables):
system is the name of the OS the build is targeting. This is the same as ocaml-config:system
However this is not true.
Looking at its definition: https://github.com/ocaml/ocaml/blob/12523517cf5c6c782563f8b76e661b67748e010b/configure.ac#L1044-L1132
on linux for instance, the value can currently be one of:
- linux
- linux_elf
- elf
- linux_eabihf
- linux_eabi
However people only match the first value when used in (enabled_if (= %{system} "linux")) for example.
One possible fix for this would be to match all possible values of system and transform it to a more consistent one (only when (lang dune >= 3.0)):
- linux --> linux
- linux_elf --> linux
- elf --> linux
- linux_eabihf --> linux
- linux_eabi --> linux
- beos --> beos
- bsd_elf --> bsd
- cygwin --> cygwin
- gnu --> gnu
- ....
Or even deprecate the variable all together and invite people to use a new variable (%{os} ?) that has a more involved mapping or even a simple output from uname -s (or uname(3)).
Specifications
- Version of
dune (output of dune --version): 2.9.0
- Version of
ocaml (output of ocamlc --version): 4.13.0
- Operating system (distribution and version): linux
According to the documentation of the
%{system}variable (https://dune.readthedocs.io/en/stable/concepts.html#variables):However this is not true.
Looking at its definition: https://github.com/ocaml/ocaml/blob/12523517cf5c6c782563f8b76e661b67748e010b/configure.ac#L1044-L1132
on linux for instance, the value can currently be one of:
However people only match the first value when used in
(enabled_if (= %{system} "linux"))for example.One possible fix for this would be to match all possible values of
systemand transform it to a more consistent one (only when(lang dune >= 3.0)):Or even deprecate the variable all together and invite people to use a new variable (
%{os}?) that has a more involved mapping or even a simple output fromuname -s(oruname(3)).Specifications
dune(output ofdune --version): 2.9.0ocaml(output ofocamlc --version): 4.13.0