Only put the boot packages in the haddock contents/index
[ghc-hetmet.git] / libraries / gen_contents_index
1 #!/bin/sh
2
3 set -e
4
5 HADDOCK_ARGS=
6
7 case $* in
8 --inplace)
9     HADDOCK=../inplace/bin/haddock
10     for LIB in `grep '^libraries/[^ ]\+ \+- \+[^ ]\+ \+[^ ]\+ \+[^ ]\+' ../packages | sed -e 's#libraries/##' -e 's/ .*//'`
11     do
12         HADDOCK_FILE="$LIB/dist-install/doc/html/$LIB/$LIB.haddock"
13         if [ -f "$HADDOCK_FILE" ]
14         then
15             LIBPATH=`echo "$HADDOCK_FILE" | sed 's#/dist-install.*##'`
16             NAME=`echo "$HADDOCK_FILE" | sed 's#.*/##' | sed 's#\.haddock$##'`
17             # It's easier to portably remove tabs with tr than to try to get
18             # sed to do what we want
19             VERSION=`grep -i '^version:' $LIBPATH/$NAME.cabal | sed 's/.*://' | tr -d ' \t'`
20             HADDOCK_ARG="--read-interface=${NAME}-${VERSION},$HADDOCK_FILE"
21             HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
22         fi
23     done
24     ;;
25 *)
26     HADDOCK=../../../../../bin/haddock
27     # We don't want the GHC API to swamp the index
28     HADDOCK_FILES=`ls -1 */*.haddock | grep -v '/ghc\.haddock' | sort`
29     for HADDOCK_FILE in $HADDOCK_FILES
30     do
31         NAME_VERSION=`echo "$HADDOCK_FILE" | sed 's#/.*##'`
32         HADDOCK_ARG="--read-interface=${NAME_VERSION},$HADDOCK_FILE"
33         HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
34     done
35     ;;
36 esac
37
38 # Now create the combined contents and index pages
39 $HADDOCK --gen-index --gen-contents -o . \
40          -t "Haskell Hierarchical Libraries" \
41          -p "prologue.txt" \
42          $HADDOCK_ARGS
43
44 # Unhandled Windows help stuff?:
45
46 #libraries.HxS : libraries.txt
47 #        haddock ...
48 #               -k libraries
49 #               --html-help=mshelp2
50 #       ( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true
51 #
52 #libraries.chm : libraries.txt
53 #       haddock ...
54 #               -k libraries \
55 #               --html-help=mshelp \
56 #       ( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true
57