Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Implement "package()" configurations predicate #202
We often have to write things like:
flag splitBase description: Choose the new smaller, split-up base package. library if flag(splitBase) build-depends: base >= 3, containers else build-depends: base < 3Which is verbose and annoying. It would be nicer to say:
library build-depends: base if package(base >= 3) build-depends: containersThis is syntactic sugar only. It translates into the existing constructs so no new behaviour is being introduced. It would translate into:
flag _1 library build-depends: base if flag(_1) build-depends: base >= 3 build-depends: containers else build-depends: base < 3It is described in more detail in this thread:
Replying to ross:
Another variant would be to support anonymous flags directly
True though I suspect it looks a bit weird to the uninitiated. We know to read the conditional syntax as an implication constraint which can be applied in either direction but I suspect many people read it in a directed functional way. I have a feeling that the anonymous flag would really throw people :-)
Perhaps we should ask opinions on the libraries list.
Of course if we want it for build-depends then we may also want it for other dependencies like pkgconfig-depends or build-tools. So we should bear that in mind in designing a syntax.
For example darcs might like to use:
pkgconfig-depends: libcurl if pkgconfig-depends(libcurl >= 7.19.1) -- curl 7.19.1 has bug-free pipelining cpp-options: -DCURL_PIPELINING_DEFAULTas syntactic sugar for:
flag curl-pipelining description: Use libcurl's HTTP pipelining. ... pkgconfig-depends: libcurl if flag(curl-pipelining) -- curl 7.19.1 has bug-free pipelining pkgconfig-depends: libcurl >= 7.19.1 cpp-options: -DCURL_PIPELINING_DEFAULT else pkgconfig-depends: libcurl < 7.19.1Note of course the above doesn't work well yet anyway, it needs #342 to be implemented.