diff --git a/pkgs/development/compilers/ghc-6.6.1/builder.sh b/pkgs/development/compilers/ghc-6.6.1/builder.sh new file mode 100644 index 00000000000..75b97218f30 --- /dev/null +++ b/pkgs/development/compilers/ghc-6.6.1/builder.sh @@ -0,0 +1,21 @@ +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 + +preConfigure() +{ + chmod u+x rts/gmp/configure +} +preConfigure=preConfigure + +# Standard configure/make/make install +genericBuild diff --git a/pkgs/development/compilers/ghc-6.6.1/default.nix b/pkgs/development/compilers/ghc-6.6.1/default.nix new file mode 100644 index 00000000000..06f5a2f9fb8 --- /dev/null +++ b/pkgs/development/compilers/ghc-6.6.1/default.nix @@ -0,0 +1,24 @@ +{stdenv, fetchurl, readline, ghc, perl, m4}: + +stdenv.mkDerivation { + 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 = "dea271503463bd28c27f25ab90998633"; + } + { url = http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src-extralibs.tar.bz2; + md5 = "43a26b81608b206c056adc3032f7da2a"; + } + ]; + + builder = ./builder.sh; + + buildInputs = [ghc readline perl m4]; + + setupHook = ./setup-hook.sh; + + meta = { + description = "The Glasgow Haskell Compiler v6.6.1"; + }; +} diff --git a/pkgs/development/compilers/ghc-6.6.1/setup-hook.sh b/pkgs/development/compilers/ghc-6.6.1/setup-hook.sh new file mode 100644 index 00000000000..23da6de0382 --- /dev/null +++ b/pkgs/development/compilers/ghc-6.6.1/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 f30fe2aecf9..3d9eb111c18 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -690,6 +690,12 @@ rec { ghc = ghc66; + ghc661 = import ../development/compilers/ghc-6.6.1 { + inherit fetchurl stdenv readline perl; + m4 = gnum4; + ghc = ghcboot; + }; + ghc66 = import ../development/compilers/ghc-6.6 { inherit fetchurl stdenv readline perl; m4 = gnum4;