diff options
Diffstat (limited to 'pkgs/development/compilers/ghc/common-hadrian.nix')
-rw-r--r-- | pkgs/development/compilers/ghc/common-hadrian.nix | 78 |
1 files changed, 49 insertions, 29 deletions
diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 522bcb10222ba..55cc96dfd3ed9 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -19,7 +19,6 @@ , autoconf , automake , coreutils -, fetchpatch , fetchurl , fetchgit , perl @@ -29,6 +28,7 @@ , xattr , autoSignDarwinBinariesHook , bash +, srcOnly , libiconv ? null, ncurses , glibcLocales ? null @@ -145,25 +145,60 @@ return $ verbosity >= Verbose '' -, ghcSrc ? (if rev != null then fetchgit else fetchurl) ({ - inherit url sha256; - } // lib.optionalAttrs (rev != null) { - inherit rev; - } // lib.optionalAttrs (postFetch != null) { - inherit postFetch; - }) +, ghcSrc ? + srcOnly { + name = "ghc-${version}"; # -source appended by srcOnly + src = + (if rev != null then fetchgit else fetchurl) ({ + inherit url sha256; + } // lib.optionalAttrs (rev != null) { + inherit rev; + } // lib.optionalAttrs (postFetch != null) { + inherit postFetch; + }); + + patches = + let + # Disable haddock generating pretty source listings to stay under 3GB on aarch64-linux + enableHyperlinkedSource = + lib.versionAtLeast version "9.8" || + !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux); + in + [ + # Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129 + (if lib.versionAtLeast version "9.8" + then ./docs-sphinx-7-ghc98.patch + else ./docs-sphinx-7.patch ) + ] + ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [ + # Prevent the paths module from emitting symbols that we don't use + # when building with separate outputs. + # + # These cause problems as they're not eliminated by GHC's dead code + # elimination on aarch64-darwin. (see + # https://github.com/NixOS/nixpkgs/issues/140774 for details). + ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch + ] + # Prevents passing --hyperlinked-source to haddock. 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 + ++ lib.optionals (!enableHyperlinkedSource) [ + # TODO(@sternenseemann): Doesn't apply for GHC >= 9.8 + ../../tools/haskell/hadrian/disable-hyperlinked-source.patch + ] + # Incorrect bounds on Cabal in hadrian + # https://gitlab.haskell.org/ghc/ghc/-/issues/24100 + ++ lib.optionals (lib.elem version [ "9.8.1" "9.8.2" ]) [ + ../../tools/haskell/hadrian/hadrian-9.8.1-allow-Cabal-3.10.patch + ]; + } # GHC's build system hadrian built from the GHC-to-build's source tree # using our bootstrap GHC. , hadrian ? import ../../tools/haskell/hadrian/make-hadrian.nix { inherit bootPkgs lib; } { - ghcSrc = ghcSrc; + inherit ghcSrc; ghcVersion = version; userSettings = hadrianUserSettings; - # Disable haddock generating pretty source listings to stay under 3GB on aarch64-linux - enableHyperlinkedSource = - # TODO(@sternenseemann): Disabling currently doesn't work with GHC >= 9.8 - lib.versionAtLeast version "9.8" || - !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux); } , # Whether to build sphinx documentation. @@ -269,21 +304,6 @@ stdenv.mkDerivation ({ enableParallelBuilding = true; - patches = [ - # Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129 - (if lib.versionAtLeast version "9.8" - then ./docs-sphinx-7-ghc98.patch - else ./docs-sphinx-7.patch ) - ] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [ - # Prevent the paths module from emitting symbols that we don't use - # when building with separate outputs. - # - # These cause problems as they're not eliminated by GHC's dead code - # elimination on aarch64-darwin. (see - # https://github.com/NixOS/nixpkgs/issues/140774 for details). - ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch - ]; - postPatch = '' patchShebangs --build . ''; |