| Cabal-1.4.0.2: A framework for packaging Haskell software | Contents | Index |
|
Distribution.PackageDescription | Portability | portable | Stability | alpha | Maintainer | Isaac Jones <ijones@syntaxpolice.org> |
|
|
|
|
|
Description |
Package description and parsing.
|
|
Synopsis |
|
|
|
|
Package descriptions
|
|
data PackageDescription |
This data type is the internal representation of the file pkg.cabal.
It contains two kinds of information about the package: information
which is needed for all packages, such as the package name and version, and
information which is needed for the simple build system only, such as
the compiler options and library name.
| Constructors | | Instances | |
|
|
data GenericPackageDescription |
Constructors | GenericPackageDescription | | |
| Instances | |
|
|
emptyPackageDescription :: PackageDescription |
|
readPackageDescription :: Verbosity -> FilePath -> IO GenericPackageDescription |
Parse the given package file.
|
|
writePackageDescription :: FilePath -> PackageDescription -> IO () |
|
parsePackageDescription :: String -> ParseResult GenericPackageDescription |
Parses the given file into a GenericPackageDescription.
In Cabal 1.2 the syntax for package descriptions was changed to a format
with sections and possibly indented property descriptions.
|
|
showPackageDescription :: PackageDescription -> String |
|
data BuildType |
The type of build system used by this package.
| Constructors | Simple | calls Distribution.Simple.defaultMain
| Configure | calls Distribution.Simple.defaultMainWithHooks defaultUserHooks,
which invokes configure to generate additional build
information used by later phases.
| Make | calls Distribution.Make.defaultMain
| Custom | uses user-supplied Setup.hs or Setup.lhs (default)
| UnknownBuildType String | a package that uses an unknown build type cannot actually
be built. Doing it this way rather than just giving a
parse error means we get better error messages and allows
you to inspect the rest of the package description.
|
| Instances | |
|
|
knownBuildTypes :: [BuildType] |
|
Libraries
|
|
data Library |
Constructors | | Instances | |
|
|
emptyLibrary :: Library |
|
withLib :: PackageDescription -> a -> (Library -> IO a) -> IO a |
If the package description has a library section, call the given
function with the library build info as argument.
|
|
hasLibs :: PackageDescription -> Bool |
does this package have any libraries?
|
|
libModules :: PackageDescription -> [String] |
Get all the module names from the libraries in this package
|
|
Executables
|
|
data Executable |
Constructors | | Instances | |
|
|
emptyExecutable :: Executable |
|
withExe :: PackageDescription -> (Executable -> IO a) -> IO () |
Perform the action on each buildable Executable in the package
description.
|
|
hasExes :: PackageDescription -> Bool |
does this package have any executables?
|
|
exeModules :: PackageDescription -> [String] |
Get all the module names from the exes in this package
|
|
Parsing
|
|
data FieldDescr a |
Field descriptor. The parameter a parameterizes over where the field's
value is stored in.
| Constructors | FieldDescr | | fieldName :: String | | fieldGet :: (a -> Doc) | | fieldSet :: (LineNo -> String -> a -> ParseResult a) | fieldSet n str x Parses the field value from the given input
string str and stores the result in x if the parse was
successful. Otherwise, reports an error on line number n.
|
|
|
|
|
type LineNo = Int |
|
Build information
|
|
data BuildInfo |
Constructors | BuildInfo | | buildable :: Bool | component is buildable here
| buildTools :: [Dependency] | tools needed to build this bit
| cppOptions :: [String] | options for pre-processing Haskell code
| ccOptions :: [String] | options for C compiler
| ldOptions :: [String] | options for linker
| pkgconfigDepends :: [Dependency] | pkg-config packages that are used
| frameworks :: [String] | support frameworks for Mac OS X
| cSources :: [FilePath] | | hsSourceDirs :: [FilePath] | where to look for the haskell module hierarchy
| otherModules :: [String] | non-exposed or non-main modules
| extensions :: [Extension] | | extraLibs :: [String] | what libraries to link with when compiling a program that uses your package
| extraLibDirs :: [String] | | includeDirs :: [FilePath] | directories to find .h files
| includes :: [FilePath] | The .h files to be found in includeDirs
| installIncludes :: [FilePath] | .h files to install with the package
| options :: [(CompilerFlavor, [String])] | | ghcProfOptions :: [String] | | ghcSharedOptions :: [String] | | customFieldsBI :: [(String, String)] | Custom fields starting
with x-, stored in a
simple assoc-list.
|
|
| Instances | |
|
|
emptyBuildInfo :: BuildInfo |
|
allBuildInfo :: PackageDescription -> [BuildInfo] |
The BuildInfo for the library (if there is one and it's buildable) and
all the buildable executables. Useful for gathering dependencies.
|
|
hcOptions :: CompilerFlavor -> BuildInfo -> [String] |
Select options for a particular Haskell compiler.
|
|
Supplementary build information
|
|
type HookedBuildInfo = (Maybe BuildInfo, [(String, BuildInfo)]) |
|
emptyHookedBuildInfo :: HookedBuildInfo |
|
updatePackageDescription :: HookedBuildInfo -> PackageDescription -> PackageDescription |
|
package configuration
|
|
data Flag |
A flag can represent a feature to be included, or a way of linking
a target against its dependencies, or in fact whatever you can think of.
| Constructors | | Instances | |
|
|
newtype FlagName |
A FlagName is the name of a user-defined configuration flag
| Constructors | | Instances | |
|
|
type FlagAssignment = [(FlagName, Bool)] |
A FlagAssignment is a total or partial mapping of FlagNames to
Bool flag values. It represents the flags chosen by the user or
discovered during configuration. For example --flags=foo --flags=-bar
becomes [(foo, True), (bar, False)]
|
|
data CondTree v c a |
Constructors | | Instances | |
|
|
data ConfVar |
A ConfVar represents the variable type used.
| Constructors | | Instances | |
|
|
data Condition c |
A boolean expression parameterized over the variable type used.
| Constructors | | Instances | |
|
|
freeVars :: CondTree ConfVar c a -> [FlagName] |
|
Supplementary build information
|
|
readHookedBuildInfo :: Verbosity -> FilePath -> IO HookedBuildInfo |
|
parseHookedBuildInfo :: String -> ParseResult HookedBuildInfo |
|
writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> IO () |
|
showHookedBuildInfo :: HookedBuildInfo -> String |
|
Deprecated compat stuff
|
|
data ParseResult a |
Constructors | | Instances | |
|
|
setupMessage :: Verbosity -> String -> PackageDescription -> IO () |
|
cabalVersion :: Version |
|
Produced by Haddock version 0.9 |