Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 2757

ghc-7.4.2-4.mga5.i586.rpm

#!/bin/sh

set -e

HADDOCK_ARGS=

case $* in
--inplace)
    HADDOCK=../inplace/bin/haddock
    for REPO in `grep '^libraries/[^ ]*  *- ' ../packages | sed -e 's#libraries/##' -e 's/ .*//'`
    do
        if [ -f "$REPO/ghc-packages" ]
        then
            LIBS="`cat $REPO/ghc-packages`"
            LIBROOT="$REPO"
        else
            LIBS="$REPO"
            LIBROOT="."
        fi
        for LIB in $LIBS
        do
            HADDOCK_FILE="$LIBROOT/$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
    done
    ;;
*)
    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
echo $HADDOCK_ARGS
$HADDOCK --gen-index --gen-contents -o . \
         -t "Haskell Hierarchical Libraries" \
         -p "prologue.txt" \
         $HADDOCK_ARGS

# Unhandled Windows help stuff?:

#libraries.HxS : libraries.txt
#	 haddock ...
#		-k libraries
#		--html-help=mshelp2
#	( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true
#
#libraries.chm : libraries.txt
#	haddock ...
#		-k libraries \
#		--html-help=mshelp \
#	( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true