2018-05-12 07:06:47 +02:00
|
|
|
{ stdenv
|
2019-12-25 01:49:48 +01:00
|
|
|
, pkgsHostHost
|
2018-05-12 07:06:47 +02:00
|
|
|
, callPackage
|
|
|
|
, fetchgit
|
|
|
|
, ghcjsSrcJson ? null
|
|
|
|
, ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson))
|
|
|
|
, bootPkgs
|
|
|
|
, stage0
|
|
|
|
, haskellLib
|
|
|
|
, cabal-install
|
|
|
|
, nodejs
|
|
|
|
, makeWrapper
|
|
|
|
, xorg
|
|
|
|
, gmp
|
2018-05-17 11:26:48 +02:00
|
|
|
, pkgconfig
|
2018-05-29 23:39:21 +02:00
|
|
|
, gcc
|
2018-05-12 07:06:47 +02:00
|
|
|
, lib
|
|
|
|
, ghcjsDepOverrides ? (_:_:{})
|
2018-07-16 04:53:54 +02:00
|
|
|
, haskell
|
2018-05-12 07:06:47 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
passthru = {
|
|
|
|
configuredSrc = callPackage ./configured-ghcjs-src.nix {
|
2018-09-25 01:59:17 +02:00
|
|
|
inherit ghcjsSrc;
|
|
|
|
inherit (bootPkgs) ghc alex happy;
|
2018-05-12 07:06:47 +02:00
|
|
|
};
|
|
|
|
genStage0 = callPackage ./mk-stage0.nix { inherit (passthru) configuredSrc; };
|
|
|
|
bootPkgs = bootPkgs.extend (lib.foldr lib.composeExtensions (_:_:{}) [
|
|
|
|
(self: _: import stage0 {
|
|
|
|
inherit (passthru) configuredSrc;
|
|
|
|
inherit (self) callPackage;
|
|
|
|
})
|
|
|
|
|
2018-09-25 01:59:17 +02:00
|
|
|
(callPackage ./common-overrides.nix {
|
|
|
|
inherit haskellLib;
|
|
|
|
})
|
2018-05-12 07:06:47 +02:00
|
|
|
ghcjsDepOverrides
|
|
|
|
]);
|
|
|
|
|
|
|
|
targetPrefix = "";
|
2018-05-17 11:27:03 +02:00
|
|
|
inherit bootGhcjs;
|
2018-05-16 09:10:52 +02:00
|
|
|
inherit (bootGhcjs) version;
|
2018-09-28 18:06:31 +02:00
|
|
|
ghcVersion = bootPkgs.ghc.version;
|
2018-05-12 07:06:47 +02:00
|
|
|
isGhcjs = true;
|
|
|
|
|
2018-06-20 23:57:35 +02:00
|
|
|
enableShared = true;
|
|
|
|
|
2019-12-25 01:49:48 +01:00
|
|
|
socket-io = pkgsHostHost.nodePackages."socket.io";
|
2018-05-29 23:39:21 +02:00
|
|
|
|
2018-05-12 07:06:47 +02:00
|
|
|
# Relics of the old GHCJS build system
|
|
|
|
stage1Packages = [];
|
2018-07-16 04:53:54 +02:00
|
|
|
mkStage2 = { callPackage }: {
|
|
|
|
# https://github.com/ghcjs/ghcjs-base/issues/110
|
|
|
|
# https://github.com/ghcjs/ghcjs-base/pull/111
|
|
|
|
ghcjs-base = haskell.lib.dontCheck (haskell.lib.doJailbreak (callPackage ./ghcjs-base.nix {}));
|
|
|
|
};
|
2018-06-13 22:34:50 +02:00
|
|
|
|
2018-06-14 17:35:19 +02:00
|
|
|
haskellCompilerName = "ghcjs-${bootGhcjs.version}";
|
2018-05-12 07:06:47 +02:00
|
|
|
};
|
|
|
|
|
2018-05-16 09:10:52 +02:00
|
|
|
bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs;
|
2018-08-20 21:11:29 +02:00
|
|
|
libexec = "${bootGhcjs}/libexec/${builtins.replaceStrings ["darwin" "i686"] ["osx" "i386"] stdenv.buildPlatform.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}";
|
2018-05-12 07:06:47 +02:00
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
2018-06-03 23:28:17 +02:00
|
|
|
name = bootGhcjs.name;
|
2018-05-12 07:06:47 +02:00
|
|
|
src = passthru.configuredSrc;
|
2018-05-16 09:10:52 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
bootGhcjs
|
|
|
|
passthru.bootPkgs.ghc
|
|
|
|
cabal-install
|
|
|
|
nodejs
|
|
|
|
makeWrapper
|
|
|
|
xorg.lndir
|
|
|
|
gmp
|
2018-05-17 11:26:48 +02:00
|
|
|
pkgconfig
|
2018-05-29 23:39:21 +02:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
gcc # https://github.com/ghcjs/ghcjs/issues/663
|
2018-05-16 09:10:52 +02:00
|
|
|
];
|
2018-06-18 21:44:23 +02:00
|
|
|
dontConfigure = true;
|
|
|
|
dontInstall = true;
|
2018-05-12 07:06:47 +02:00
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$TMP
|
2018-06-03 23:28:17 +02:00
|
|
|
mkdir $HOME/.cabal
|
|
|
|
touch $HOME/.cabal/config
|
2018-05-12 07:06:47 +02:00
|
|
|
cd lib/boot
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
2018-06-26 22:34:03 +02:00
|
|
|
mkdir -p $out/lib/${bootGhcjs.name}
|
2018-05-12 07:06:47 +02:00
|
|
|
lndir ${libexec} $out/bin
|
|
|
|
|
2018-06-26 22:34:03 +02:00
|
|
|
wrapProgram $out/bin/ghcjs --add-flags "-B$out/lib/${bootGhcjs.name}"
|
|
|
|
wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/lib/${bootGhcjs.name}"
|
|
|
|
wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/lib/${bootGhcjs.name}/package.conf.d"
|
2018-05-12 07:06:47 +02:00
|
|
|
|
2018-05-17 11:27:38 +02:00
|
|
|
env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j1 --with-ghcjs-bin $out/bin
|
2018-05-12 07:06:47 +02:00
|
|
|
'';
|
|
|
|
|
2018-05-17 11:27:38 +02:00
|
|
|
# We hard code -j1 as a temporary workaround for
|
|
|
|
# https://github.com/ghcjs/ghcjs/issues/654
|
|
|
|
# enableParallelBuilding = true;
|
2018-05-12 07:06:47 +02:00
|
|
|
|
|
|
|
inherit passthru;
|
|
|
|
|
2020-05-15 20:12:23 +02:00
|
|
|
meta.broken = true; # build does not succeed
|
|
|
|
meta.platforms = lib.platforms.none; # passthru.bootPkgs.ghc.meta.platforms;
|
2019-01-15 00:16:39 +01:00
|
|
|
meta.maintainers = [lib.maintainers.elvishjerricco];
|
2018-05-12 07:06:47 +02:00
|
|
|
}
|