mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
Extended ghcWithPackages to link binaries.
svn path=/nixpkgs/trunk/; revision=30726
This commit is contained in:
parent
dccc3f83b3
commit
f237a3a418
@ -1,7 +1,7 @@
|
||||
{stdenv, ghcPlain, packages ? [], makeWrapper}:
|
||||
{stdenv, ghc, packages ? [], makeWrapper}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ghc-${ghcPlain.version}-linkdir";
|
||||
name = "ghc-${ghc.version}-linkdir";
|
||||
|
||||
allPackages = stdenv.lib.closePropagation packages;
|
||||
buildInputs = allPackages ++ [makeWrapper];
|
||||
@ -10,58 +10,71 @@ stdenv.mkDerivation rec {
|
||||
unpackPhase = "true";
|
||||
|
||||
installPhase = ''
|
||||
originalTopDir="${ghcPlain}/lib/ghc-${ghcPlain.version}"
|
||||
originalTopDir="${ghc}/lib/ghc-${ghc.version}"
|
||||
originalPkgDir="$originalTopDir/package.conf.d"
|
||||
linkedTopDir="$out/lib"
|
||||
linkedPkgDir="$linkedTopDir/package.conf.d"
|
||||
|
||||
ensureDir $out/bin
|
||||
cd $out/bin
|
||||
|
||||
echo "Generating wrappers ..."
|
||||
|
||||
for prg in ghc ghci ghc-${ghcPlain.version} ghci-${ghcPlain.version}; do
|
||||
makeWrapper ${ghcPlain}/bin/$prg $out/bin/$prg --add-flags "-B$linkedTopDir"
|
||||
done
|
||||
|
||||
for prg in runghc runhaskell; do
|
||||
makeWrapper ${ghcPlain}/bin/$prg $out/bin/$prg --add-flags "-f $out/bin/ghc"
|
||||
done
|
||||
|
||||
for prg in ghc-pkg ghc-pkg-${ghcPlain.version}; do
|
||||
makeWrapper ${ghcPlain}/bin/$prg $out/bin/$prg --add-flags "--global-conf $linkedPkgDir"
|
||||
done
|
||||
|
||||
for prg in hp2ps hpc hasktags hsc2hs haddock haddock-${ghcPlain.version}; do
|
||||
test -x ${ghcPlain}/bin/$prg && ln -s ${ghcPlain}/bin/$prg $out/bin/$prg
|
||||
done
|
||||
|
||||
ensureDir $linkedTopDir
|
||||
cd $linkedTopDir
|
||||
ensureDir $linkedPkgDir
|
||||
|
||||
echo "Linking GHC core libraries:"
|
||||
|
||||
if test -f $originalTopDir/settings; then
|
||||
echo "Linking $originalTopDir/settings ..."
|
||||
ln -s $originalTopDir/settings .
|
||||
echo -n "Linking $originalTopDir/settings "
|
||||
ln -s $originalTopDir/settings $linkedTopDir
|
||||
echo .
|
||||
fi
|
||||
|
||||
ensureDir $linkedPkgDir
|
||||
cd $linkedPkgDir
|
||||
echo -n "Linking $originalPkgDir "
|
||||
for f in $originalPkgDir/*.conf; do
|
||||
ln -s $f $linkedPkgDir
|
||||
echo -n .
|
||||
done
|
||||
echo
|
||||
|
||||
echo "Linking $originalPkgDir ..."
|
||||
ln -s $originalPkgDir/*.conf .
|
||||
echo "Linking selected packages and dependencies:"
|
||||
|
||||
for currentPath in ${stdenv.lib.concatStringsSep " " allPackages}; do
|
||||
currentPkgDir="$currentPath/lib/ghc-pkgs/ghc-${ghcPlain.version}"
|
||||
if test -d $currentPkgDir; then
|
||||
echo "Linking $currentPkgDir ..."
|
||||
ln -s $currentPkgDir/*.conf .
|
||||
fi
|
||||
currentPkgDir="$currentPath/lib/ghc-pkgs/ghc-${ghc.version}"
|
||||
echo -n "Linking $currentPath "
|
||||
for f in $currentPath/bin/*; do
|
||||
ln -s $f $out/bin
|
||||
echo -n .
|
||||
done
|
||||
for f in $currentPkgDir/*.conf; do
|
||||
ln -s $f $linkedPkgDir
|
||||
echo -n .
|
||||
done
|
||||
echo
|
||||
done
|
||||
|
||||
echo "Generating package cache ..."
|
||||
${ghcPlain}/bin/ghc-pkg --global-conf $linkedPkgDir recache
|
||||
${ghc}/bin/ghc-pkg --global-conf $linkedPkgDir recache
|
||||
|
||||
echo -n "Generating wrappers "
|
||||
|
||||
for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version}; do
|
||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "-B$linkedTopDir"
|
||||
echo -n .
|
||||
done
|
||||
|
||||
for prg in runghc runhaskell; do
|
||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "-f $out/bin/ghc"
|
||||
echo -n .
|
||||
done
|
||||
|
||||
for prg in ghc-pkg ghc-pkg-${ghc.version}; do
|
||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "--global-conf $linkedPkgDir"
|
||||
echo -n .
|
||||
done
|
||||
|
||||
for prg in hp2ps hpc hasktags hsc2hs haddock haddock-${ghc.version}; do
|
||||
test -x ${ghc}/bin/$prg && ln -s ${ghc}/bin/$prg $out/bin/$prg && echo -n .
|
||||
done
|
||||
echo
|
||||
'';
|
||||
|
||||
# inherit ghc.meta;
|
||||
meta = ghc.meta;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
|
||||
# top of this file.
|
||||
|
||||
ghc = callPackage ../development/compilers/ghc/wrapper.nix {
|
||||
ghc = ghc;
|
||||
ghc = ghc; # refers to ghcPlain
|
||||
};
|
||||
|
||||
# An experimental wrapper around ghcPlain that does not automatically
|
||||
@ -113,6 +113,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
|
||||
# argument to this function.
|
||||
|
||||
ghcWithPackages = pkgs : callPackage ../development/compilers/ghc/with-packages.nix {
|
||||
ghc = ghc; # refers to ghcPlain
|
||||
packages = pkgs self;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user