mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 20:34:52 +03:00
Make hoogle-local compatible wih hoogle >= 5.0.4
This commit is contained in:
parent
57f5d1b7a8
commit
f16f2017ac
@ -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 "$@"
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user