summaryrefslogtreecommitdiff
path: root/distrib/mkDocs/mkDocs
blob: 641d945cfad61c3cfd6a7733383840a104cd6b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

set -e

die () {
    echo "$1" >&2
    exit 1
}

NO_CLEAN=0
if [ "$1" = "--no-clean" ]
then
    NO_CLEAN=1
    shift
fi
[ "$#" -eq 2 ] || die "Bad args. Usage: $0 [--no-clean] <Linux bindist> <Windows bindist>"

LINUX_BINDIST=$(realpath "$1")
WINDOWS_BINDIST=$(realpath "$2")

mkdir docs
cd docs
INST=$(pwd)/inst
tar -Jxf "$LINUX_BINDIST"
mv ghc* linux
cd linux
./configure --prefix="$INST"
make install
cd ..
[ "$NO_CLEAN" -eq 0 ] && rm -r linux

tar -Jxf "$WINDOWS_BINDIST"
mv ghc* windows
cd inst/share/doc/ghc*/html/libraries

# try extracting the make bindist docs and then the hadrian bindist docs
mv ../../../../../../windows/doc/html/libraries/Win32-* . || \
    mv ../../../../../../windows/docs/html/libraries/Win32 . || \
    die "failed to find the Win32 package documentation"

sh gen_contents_index
cd ..
for i in haddock libraries users_guide
do
    tar -Jcf ../../../../../$i.html.tar.xz $i
done
mv index.html ../../../../..
cd ..
mv ./*.pdf ../../../..
cd ../../../..
[ "$NO_CLEAN" -eq 0 ] && rm -r inst
[ "$NO_CLEAN" -eq 0 ] && rm -r windows