Portability | portable |
---|---|
Maintainer | cabal-devel@haskell.org |
This provides an abstraction which deals with configuring and running
programs. A Program
is a static notion of a known program. A
ConfiguredProgram
is a Program
that has been found on the current
machine and is ready to be run (possibly with some user-supplied default
args). Configuring a program involves finding its location and if necessary
finding its version. There's reasonable default behavior for trying to find
"foo" in PATH, being able to override its location, etc.
- data Program = Program {
- programName :: String
- programFindLocation :: Verbosity -> IO (Maybe FilePath)
- programFindVersion :: Verbosity -> FilePath -> IO (Maybe Version)
- programPostConf :: Verbosity -> ConfiguredProgram -> IO [ProgArg]
- internalProgram :: [FilePath] -> String -> Program
- simpleProgram :: String -> Program
- data ConfiguredProgram = ConfiguredProgram {}
- programPath :: ConfiguredProgram -> FilePath
- type ProgArg = String
- data ProgramLocation
- = UserSpecified { }
- | FoundOnSystem { }
Program and functions for constructing them
Represents a program which can be configured.
Program | |
|
internalProgram :: [FilePath] -> String -> ProgramSource
Make a simple internal
program; that is, one that was built as an
executable already and is expected to be found in the build directory
simpleProgram :: String -> ProgramSource
Make a simple named program.
By default we'll just search for it in the path and not try to find the version name. You can override these behaviours if necessary, eg:
simpleProgram "foo" { programFindLocation = ... , programFindVersion ... }
Configured program and related functions
data ConfiguredProgram Source
ConfiguredProgram | |
|
programPath :: ConfiguredProgram -> FilePathSource
The full path of a configured program.
data ProgramLocation Source
Where a program was found. Also tells us whether it's specifed by user or not. This includes not just the path, but the program as well.
UserSpecified | The user gave the path to this program, eg. --ghc-path=/usr/bin/ghc-6.6 |
FoundOnSystem | The location of the program, as located by searching PATH. |