From 23d6fce80d181d88b992dbef7ed7aee2f7a3ac2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20L=C3=B6h?= Date: Fri, 19 Oct 2007 13:24:29 +0000 Subject: [PATCH] * adding ghc-6.8 even though it still segfaults on my machine (it's marked lowPrio for now, so it shouldn't break anything) svn path=/nixpkgs/trunk/; revision=9482 --- pkgs/development/compilers/ghc-6.8/builder.sh | 26 ++++++++++++ .../development/compilers/ghc-6.8/default.nix | 41 +++++++++++++++++++ .../compilers/ghc-6.8/setup-hook.sh | 41 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 +++ 4 files changed, 114 insertions(+) create mode 100644 pkgs/development/compilers/ghc-6.8/builder.sh create mode 100644 pkgs/development/compilers/ghc-6.8/default.nix create mode 100644 pkgs/development/compilers/ghc-6.8/setup-hook.sh diff --git a/pkgs/development/compilers/ghc-6.8/builder.sh b/pkgs/development/compilers/ghc-6.8/builder.sh new file mode 100644 index 00000000000..0ea4fc496f9 --- /dev/null +++ b/pkgs/development/compilers/ghc-6.8/builder.sh @@ -0,0 +1,26 @@ +source $stdenv/setup + +# Setup isolated package management +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 +} +postInstall=postInstall + +configureFlags="--with-gmp-libraries=$gmp/lib --with-readline-libraries=\"$readline/lib\"" + +preConfigure() +{ + chmod u+x rts/gmp/configure + # still requires a hack for ncurses + sed -i "s|^\(library-dirs.*$\)|\1 \"$ncurses/lib\"|" libraries/readline/package.conf.in +} +preConfigure=preConfigure + + +# Standard configure/make/make install +genericBuild diff --git a/pkgs/development/compilers/ghc-6.8/default.nix b/pkgs/development/compilers/ghc-6.8/default.nix new file mode 100644 index 00000000000..1e1577ea292 --- /dev/null +++ b/pkgs/development/compilers/ghc-6.8/default.nix @@ -0,0 +1,41 @@ +{stdenv, fetchurl, readline, ghc, perl, m4, gmp, ncurses}: + +stdenv.mkDerivation (rec { + name = "ghc-6.8.0.20071018"; + homepage = "http://www.haskell.org/ghc"; + + src = map fetchurl [ + { url = "${homepage}/dist/stable/dist/${name}-src.tar.bz2"; + md5 = "7e61bd2a55c2d6ed5a6d996d19d3f6bf"; + } + { url = "${homepage}/dist/stable/dist/${name}-src-extralibs.tar.bz2"; + md5 = "7b155c1d1e7daa492cc2161b3828a377"; + } + ]; + + buildInputs = [ghc readline perl m4]; + + setupHook = ./setup-hook.sh; + + meta = { + description = "The Glasgow Haskell Compiler v6.8 (snapshot)"; + }; + + 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\""; + + # the presence of this file makes Cabal cry for happy while generating makefiles ... + preConfigure = " + echo 'GhcThreaded=NO' > mk/build.mk + rm libraries/haskell-src/Language/Haskell/Parser.ly + "; + + inherit readline gmp ncurses; +}) diff --git a/pkgs/development/compilers/ghc-6.8/setup-hook.sh b/pkgs/development/compilers/ghc-6.8/setup-hook.sh new file mode 100644 index 00000000000..23da6de0382 --- /dev/null +++ b/pkgs/development/compilers/ghc-6.8/setup-hook.sh @@ -0,0 +1,41 @@ +# Support dir for isolating GHC +ghc_support=$TMPDIR/ghc-6.6-nix-support +mkdir -p $ghc_support + +# Create isolated package config +packages_db=$ghc_support/package.conf +cp $ghc/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 \"$ghc/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) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f700278211d..b047fc31839 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -890,6 +890,12 @@ rec { ghc = ghc661; + ghc68 = lowPrio (appendToName "snapshot" (import ../development/compilers/ghc-6.8 { + inherit fetchurl stdenv readline perl gmp ncurses; + m4 = gnum4; + ghc = ghcboot; + })); + ghc661 = import ../development/compilers/ghc-6.6.1 { inherit fetchurl stdenv readline perl gmp ncurses; m4 = gnum4;