| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
BuildEnv.BuildOne
Description
setupPackage prepares a package for building, returning instructions
that compile its Setup script.
buildUnit computes build instructions to configure, build and install
the unit using its Setup script. If the unit is a library, the instructions
will also register it into a local package database using ghc-pkg.
Synopsis
- setupPackage :: Verbosity -> Compiler -> BuildPaths ForBuild -> PkgDbDirs ForBuild -> PkgDir ForPrep -> PkgDir ForBuild -> Map UnitId PlanUnit -> ConfiguredUnit -> IO BuildScript
- buildUnit :: Verbosity -> Compiler -> BuildPaths ForBuild -> PkgDbDirs ForBuild -> PkgDir ForBuild -> UnitArgs -> Map UnitId PlanUnit -> ConfiguredUnit -> BuildScript
- data PkgDir use = PkgDir {
- pkgNameVer :: !String
- pkgDir :: !FilePath
- getPkgDir :: FilePath -> Paths use -> ConfiguredUnit -> PkgDir use
- data family PkgDbDirs use
- getPkgDbDirsForPrep :: Paths ForPrep -> PkgDbDirs ForPrep
- getPkgDbDirsForBuild :: Paths ForBuild -> IO (PkgDbDirs ForBuild)
Building packages
Arguments
| :: Verbosity | |
| -> Compiler | |
| -> BuildPaths ForBuild | Overall build directory structure. |
| -> PkgDbDirs ForBuild | Package database directories (see |
| -> PkgDir ForPrep | Package directory (to find the |
| -> PkgDir ForBuild | Package directory (to build the |
| -> Map UnitId PlanUnit | All dependencies in the build plan. |
| -> ConfiguredUnit | The unit to build. |
| -> IO BuildScript |
Setup a single package.
Returns a build script which compiles the Setup script.
Arguments
| :: Verbosity | |
| -> Compiler | |
| -> BuildPaths ForBuild | Overall build directory structure. |
| -> PkgDbDirs ForBuild | Package database directories (see |
| -> PkgDir ForBuild | This package's directory (see |
| -> UnitArgs | Extra arguments for this unit. |
| -> Map UnitId PlanUnit | All dependencies in the build plan. |
| -> ConfiguredUnit | The unit to build. |
| -> BuildScript |
Return build steps to to configure, build and and installing the unit, including registering it in the package database if it is a library.
You can run the build script with executeBuildScript, or you can
turn it into a shell script with script.
Note: executing the build script will fail if the unit has already been registered in the package database.
Package directory structure helpers
Note [Using two package databases]
We need two distinct package databases: we might want to perform the build
in a temporary location, before everything gets placed into its final
destination. The final package database might use a specific, baked-in
installation prefix (in the sense of Setup configure --prefix pfx). As a
result, this package database won't be immediately usable, as we won't have
copied over the build products yet.
In order to be able to build packages in a temporary directory, we create a
temporary package database that is used for the build, making use of it
with Setup register --inplace.
We also register the packages into the final package database using
ghc-pkg --force: otherwise, ghc-pkg would error because the relevant files
haven't been copied over yet.
The package name-version string and its directory.
Constructors
| PkgDir | |
Fields
| |
Arguments
| :: FilePath | Working directory (used only to relativise paths to local packages). |
| -> Paths use | Overall directory structure to base the computation off. |
| -> ConfiguredUnit | Any unit from the package in question. |
| -> PkgDir use |
Compute the package directory location.
data family PkgDbDirs use Source #
The package database directories.
See Note [Using two package databases].
Instances
| data PkgDbDirs 'ForBuild Source # | |
Defined in BuildEnv.BuildOne data PkgDbDirs 'ForBuild = PkgDbDirsForBuild {
| |
| data PkgDbDirs 'ForPrep Source # | |
Defined in BuildEnv.BuildOne | |