Commit 29b7c904 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Adjust the Cabal dep constraint for legacy Setup.hs scripts

Add a lower bound of >= 1.18. Also improve the related comments.

Using >= 1.18 since we currently have problems working with 1.16 as that
version lacks support for named build targets. We ought to fix working
with older versions though.
parent 58021348
......@@ -1740,25 +1740,31 @@ defaultSetupDeps compiler platform pkg =
Just $
[ Dependency depPkgname anyVersion
| depPkgname <- legacyCustomSetupPkgs compiler platform ] ++
-- The Cabal dep is slightly special:
-- * we omit the dep for the Cabal lib itself (since it bootstraps),
-- * we constrain it to be less than 1.23 since all packages
-- relying on later Cabal spec versions are supposed to use
-- explit setup deps. Having this constraint also allows later
-- Cabal lib versions to make breaking API changes without breaking
-- all old Setup.hs scripts.
[ Dependency cabalPkgname cabalConstraint
| packageName pkg /= cabalPkgname ]
where
cabalConstraint = orLaterVersion (PD.specVersion pkg)
-- The Cabal dep is slightly special:
-- * We omit the dep for the Cabal lib itself, since it bootstraps.
-- * We constrain it to be >= 1.18 < 2
--
cabalConstraint = orLaterVersion cabalCompatMinVer
`intersectVersionRanges`
orLaterVersion (PD.specVersion pkg)
`intersectVersionRanges`
earlierVersion cabalCompatMaxVer
-- TODO/FIXME: turns out that constraining to less than 1.23 causes
-- problems with GHC8 as there's too many important packages
-- with Custom build-type, for which there wouldn't be any
-- install-plan (as GHC8 requires Cabal-1.24+). So let's
-- set an implicit upper bound `Cabal < 2` instead.
-- The idea here is that at some point we will make significant
-- breaking changes to the Cabal API that Setup.hs scripts use.
-- So for old custom Setup scripts that do not specify explicit
-- constraints, we constrain them to use a compatible Cabal version.
-- The exact version where we'll make this API break has not yet been
-- decided, so for the meantime we guess at 2.x.
cabalCompatMaxVer = Version [2] []
-- In principle we can talk to any old Cabal version, and we need to
-- be able to do that for custom Setup scripts that require older
-- Cabal lib versions. However in practice we have currently have
-- problems with Cabal-1.16. (1.16 does not know about build targets)
-- If this is fixed we can relax this constraint.
cabalCompatMinVer = Version [1,18] []
-- For other build types (like Simple) if we still need to compile an
-- external Setup.hs, it'll be one of the simple ones that only depends
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment