set -e
HADDOCK_ARGS=
-NAMES=
case $* in
--inplace)
- HADDOCK=../utils/haddock/install-inplace/bin/haddock
- HADDOCK_FILES=`ls -1 */dist/doc/html/*/*.haddock | sort`
+ HADDOCK=../inplace/bin/haddock
+ for LIB in `grep '^libraries/[^ ]\+ \+- \+[^ ]\+ \+[^ ]\+ \+[^ ]\+' ../packages | sed -e 's#libraries/##' -e 's/ .*//'`
+ do
+ HADDOCK_FILE="$LIB/dist-install/doc/html/$LIB/$LIB.haddock"
+ if [ -f "$HADDOCK_FILE" ]
+ then
+ LIBPATH=`echo "$HADDOCK_FILE" | sed 's#/dist-install.*##'`
+ NAME=`echo "$HADDOCK_FILE" | sed 's#.*/##' | sed 's#\.haddock$##'`
+ # It's easier to portably remove tabs with tr than to try to get
+ # sed to do what we want
+ VERSION=`grep -i '^version:' $LIBPATH/$NAME.cabal | sed 's/.*://' | tr -d ' \t'`
+ HADDOCK_ARG="--read-interface=${NAME}-${VERSION},$HADDOCK_FILE"
+ HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
+ fi
+ done
;;
*)
- HADDOCK=../../../../bin/haddock
+ HADDOCK=../../../../../bin/haddock
# We don't want the GHC API to swamp the index
- HADDOCK_FILES=`ls -1 */*.haddock | grep -v "ghc/" | sort`
+ HADDOCK_FILES=`ls -1 */*.haddock | grep -v '/ghc\.haddock' | sort`
+ for HADDOCK_FILE in $HADDOCK_FILES
+ do
+ NAME_VERSION=`echo "$HADDOCK_FILE" | sed 's#/.*##'`
+ HADDOCK_ARG="--read-interface=${NAME_VERSION},$HADDOCK_FILE"
+ HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
+ done
;;
esac
-for HADDOCK_FILE in $HADDOCK_FILES
-do
- NAME=`echo "$HADDOCK_FILE" | sed 's#/.*##'`
- HADDOCK_ARGS="$HADDOCK_ARGS --read-interface=$NAME,$HADDOCK_FILE"
- NAMES="$NAMES $NAME"
-done
-
# Now create the combined contents and index pages
$HADDOCK --gen-index --gen-contents -o . \
-t "Haskell Hierarchical Libraries" \
+ -p "prologue.txt" \
$HADDOCK_ARGS
# Unhandled Windows help stuff?: