on e94de40 help sign in
haskell.nix/compiler/ghc/source-dist.nix
40 lines 1.4 kB history raw
1{ src, stdenv, pkgs, version, ghc, alex, happy, hscolour }:
2stdenv.mkDerivation {
4 inherit version;
6 name = "ghc-source-dist";
8 buildInputs = [ ghc alex happy hscolour ] ++ (with pkgs; [ automake bash git cacert python3 autoconf xorg.lndir ]);
10 inherit src;
12 phases = [ "unpackPhase" "buildPhase" "installPhase" ];
14 buildPhase = ''
15 # Happy and Alex are confused about their data dirs. See
16 # https://github.com/haskell/cabal/issues/5862 for details.
17 #
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.
28 ./configure --silent
30 # this folder ends up being needed for the windows dists; just mock it.
31 mkdir ghc-tarballs
32 make sdist --silent
33 '';
35 installPhase = ''
36 mkdir -p $out
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
39 '';