on iko/ghcjs-patch-master help sign in
Source dist logic
commitbb39ebbadf6ebe66110124c7c05f0e3e84f299e8 authorMoritz Angermann <moritz.angermann@gmail.com> dateThu 24 Sep 2020, 07:42 (6 years ago) parent828a04f
1 file changed+40
compiler/ghc/source-dist.nix+40
compiler/ghc/source-dist.nixnew file+40
@@ -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+}