Cabal-3.10.1.0: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2004
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.Simple.Register

Description

This module deals with registering and unregistering packages. There are a couple ways it can do this, one is to do it directly. Another is to generate a script that can be run later to do it. The idea here being that the user is shielded from the details of what command to use for package registration for a particular compiler. In practice this aspect was not especially popular so we also provide a way to simply generate the package registration file which then must be manually passed to `ghc-pkg`. It is possible to generate registration information for where the package is to be installed, or alternatively to register the package in place in the build tree. The latter is occasionally handy, and will become more important when we try to build multi-package systems.

This module does not delegate anything to the per-compiler modules but just mixes it all in this module, which is rather unsatisfactory. The script generation and the unregister feature are not well used or tested.

Synopsis

- register :: PackageDescription -> LocalBuildInfo -> RegisterFlags -> IO ()
- unregister :: PackageDescription -> LocalBuildInfo -> RegisterFlags -> IO ()
- internalPackageDBPath :: LocalBuildInfo -> FilePath -> FilePath
- initPackageDB :: Verbosity -> Compiler -> ProgramDb -> FilePath -> IO ()
- doesPackageDBExist :: FilePath -> IO Bool
- createPackageDB :: Verbosity -> Compiler -> ProgramDb -> Bool -> FilePath -> IO ()
- deletePackageDB :: FilePath -> IO ()
- abiHash :: Verbosity -> PackageDescription -> FilePath -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO AbiHash
- invokeHcPkg :: Verbosity -> Compiler -> ProgramDb -> PackageDBStack -> [String] -> IO ()
- registerPackage :: Verbosity -> Compiler -> ProgramDb -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> IO ()
- data RegisterOptions = RegisterOptions {
  - registerAllowOverwrite :: Bool
  - registerMultiInstance :: Bool
  - registerSuppressFilesCheck :: Bool
  }
- defaultRegisterOptions :: RegisterOptions
- generateRegistrationInfo :: Verbosity -> PackageDescription -> Library -> LocalBuildInfo -> ComponentLocalBuildInfo -> Bool -> Bool -> FilePath -> PackageDB -> IO InstalledPackageInfo
- inplaceInstalledPackageInfo :: FilePath -> FilePath -> PackageDescription -> AbiHash -> Library -> LocalBuildInfo -> ComponentLocalBuildInfo -> InstalledPackageInfo
- absoluteInstalledPackageInfo :: PackageDescription -> AbiHash -> Library -> LocalBuildInfo -> ComponentLocalBuildInfo -> InstalledPackageInfo
- generalInstalledPackageInfo :: ([FilePath] -> [FilePath]) -> PackageDescription -> AbiHash -> Library -> LocalBuildInfo -> ComponentLocalBuildInfo -> InstallDirs FilePath -> InstalledPackageInfo

# Documentation

register Source #

Arguments

:: PackageDescription |
-> LocalBuildInfo |
-> RegisterFlags | Install in the user's database?; verbose
-> IO () |

unregister :: PackageDescription -> LocalBuildInfo -> RegisterFlags -> IO () Source #

internalPackageDBPath :: LocalBuildInfo -> FilePath -> FilePath Source #

initPackageDB :: Verbosity -> Compiler -> ProgramDb -> FilePath -> IO () Source #

doesPackageDBExist :: FilePath -> IO Bool Source #

createPackageDB :: Verbosity -> Compiler -> ProgramDb -> Bool -> FilePath -> IO () Source #

Create an empty package DB at the specified location.

deletePackageDB :: FilePath -> IO () Source #

abiHash :: Verbosity -> PackageDescription -> FilePath -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO AbiHash Source #

Compute the `AbiHash` of a library that we built inplace.

invokeHcPkg :: Verbosity -> Compiler -> ProgramDb -> PackageDBStack -> [String] -> IO () Source #

Run `hc-pkg` using a given package DB stack, directly forwarding the provided command-line arguments to it.

registerPackage :: Verbosity -> Compiler -> ProgramDb -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> IO () Source #

data RegisterOptions Source #

Additional variations in the behaviour for `register`.

Constructors

RegisterOptions |

Fields

- registerAllowOverwrite :: Bool

  Allows re-registering / overwriting an existing package

- registerMultiInstance :: Bool

  Insist on the ability to register multiple instances of a single version of a single package. This will fail if the `hc-pkg` does not support it, see `nativeMultiInstance` and `recacheMultiInstance`.

- registerSuppressFilesCheck :: Bool

  Require that no checks are performed on the existence of package files mentioned in the registration info. This must be used if registering prior to putting the files in their final place. This will fail if the `hc-pkg` does not support it, see `suppressFilesCheck`.

defaultRegisterOptions :: RegisterOptions Source #

Defaults are `True`, `False` and `False`

generateRegistrationInfo :: Verbosity -> PackageDescription -> Library -> LocalBuildInfo -> ComponentLocalBuildInfo -> Bool -> Bool -> FilePath -> PackageDB -> IO InstalledPackageInfo Source #

inplaceInstalledPackageInfo Source #

Arguments

:: FilePath | top of the build tree
-> FilePath | location of the dist tree
-> PackageDescription |
-> AbiHash |
-> Library |
-> LocalBuildInfo |
-> ComponentLocalBuildInfo |
-> InstalledPackageInfo |

Construct `InstalledPackageInfo` for a library that is in place in the build tree.

This function knows about the layout of in place packages.

absoluteInstalledPackageInfo :: PackageDescription -> AbiHash -> Library -> LocalBuildInfo -> ComponentLocalBuildInfo -> InstalledPackageInfo Source #

Construct `InstalledPackageInfo` for the final install location of a library package.

This function knows about the layout of installed packages.

generalInstalledPackageInfo Source #

Arguments

:: ([FilePath] -> [FilePath]) | Translate relative include dir paths to absolute paths.
-> PackageDescription |
-> AbiHash |
-> Library |
-> LocalBuildInfo |
-> ComponentLocalBuildInfo |
-> InstallDirs FilePath |
-> InstalledPackageInfo |

Construct `InstalledPackageInfo` for a library in a package, given a set of installation directories.