diff options
author | Charles Strahan <charles.c.strahan@gmail.com> | 2015-03-12 23:20:56 -0400 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2015-03-29 03:34:04 +0200 |
commit | d590a0f4b63901766b94ef8691baa389db56d074 (patch) | |
tree | 7bf5ab1aa0c0159aeff3ceca338117cc5f6ef5e1 /pkgs/development/haskell-modules/with-packages-wrapper.nix | |
parent | 1901f3fe77d24c0eef00f73f73c176fae3bcb44e (diff) |
ghcjs: support for Haskell-NG
closes #5828
closes #6786
Diffstat (limited to 'pkgs/development/haskell-modules/with-packages-wrapper.nix')
-rw-r--r-- | pkgs/development/haskell-modules/with-packages-wrapper.nix | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix index b2071fa61c0f..d2116a879d5a 100644 --- a/pkgs/development/haskell-modules/with-packages-wrapper.nix +++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix @@ -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; |