afde8e6270
note: the old GHC 6.4(.2?) version is still there. I reused the bootstrap-version to bootstrap GHC-6.6. And some other packages depend on the old GHC version as well. note: only use this package for building other packages. If you install it as an end-user, you'll only be able to use the default GHC libraries, because other libraries are only privately registered to this GHC version during a nix-build by hooks (which are not executed when you run GHC yourself as an end-user). Consequently, also added a newer version of uulib and uuagc. svn path=/nixpkgs/trunk/; revision=7346
42 lines
1.3 KiB
Bash
42 lines
1.3 KiB
Bash
# 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 --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)
|