Cabal-1.22.5.0: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2005
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | None
Language | Haskell98

Distribution.Simple.Configure

Description

This deals with the configure phase. It provides the `configure` action which is given the package description and configure flags. It then tries to: configure the compiler; resolves any conditionals in the package description; resolve the package dependencies; check if all the extensions used by this package are supported by the compiler; check that all the build tools are available (including version checks if appropriate); checks for any required `pkg-config` packages (updating the `BuildInfo` with the results)

Then based on all this it saves the info in the `LocalBuildInfo` and writes it out to the `dist/setup-config` file. It also displays various details to the user, the amount of information displayed depending on the verbosity level.

Synopsis

- configure :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
- writePersistBuildConfig :: FilePath -> LocalBuildInfo -> IO ()
- getConfigStateFile :: FilePath -> IO LocalBuildInfo
- getPersistBuildConfig :: FilePath -> IO LocalBuildInfo
- checkPersistBuildConfigOutdated :: FilePath -> FilePath -> IO Bool
- tryGetPersistBuildConfig :: FilePath -> IO (Either ConfigStateFileError LocalBuildInfo)
- maybeGetPersistBuildConfig :: FilePath -> IO (Maybe LocalBuildInfo)
- localBuildInfoFile :: FilePath -> FilePath
- getInstalledPackages :: Verbosity -> Compiler -> PackageDBStack -> ProgramConfiguration -> IO InstalledPackageIndex
- getPackageDBContents :: Verbosity -> Compiler -> PackageDB -> ProgramConfiguration -> IO InstalledPackageIndex
- configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> Verbosity -> IO (Compiler, ProgramConfiguration)
- configCompilerAux :: ConfigFlags -> IO (Compiler, ProgramConfiguration)
- configCompilerEx :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> Verbosity -> IO (Compiler, Platform, ProgramConfiguration)
- configCompilerAuxEx :: ConfigFlags -> IO (Compiler, Platform, ProgramConfiguration)
- ccLdOptionsBuildInfo :: [String] -> [String] -> BuildInfo
- checkForeignDeps :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO ()
- interpretPackageDbFlags :: Bool -> [Maybe PackageDB] -> PackageDBStack
- data ConfigStateFileError
  - = ConfigStateFileNoHeader
  - | ConfigStateFileBadHeader
  - | ConfigStateFileNoParse
  - | ConfigStateFileMissing
  - | ConfigStateFileBadVersion PackageIdentifier PackageIdentifier (Either ConfigStateFileError LocalBuildInfo)
- tryGetConfigStateFile :: FilePath -> IO (Either ConfigStateFileError LocalBuildInfo)
- platformDefines :: LocalBuildInfo -> [String]

# Documentation

configure :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo Source

Perform the "`./setup configure`" action. Returns the `.setup-config` file.

writePersistBuildConfig :: FilePath -> LocalBuildInfo -> IO () Source

After running configure, output the `LocalBuildInfo` to the `localBuildInfoFile`.

getConfigStateFile :: FilePath -> IO LocalBuildInfo Source

getPersistBuildConfig :: FilePath -> IO LocalBuildInfo Source

Read the `localBuildInfoFile`. Throw an exception if the file is missing, if the file cannot be read, or if the file was created by an older version of Cabal.

checkPersistBuildConfigOutdated :: FilePath -> FilePath -> IO Bool Source

Check that localBuildInfoFile is up-to-date with respect to the .cabal file.

tryGetPersistBuildConfig :: FilePath -> IO (Either ConfigStateFileError LocalBuildInfo) Source

Try to read the `localBuildInfoFile`.

maybeGetPersistBuildConfig :: FilePath -> IO (Maybe LocalBuildInfo) Source

Try to read the `localBuildInfoFile`.

localBuildInfoFile :: FilePath -> FilePath Source

    dist/setup-config

getInstalledPackages :: Verbosity -> Compiler -> PackageDBStack -> ProgramConfiguration -> IO InstalledPackageIndex Source

getPackageDBContents :: Verbosity -> Compiler -> PackageDB -> ProgramConfiguration -> IO InstalledPackageIndex Source

Like `getInstalledPackages`, but for a single package DB.

configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> Verbosity -> IO (Compiler, ProgramConfiguration) Source

Deprecated: `configCompiler` is deprecated. Use `configCompilerEx` instead.

configCompilerAux :: ConfigFlags -> IO (Compiler, ProgramConfiguration) Source

Deprecated: configCompilerAux is deprecated. Use `configCompilerAuxEx` instead.

configCompilerEx :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> Verbosity -> IO (Compiler, Platform, ProgramConfiguration) Source

configCompilerAuxEx :: ConfigFlags -> IO (Compiler, Platform, ProgramConfiguration) Source

ccLdOptionsBuildInfo :: [String] -> [String] -> BuildInfo Source

Makes a `BuildInfo` from C compiler and linker flags.

This can be used with the output from configuration programs like pkg-config and similar package-specific programs like mysql-config, freealut-config etc. For example:

    ccflags <- rawSystemProgramStdoutConf verbosity prog conf ["--cflags"]
    ldflags <- rawSystemProgramStdoutConf verbosity prog conf ["--libs"]
    return (ccldOptionsBuildInfo (words ccflags) (words ldflags))

checkForeignDeps :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO () Source

interpretPackageDbFlags :: Bool -> [Maybe PackageDB] -> PackageDBStack Source

The user interface specifies the package dbs to use with a combination of `--global`, `--user` and `--package-db=global|user|clear|$file`. This function combines the global/user flag and interprets the package-db flag into a single package db stack.

data ConfigStateFileError Source

Constructors

ConfigStateFileNoHeader |
ConfigStateFileBadHeader |
ConfigStateFileNoParse |
ConfigStateFileMissing |
ConfigStateFileBadVersion PackageIdentifier PackageIdentifier (Either ConfigStateFileError LocalBuildInfo) |

Instances

Show ConfigStateFileError Source |
Exception ConfigStateFileError Source |

tryGetConfigStateFile :: FilePath -> IO (Either ConfigStateFileError LocalBuildInfo) Source

platformDefines :: LocalBuildInfo -> [String] Source