I’m porting the ocamlfuse package to dune and it required linking with (c_library_flags (-losxfuse)) on Mac and (c_library_flags (-lfuse)) on all other operating systems. How do I go about customizing the dune build based on host operating system?
Do I have to use dune “environments” for this? I imagine I would also need to modify the opam file to use different build commands based on OS?
There are no dune “environments”, I think you might mean profiles here but I wouldn’t recommend them for this use case. Conditional compilation solves this problem. I also advise against using anything but the standard dune command in the opam file. All of this configuration should be done in your dune build itself.
ocamlfuse packages is now ported, and you can see the relevant dune file and discover.ml file.
The project also uses camlidl to generate the C bindings, which may be of interest.
When I said “environments”, I was referring to the env stanza which came up when I searched the docs for “environment”, the keyword “operating system” did not yield anything useful, the keyword I needed was “configuration”, but that never occurred to me.