RE: cabal posix build-depends issue

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. Cheers, Simon

Isaac Jones writes:
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.
There is a further problem: nhc98 has neither posix nor util packages, so a straightforward dependency on either would be wrong. Simon Marlow writes:
My gut feeling is that we should be able to say something like build-depends: if-not-os("mingw32",unix >= 1.0)
I would agree that we need platform-selected dependencies. Platform includes compiler, compiler version, OS, and possibly OS version. Regards, Malcolm
participants (2)
-
Malcolm Wallace
-
Simon Marlow