2018-05-12 06:06:47 +01:00
|
|
|
{ stdenv
|
|
|
|
, callPackage
|
|
|
|
, fetchgit
|
|
|
|
, ghcjsSrcJson ? null
|
|
|
|
, ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson))
|
|
|
|
, bootPkgs
|
|
|
|
, alex
|
|
|
|
, happy
|
|
|
|
, stage0
|
|
|
|
, haskellLib
|
|
|
|
, cabal-install
|
|
|
|
, nodejs
|
|
|
|
, makeWrapper
|
|
|
|
, xorg
|
|
|
|
, gmp
|
2018-05-17 10:26:48 +01:00
|
|
|
, pkgconfig
|
2018-05-29 22:39:21 +01:00
|
|
|
, gcc
|
2018-05-12 06:06:47 +01:00
|
|
|
, lib
|
2018-05-29 22:39:21 +01:00
|
|
|
, nodePackages
|
2018-05-12 06:06:47 +01:00
|
|
|
, ghcjsDepOverrides ? (_:_:{})
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
passthru = {
|
|
|
|
configuredSrc = callPackage ./configured-ghcjs-src.nix {
|
|
|
|
inherit ghcjsSrc alex happy;
|
|
|
|
inherit (bootPkgs) ghc;
|
|
|
|
};
|
|
|
|
genStage0 = callPackage ./mk-stage0.nix { inherit (passthru) configuredSrc; };
|
|
|
|
bootPkgs = bootPkgs.extend (lib.foldr lib.composeExtensions (_:_:{}) [
|
|
|
|
(self: _: import stage0 {
|
|
|
|
inherit (passthru) configuredSrc;
|
|
|
|
inherit (self) callPackage;
|
|
|
|
})
|
|
|
|
|
|
|
|
(callPackage ./common-overrides.nix { inherit haskellLib alex happy; })
|
|
|
|
ghcjsDepOverrides
|
|
|
|
]);
|
|
|
|
|
|
|
|
targetPrefix = "";
|
2018-05-17 10:27:03 +01:00
|
|
|
inherit bootGhcjs;
|
2018-05-16 08:10:52 +01:00
|
|
|
inherit (bootGhcjs) version;
|
2018-05-12 06:06:47 +01:00
|
|
|
isGhcjs = true;
|
|
|
|
|
2018-05-29 22:39:21 +01:00
|
|
|
socket-io = nodePackages."socket.io";
|
|
|
|
|
2018-05-12 06:06:47 +01:00
|
|
|
# Relics of the old GHCJS build system
|
|
|
|
stage1Packages = [];
|
|
|
|
mkStage2 = _: {};
|
2018-06-13 21:34:50 +01:00
|
|
|
|
2018-06-14 16:35:19 +01:00
|
|
|
haskellCompilerName = "ghcjs-${bootGhcjs.version}";
|
2018-05-12 06:06:47 +01:00
|
|
|
};
|
|
|
|
|
2018-05-16 08:10:52 +01:00
|
|
|
bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs;
|
2018-06-10 00:45:46 +01:00
|
|
|
libexec = "${bootGhcjs}/libexec/${builtins.replaceStrings ["darwin" "i686"] ["osx" "i386"] stdenv.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}";
|
2018-05-12 06:06:47 +01:00
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
2018-06-03 22:28:17 +01:00
|
|
|
name = bootGhcjs.name;
|
2018-05-12 06:06:47 +01:00
|
|
|
src = passthru.configuredSrc;
|
2018-05-16 08:10:52 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
bootGhcjs
|
|
|
|
passthru.bootPkgs.ghc
|
|
|
|
cabal-install
|
|
|
|
nodejs
|
|
|
|
makeWrapper
|
|
|
|
xorg.lndir
|
|
|
|
gmp
|
2018-05-17 10:26:48 +01:00
|
|
|
pkgconfig
|
2018-05-29 22:39:21 +01:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
gcc # https://github.com/ghcjs/ghcjs/issues/663
|
2018-05-16 08:10:52 +01:00
|
|
|
];
|
2018-05-12 06:06:47 +01:00
|
|
|
phases = ["unpackPhase" "buildPhase"];
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$TMP
|
2018-06-03 22:28:17 +01:00
|
|
|
mkdir $HOME/.cabal
|
|
|
|
touch $HOME/.cabal/config
|
2018-05-12 06:06:47 +01:00
|
|
|
cd lib/boot
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/libexec
|
|
|
|
lndir ${libexec} $out/bin
|
|
|
|
|
2018-05-17 10:27:19 +01:00
|
|
|
wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec"
|
2018-05-12 06:06:47 +01:00
|
|
|
wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/libexec"
|
|
|
|
wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/libexec/package.conf.d"
|
|
|
|
|
2018-05-17 10:27:38 +01:00
|
|
|
env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j1 --with-ghcjs-bin $out/bin
|
2018-05-12 06:06:47 +01:00
|
|
|
'';
|
|
|
|
|
2018-05-17 10:27:38 +01:00
|
|
|
# We hard code -j1 as a temporary workaround for
|
|
|
|
# https://github.com/ghcjs/ghcjs/issues/654
|
|
|
|
# enableParallelBuilding = true;
|
2018-05-12 06:06:47 +01:00
|
|
|
|
|
|
|
inherit passthru;
|
|
|
|
|
|
|
|
meta.platforms = passthru.bootPkgs.ghc.meta.platforms;
|
|
|
|
}
|
|
|
|
|