* GHC setup hook: don't generate wrappers around ghc etc., instead

set GHC_PACKAGE_PATH.
* Let Cabal generate a package configuration file
  ($out/nix-support/ghc-package.conf) instead of a registration
  script.

svn path=/nixpkgs/trunk/; revision=15127
This commit is contained in:
Eelco Dolstra 2009-04-18 15:23:00 +00:00
parent 9c509e2583
commit baad5d7cb4
4 changed files with 12 additions and 44 deletions

View File

@ -1,40 +1,15 @@
# Support dir for isolating GHC
ghc_support=$TMPDIR/ghc-6.8-nix-support
ensureDir $ghc_support
# Create isolated package config # Create isolated package config
packages_db=$ghc_support/package.conf packages_db=$TMPDIR/.package.conf
cp @ghc@/lib/ghc-*/package.conf $packages_db cp @ghc@/lib/ghc-*/package.conf $packages_db
chmod +w $packages_db chmod u+w $packages_db
# Generate wrappers for GHC that use the isolated package config export GHC_PACKAGE_PATH=$packages_db
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 # Env hook to add packages to the package config
addLibToPackageConf () addLibToPackageConf () {
{ local confFile=$1/nix-support/ghc-package.conf
local regscript=$1/nix-support/register-ghclib.sh if test -f $confFile; then
if test -f $regscript; then @ghc@/bin/ghc-pkg register $confFile
local oldpath=$PATH
export PATH=$ghc_support:$PATH
sh $regscript $package_db
export PATH=$oldpath
fi fi
} }

View File

@ -78,16 +78,10 @@ attrs :
eval "$preInstall" eval "$preInstall"
./Setup copy ./Setup copy
./Setup register --gen-script
mkdir -p $out/nix-support
if test -f register.sh; then
sed -i 's/|.*\(ghc-pkg update\)/| \1/' register.sh
cp register.sh $out/nix-support/register-ghclib.sh
sed -i 's/\(ghc-pkg update\)/\1 --user/' register.sh
mkdir -p $out/bin
cp register.sh $out/bin/register-${self.name}.sh
fi
ensureDir $out/nix-support
./Setup register --gen-pkg-config=$out/nix-support/ghc-package.conf
eval "$postInstall" eval "$postInstall"
''; '';
}; };

View File

@ -113,8 +113,8 @@ rec {
# Compilers. # Compilers.
ehc = import ../development/compilers/ehc { ehc = import ../development/compilers/ehc {
inherit ghc; inherit ghc uulib uuagc;
inherit (pkgs) fetchsvn stdenv coreutils m4 libtool uulib uuagc llvm; inherit (pkgs) fetchsvn stdenv coreutils m4 libtool llvm;
}; };

View File

@ -293,7 +293,6 @@ in {
wget = all; wget = all;
wine = ["i686-linux"]; wine = ["i686-linux"];
wirelesstools = linux; wirelesstools = linux;
wxHaskell = linux;
x11_ssh_askpass = linux; x11_ssh_askpass = linux;
xchm = linux; xchm = linux;
xfig = x11Supported; xfig = x11Supported;