@@ -0,0 +1,40 @@
1+{ src, stdenv, pkgs, version, ghc, alex, happy, hscolour }:
6+ name = "ghc-source-dist";
8+ buildInputs = [ ghc alex happy hscolour ] ++ (with pkgs; [ automake bash git cacert python3 autoconf xorg.lndir ]);
12+ phases = [ "unpackPhase" "buildPhase" "installPhase" ];
15+ # Happy and Alex are confused about their data dirs. See
16+ # https://github.com/haskell/cabal/issues/5862 for details.
18+ # This is fixed in more recent builds. We can't rely on
19+ # custom built tools as computing the source-dist is pretty
20+ # much in the bootstrap lane.
22+ export alex_datadir=$(find ${alex}/share -name "alex-*" -type d -and -not -path "*doc*")
23+ export happy_datadir=$(find ${happy}/share -name "happy-*" -type d -and -not -path "*doc*")
25+ # We need to --skip-url-rewrites, ghc is a bit too strict here.
26+ python3 ./boot --skip-url-rewrites
27+ # let's not flood the screen with garbage.
30+ # this folder ends up being needed for the windows dists; just mock it.
37+ install -Dm644 sdistprep/ghc-$(cat VERSION)-src.tar.xz $out/src.tar.xz
38+ install -Dm644 sdistprep/ghc-$(cat VERSION)-testsuite.tar.xz $out/testsuite.tar.xz