2008-03-06 03:46:29 +01:00
|
|
|
args: with args; with lib;
|
2007-11-05 10:27:36 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2008-03-06 03:46:29 +01:00
|
|
|
inherit suffix name ghc readline ncurses;
|
2007-11-05 10:27:36 +01:00
|
|
|
|
2008-03-06 03:46:29 +01:00
|
|
|
buildInputs = (libraries ++ [ghcPkgUtil]);
|
2008-03-09 01:08:45 +01:00
|
|
|
tags = map (x : sourceWithTagsDerivation (x.passthru.sourceWithTags))
|
2008-03-06 03:46:29 +01:00
|
|
|
(uniqList { inputList= filter annotatedWithSourceAndTagInfo libraries; } );
|
2007-11-05 10:27:36 +01:00
|
|
|
|
|
|
|
phases="installPhase";
|
|
|
|
|
|
|
|
installPhase="
|
|
|
|
ensureDir \$out/bin
|
|
|
|
if test -n \"\$ghcPackagedLibs\"; then
|
|
|
|
g=:\$(echo \$ghc/lib/ghc-*/package.conf)
|
|
|
|
fi
|
|
|
|
|
|
|
|
for a in ghc ghci ghc-pkg; do
|
|
|
|
app=$(ls -al $ghc/bin/$a | sed -n 's%.*-> \\(.*\\)%\\1%p');
|
|
|
|
cat > \"\$out/bin/\$a$suffix\" << EOF
|
|
|
|
#!`type -f sh | gawk '{ print $3; }'`
|
2008-03-06 03:46:29 +01:00
|
|
|
export LIBRARY_PATH=\$readline/lib:\$ncurses/lib
|
2007-11-05 10:27:36 +01:00
|
|
|
GHC_PACKAGE_PATH=\${GHC_PACKAGE_PATH}\${g} \$ghc/bin/$app \"\\\$@\"
|
|
|
|
EOF
|
|
|
|
chmod +x \"\$out/bin/\$a$suffix\"
|
|
|
|
done
|
2008-02-12 17:24:02 +01:00
|
|
|
|
2008-03-06 03:46:29 +01:00
|
|
|
ensureDir \$out/src
|
2008-02-12 17:24:02 +01:00
|
|
|
for i in \$tags; do
|
2008-03-06 03:46:29 +01:00
|
|
|
ln -s \$i/src/* \$out/src
|
2008-02-12 17:24:02 +01:00
|
|
|
done
|
2007-11-05 10:27:36 +01:00
|
|
|
";
|
|
|
|
}
|