]>
Commit | Line | Data |
---|---|---|
f67539c2 | 1 | #!/bin/sh |
7c673cae FG |
2 | |
3 | cd "$(dirname "$0")" | |
4 | cd .. | |
5 | TOPDIR=`pwd` | |
6 | ||
7 | install -d -m0755 build-doc | |
8 | ||
9 | if command -v dpkg >/dev/null; then | |
10 | packages=`cat ${TOPDIR}/doc_deps.deb.txt` | |
11 | for package in $packages; do | |
12 | if [ "$(dpkg --status -- $package 2>&1 | sed -n 's/^Status: //p')" != "install ok installed" ]; then | |
13 | # add a space after old values | |
14 | missing="${missing:+$missing }$package" | |
15 | fi | |
16 | done | |
17 | if [ -n "$missing" ]; then | |
18 | echo "$0: missing required packages, please install them:" 1>&2 | |
19 | echo "sudo apt-get install -o APT::Install-Recommends=true $missing" 1>&2 | |
20 | exit 1 | |
21 | fi | |
22 | elif command -v yum >/dev/null; then | |
9f95a23c | 23 | for package in ant ditaa doxygen libxslt-devel libxml2-devel graphviz python3-devel python3-pip python3-virtualenv python3-Cython; do |
11fdf7f2 | 24 | if ! rpm -q --whatprovides $package >/dev/null ; then |
7c673cae FG |
25 | missing="${missing:+$missing }$package" |
26 | fi | |
27 | done | |
28 | if [ -n "$missing" ]; then | |
29 | echo "$0: missing required packages, please install them:" 1>&2 | |
30 | echo "yum install $missing" | |
31 | exit 1 | |
32 | fi | |
33 | else | |
f67539c2 TL |
34 | for command in dot virtualenv doxygen ant ditaa cython; do |
35 | if ! command -v "$command" > /dev/null; then | |
7c673cae | 36 | # add a space after old values |
f67539c2 TL |
37 | missing="${missing:+$missing }$command" |
38 | fi | |
7c673cae FG |
39 | done |
40 | if [ -n "$missing" ]; then | |
f67539c2 TL |
41 | echo "$0: missing required command, please install them:" 1>&2 |
42 | echo "$missing" 1>&2 | |
7c673cae FG |
43 | exit 1 |
44 | fi | |
45 | fi | |
46 | ||
47 | # Don't enable -e until after running all the potentially-erroring checks | |
48 | # for availability of commands | |
49 | set -e | |
50 | ||
7c673cae FG |
51 | [ -z "$vdir" ] && vdir="$TOPDIR/build-doc/virtualenv" |
52 | ||
53 | if [ ! -e $vdir ]; then | |
9f95a23c | 54 | virtualenv --python=python3 $vdir |
7c673cae | 55 | fi |
f67539c2 TL |
56 | |
57 | $vdir/bin/pip install --quiet \ | |
58 | -r $TOPDIR/admin/doc-requirements.txt \ | |
59 | -r $TOPDIR/admin/doc-python-common-requirements.txt | |
60 | BUILD_DOC=1 $vdir/bin/pip install --quiet \ | |
61 | -r $TOPDIR/admin/doc-pybind.txt | |
7c673cae FG |
62 | |
63 | install -d -m0755 \ | |
64 | $TOPDIR/build-doc/output/html \ | |
65 | $TOPDIR/build-doc/output/man | |
66 | ||
f67539c2 TL |
67 | for opt in "$@"; do |
68 | case $opt in | |
69 | html|man|livehtml) | |
70 | sphinx_targets="$sphinx_targets $opt" | |
71 | shift | |
72 | ;; | |
73 | --) | |
74 | shift | |
75 | break | |
76 | esac | |
7c673cae FG |
77 | done |
78 | ||
f67539c2 | 79 | if [ -z "$sphinx_targets" ]; then |
7c673cae | 80 | sphinx_targets="html man" |
7c673cae | 81 | fi |
f67539c2 TL |
82 | |
83 | cd build-doc | |
84 | ||
7c673cae | 85 | for target in $sphinx_targets; do |
f67539c2 | 86 | # Build with -W so that warnings are treated as errors and this fails |
7c673cae FG |
87 | case $target in |
88 | html) | |
f67539c2 TL |
89 | $vdir/bin/sphinx-build -W --keep-going -a -b dirhtml -d doctrees \ |
90 | $TOPDIR/doc $TOPDIR/build-doc/output/$target | |
7c673cae FG |
91 | ;; |
92 | man) | |
f67539c2 TL |
93 | $vdir/bin/sphinx-build -W --keep-going -a -b man -t man -d doctrees \ |
94 | $TOPDIR/doc $TOPDIR/build-doc/output/$target | |
95 | ;; | |
96 | livehtml) | |
97 | $vdir/bin/pip install --quiet sphinx-autobuild | |
98 | $vdir/bin/sphinx-autobuild --re-ignore '.*\.dot' "$@" \ | |
99 | $TOPDIR/doc $TOPDIR/build-doc/output/html | |
7c673cae FG |
100 | ;; |
101 | esac | |
7c673cae FG |
102 | done |
103 | ||
104 | # | |
105 | # Build and install JavaDocs | |
106 | # | |
107 | JAVADIR=$TOPDIR/src/java | |
108 | ||
109 | # Clean and build JavaDocs | |
110 | rm -rf $JAVADIR/doc | |
111 | ant -buildfile $JAVADIR/build.xml docs | |
112 | ||
113 | # Create clean target directory | |
f67539c2 | 114 | JAVA_OUTDIR=$TOPDIR/build-doc/output/html/cephfs/api/libcephfs-java/javadoc |
7c673cae FG |
115 | rm -rf $JAVA_OUTDIR |
116 | mkdir $JAVA_OUTDIR | |
117 | ||
118 | # Copy JavaDocs to target directory | |
119 | cp -a $JAVADIR/doc/* $JAVA_OUTDIR/ | |
9f95a23c TL |
120 | |
121 | echo "SUCCESS" |