Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'ryantrinkle/ghcjs-update' into ghcjs-up…
Browse files Browse the repository at this point in the history
…date

# Conflicts:
#	pkgs/development/compilers/ghcjs/default.nix
#	pkgs/development/haskell-modules/with-packages-wrapper.nix
  • Loading branch information
Ryan Trinkle committed Feb 7, 2017
2 parents 46bec22 + 09c3d04 commit f311065
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions pkgs/development/compilers/ghcjs/base.nix
Expand Up @@ -88,6 +88,8 @@
]

, stage2 ? import ./stage2.nix

, ghcLibdir ? null
}:
let
inherit (bootPkgs) ghc;
Expand Down Expand Up @@ -159,6 +161,7 @@ in mkDerivation (rec {
--with-cabal ${cabal-install}/bin/cabal \
--with-gmp-includes ${gmp.dev}/include \
--with-gmp-libraries ${gmp.out}/lib
${if ghcLibdir == null then "" else ''echo "${ghcLibdir}" >$out/lib/ghcjs-${version}/ghc_libdir''}
'';
passthru = let
ghcjsNodePkgs = callPackage ../../../top-level/node-packages.nix {
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/compilers/ghcjs/ghcjs.patch
@@ -1,8 +1,8 @@
diff --git a/src-bin/Boot.hs b/src-bin/Boot.hs
index db8b12e..7b815c5 100644
index 8e19b1d..03d3ac0 100644
--- a/src-bin/Boot.hs
+++ b/src-bin/Boot.hs
@@ -526,9 +526,7 @@ initPackageDB :: B ()
@@ -530,9 +530,7 @@ initPackageDB :: B ()
initPackageDB = do
msg info "creating package databases"
initDB "--global" <^> beLocations . blGlobalDB
Expand All @@ -12,7 +12,7 @@ index db8b12e..7b815c5 100644
initDB dbName db = do
rm_rf db >> mkdir_p db
ghcjs_pkg_ ["init", toTextI db] `catchAny_` return ()
@@ -552,29 +550,22 @@ installDevelopmentTree = subTop $ do
@@ -556,29 +554,22 @@ installDevelopmentTree = subTop $ do
msgD info $ "preparing development boot tree"
checkpoint' "ghcjs-boot-git" "ghcjs-boot repository already cloned and prepared" $ do
testGit "ghcjs-boot" >>= \case
Expand Down Expand Up @@ -46,7 +46,7 @@ index db8b12e..7b815c5 100644
mapM_ patchPackage =<< allPackages
preparePrimops
buildGenPrim
@@ -1110,14 +1101,14 @@ cabalInstallFlags parmakeGhcjs = do
@@ -1167,14 +1158,14 @@ cabalInstallFlags parmakeGhcjs = do
, "--avoid-reinstalls"
, "--builddir", "dist"
, "--with-compiler", ghcjs ^. pgmLocText
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/haskell-modules/generic-builder.nix
Expand Up @@ -187,7 +187,7 @@ stdenv.mkDerivation ({
runHook preSetupCompilerEnvironment
echo "Build with ${ghc}."
export PATH="${ghc}/bin:$PATH"
export PATH="${if ghc.isGhcjs or false then ghcEnv else ghc}/bin:$PATH"
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
packageConfDir="$TMPDIR/package.conf.d"
Expand Down
12 changes: 11 additions & 1 deletion pkgs/development/haskell-modules/with-packages-wrapper.nix
Expand Up @@ -2,6 +2,7 @@
, ignoreCollisions ? false, withLLVM ? false
, postBuild ? ""
, haskellPackages
, ghcLibdir ? null
}:

# This wrapper works only with GHC 6.12 or later.
Expand Down Expand Up @@ -46,14 +47,22 @@ let
llvm = lib.makeBinPath
([ llvmPackages.llvm ]
++ lib.optional stdenv.isDarwin llvmPackages.clang);
ghcLibdirLink = stdenv.mkDerivation {
name = "ghc_libdir";
inherit ghcLibdir;
buildCommand = ''
mkdir -p ${libDir}
echo "$ghcLibdir" > ${libDir}/ghc_libdir_override
'';
};
in
if paths == [] && !withLLVM then ghc else
buildEnv {
# this makes computing paths from the name attribute impossible;
# if such a feature is needed, the real compiler name should be saved
# as a dedicated drv attribute, like `compiler-name`
name = ghc.name + "-with-packages";
paths = paths ++ [ghc];
paths = paths ++ [ghc] ++ lib.optional isGhcjs ghcLibdirLink;
extraOutputsToInstall = [ "out" "doc" ];
inherit ignoreCollisions;
postBuild = ''
Expand Down Expand Up @@ -102,6 +111,7 @@ buildEnv {
done
${lib.optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
${lib.optionalString (isGhcjs && ghcLibdir != null) "mv ${libDir}/ghc_libdir_override ${libDir}/ghc_libdir"}
$out/bin/${ghcCommand}-pkg check
'' + postBuild;
passthru = {
Expand Down

0 comments on commit f311065

Please sign in to comment.