1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/compilers/ghcjs-ng/default.nix

108 lines
2.9 KiB
Nix
Raw Normal View History

2018-05-12 06:06:47 +01:00
{ stdenv
, pkgsHostHost
2018-05-12 06:06:47 +01:00
, callPackage
, fetchgit
, ghcjsSrcJson ? null
, ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson))
, bootPkgs
, stage0
, haskellLib
, cabal-install
, nodejs
, makeWrapper
, xorg
, gmp
2018-05-17 10:26:48 +01:00
, pkgconfig
, gcc
2018-05-12 06:06:47 +01:00
, lib
, ghcjsDepOverrides ? (_:_:{})
2018-07-16 03:53:54 +01:00
, haskell
2018-05-12 06:06:47 +01:00
}:
let
passthru = {
configuredSrc = callPackage ./configured-ghcjs-src.nix {
inherit ghcjsSrc;
inherit (bootPkgs) ghc alex happy;
2018-05-12 06:06:47 +01: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;
})
(callPackage ./common-overrides.nix {
inherit haskellLib;
})
2018-05-12 06:06:47 +01:00
ghcjsDepOverrides
]);
targetPrefix = "";
inherit bootGhcjs;
inherit (bootGhcjs) version;
ghcVersion = bootPkgs.ghc.version;
2018-05-12 06:06:47 +01:00
isGhcjs = true;
enableShared = true;
socket-io = pkgsHostHost.nodePackages."socket.io";
2018-05-12 06:06:47 +01:00
# Relics of the old GHCJS build system
stage1Packages = [];
2018-07-16 03:53:54 +01: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 {}));
};
haskellCompilerName = "ghcjs-${bootGhcjs.version}";
2018-05-12 06:06:47 +01:00
};
bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs;
libexec = "${bootGhcjs}/libexec/${builtins.replaceStrings ["darwin" "i686"] ["osx" "i386"] stdenv.buildPlatform.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}";
2018-05-12 06:06:47 +01:00
in stdenv.mkDerivation {
name = bootGhcjs.name;
2018-05-12 06:06:47 +01:00
src = passthru.configuredSrc;
nativeBuildInputs = [
bootGhcjs
passthru.bootPkgs.ghc
cabal-install
nodejs
makeWrapper
xorg.lndir
gmp
2018-05-17 10:26:48 +01:00
pkgconfig
] ++ lib.optionals stdenv.isDarwin [
gcc # https://github.com/ghcjs/ghcjs/issues/663
];
dontConfigure = true;
dontInstall = true;
2018-05-12 06:06:47 +01:00
buildPhase = ''
export HOME=$TMP
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/lib/${bootGhcjs.name}
2018-05-12 06:06:47 +01:00
lndir ${libexec} $out/bin
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 06:06:47 +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
'';
# 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;
meta.maintainers = [lib.maintainers.elvishjerricco];
2018-05-12 06:06:47 +01:00
}