Skip to content

Commit bb39ebb

Browse files
committed
Source dist logic
1 parent 828a04f commit bb39ebb

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

compiler/ghc/source-dist.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ src, stdenv, pkgs, version, ghc, alex, happy, hscolour }:
2+
stdenv.mkDerivation {
3+
4+
inherit version;
5+
6+
name = "ghc-source-dist";
7+
8+
buildInputs = [ ghc alex happy hscolour ] ++ (with pkgs; [ automake bash git cacert python3 autoconf xorg.lndir ]);
9+
10+
inherit src;
11+
12+
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
13+
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.
21+
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*")
24+
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
29+
30+
# this folder ends up being needed for the windows dists; just mock it.
31+
mkdir ghc-tarballs
32+
make sdist --silent
33+
'';
34+
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+
'';
40+
}

0 commit comments

Comments
 (0)