X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=libraries%2Fgen_contents_index;h=04209fdb8fc70502717b1c9cf6d45b27c08ecad9;hp=bd628ba5513a57787e3f526e7657f11bbcebbd52;hb=cf5905ea24904cf73a041fd7535e8723a668cb9a;hpb=80a290e38a1d53f8db2120dc40f362e5e4498ce6 diff --git a/libraries/gen_contents_index b/libraries/gen_contents_index index bd628ba..04209fd 100644 --- a/libraries/gen_contents_index +++ b/libraries/gen_contents_index @@ -2,40 +2,44 @@ set -e -if [ -e base/dist ] -then - HADDOCK_FILES=`ls -1 */dist/doc/html/*/*.haddock | sort` -else - HADDOCK_FILES=`ls -1 */*.haddock | sort` -fi +HADDOCK_ARGS= -# Automagically create the prologue for the combined index via a -# header, the package prologues (in alphabetical order of the -# packages) and a footer. -{ - cat libraries-header.txt - echo - # Hack to find out if we're in a build tree or installed docs - for HADDOCK_FILE in $HADDOCK_FILES +case $* in +--inplace) + HADDOCK=../inplace/bin/haddock + for LIB in `grep '^libraries/[^ ]* *- ' ../packages | sed -e 's#libraries/##' -e 's/ .*//'` do - NAME=`echo "$HADDOCK_FILE" | sed "s#/.*##"` - if [ "$NAME" != haskell98 ] + HADDOCK_FILE="$LIB/dist-install/doc/html/$LIB/$LIB.haddock" + if [ -f "$HADDOCK_FILE" ] then - echo "[@${NAME}@]" - grep -v '^ *$$' "$NAME"/prologue.txt - echo - HADDOCK_ARGS="$HADDOCK_ARGS --read-interface=$NAME,$HADDOCK_FILE" + 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 - cat libraries-footer.txt - echo -} > libraries.txt + ;; +*) + HADDOCK=../../../../../bin/haddock + # We don't want the GHC API to swamp the index + 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 # Now create the combined contents and index pages -haddock --gen-index --gen-contents -o . \ - -t "Haskell Hierarchical Libraries" \ - -p libraries.txt \ - $HADDOCK_ARGS +$HADDOCK --gen-index --gen-contents -o . \ + -t "Haskell Hierarchical Libraries" \ + -p "prologue.txt" \ + $HADDOCK_ARGS # Unhandled Windows help stuff?: