haskell: use GHCJS to build Setup.hs for GHCJS packages
Closes https://github.com/NixOS/nixpkgs/pull/23614.
This commit is contained in:
committed by
Peter Simons
parent
80a52e22b3
commit
2553ceb982
@@ -1,5 +1,5 @@
|
||||
{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
|
||||
, jailbreak-cabal, hscolour, cpphs
|
||||
, jailbreak-cabal, hscolour, cpphs, nodejs
|
||||
}: let isCross = (ghc.cross or null) != null; in
|
||||
|
||||
{ pname
|
||||
@@ -133,6 +133,7 @@ let
|
||||
|
||||
setupCompileFlags = [
|
||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
||||
(optionalString isGhcjs "-build-runner")
|
||||
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||
# https://github.com/haskell/cabal/issues/2398
|
||||
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
||||
@@ -157,7 +158,7 @@ let
|
||||
|
||||
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
||||
|
||||
setupBuilder = if isCross || isGhcjs then "${nativeGhc}/bin/ghc" else ghcCommand;
|
||||
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
|
||||
setupCommand = "./Setup";
|
||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
||||
@@ -294,6 +295,14 @@ stdenv.mkDerivation ({
|
||||
local pkgId=$( ${gnused}/bin/sed -n -e 's|^id: ||p' $packageConfFile )
|
||||
mv $packageConfFile $packageConfDir/$pkgId.conf
|
||||
''}
|
||||
${optionalString isGhcjs ''
|
||||
for exeDir in "$out/bin/"*.jsexe; do
|
||||
exe="''${exeDir%.jsexe}"
|
||||
printf '%s\n' '#!${nodejs}/bin/node' > "$exe"
|
||||
cat "$exeDir/all.js" >> "$exe"
|
||||
chmod +x "$exe"
|
||||
done
|
||||
''}
|
||||
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
|
||||
${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") ''
|
||||
for exe in "$out/bin/"* ; do
|
||||
|
||||
Reference in New Issue
Block a user