From 2ec6f635344b634beb6b58137a78df83ab18f95e Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sat, 21 Oct 2023 12:35:29 +0200 Subject: haskell.compiler.ghcHEAD: 9.7.20230527 -> 9.9.20231014 --- pkgs/development/compilers/ghc/common-hadrian.nix | 2 +- pkgs/development/compilers/ghc/head.nix | 6 +-- .../haskell-modules/configuration-ghc-9.10.x.nix | 52 +++++++++++++++++++ .../haskell-modules/configuration-ghc-9.8.x.nix | 7 --- pkgs/development/tools/haskell/hadrian/default.nix | 50 ------------------ .../tools/haskell/hadrian/ghc-platform.nix | 16 ++++++ .../tools/haskell/hadrian/ghc-toolchain.nix | 19 +++++++ pkgs/development/tools/haskell/hadrian/hadrian.nix | 55 ++++++++++++++++++++ .../tools/haskell/hadrian/make-hadrian.nix | 59 ++++++++++++++++++++++ pkgs/top-level/haskell-packages.nix | 17 ++----- 10 files changed, 210 insertions(+), 73 deletions(-) create mode 100644 pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix delete mode 100644 pkgs/development/tools/haskell/hadrian/default.nix create mode 100644 pkgs/development/tools/haskell/hadrian/ghc-platform.nix create mode 100644 pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix create mode 100644 pkgs/development/tools/haskell/hadrian/hadrian.nix create mode 100644 pkgs/development/tools/haskell/hadrian/make-hadrian.nix (limited to 'pkgs') diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index e876c4be0af7..d2d6dade497e 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -150,7 +150,7 @@ # GHC's build system hadrian built from the GHC-to-build's source tree # using our bootstrap GHC. -, hadrian ? bootPkgs.callPackage ../../tools/haskell/hadrian { +, hadrian ? import ../../tools/haskell/hadrian/make-hadrian.nix { inherit bootPkgs lib; } { ghcSrc = ghcSrc; ghcVersion = version; userSettings = hadrianUserSettings; diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 951b708381f1..6b8d657f34ec 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -1,5 +1,5 @@ import ./common-hadrian.nix { - version = "9.7.20230527"; - rev = "69fdbece5f6ca0a718bb9f1fef7b0ab57cf6b664"; - sha256 = "13rf1d27wdich0kmbds55by9vj3wz0v9clba9p8qpwz7x7wpcjz2"; + version = "9.9.20231014"; + rev = "13d3c613c3c1e4942c698449bdf58a6a13b76695"; + sha256 = "13xp4ijnym2qbw2qbxkvfb79l7034vrcm9j2j9kirbhjxzdshvx9"; } diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix new file mode 100644 index 000000000000..99f48333323c --- /dev/null +++ b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix @@ -0,0 +1,52 @@ +{ pkgs, haskellLib }: + +let + inherit (pkgs) lib; +in + +self: super: { + llvmPackages = lib.dontRecurseIntoAttrs self.ghc.llvmPackages; + + # Disable GHC core libraries + array = null; + base = null; + binary = null; + bytestring = null; + Cabal = null; + Cabal-syntax = null; + containers = null; + deepseq = null; + directory = null; + exceptions = null; + filepath = null; + ghc-bignum = null; + ghc-boot = null; + ghc-boot-th = null; + ghc-compact = null; + ghc-experimental = null; + ghc-heap = null; + ghc-internal = null; + ghc-platform = null; + ghc-prim = null; + ghc-toolchain = null; + ghci = null; + haskeline = null; + hpc = null; + integer-gmp = null; + mtl = null; + parsec = null; + pretty = null; + process = null; + rts = null; + semaphore-compat = null; + stm = null; + system-cxx-std-lib = null; + template-haskell = null; + # GHC only builds terminfo if it is a native compiler + terminfo = if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then null else self.terminfo_0_4_1_6; + text = null; + time = null; + transformers = null; + unix = null; + xhtml = null; +} diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix index 4588933abc13..cab81349733e 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.8.x.nix @@ -1,10 +1,3 @@ -## -## Caveat: a copy of configuration-ghc-8.6.x.nix with minor changes: -## -## 1. "8.7" strings -## 2. llvm 6 -## 3. disabled library update: parallel -## { pkgs, haskellLib }: with haskellLib; diff --git a/pkgs/development/tools/haskell/hadrian/default.nix b/pkgs/development/tools/haskell/hadrian/default.nix deleted file mode 100644 index 1801d63cf8b9..000000000000 --- a/pkgs/development/tools/haskell/hadrian/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ # GHC source tree to build hadrian from - ghcSrc ? null, ghcVersion ? null -, mkDerivation, base, bytestring, Cabal, containers, directory -, extra, filepath, lib, mtl, parsec, shake, text, transformers -, unordered-containers, cryptohash-sha256, base16-bytestring -, userSettings ? null -# Whether to pass --hyperlinked-source to haddock or not. This is a custom -# workaround as we wait for this to be configurable via userSettings or similar. -# https://gitlab.haskell.org/ghc/ghc/-/issues/23625 -, enableHyperlinkedSource ? true -, writeText -}: - -if ghcSrc == null || ghcVersion == null -then throw "hadrian: need to specify ghcSrc and ghcVersion arguments manually" -else - -mkDerivation { - pname = "hadrian"; - version = ghcVersion; - src = ghcSrc; - postUnpack = '' - sourceRoot="$sourceRoot/hadrian" - ''; - patches = lib.optionals (!enableHyperlinkedSource) [ - ./disable-hyperlinked-source.patch - ]; - # Overwrite UserSettings.hs with a provided custom one - postPatch = lib.optionalString (userSettings != null) '' - install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs - ''; - configureFlags = [ - # avoid QuickCheck dep which needs shared libs / TH - "-f-selftest" - # Building hadrian with -O1 takes quite some time with little benefit. - # Additionally we need to recompile it on every change of UserSettings.hs. - # See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190 - "-O0" - ]; - isLibrary = false; - isExecutable = true; - executableHaskellDepends = [ - base bytestring Cabal containers directory extra filepath mtl - parsec shake text transformers unordered-containers - ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [ - cryptohash-sha256 base16-bytestring - ]; - description = "GHC build system"; - license = lib.licenses.bsd3; -} diff --git a/pkgs/development/tools/haskell/hadrian/ghc-platform.nix b/pkgs/development/tools/haskell/hadrian/ghc-platform.nix new file mode 100644 index 000000000000..3b1b17fba2c7 --- /dev/null +++ b/pkgs/development/tools/haskell/hadrian/ghc-platform.nix @@ -0,0 +1,16 @@ +{ mkDerivation, base, lib + # GHC source tree to build ghc-toolchain from +, ghcSrc +, ghcVersion +}: +mkDerivation { + pname = "ghc-platform"; + version = ghcVersion; + src = ghcSrc; + postUnpack = '' + sourceRoot="$sourceRoot/libraries/ghc-platform" + ''; + libraryHaskellDepends = [ base ]; + description = "Platform information used by GHC and friends"; + license = lib.licenses.bsd3; +} diff --git a/pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix b/pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix new file mode 100644 index 000000000000..035fee7aca80 --- /dev/null +++ b/pkgs/development/tools/haskell/hadrian/ghc-toolchain.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, directory, filepath, ghc-platform, lib +, process, text, transformers + # GHC source tree to build ghc-toolchain from +, ghcVersion +, ghcSrc +}: +mkDerivation { + pname = "ghc-toolchain"; + version = ghcVersion; + src = ghcSrc; + postUnpack = '' + sourceRoot="$sourceRoot/utils/ghc-toolchain" + ''; + libraryHaskellDepends = [ + base directory filepath ghc-platform process text transformers + ]; + description = "Utility for managing GHC target toolchains"; + license = lib.licenses.bsd3; +} diff --git a/pkgs/development/tools/haskell/hadrian/hadrian.nix b/pkgs/development/tools/haskell/hadrian/hadrian.nix new file mode 100644 index 000000000000..1be21d6f4519 --- /dev/null +++ b/pkgs/development/tools/haskell/hadrian/hadrian.nix @@ -0,0 +1,55 @@ +# See also ./make-hadria.nix +{ mkDerivation, base, bytestring, Cabal, containers, directory +, extra, filepath, lib, mtl, parsec, shake, text, transformers +, unordered-containers, cryptohash-sha256, base16-bytestring +, writeText + # Dependencies that are not on Hackage and only used in certain Hadrian versions +, ghc-platform ? null +, ghc-toolchain ? null + # GHC source tree to build hadrian from +, ghcSrc +, ghcVersion + # Customization +, userSettings ? null +, enableHyperlinkedSource +}: + +mkDerivation { + pname = "hadrian"; + version = ghcVersion; + src = ghcSrc; + postUnpack = '' + sourceRoot="$sourceRoot/hadrian" + ''; + patches = lib.optionals (!enableHyperlinkedSource) [ + ./disable-hyperlinked-source.patch + ]; + # Overwrite UserSettings.hs with a provided custom one + postPatch = lib.optionalString (userSettings != null) '' + install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs + ''; + configureFlags = [ + # avoid QuickCheck dep which needs shared libs / TH + "-f-selftest" + # Building hadrian with -O1 takes quite some time with little benefit. + # Additionally we need to recompile it on every change of UserSettings.hs. + # See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190 + "-O0" + ]; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base bytestring Cabal containers directory extra filepath mtl + parsec shake text transformers unordered-containers + ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [ + cryptohash-sha256 base16-bytestring + ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.9") [ + ghc-platform ghc-toolchain + ]; + passthru = { + # Expose »private« dependencies if any + inherit ghc-platform ghc-toolchain; + }; + description = "GHC build system"; + license = lib.licenses.bsd3; +} diff --git a/pkgs/development/tools/haskell/hadrian/make-hadrian.nix b/pkgs/development/tools/haskell/hadrian/make-hadrian.nix new file mode 100644 index 000000000000..6aa30cb9e60c --- /dev/null +++ b/pkgs/development/tools/haskell/hadrian/make-hadrian.nix @@ -0,0 +1,59 @@ +# Hadrian is the build system used to (exclusively) build GHC. It can +# (theoretically) be used starting with GHC 9.4 and is required since 9.6. It is +# developed in the GHC source tree and specific to the GHC version it is released +# with, i.e. Hadrian always needs to be built from the same GHC source tree as +# the GHC we want to build. +# +# This fact makes it impossible to integrate Hadrian into our Haskell package +# sets which are also used to bootstrap GHC, since a package set can bootstrap +# multiple GHC versions (usually two major versions). A bootstrap set would need +# knowledge of the GHC it would eventually bootstrap which would make the logic +# unnecessarily complicated. +# +# Luckily Hadrian is, while annoying to bootstrap, relatively simple. Specifically +# all it requires to build is (relative to the GHC we are trying to build) a +# build->build GHC and build->build Haskell packages. We can get all of this +# from bootPkgs which is already passed to the GHC expression. +# +# The solution is the following: The GHC expression passes its source tree and +# version along with some parameters to this function (./make-hadrian.nix) +# which acts as a common expression builder for all Hadrian version as well as +# related packages that are managed in the GHC source tree. Its main job is to +# expose all possible compile time customization in a common interface and +# take care of all differences between Hadrian versions. +{ bootPkgs +, lib +}: + +{ # GHC source tree and version to build hadrian & friends from. + # These are passed on to the actual package expressions. + ghcSrc +, ghcVersion + # Contents of a non-default UserSettings.hs to use when building hadrian, if any. + # Should be a string or null. +, userSettings ? null + # Whether to pass --hyperlinked-source to haddock or not. This is a custom + # workaround as we wait for this to be configurable via userSettings or similar. + # https://gitlab.haskell.org/ghc/ghc/-/issues/23625 +, enableHyperlinkedSource ? false +}: + +let + callPackage' = f: args: bootPkgs.callPackage f ({ + inherit ghcSrc ghcVersion; + } // args); + + ghc-platform = callPackage' ./ghc-platform.nix { }; + ghc-toolchain = callPackage' ./ghc-toolchain.nix { + inherit ghc-platform; + }; +in + +callPackage' ./hadrian.nix ({ + inherit userSettings enableHyperlinkedSource; +} // lib.optionalAttrs (lib.versionAtLeast ghcVersion "9.9") { + # Starting with GHC 9.9 development, additional in tree packages are required + # to build hadrian. (Hackage-released conditional dependencies are handled + # in ./hadrian.nix without requiring intervention here.) + inherit ghc-platform ghc-toolchain; +}) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 6b129e6aca01..0b970cb44f04 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -415,22 +415,15 @@ in { }; ghc98 = compiler.ghc981; ghcHEAD = callPackage ../development/compilers/ghc/head.nix { - bootPkgs = - # For GHC 9.2 no armv7l bindists are available. - if stdenv.hostPlatform.isAarch32 then - packages.ghc924 - else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then - packages.ghc924 - else - packages.ghc924Binary; + bootPkgs = packages.ghc963; inherit (buildPackages.python3Packages) sphinx; # Need to use apple's patched xattr until # https://github.com/xattr/xattr/issues/44 and # https://github.com/xattr/xattr/issues/55 are solved. inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; - # 2023-01-15: Support range >= 10 && < 15 - buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_14; - llvmPackages = pkgs.llvmPackages_14; + # 2023-01-15: Support range >= 11 && < 16 + buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_15; + llvmPackages = pkgs.llvmPackages_15; }; ghcjs = compiler.ghcjs810; @@ -586,7 +579,7 @@ in { ghcHEAD = callPackage ../development/haskell-modules { buildHaskellPackages = bh.packages.ghcHEAD; ghc = bh.compiler.ghcHEAD; - compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.8.x.nix { }; + compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.10.x.nix { }; }; ghcjs = packages.ghcjs810; -- cgit 1.4.1