expanding use of the Program abstraction
Isaac Jones
ijones at syntaxpolice.org
Sun Aug 20 18:02:03 EDT 2006
I wonder if someone is interested in expanding the use of Program
inside Cabal.
There's a type in cabal Distribution.Program.Program which does some
nice stuff for describing programs internally for Cabal. A program is
basically a name, a location, and some arguments:
-- |Represents a program which cabal may call.
data Program
= Program { -- |The simple name of the program, eg ghc
programName :: String
-- |The name of this program's binary, eg ghc-6.4
,programBinName :: String
-- |Default command-line args for this program
,programArgs :: [String]
-- |Location of the program. eg. \/usr\/bin\/ghc-6.4
,programLocation :: ProgramLocation
} deriving (Read, Show)
One nice thing about using it is that any program that is registered
with Cabal will get some "configure" and ".cabal" helpers like
--with-foo-args
--foo-path=
and
extra-foo-args:
There's also good default behavior for trying to find "foo" in PATH,
being able to override its location, etc.
There's also a hook for adding programs in a Setup.lhs script so that
you get these flags and such so that you don't have to write all the
PATH logic inside Setup.lhs.
The only thing that's wrong w/ Program is that its not used all over
Cabal :) Tools like ranlib do use it, I think, but not all
preprocessors and the compilers don't use it.
Does anyone feel like digging around in Cabal and expanding the use of
Program so that we have more consistent flags and such?
Some basic TODOs are here:
http://hackage.haskell.org/trac/hackage/search?q=Distribution.Program&ticket=on
peace,
isaac
More information about the cabal-devel
mailing list