What are hookedPrograms for?
duncan.coutts at worc.ox.ac.uk
Wed Jun 11 06:00:31 EDT 2008
On Wed, 2008-06-11 at 09:06 +0100, Alistair Bayley wrote:
> I'm looking at an example Duncan gave for Takusen's setup + .cabal:
> ... and do not understamd what hookedPrograms is all about. Can
> someone enlighten me?
It allows you to define new programs that Cabal knows about. It already
has a list of several, eg ghc, happy, ld, ar, etc.
You want to locate and use these extra progs. So we tell cabal about
them. This also means we can mention them in the .cabal file as
build-tools. By default we look for programs on the path, but you can
change that using the programFindLocation method of the Program.
BTW, the hack with pgconfig vs pg_config is no longer needed as '_' are
now allowed in build-tool names (though only with Cabal-1.4+).
> FWIW, my goal is to either locate or run some programs during the
> configure stage, and use the results (locating a program gives a
> directory, running a program gives directories printed on stdout) to
> modify the extraLibDirs and includeDirs in BuildInfo.
> I've been browsing the 1.3.12 sources, but no epiphany yet...
Take a look at Distribution.Simple.Program.
If the program is in a build-tools field that is enabled then it will be
automatically configured during the configure phase (and it not being
found will be an error).
You can find the location of a configured program or run a configured
program and capture its stdout.
More information about the cabal-devel