Tiny refactor
[ghc.git] / distrib / mkDocs / mkDocs
1 #!/bin/sh
2
3 set -e
4
5 die () {
6     echo "$1" >&2
7     exit 1
8 }
9
10 NO_CLEAN=0
11 if [ "$1" = "--no-clean" ]
12 then
13     NO_CLEAN=1
14     shift
15 fi
16 [ "$#" -eq 2 ] || die "Bad args. Usage: $0 [--no-clean] <Linux bindist> <Windows bindist>"
17
18 LINUX_BINDIST=`realpath "$1"`
19 WINDOWS_BINDIST=`realpath "$2"`
20
21 mkdir docs
22 cd docs
23 INST=`pwd`/inst
24 tar -Jxf "$LINUX_BINDIST"
25 mv ghc* linux
26 cd linux
27 ./configure --prefix="$INST"
28 make install
29 cd ..
30 [ "$NO_CLEAN" -eq 0 ] && rm -r linux
31 tar -Jxf "$WINDOWS_BINDIST"
32 mv ghc* windows
33 cd inst/share/doc/ghc*/html/libraries
34 mv ../../../../../../windows/doc/html/libraries/Win32-* .
35 sh gen_contents_index
36 cd ..
37 for i in haddock libraries users_guide
38 do
39     tar -Jcf ../../../../../$i.html.tar.xz $i
40 done
41 mv index.html ../../../../..
42 cd ..
43 mv *.pdf *.ps ../../../..
44 cd ../../../..
45 [ "$NO_CLEAN" -eq 0 ] && rm -r inst
46 [ "$NO_CLEAN" -eq 0 ] && rm -r windows
47