I'd like a flag that is conditioned on the version of the OS, and not just the OS:
if os(darwin) && os-version() >= 10.7
or
if os-version(>=10.7)
or something with that behavior.
I could do it with make
and sw_vers -productVersion
, but I want to keep the Cabal file with build-type: Simple
(I mean it even has a frameworks
field).
Context: I have some bindings to some Cocoa functions that were introduced in OSX 10.7 or so. I'd like Cabal to not try to build on older Macs, rather than spamming the person installing the package with unhelpful "symbol not found" errors or whatnot.
https://www.haskell.org/cabal/users-guide/developing-packages.html#configurations (Under "conditions") seems to say no.
You're correct. Cabal does not offer this feature. Here's the relevant ticket. However, for OS X you don't need to necessarily move from build-type: Simple
. Rather you can use CPP
and the macros provided by apple, as discussed at another SO question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With