Skip to content
Open
24 changes: 3 additions & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
url = "github:input-output-hk/stackage.nix";
flake = false;
};
cabal-32 = {
url = "github:haskell/cabal/3.2";
flake = false;
};
cabal-34 = {
url = "github:haskell/cabal/3.4";
flake = false;
Expand Down
8 changes: 4 additions & 4 deletions lazy-inputs/ghc913/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion overlays/bootstrap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ in {
++ fromUntil "9.8.3" "9.8.4" ./patches/ghc/ghc-9.8.3-text-upper-bound.patch
++ fromUntil "9.10" "9.10.2" ./patches/ghc/ghc-9.10-containers-upper-bound.patch
++ fromUntil "9.10" "9.14" ./patches/ghc/ghc-9.10-merge-objects.patch
++ fromUntil "9.12" "9.13" ./patches/ghc/ghc-9.12-Cabal-3.14.patch
++ fromUntil "9.12" "9.13" ./patches/ghc/ghc-9.12-alex-3.5.2.0.patch

# This patch will make windows stop emitting absolute relocations. This is one way in which binutils 2.36+ (with ASLR enabled), will just choke on the
# assembly we generate because it's always absolute (32bit) addressing modes.
Expand All @@ -338,7 +340,7 @@ in {
# unbreak modern clang with proper _atomic declarations.
++ onAndroid (fromUntil "9.6" "9.6.5" ./patches/ghc/7db8c9927fae3369fc4ecff68f80c4cb32eea757.patch)

++ onGhcjs (from "9.12" ./patches/ghc/ghc-9.12-ghcjs-rts-mem-heap8.patch)
++ onGhcjs (fromUntil "9.12" "9.13" ./patches/ghc/ghc-9.12-ghcjs-rts-mem-heap8.patch)
# Fix for `fatal error: 'rts/Types.h' file not found` when building `primitive`
++ onGhcjs (from "9.13" ./patches/ghc/ghc-9.13-ghcjs-rts-types.patch)

Expand Down
109 changes: 109 additions & 0 deletions overlays/patches/ghc/ghc-9.12-Cabal-3.14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
diff --git a/compiler/Setup.hs b/compiler/Setup.hs
index c7c0850383..3ce6624307 100644
--- a/compiler/Setup.hs
+++ b/compiler/Setup.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
module Main where

@@ -11,6 +12,10 @@ import Distribution.Verbosity
import Distribution.Simple.Program
import Distribution.Simple.Utils
import Distribution.Simple.Setup
+import Distribution.Simple.PackageIndex
+#if MIN_VERSION_Cabal(3,14,0)
+import Distribution.Utils.Path (interpretSymbolicPath)
+#endif

import System.IO
import System.Process
@@ -57,7 +62,11 @@ primopIncls =
ghcAutogen :: Verbosity -> LocalBuildInfo -> IO ()
ghcAutogen verbosity lbi@LocalBuildInfo{..} = do
-- Get compiler/ root directory from the cabal file
+#if MIN_VERSION_Cabal(3,14,0)
+ let Just compilerRoot = takeDirectory . interpretSymbolicPath Nothing <$> pkgDescrFile
+#else
let Just compilerRoot = takeDirectory <$> pkgDescrFile
+#endif

-- Require the necessary programs
(gcc ,withPrograms) <- requireProgram normal gccProgram withPrograms
@@ -77,10 +86,20 @@ ghcAutogen verbosity lbi@LocalBuildInfo{..} = do
-- Call genprimopcode to generate *.hs-incl
forM_ primopIncls $ \(file,command) -> do
contents <- readProcess "genprimopcode" [command] primopsStr
+#if MIN_VERSION_Cabal(3,14,0)
+ rewriteFileEx verbosity (interpretSymbolicPath Nothing (buildDir lbi) </> file) contents
+#elif MIN_VERSION_Cabal(3,11,0)
+ rewriteFileEx verbosity (buildDir lbi </> file) contents
+#else
rewriteFileEx verbosity (buildDir </> file) contents
+#endif

-- Write GHC.Platform.Constants
+#if MIN_VERSION_Cabal(3,14,0)
+ let platformConstantsPath = interpretSymbolicPath Nothing (autogenPackageModulesDir lbi) </> "GHC/Platform/Constants.hs"
+#else
let platformConstantsPath = autogenPackageModulesDir lbi </> "GHC/Platform/Constants.hs"
+#endif
targetOS = case lookup "target os" settings of
Nothing -> error "no target os in settings"
Just os -> os
@@ -95,7 +114,11 @@ ghcAutogen verbosity lbi@LocalBuildInfo{..} = do
_ -> error "Couldn't find unique cabal library when building ghc"

-- Write GHC.Settings.Config
+#if MIN_VERSION_Cabal(3,14,0)
+ configHsPath = interpretSymbolicPath Nothing (autogenPackageModulesDir lbi) </> "GHC/Settings/Config.hs"
+#else
configHsPath = autogenPackageModulesDir lbi </> "GHC/Settings/Config.hs"
+#endif
configHs = generateConfigHs cProjectUnitId settings
createDirectoryIfMissingVerbose verbosity True (takeDirectory configHsPath)
rewriteFileEx verbosity configHsPath configHs
diff --git a/libraries/ghc-boot/Setup.hs b/libraries/ghc-boot/Setup.hs
index 0995ee3f8f..73e6b3e5e7 100644
--- a/libraries/ghc-boot/Setup.hs
+++ b/libraries/ghc-boot/Setup.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LambdaCase #-}
@@ -10,6 +11,9 @@ import Distribution.Verbosity
import Distribution.Simple.Program
import Distribution.Simple.Utils
import Distribution.Simple.Setup
+#if MIN_VERSION_Cabal(3,14,0)
+import Distribution.Utils.Path (interpretSymbolicPath)
+#endif

import System.IO
import System.Directory
@@ -32,12 +36,24 @@ main = defaultMainWithHooks ghcHooks
ghcAutogen :: Verbosity -> LocalBuildInfo -> IO ()
ghcAutogen verbosity lbi@LocalBuildInfo{..} = do
-- Get compiler/ root directory from the cabal file
+#if MIN_VERSION_Cabal(3,14,0)
+ let Just compilerRoot = takeDirectory . interpretSymbolicPath Nothing <$> pkgDescrFile
+#else
let Just compilerRoot = takeDirectory <$> pkgDescrFile
+#endif

let platformHostFile = "GHC/Platform/Host.hs"
+#if MIN_VERSION_Cabal(3,14,0)
+ platformHostPath = interpretSymbolicPath Nothing (autogenPackageModulesDir lbi) </> platformHostFile
+#else
platformHostPath = autogenPackageModulesDir lbi </> platformHostFile
+#endif
ghcVersionFile = "GHC/Version.hs"
+#if MIN_VERSION_Cabal(3,14,0)
+ ghcVersionPath = interpretSymbolicPath Nothing (autogenPackageModulesDir lbi) </> ghcVersionFile
+#else
ghcVersionPath = autogenPackageModulesDir lbi </> ghcVersionFile
+#endif

-- Get compiler settings
settings <- lookupEnv "HADRIAN_SETTINGS" >>= \case
27 changes: 27 additions & 0 deletions overlays/patches/ghc/ghc-9.12-alex-3.5.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index fe08dc69cd..57157cd8bb 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -41,6 +41,7 @@
-- Alex "Haskell code fragment top"

{
+{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
@@ -3471,10 +3472,14 @@ topNoLayoutContainsCommas [] = False
topNoLayoutContainsCommas (ALRLayout _ _ : ls) = topNoLayoutContainsCommas ls
topNoLayoutContainsCommas (ALRNoLayout b _ : _) = b

+#ifdef MIN_TOOL_VERSION_alex
+#if !MIN_TOOL_VERSION_alex(3,5,2)
-- If the generated alexScan/alexScanUser functions are called multiple times
-- in this file, alexScanUser gets broken out into a separate function and
-- increases memory usage. Make sure GHC inlines this function and optimizes it.
{-# INLINE alexScanUser #-}
+#endif
+#endif

lexToken :: P (PsLocated Token)
lexToken = do
2 changes: 1 addition & 1 deletion test/cabal.project.local
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repository head.hackage.ghc.haskell.org
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
--sha256: sha256-Tc0SzZeJtkhLr7Fi99RPXBpaW/74/wfUqnfz9E7TJKg=
--sha256: sha256-BXYLDqKdgRe/Spq81B4t4KbYRDJ//BZbHOAp4XF0IqQ=

repository ghcjs-overlay
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b
Expand Down
4 changes: 3 additions & 1 deletion test/gi-gtk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ in recurseIntoAttrs rec {
# Cross compilation to aarch64 is also broken
|| stdenv.hostPlatform.isAarch64 && !stdenv.buildPlatform.isAarch64
# glu is marked ase broken for isAndroid
|| stdenv.hostPlatform.isAndroid;
|| stdenv.hostPlatform.isAndroid
# Skip until we update haskell.nix to Cabal 3.16
|| builtins.elem compiler-nix-name ["ghc91320251028"];

ifdInputs = {
inherit (project) plan-nix;
Expand Down
Loading