The attached patch allows for the change in the package database flag in GHC 
7.6.1 (from package-conf to package-db).  The change in flag combined with the 
-Werror option was causing build failures.

>From 2d73aae91cec2bdb377da324f3c9a0324fa07c3a Mon Sep 17 00:00:00 2001
From: Karn Kallio <[email protected]>
Date: Wed, 12 Sep 2012 02:18:59 -0430
Subject: [PATCH] ghc-wrapper: Accomodate GHC 7.6.1 change in the package
 database flag.

---
 pkgs/development/compilers/ghc/wrapper.nix | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/compilers/ghc/wrapper.nix b/pkgs/development/compilers/ghc/wrapper.nix
index 4407f16..547b04e 100644
--- a/pkgs/development/compilers/ghc/wrapper.nix
+++ b/pkgs/development/compilers/ghc/wrapper.nix
@@ -1,5 +1,10 @@
 {stdenv, ghc, makeWrapper, coreutils}:
 
+let databaseFlagSuffix =
+  if builtins.lessThan (builtins.compareVersions ghc.version "7.6.1") 0
+  then "conf"
+  else "db"; in
+
 stdenv.mkDerivation {
   name = "ghc-${ghc.version}-wrapper";
 
@@ -10,15 +15,16 @@ stdenv.mkDerivation {
   installPhase = ''
     mkdir -p $out/bin
     cp $GHCGetPackages $out/bin/ghc-get-packages.sh
+    sed -i '8s/conf/${databaseFlagSuffix}/' $out/bin/ghc-get-packages.sh
     chmod 755 $out/bin/ghc-get-packages.sh
     for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version}; do
       makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\")"
     done
     for prg in runghc runhaskell; do
-      makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" \" -package-conf --ghc-arg=\")"
+      makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" \" -package-${databaseFlagSuffix} --ghc-arg=\")"
     done
     for prg in ghc-pkg ghc-pkg-${ghc.version}; do
-      makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" --package-conf=)"
+      makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" --package-${databaseFlagSuffix}=)"
     done
     for prg in hp2ps hpc hasktags hsc2hs; do
       test -x $ghc/bin/$prg && ln -s $ghc/bin/$prg $out/bin/$prg
@@ -29,7 +35,7 @@ stdenv.mkDerivation {
 
     for arg in \$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\"); do
       case "\$arg" in
-        -package-conf) ;;
+        -package-${databaseFlagSuffix}) ;;
         *)
           CANONICALIZED="\$(${stdenv.lib.optionalString stdenv.isDarwin "${coreutils}/bin/"}readlink -f "\$arg")"
           GHC_PACKAGES_HASH["\$CANONICALIZED"]= ;;
-- 
1.7.12

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to