Hi, how do I add a condition dependency in a package in dune-project? E.g. a platform-specific one?
I foolishly asked this question on Stackoverflow so there are some more details about what I mean there: https://stackoverflow.com/q/79761212/265521
Hi, how do I add a condition dependency in a package in dune-project? E.g. a platform-specific one?
I foolishly asked this question on Stackoverflow so there are some more details about what I mean there: https://stackoverflow.com/q/79761212/265521
Following your example on StackOverflow, what you are looking for is:
(package
(name foo)
(depends
(linenoise (and (>= 1.1.0) (= :os "linux")))))
;; ^^^^
;; Here is the correct name
or if you just want not to support windows:
(package
(name foo)
(depends
(linenoise (and (>= 1.1.0) (<> :os "windows")))))
IIRC, in the dependency specification language for packages, it doesn’t use variable expansion but S-expression atoms. When dune generates the opam file, it turns :os to the variable os.
An nice that worked, thanks! But how did you know about it?
The spec for those filters does not list :os
Also how do I know what the possible values of :os are?
The possible values are whatever OPAM determines your OS to be. Dune does not limit the possible values. You can find the implementation here.
I suggest
(conf-libgl (and (<> :os "macos") (<> :os "win32"))
as “windows” is not what opam reports for the os variable under Windows