Cabal and Hooks?

Dimitry Golubovsky golubovsky at gmail.com
Tue Jan 3 09:37:05 EST 2006


I am developing an extension to HSFFIG to create Haskell packages out
of C header files. Before I start reinwenting the wheel, I would like
to reuse as much of Cabal functionality as possible.

I am trying to figure out whether the following can be done with user
hooks using Distribution.Smple.

1. I need to extend the Setup command line syntax with custom options
(esp. Setup configure). For example, I need to specify locations for
the imported C headers and libraries they relate to. The package
description file does not seem to be a good place for them because on
different systems these locations may be totally arbitrary. Results of
parsing of those options must be visible to subsequent package
building phases. These options also must appear in the help message.

2. I need to override the build process completely. The package build
process is pretty much straightforward [1], but differs from the
"standard" ghc --make: module dependencies are pregenerated by running
GHC -M; all source files are compiled with the split_objs option one
by one (when compiling tens/hundreds of modules with --make, memory
used by GHC exceeds reasonable limits). Does the buildHook do the job
(looks like it does, but just to make sure...)?

2a Another problem with build/install is that while the names of
exposed-modules are known in advance (basically there is only one
module to expose which re-exports the rest), names of other-modules
are only known after the build completes. The source splitter may
leave tens or even hundreds of separate modules (see HSFFIG tutorial:
for example, a single module is created for every structure/union). It
is impossible to specify them all in the package description file.
Provided that the location of those modules is known, is there any way
to state in the package description file that all modules at the given
location should be "other-modules" (kind of a regexp)?

I see the possibility to use Distribution.Make as a last resort.
However it delegates too much functionality to the make and configure
utilities; I would be happy to have more Cabal on my side ;)

Thanks for any ideas.

---------------
[1] http://haskell.org/hawiki/HsffigLinkageOptimization

--
Dimitry Golubovsky

Anywhere on the Web


More information about the Libraries mailing list