nixpkgs/pkgs/development/libraries/haskell/generic/ghcPkgUtil.sh
Marc Weber fff1ba967e New proposal on howto library dependencies could be handled.
Just install ghc68_wrapper which will install the required dependencies ghc
(and libraries) itself.
The list libraries given in the wrapper attribute set can be user tuned in the future ?
An alternative would be creating something similar to the gcc/g++ include/ lib/ scheme which
is could be used by ghc to find installed packages..

svn path=/nixpkgs/trunk/; revision=9581
2007-11-05 09:27:36 +00:00

38 lines
1.1 KiB
Bash

# mantainer: Marc Weber (marco-oweber@gmx.de)
#
# example usage: add ghcPkgUtil to buildInputs then somewhere in buildPhase:
#
# createEmptyPackageDatabaseAndSetupHook
# configure --with-package-db=$PACKAGE_DB
# ... compile ghc library ...
# add your library to propagatedBuildInputs instead of buildInputs
# in all depending libraries
# creates a setup hook
# adding the package database
# nix-support/package.conf to GHC_PACKAGE_PATH
# if not already contained
setupHookRegisteringPackageDatabase(){
ensureDir $out/nix-support;
if test -n "$1"; then
local pkgdb=$1
else
local pkgdb=$out/nix-support/package.conf
fi
cat >> $out/nix-support/setup-hook << EOF
echo \$GHC_PACKAGE_PATH | grep -l $pkgdb &> /dev/null || \
export GHC_PACKAGE_PATH=\$GHC_PACKAGE_PATH\${GHC_PACKAGE_PATH:+$PATH_DELIMITER}$pkgdb;
EOF
}
# create an empty package database in which the new library can be registered.
createEmptyPackageDatabaseAndSetupHook(){
ensureDir $out/nix-support;
PACKAGE_DB=$out/nix-support/package.conf;
echo '[]' > "$PACKAGE_DB";
setupHookRegisteringPackageDatabase
}