[Haskell-cafe] RE: Definition of the Haskell standard library
Chris Smith
cdsmith at twu.net
Tue Jul 31 14:18:49 EDT 2007
Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> What is missing from the local docs is a single integrated index page
> that lists all the modules and then links off to the various packages's
> docs like we have on the ghc website.
>
> The problem with generating one of those is what manages it? What
> package would it belong to etc.
Locally, I've kludged things together to add to the documentation
package that GHC builds. That may be the wrong place, but it kinda
works anyway. This script gets you much of the way there (with some
unfortunate line wrapping at the end that you'd have to fix). Of
course, the script does more than just build haddock; and there are
several other quirks here to that were needed to get random stuff to
work for some packages, and unfortunately there are a number of packages
for which it seems that 'runhaskell Setup haddock' just doesn't work at
all due to use of features in the source that haddock can't parse.
What it doesn't do is fix up the links to contents and index from the
other packages so that they point back to the right place.
-- begin attached script --
#!/bin/sh
ghcver=`ls -d /usr/local/lib/ghc-* | sort`
ghcver=`expr match "$ghcver" '.*\(ghc-6.7.[0-9]*\)'`
sudo rm /usr/local/lib/${ghcver}/share
sudo ln -s /usr/local/share /usr/local/lib/${ghcver}/share
sudo cp ../ghc/libraries/libraries-*.txt /usr/local/share/ghc/doc/html
for ln in `cat packages.list`
do
d=${ln:0:1}
p=${ln:1}
echo ===============================================================
echo == BUILDING: $p
echo ===============================================================
echo $d $p
cd $p || exit 1
if [ -d _darcs ]
then
darcs pull || exit 1
fi
if [ -f configure.in -o -f configure.ac ]
then
autoreconf || exit 1
fi
if [ -f Setup.hs -o -f Setup.lhs ]
then
runhaskell Setup clean || exit 1
runhaskell Setup configure || exit 1
runhaskell Setup build || exit 1
if [ $d = "+" ]
then
runhaskell Setup haddock --html-location=/usr/local/share/ghc \
|| exit 1
fi
sudo runhaskell Setup install || exit 1
elif [ -f Makefile -o -f Makefile.in -o -f Makefile.am ]
then
if [ $d = "+" ]
then
echo "Don't know how to run haddock"
exit 1
fi
make distclean || true
./configure || exit 1
make || exit 1
sudo make install || exit 1
else
echo "Don't know how to make $p"
exit 1
fi
cd ..
done
ls /usr/local/share/*/doc/html/*/haddock.css \
| grep -v '/usr/local/share/ghc' \
| sed 's/\(\/usr\/local\/share\/.*\/doc\/html\/\([^/]*\)\)
\/haddock.css/cp -r \1 \/usr\/local\/share\/ghc\/doc\/html\/\2 ; echo \2
> \/usr\/local\/share\/ghc\/doc\/html\/\2\/prologue.txt/' \
| sudo /bin/sh
ls ../ghc/libraries/*/prologue.txt \
| sed 's/\(\.\.\/ghc\/libraries\/\([^\/]*\)\/prologue.txt\)/cp \1
\/usr\/local\/share\/ghc\/doc\/html\/\2/' \
| sudo /bin/sh
cd /usr/local/share/ghc/doc/html
sudo ./gen_contents_index
--
Chris Smith
More information about the cabal-devel
mailing list