From 3f013f7beeadf290705abba5b9e4555930832cfc Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 29 Jan 2008 13:26:18 +0000 Subject: [PATCH] update ghc proposal (still not working) svn path=/nixpkgs/trunk/; revision=10388 --- pkgs/top-level/all-packages.nix | 30 +++++++++++++----------------- pkgs/top-level/builder-defs.nix | 10 +++++----- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e2d4ac41c89..29f51c908d7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1026,8 +1026,6 @@ rec { profiledCompiler = true; }); - /* doesn't work yet - # This new ghc stuff is under heavy development and might change ! # usage: see ghcPkgUtil.sh - use setup-new2 because of PATH_DELIMITER @@ -1052,20 +1050,20 @@ rec { }; # this will change in the future - ghc68_extra_libs = - ghc : let - deriv = name : goSrcDir : deps : - let bd = builderDefs { - goSrcDir = "ghc-* /libraries"; - src = ghc.extra_src; - } null; in - stdenv.mkDerivation rec { - inherit name; - builder = bd.writeScript (name + "-builder") - (bd.textClosure [builderDefs.haskellBuilderDefs]); - }; + ghc68_extra_libs = ghc: + let deriv = name : goSrcDir : deps : + let localDefs = builderDefs { + inherit goSrcDir; + src = ghc.extra_src; + } null; + in with localDefs; + stdenv.mkDerivation rec { + inherit name; + builder = writeScript (name + "-builder") + (textClosure localDefs [ cabalBuild ]); + }; # using nvs to be able to use mtl-1.1.0.0 as name - in lib.nvs "mtl-1.1.0.0" (deriv "mtl-1.1.0.0" "libraries/mtl" [ (__getAttr "base-3.0.1.0" ghc.core_libs) ]); + in lib.nvs "mtl-1.1.0.0" (deriv "mtl-1.1.0.0" "cd libraries/mtl" [ (__getAttr "base-3.0.1.0" ghc.core_libs) ]); # the wrappers basically does one thing: It defines GHC_PACKAGE_PATH before calling ghc{i,-pkg} # So you can have different wrappers with different library combinations @@ -1091,8 +1089,6 @@ rec { inherit ghc; }; - */ - # ghc66boot = import ../development/compilers/ghc-6.6-boot { # inherit fetchurl stdenv perl readline; # m4 = gnum4; diff --git a/pkgs/top-level/builder-defs.nix b/pkgs/top-level/builder-defs.nix index e70191f091c..6b53ba76fd4 100644 --- a/pkgs/top-level/builder-defs.nix +++ b/pkgs/top-level/builder-defs.nix @@ -199,6 +199,7 @@ args: with args; with stringsWithDeps; with lib; bzip2 -d <${s} > \$PWD/\$(basename ${s} .bz2)/\${NAME#*-} cd \$(basename ${s} .bz2) " else (abort "unknown archive type : ${s}"))+ + # goSrcDir is typically something like "cd mysubdir" .. but can be anything else (if args ? goSrcDir then args.goSrcDir else "") ) ["minInit"]; @@ -283,7 +284,7 @@ args: with args; with stringsWithDeps; with lib; replaceScripts = l:(concatStringsSep "\n" (pairMap replaceInScript l)); doReplaceScripts = FullDepEntry (replaceScripts (getAttr ["shellReplacements"] [] args)) [minInit]; makeNest = x:(if x==defNest.text then x else "startNest\n" + x + "\nstopNest\n"); - textClosure = textClosureMapOveridable makeNest; + textClosure = a : steps : textClosureMapOveridable makeNest a (["defNest"] ++ steps); inherit noDepEntry FullDepEntry PackEntry; @@ -355,7 +356,7 @@ args: with args; with stringsWithDeps; with lib; PACKAGE_DB=$out/nix-support/package.conf; echo '[]' > \"$PACKAGE_DB\"; setupHookRegisteringPackageDatabase - }" [defSetupHookRegisteringPackageDatabase]; + }" ["defSetupHookRegisteringPackageDatabase" "defEnsureDir"]; # Cabal does only support --user ($HOME/.ghc/** ) and --global (/nix/store/*-ghc/lib/...) # But we need kind of --custom=my-package-db @@ -370,8 +371,7 @@ args: with args; with stringsWithDeps; with lib; # and ./setup register --gen-script to install to our local database # after replacing /usr/lib etc with our pure $out path cabalBuild = FullDepEntry - (if (args ? subdir) then "cd ${args.subdir}" else "")+ " - createEmptyPackageDatabaseAndSetupHook + " createEmptyPackageDatabaseAndSetupHook ghc --make setup.hs -o setup \$CABAL_SETUP configure \$CABAL_SETUP build @@ -380,6 +380,6 @@ args: with args; with stringsWithDeps; with lib; sed -e 's=/usr/local/lib=\$out=g' \\ -i register.sh GHC_PACKAGE_PATH=\$PACKAGE_DB ./register.sh - " [defCreateEmptyPackageDatabaseAndSetupHook defCabalSetupCmd]; + " ["defCreateEmptyPackageDatabaseAndSetupHook" "defCabalSetupCmd"]; }) // args