
John Lato wrote:
From: Jeff Heard
Is there a way to do something like autoconf and configure dependencies at install time? Building buster, I keep adding dependencies and I'd like to keep that down to a minimum without the annoyance of littering Hackage with dozens of packages. For instance, today I developed an HTTP behaviour and that of course requires network and http, which were previously not required. I'm about to put together a haxr XML-RPC behaviour as well, and that of course would add that much more to the dependency list. HaXml, haxr, and haxr-th most likely.
so... any way to do that short of making a bunch of separate packages with one or two modules apiece? Otherwise I'm thinking of breaking things up into buster, buster-ui, buster-network, buster-console, and buster-graphics to start and adding more as I continue along.
I'd be interested in hearing answers to this as well. I'm not a fan of configure-style compile-time conditional compilation, at least for libraries. It makes it much harder to specify dependencies. With this, if package Foo depends on buster and the HTTP behavior, it's no longer enough to specify "build-depends: buster" because that will only work if buster was configured properly on any given system.
I think that the proper solution is to break up libraries into separate packages as Jeff suggests (buster, buster-ui, etc.), but then the total packages on hackage would explode. I don't feel great about doing that with my own packages either; is it a problem? If so, maybe there could be just one extra package, e.g. buster and buster-extras. Is there a better solution I'm missing?
Cabal's flag system sounds like a nice solution for this, except I don't know if it's possible to add specific flags to your build dependencies, i.e. build-depends: buster -fhttp Martijn.