aboutsummaryrefslogtreecommitdiff
path: root/meson-dist-script
blob: fb328af9ba62d8313c1276372aa0bbb363980b56 (plain) (blame)
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
#!/bin/sh

set -eu

# This is more portable than `which' but comes with
# the caveat of not(?) properly working on busybox's ash:
existence()
{
    type "$1" >/dev/null 2>&1
}

cd "${MESON_DIST_ROOT}"
echo "Updating handbook..."
if existence sphinx-build; then
  cwd=$PWD
  cd src/handbook || exit 1
  if test -e _build; then
    make clean
  fi
  # GNS
  make html >/dev/null || exit 1
  if test -e ../../doc/handbook/html; then
    rm -r ../../doc/handbook/html || exit 1
  fi
  cp -r _build/html ../../doc/handbook/ || exit 1
  if test -e ../../doc/handbook/texinfo; then
    rm -r ../../doc/handbook/texinfo || exit 1
  fi
  make info >/dev/null || exit 1
  cp -r _build/texinfo ../../doc/handbook/ || exit 1
  cd $cwd
else
  echo "ERROR: Sphinx not found! Unable to generate recent documentation."
  exit 1
fi