aports/community/ghc/ghc-self-bootstrap.patch

103 lines
4.2 KiB
Diff

This patch allows bootstrapping GHC 9.8.2 with itself. The patch
includes a fix for a bug in Hadrian as well as as a few additional
changes to version constraints in Cabal files.
Specifically, it is a (partial) backport of the following commits:
* https://gitlab.haskell.org/ghc/ghc/-/commit/ef3d20f83499cf129b1cacac07906b8d6188fc17
* https://gitlab.haskell.org/ghc/ghc/-/commit/fa97703474602a079f63e3be4bd48695de33a60d
* https://gitlab.haskell.org/ghc/ghc/-/commit/471b267294bc5f17e4864ce9bb2f221c4d47eac8
I have high hopes that this will be fixed in the 9.8.3 upstream release.
See also: https://gitlab.haskell.org/ghc/ghc/-/issues/24605
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 9840ae9db2..ab1cd8021b 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -6,6 +6,7 @@ import Oracles.Setting
import Oracles.Flag
import Packages
import Settings
+import Data.Version.Extra
-- | Package-specific command-line arguments.
packageArgs :: Args
@@ -29,6 +30,7 @@ packageArgs = do
cursesLibraryDir <- getSetting CursesLibDir
ffiIncludeDir <- getSetting FfiIncludeDir
ffiLibraryDir <- getSetting FfiLibDir
+ stageVersion <- readVersion <$> (expr $ ghcVersionStage stage)
mconcat
--------------------------------- base ---------------------------------
@@ -79,7 +81,7 @@ packageArgs = do
-- not being fixed to `ghc`, when building stage0, we must set
-- -this-unit-id to `ghc` because the boot compiler expects that.
-- We do it through a cabal flag in ghc.cabal
- , stage0 ? arg "+hadrian-stage0"
+ , stageVersion < makeVersion [9,8,1] ? arg "+hadrian-stage0"
, flag StaticLibzstd `cabalFlag` "static-libzstd"
]
diff --git a/linters/lint-whitespace/lint-whitespace.cabal b/linters/lint-whitespace/lint-whitespace.cabal
index 61e376d1f9..e4fab0631e 100644
--- a/linters/lint-whitespace/lint-whitespace.cabal
+++ b/linters/lint-whitespace/lint-whitespace.cabal
@@ -28,4 +28,4 @@ executable lint-whitespace
base
>= 4.14 && < 5,
text
- >= 1.2 && < 2.1,
+ >= 1.2 && < 3,
diff --git a/linters/linters-common/linters-common.cabal b/linters/linters-common/linters-common.cabal
index 02245750dd..eea509a207 100644
--- a/linters/linters-common/linters-common.cabal
+++ b/linters/linters-common/linters-common.cabal
@@ -16,7 +16,7 @@ library
base
>= 4.14 && < 5,
text
- >= 1.2 && < 2.1,
+ >= 1.2 && < 3,
deepseq
>= 1.1,
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal
--- ghc-9.8.2.orig/hadrian/hadrian.cabal 2024-03-15 22:58:30.689145289 +0000
+++ ghc-9.8.2/hadrian/hadrian.cabal 2024-03-15 22:59:33.660843297 +0000
@@ -151,7 +151,7 @@ executable hadrian
, TypeOperators
other-extensions: MultiParamTypeClasses
, TypeFamilies
- build-depends: Cabal >= 3.2 && < 3.9
+ build-depends: Cabal >= 3.2 && < 3.11
, base >= 4.11 && < 5
, bytestring >= 0.10 && < 0.13
, containers >= 0.5 && < 0.7
diff --git a/linters/lint-submodule-refs/lint-submodule-refs.cabal b/linters/lint-submodule-refs/lint-submodule-refs.cabal
--- ghc-9.8.2.orig/linters/lint-submodule-refs/lint-submodule-refs.cabal 2024-03-16 08:15:17.641021635 +0000
+++ ghc-9.8.2/linters/lint-submodule-refs/lint-submodule-refs.cabal 2024-03-16 08:15:32.758094822 +0000
@@ -15,7 +15,7 @@ executable lint-submodule-refs
base
>= 4.14 && < 5,
text
- >= 1.2 && < 2.1,
+ >= 1.2 && < 2.2,
linters-common
ghc-options:
diff --git a/linters/lint-commit-msg/lint-commit-msg.cabal b/linters/lint-commit-msg/lint-commit-msg.cabal
--- ghc-9.8.2.orig/linters/lint-commit-msg/lint-commit-msg.cabal 2024-03-16 08:15:17.641021635 +0000
+++ ghc-9.8.2/linters/lint-commit-msg/lint-commit-msg.cabal 2024-03-16 08:15:41.945008537 +0000
@@ -26,4 +26,4 @@ executable lint-commit-msg
base
>= 4.14 && < 5,
text
- >= 1.2 && < 2.1
+ >= 1.2 && < 2.2