Cabal-1.2.1: A framework for packaging Haskell softwareContentsIndex
Distribution.Simple.InstallDirs
Portabilityportable
Stabilityalpha
MaintainerIsaac Jones <ijones@syntaxpolice.org>
Description
Definition of the LocalBuildInfo data type. This is basically the information that is gathered by the end of the configuration step which could include package information from ghc-pkg, flags the user passed to configure, and the location of tools in the PATH.
Synopsis
data InstallDirs dir = InstallDirs {
prefix :: dir
bindir :: dir
libdir :: dir
dynlibdir :: dir
libexecdir :: dir
progdir :: dir
includedir :: dir
datadir :: dir
docdir :: dir
htmldir :: dir
}
haddockdir :: InstallDirs FilePath -> PackageDescription -> FilePath
data InstallDirTemplates = InstallDirTemplates {
prefixDirTemplate :: PathTemplate
binDirTemplate :: PathTemplate
libDirTemplate :: PathTemplate
libSubdirTemplate :: PathTemplate
libexecDirTemplate :: PathTemplate
progDirTemplate :: PathTemplate
includeDirTemplate :: PathTemplate
dataDirTemplate :: PathTemplate
dataSubdirTemplate :: PathTemplate
docDirTemplate :: PathTemplate
htmlDirTemplate :: PathTemplate
}
defaultInstallDirs :: CompilerFlavor -> Bool -> IO InstallDirTemplates
absoluteInstallDirs :: PackageIdentifier -> PackageIdentifier -> CopyDest -> InstallDirTemplates -> InstallDirs FilePath
prefixRelativeInstallDirs :: PackageIdentifier -> PackageIdentifier -> InstallDirTemplates -> InstallDirs (Maybe FilePath)
data PathTemplate
data PathTemplateVariable
= PrefixVar
| BinDirVar
| LibDirVar
| LibSubdirVar
| DataDirVar
| DataSubdirVar
| DocDirVar
| PkgNameVar
| PkgVerVar
| PkgIdVar
| CompilerVar
toPathTemplate :: FilePath -> PathTemplate
fromPathTemplate :: PathTemplate -> FilePath
substPathTemplate :: [(PathTemplateVariable, PathTemplate)] -> PathTemplate -> PathTemplate
initialPathTemplateEnv :: PackageIdentifier -> PackageIdentifier -> [(PathTemplateVariable, PathTemplate)]
Documentation
data InstallDirs dir

The directories where we will install files for packages.

We have several different directories for different types of files since many systems have conventions whereby different types of files in a package are installed in different direcotries. This is particularly the case on unix style systems.

Constructors
InstallDirs
prefix :: dir
bindir :: dir
libdir :: dir
dynlibdir :: dir
libexecdir :: dir
progdir :: dir
includedir :: dir
datadir :: dir
docdir :: dir
htmldir :: dir
show/hide Instances
Read dir => Read (InstallDirs dir)
Show dir => Show (InstallDirs dir)
haddockdir :: InstallDirs FilePath -> PackageDescription -> FilePath
data InstallDirTemplates

The installation dirctories in terms of PathTemplates that contain variables.

The defaults for most of the directories are relative to each other, in particular they are all relative to a single prefix. This makes it convenient for the user to override the default installation directory by only having to specify --prefix=... rather than overriding each individually. This is done by allowing $-style variables in the dirs. These are expanded by textual substituion (see substPathTemplate).

A few of these installation directories are split into two components, the dir and subdir. The full installation path is formed by combining the two together with \/. The reason for this is compatability with other unix build systems which also support --libdir and --datadir. We would like users to be able to configure --libdir=/usr/lib64 for example but because by default we want to support installing multiplve versions of packages and building the same package for multiple compilers we append the libdubdir to get: /usr/lib64/$pkgid/$compiler.

An additional complication is the need to support relocatable packages on systems which support such things, like Windows.

Constructors
InstallDirTemplates
prefixDirTemplate :: PathTemplate
binDirTemplate :: PathTemplate
libDirTemplate :: PathTemplate
libSubdirTemplate :: PathTemplate
libexecDirTemplate :: PathTemplate
progDirTemplate :: PathTemplate
includeDirTemplate :: PathTemplate
dataDirTemplate :: PathTemplate
dataSubdirTemplate :: PathTemplate
docDirTemplate :: PathTemplate
htmlDirTemplate :: PathTemplate
show/hide Instances
defaultInstallDirs :: CompilerFlavor -> Bool -> IO InstallDirTemplates
absoluteInstallDirs :: PackageIdentifier -> PackageIdentifier -> CopyDest -> InstallDirTemplates -> InstallDirs FilePath
Convert from abstract install directories to actual absolute ones by substituting for all the variables in the abstract paths, to get real absolute path.
prefixRelativeInstallDirs :: PackageIdentifier -> PackageIdentifier -> InstallDirTemplates -> InstallDirs (Maybe FilePath)

Check which of the paths are relative to the installation $prefix.

If any of the paths are not relative, ie they are absolute paths, then it prevents us from making a relocatable package (also known as a "prefix independent" package).

data PathTemplate
An abstract path, posibly containing variables that need to be substituted for to get a real FilePath.
show/hide Instances
data PathTemplateVariable
Constructors
PrefixVarThe $prefix path variable
BinDirVarThe $bindir path variable
LibDirVarThe $libdir path variable
LibSubdirVarThe $libsubdir path variable
DataDirVarThe $datadir path variable
DataSubdirVarThe $datasubdir path variable
DocDirVarThe $docdir path variable
PkgNameVarThe $pkg package name path variable
PkgVerVarThe $version package version path variable
PkgIdVarThe $pkgid package Id path variable, eg foo-1.0
CompilerVarThe compiler name and version, eg ghc-6.6.1
show/hide Instances
toPathTemplate :: FilePath -> PathTemplate
Convert a FilePath to a PathTemplate including any template vars.
fromPathTemplate :: PathTemplate -> FilePath
Convert back to a path, ingoring any remaining vars
substPathTemplate :: [(PathTemplateVariable, PathTemplate)] -> PathTemplate -> PathTemplate
initialPathTemplateEnv :: PackageIdentifier -> PackageIdentifier -> [(PathTemplateVariable, PathTemplate)]
The initial environment has all the static stuff but no paths
Produced by Haddock version 0.8