Make hoogle-local compatible wih hoogle >= 5.0.4

This commit is contained in:
Michael Alan Dorman 2016-08-31 05:53:18 -04:00 committed by Peter Simons
parent 57f5d1b7a8
commit f16f2017ac
2 changed files with 5 additions and 23 deletions

View File

@ -2,4 +2,4 @@
COMMAND=$1 COMMAND=$1
shift shift
exec @hoogle@/bin/hoogle "$COMMAND" -d @out@/share/doc/hoogle "$@" exec @hoogle@/bin/hoogle "$COMMAND" --database @out@/share/doc/hoogle/default.hoo "$@"

View File

@ -23,7 +23,7 @@
# This will build mmorph and monadControl, and have the hoogle installation # This will build mmorph and monadControl, and have the hoogle installation
# refer to their documentation via symlink so they are not garbage collected. # refer to their documentation via symlink so they are not garbage collected.
{ lib, stdenv, hoogle, rehoo, writeText { lib, stdenv, hoogle, writeText
, ghc, packages ? [ ghc.ghc ] , ghc, packages ? [ ghc.ghc ]
}: }:
@ -54,7 +54,7 @@ let
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "hoogle-local-0.1"; name = "hoogle-local-0.1";
buildInputs = [hoogle rehoo]; buildInputs = [ghc hoogle];
phases = [ "buildPhase" ]; phases = [ "buildPhase" ];
@ -68,22 +68,11 @@ stdenv.mkDerivation {
mkdir -p $out/share/doc/hoogle mkdir -p $out/share/doc/hoogle
function import_dbs() {
find $1 -name '*.txt' | while read f; do
newname=$(basename "$f" | tr '[:upper:]' '[:lower:]')
if [[ -f $f && ! -f ./$newname ]]; then
cp -p $f "./$newname"
hoogle convert -d "$(dirname $f)" "./$newname"
fi
done
}
echo importing builtin packages echo importing builtin packages
for docdir in ${ghc.doc}/${docLibGlob}/*; do for docdir in ${ghc.doc}/${docLibGlob}/*; do
name="$(basename $docdir)" name="$(basename $docdir)"
${opts isGhcjs ''docdir="$docdir/html"''} ${opts isGhcjs ''docdir="$docdir/html"''}
if [[ -d $docdir ]]; then if [[ -d $docdir ]]; then
import_dbs $docdir
ln -sfn $docdir $out/share/doc/hoogle/$name ln -sfn $docdir $out/share/doc/hoogle/$name
fi fi
done done
@ -92,10 +81,9 @@ stdenv.mkDerivation {
for i in $docPackages; do for i in $docPackages; do
if [[ ! $i == $out ]]; then if [[ ! $i == $out ]]; then
for docdir in $i/share/doc/*-${ghcName}-*/* $i/share/doc/*; do for docdir in $i/share/doc/*-${ghcName}-*/* $i/share/doc/*; do
name=`basename $docdir` name="$(basename $docdir)"
docdir=$docdir/html docdir=$docdir/html
if [[ -d $docdir ]]; then if [[ -d $docdir ]]; then
import_dbs $docdir
ln -sfn $docdir $out/share/doc/hoogle/$name ln -sfn $docdir $out/share/doc/hoogle/$name
fi fi
done done
@ -103,13 +91,7 @@ stdenv.mkDerivation {
done done
echo building hoogle database echo building hoogle database
# FIXME: rehoo is marked as depricated on Hackage hoogle generate --database $out/share/doc/hoogle/default.hoo --local=$out/share/doc/hoogle
chmod 644 *.hoo *.txt
rehoo -j$NIX_BUILD_CORES -c64 .
mv default.hoo .x
rm -fr downloads *.dep *.txt *.hoo
mv .x $out/share/doc/hoogle/default.hoo
echo building haddock index echo building haddock index
# adapted from GHC's gen_contents_index # adapted from GHC's gen_contents_index