nixpkgs/pkgs/development/compilers/ghcjs-ng/default.nix
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00

110 lines
3.0 KiB
Nix

{ stdenv
, pkgsHostHost
, callPackage
, fetchgit
, ghcjsSrcJson ? null
, ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson))
, bootPkgs
, stage0
, haskellLib
, cabal-install
, nodejs
, makeWrapper
, xorg
, gmp
, pkg-config
, gcc
, lib
, ghcjsDepOverrides ? (_:_:{})
, haskell
}:
let
passthru = {
configuredSrc = callPackage ./configured-ghcjs-src.nix {
inherit ghcjsSrc;
inherit (bootPkgs) ghc alex happy;
};
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;
})
ghcjsDepOverrides
]);
targetPrefix = "";
inherit bootGhcjs;
inherit (bootGhcjs) version;
ghcVersion = bootPkgs.ghc.version;
isGhcjs = true;
enableShared = true;
socket-io = pkgsHostHost.nodePackages."socket.io";
# Relics of the old GHCJS build system
stage1Packages = [];
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}";
};
bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs;
libexec = "${bootGhcjs}/libexec/${builtins.replaceStrings ["darwin" "i686"] ["osx" "i386"] stdenv.buildPlatform.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}";
in stdenv.mkDerivation {
name = bootGhcjs.name;
src = passthru.configuredSrc;
nativeBuildInputs = [
bootGhcjs
passthru.bootPkgs.ghc
cabal-install
nodejs
makeWrapper
xorg.lndir
gmp
pkg-config
] ++ lib.optionals stdenv.isDarwin [
gcc # https://github.com/ghcjs/ghcjs/issues/663
];
dontConfigure = true;
dontInstall = true;
buildPhase = ''
export HOME=$TMP
mkdir $HOME/.cabal
touch $HOME/.cabal/config
cd lib/boot
mkdir -p $out/bin
mkdir -p $out/lib/${bootGhcjs.name}
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"
env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j1 --with-ghcjs-bin $out/bin
'';
# We hard code -j1 as a temporary workaround for
# https://github.com/ghcjs/ghcjs/issues/654
# enableParallelBuilding = true;
inherit passthru;
meta.platforms = passthru.bootPkgs.ghc.meta.platforms;
meta.maintainers = [lib.maintainers.elvishjerricco];
meta.hydraPlatforms = [];
meta.broken = true; # https://hydra.nixos.org/build/129701778
}