about summary refs log tree commit diff
path: root/pkgs/development/compilers/ghc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-16 18:12:59 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-16 18:12:59 +0000
commit27855da0d9e5b835848019f6af627470aa2f4137 (patch)
tree743f1a25f007bbf989849f006622945c9845abed /pkgs/development/compilers/ghc
parent49e5575268f564799a3ee386941541daab8da1d0 (diff)
* Put all the GHCs in one directory.
svn path=/nixpkgs/trunk/; revision=15092
Diffstat (limited to 'pkgs/development/compilers/ghc')
-rw-r--r--pkgs/development/compilers/ghc/6.4.2.nix (renamed from pkgs/development/compilers/ghc/default.nix)0
-rw-r--r--pkgs/development/compilers/ghc/6.6.1.nix47
-rw-r--r--pkgs/development/compilers/ghc/6.8.2.nix42
-rw-r--r--pkgs/development/compilers/ghc/6.8.3.nix45
-rw-r--r--pkgs/development/compilers/ghc/setup-hook.sh41
5 files changed, 175 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/default.nix b/pkgs/development/compilers/ghc/6.4.2.nix
index c175f242ff109..c175f242ff109 100644
--- a/pkgs/development/compilers/ghc/default.nix
+++ b/pkgs/development/compilers/ghc/6.4.2.nix
diff --git a/pkgs/development/compilers/ghc/6.6.1.nix b/pkgs/development/compilers/ghc/6.6.1.nix
new file mode 100644
index 0000000000000..841306578eb69
--- /dev/null
+++ b/pkgs/development/compilers/ghc/6.6.1.nix
@@ -0,0 +1,47 @@
+{stdenv, fetchurl, readline, ghc, perl58, m4, gmp, ncurses}:
+
+stdenv.mkDerivation (rec {
+  name = "ghc-6.6.1";
+
+  src = map fetchurl [
+    { url = http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src.tar.bz2;
+      md5 = "ba9f4aec2fde5ff1e1548ae69b78aeb0";
+    }
+    { url = http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src-extralibs.tar.bz2;
+      md5 = "43a26b81608b206c056adc3032f7da2a";
+    }
+  ];
+
+  buildInputs = [ghc readline perl58 m4 gmp];
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    description = "The Glasgow Haskell Compiler";
+  };
+
+  postInstall = ''
+    ensureDir "$out/nix-support"
+    echo "# Path to the GHC compiler directory in the store" > $out/nix-support/setup-hook
+    echo "ghc=$out" >> $out/nix-support/setup-hook
+    echo ""         >> $out/nix-support/setup-hook
+    cat $setupHook  >> $out/nix-support/setup-hook
+  '';
+
+  configureFlags=[
+    "--with-gmp-libraries=${gmp}/lib"
+    "--with-readline-libraries=${readline}/lib"
+    "--with-gmp-includes=${gmp}/include"
+    "--with-gcc=${gcc}/bin/gcc"
+  ];
+
+  preConfigure = ''
+    # still requires a hack for ncurses
+    sed -i "s|^\(library-dirs.*$\)|\1 \"${ncurses}/lib\"|" libraries/readline/package.conf.in
+    # fix for gcc 4.2
+    echo "SplitObjs=NO" >> mk/build.mk
+  '';
+
+  inherit (stdenv) gcc;
+  inherit readline gmp ncurses;
+})
diff --git a/pkgs/development/compilers/ghc/6.8.2.nix b/pkgs/development/compilers/ghc/6.8.2.nix
new file mode 100644
index 0000000000000..9b78a979a9678
--- /dev/null
+++ b/pkgs/development/compilers/ghc/6.8.2.nix
@@ -0,0 +1,42 @@
+{stdenv, fetchurl, readline, ghc, perl, m4, gmp, ncurses}:
+
+stdenv.mkDerivation (rec {
+  version = "6.8.2";
+  name = "ghc-${version}";
+  homepage = "http://www.haskell.org/ghc";
+
+  src = map fetchurl [
+    { url = "${homepage}/dist/${version}/${name}-src.tar.bz2";
+      sha256 = "2d10f973c35e8d7d9f62b53e26fef90177a9a15105cda4b917340ba7696a22d9";
+    }
+    { url = "${homepage}/dist/${version}/${name}-src-extralibs.tar.bz2";
+      md5 = "d199c50814188fb77355d41058b8613c";
+    }
+  ];
+
+  buildInputs = [ghc readline perl m4 gmp];
+
+  # The setup hook is executed by other packages building with ghc.
+  # It then looks for package configurations that are available and
+  # build a package database on the fly.
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    description = "The Glasgow Haskell Compiler";
+  };
+
+  configureFlags=[
+    "--with-gmp-libraries=${gmp}/lib"
+    "--with-gmp-includes=${gmp}/include"
+    "--with-readline-libraries=${readline}/lib"
+    "--with-gcc=${gcc}/bin/gcc"
+  ];
+
+  preConfigure = "
+    # still requires a hack for ncurses
+    sed -i \"s|^\\\(ld-options.*$\\\)|\\\1 -L${ncurses}/lib|\" libraries/readline/readline.buildinfo.in
+  ";
+
+  inherit (stdenv) gcc;
+  inherit readline gmp ncurses;
+})
diff --git a/pkgs/development/compilers/ghc/6.8.3.nix b/pkgs/development/compilers/ghc/6.8.3.nix
new file mode 100644
index 0000000000000..98ddca5b36dcc
--- /dev/null
+++ b/pkgs/development/compilers/ghc/6.8.3.nix
@@ -0,0 +1,45 @@
+{stdenv, fetchurl, readline, ghc, perl, m4, gmp, ncurses, haddock}:
+
+stdenv.mkDerivation (rec {
+  name = "ghc-6.8.3";
+  homepage = "http://www.haskell.org/ghc";
+
+  src = map fetchurl [
+    { url    = "${homepage}/dist/6.8.3/${name}-src.tar.bz2";
+      sha256 = "1fc1ff82a555532f1c9d2dc628fd9de5e6ebab2ce6ee9490a34174ceb6f76e6b";
+    }
+    { url    = "${homepage}/dist/6.8.3/${name}-src-extralibs.tar.bz2";
+      sha256 = "ee2f5ba6a46157fc53eae515cb6fa1ed3c5023e7eac15981d92af0af00ee2ba2";
+    }
+  ];
+
+  buildInputs = [ghc readline perl m4 gmp haddock];
+
+  # The setup hook is executed by other packages building with ghc.
+  # It then looks for package configurations that are available and
+  # build a package database on the fly.
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    description = "The Glasgow Haskell Compiler";
+  };
+
+  configureFlags=[
+    "--with-gmp-libraries=${gmp}/lib"
+    "--with-gmp-includes=${gmp}/include"
+    "--with-readline-libraries=${readline}/lib"
+    "--with-gcc=${gcc}/bin/gcc"
+  ];
+
+  preConfigure = ''
+    # still requires a hack for ncurses
+    sed -i "s|^\(ld-options.*$\)|\1 -L${ncurses}/lib|" libraries/readline/readline.buildinfo.in
+    # build haddock docs
+    echo "HADDOCK_DOCS = YES" >> mk/build.mk
+  '';
+
+  installTargets = ["install" "install-docs"];
+
+  inherit (stdenv) gcc;
+  inherit readline gmp ncurses;
+})
diff --git a/pkgs/development/compilers/ghc/setup-hook.sh b/pkgs/development/compilers/ghc/setup-hook.sh
new file mode 100644
index 0000000000000..263f46f52d429
--- /dev/null
+++ b/pkgs/development/compilers/ghc/setup-hook.sh
@@ -0,0 +1,41 @@
+# Support dir for isolating GHC
+ghc_support=$TMPDIR/ghc-6.8-nix-support
+ensureDir $ghc_support
+
+# Create isolated package config
+packages_db=$ghc_support/package.conf
+cp @out@/lib/ghc-*/package.conf $packages_db
+chmod +w $packages_db
+
+# Generate wrappers for GHC that use the isolated package config
+makeWrapper() {
+  wrapperName="$1"
+  wrapper="$ghc_support/$wrapperName"
+  shift #the other arguments are passed to the source app
+  echo '#!'"$SHELL" > "$wrapper"
+  echo "exec \"@out@/bin/$wrapperName\" $@" '"$@"' >> "$wrapper"
+  chmod +x "$wrapper"
+}
+
+makeWrapper "ghc"         "-no-user-package-conf -package-conf $packages_db"
+makeWrapper "ghci"        "-no-user-package-conf -package-conf $packages_db"
+makeWrapper "runghc"      "-no-user-package-conf -package-conf $packages_db"
+makeWrapper "runhaskell"  "-no-user-package-conf -package-conf $packages_db"
+makeWrapper "ghc-pkg"     "--global-conf $packages_db"
+
+# Add wrappers to search path
+export _PATH=$ghc_support:$_PATH
+
+# Env hook to add packages to the package config
+addLibToPackageConf ()
+{
+    local regscript=$1/nix-support/register-ghclib.sh
+    if test -f $regscript; then
+        local oldpath=$PATH
+        export PATH=$ghc_support:$PATH
+        sh $regscript $package_db
+        export PATH=$oldpath
+    fi
+}
+
+envHooks=(${envHooks[@]} addLibToPackageConf)