cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Client.ProjectPlanning.SetupPolicy

Description

Setup.hs script policy

Handling for Setup.hs scripts is a bit tricky, part of it lives in the solver phase, and part in the elaboration phase. We keep the helper functions for both phases together here so at least you can see all of it in one place.

There are four major cases for Setup.hs handling:

  1. build-type Custom with a custom-setup section
  2. build-type Custom without a custom-setup section
  3. build-type not Custom with cabal-version > $our-cabal-version
  4. build-type not Custom with cabal-version <= $our-cabal-version

It's also worth noting that packages specifying cabal-version: >= 1.23 or later that have build-type Custom will always have a custom-setup section. Therefore in case 2, the specified cabal-version will always be less than 1.23.

In cases 1 and 2 we obviously have to build an external Setup.hs script, while in case 4 we can use the internal library API.

Since: 3.12.0.0

Synopsis

Documentation

mkDefaultSetupDeps :: Compiler -> Platform -> PackageDescription -> Maybe [Dependency] Source #

Part of our Setup.hs handling policy is implemented by getting the solver to work out setup dependencies for packages. The solver already handles packages that explicitly specify setup dependencies, but we can also tell the solver to treat other packages as if they had setup dependencies. That's what this function does, it gets called by planPackages for all packages that don't already have setup dependencies.

The dependencies we want to add is different for each SetupScriptStyle.

Note in addition to adding setup dependencies, we also use addSetupCabalMinVersionConstraint (in planPackages) to require Cabal >= 1.20 for Setup scripts.

Since: 3.12.0.0

packageSetupScriptStyle :: PackageDescription -> SetupScriptStyle Source #

Work out the SetupScriptStyle given the package description.

Since: 3.12.0.0

packageSetupScriptSpecVersion :: SetupScriptStyle -> PackageDescription -> Graph NonSetupLibDepSolverPlanPackage -> ComponentDeps [SolverId] -> Version Source #

Work out which version of the Cabal we will be using to talk to the Setup.hs interface for this package.

This depends somewhat on the SetupScriptStyle but most cases are a result of what the solver picked for us, based on the explicit setup deps or the ones added implicitly by mkDefaultSetupDeps.

Since: 3.12.0.0

newtype NonSetupLibDepSolverPlanPackage Source #

A newtype for SolverPlanPackage for which the dependency graph considers only dependencies on libraries which are NOT from setup dependencies. Used to compute the set of packages needed for profiling and dynamic libraries.

Since: 3.12.0.0