* Put all the GHCs in one directory.

svn path=/nixpkgs/trunk/; revision=15092
This commit is contained in:
Eelco Dolstra
2009-04-16 18:12:59 +00:00
parent 49e5575268
commit 27855da0d9
7 changed files with 4 additions and 45 deletions
+47
View File
@@ -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;
})
+42
View File
@@ -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;
})
+45
View File
@@ -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;
})
@@ -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)