cabal posix build-depends issue

Simon Marlow simonmar at
Mon Jan 17 05:28:51 EST 2005

On 16 January 2005 00:32, Isaac Jones wrote:

> I have a bit of a problem with Cabal's need to build-depend on posix.
> I'm building cabal with itself, and I think this is what's happening:
> If it depends on posix, on a non-posix system, the user will get an
> error because the posix package doesn't exist.
> If it doesn't depend on posix on a posix-based system, then ghc won't
> get the -package posix flag, and so cabal will fail to link.
> On the other hand, "depends" in the cabal sense is meant to be a
> static value; not dependent on what kind of system you are
> using... it's kinda funny to say "if you're on a posix system, then
> cabal depends on posix."
> Cabal doesn't _really_ depend on POSIX... it only does in its Compat
> libraries, and we could get rid of all the POSIX code.
> I think another ugly workaround is to have cabal depend on "util" or
> something, since that package depends on posix on a posix system, and
> presumably it doesn't depend on posix on a non-posix system.

Depending on "util" isn't entirely satisfactory, because util is an old
non-hierarchical package which is going away soon.

I don't see a good way around this one, in general.  It would be nice to
have no system-dependent package dependencies, but is that practical?
It means we have to have a "dummy" unix package on those platforms which
don't support it, which seems even uglier than an explicit
platform-dependency in the build-depends list.

My gut feeling is that we should be able to say something like

  build-depends: if-not-os("mingw32",unix >= 1.0)

This is pretty easy to implement, and since we get to pick a
well-defined syntax, separate tools that read the .cabal file can grok
it too.


More information about the Libraries mailing list