ross at soi.city.ac.uk
Tue Jan 11 07:49:11 EST 2005
On Tue, Jan 11, 2005 at 02:33:52PM +0200, Krasimir Angelov wrote:
> I am trying to cabalize HSQL. There is a simple ./configure script
> which performs some simple checks. Now I would like to perform these
> checks from Setup.lhs using Cabal hooks. The hooks API looks a little
> bit strange for me. The preConf hooks returns (Maybe
> PackageDescription) which after that is merged with the basic
> description. The Setup.buildinfo file contains only the hooked
> description instead of merged one. The parser requires to have package
> name and version, in order to properly parse the description. I need
> to return the right name and version from preConf hook to satisfy this
> restriction. I can't do this without re-reading the original
> description from Setup.description.
I think these checks are off at the moment. But you can get the
effect you're after by using
main = defaultMainWithHooks defaultUserHooks
can't you? (cf fptools/libraries/X11) There's a need to do
something different under Windows, though.
> Isn't it simpler to change the hooks type to something like:
> PackageDescription -> IO PackageDescription
> where the argument is the original description and the result is the
> possible updated one? This avoids the need of merging and simplifies
> the library code.
This relates to the discussion on package description structure.
With this interface, it would be possible for the preConf hook to
alter fields that are supposed to be fixed.
More information about the Libraries