summaryrefslogtreecommitdiffstats
path: root/scripts/update-docs.sh
blob: 34d181eaac82101f4e04c04202e23fa61f2912f3 (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
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later

cd "$(git rev-parse --show-toplevel)" || exit 1

# build man docs
BUILDDIR="$(mktemp -d)"
echo "${BUILDDIR}"
trap 'rm -rf -- ${BUILDDIR}' EXIT

meson setup 		\
    -Ddocs=man		\
    -Ddocs-build=true	\
    "${BUILDDIR}"
meson compile 		\
    -C "${BUILDDIR}"

rm -rf doc/man
mkdir doc/man

find "${BUILDDIR}/doc" -maxdepth 1 -name '*.2' -exec cp {} doc/man \;

# build ReST docs
rm -rf -- "${BUILDDIR}"
BUILDDIR="$(mktemp -d)"
echo "${BUILDDIR}"
trap 'rm -rf -- ${BUILDDIR}' EXIT

meson setup 		\
    -Ddocs=rst 		\
    -Ddocs-build=true	\
    "${BUILDDIR}"
meson compile 		\
    -C "${BUILDDIR}"

rm -rf doc/rst/*.rst
mkdir -p doc/rst

find "${BUILDDIR}/doc/rst" -maxdepth 1 -name '*.rst' -exec cp {} doc/rst \;

cp "${BUILDDIR}/doc/conf.py" doc
cp "${BUILDDIR}/doc/index.rst" doc
cp "${BUILDDIR}/doc/config-schema.json" doc

# build html docs
# The HTML doc is not ready yet
# rm -rf $DESTDIR/doc/html
# cp -R $BUILDDIR/doc/html $DESTDIR/doc/