ghcjs: support for Haskell-NG

closes #5828
closes #6786
This commit is contained in:
Charles Strahan
2015-03-29 03:34:04 +02:00
committed by Peter Simons
parent 1901f3fe77
commit d590a0f4b6
13 changed files with 287 additions and 476 deletions
@@ -29,9 +29,10 @@ assert versionOlder "6.12" ghc.version;
# fi
let
ghc761OrLater = versionOlder "7.6.1" ghc.version;
ghc761OrLater = ghc.isGhcjs || versionOlder "7.6.1" ghc.version;
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
libDir = "$out/lib/ghc-${ghc.version}";
ghcCommand = if ghc.isGhcjs then "ghcjs" else "ghc";
libDir = "$out/lib/${ghcCommand}-${ghc.version}";
docDir = "$out/share/doc/ghc/html";
packageCfgDir = "${libDir}/package.conf.d";
paths = filter (x: x ? isHaskellLibrary) (closePropagation packages);
@@ -50,6 +51,10 @@ buildEnv {
postBuild = ''
. ${makeWrapper}/nix-support/setup-hook
${lib.optionalString ghc.isGhcjs ''
cp -r ${ghc}/${ghc.libDir}/* ${libDir}/
''}
if test -L "$out/bin"; then
binTarget="$(readlink -f "$out/bin")"
rm "$out/bin"
@@ -59,32 +64,32 @@ buildEnv {
for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version}; do
rm -f $out/bin/$prg
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
--add-flags '"-B$NIX_GHC_LIBDIR"' \
--set "NIX_GHC" "$out/bin/ghc" \
--set "NIX_GHCPKG" "$out/bin/ghc-pkg" \
--set "NIX_GHC_DOCDIR" "${docDir}" \
--set "NIX_GHC_LIBDIR" "${libDir}" \
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
--add-flags '"-B$NIX_GHC_LIBDIR"' \
--set "NIX_GHC" "$out/bin/${ghcCommand}" \
--set "NIX_GHCPKG" "$out/bin/${ghcCommand}-pkg" \
--set "NIX_GHC_DOCDIR" "${docDir}" \
--set "NIX_GHC_LIBDIR" "${libDir}" \
${optionalString withLLVM ''--prefix "PATH" ":" "${llvm}"''}
done
for prg in runghc runhaskell; do
rm -f $out/bin/$prg
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
--add-flags "-f $out/bin/ghc" \
--set "NIX_GHC" "$out/bin/ghc" \
--set "NIX_GHCPKG" "$out/bin/ghc-pkg" \
--set "NIX_GHC_DOCDIR" "${docDir}" \
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
--add-flags "-f $out/bin/ghc" \
--set "NIX_GHC" "$out/bin/${ghcCommand}" \
--set "NIX_GHCPKG" "$out/bin/${ghcCommand}-pkg" \
--set "NIX_GHC_DOCDIR" "${docDir}" \
--set "NIX_GHC_LIBDIR" "${libDir}"
done
for prg in ghc-pkg ghc-pkg-${ghc.version}; do
for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do
rm -f $out/bin/$prg
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
done
${optionalString hasLibraries "$out/bin/ghc-pkg recache"}
$out/bin/ghc-pkg check
${optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
$out/bin/${ghcCommand}-pkg check
'';
} // {
preferLocalBuild = true;