2020-03-15 02:40:16 +00:00
|
|
|
#!/bin/sh
|
2015-02-11 12:56:34 +00:00
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
cd ..
|
2012-10-26 16:35:14 +00:00
|
|
|
TOPDIR=`pwd`
|
2011-08-19 23:43:21 +00:00
|
|
|
|
2011-08-29 22:43:41 +00:00
|
|
|
install -d -m0755 build-doc
|
|
|
|
|
2011-12-06 20:04:03 +00:00
|
|
|
if command -v dpkg >/dev/null; then
|
2016-05-24 06:08:05 +00:00
|
|
|
packages=`cat ${TOPDIR}/doc_deps.deb.txt`
|
2016-05-16 15:35:18 +00:00
|
|
|
for package in $packages; do
|
|
|
|
if [ "$(dpkg --status -- $package 2>&1 | sed -n 's/^Status: //p')" != "install ok installed" ]; then
|
|
|
|
# add a space after old values
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
2011-12-06 20:04:03 +00:00
|
|
|
done
|
|
|
|
if [ -n "$missing" ]; then
|
2016-05-16 15:35:18 +00:00
|
|
|
echo "$0: missing required packages, please install them:" 1>&2
|
|
|
|
echo "sudo apt-get install -o APT::Install-Recommends=true $missing" 1>&2
|
|
|
|
exit 1
|
2011-12-06 20:04:03 +00:00
|
|
|
fi
|
2015-02-11 13:18:53 +00:00
|
|
|
elif command -v yum >/dev/null; then
|
2021-07-31 12:59:33 +00:00
|
|
|
for package in ant ditaa doxygen libxslt-devel libxml2-devel graphviz python3-devel python3-pip python3-Cython; do
|
2018-01-04 14:55:16 +00:00
|
|
|
if ! rpm -q --whatprovides $package >/dev/null ; then
|
2015-02-11 13:18:53 +00:00
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: missing required packages, please install them:" 1>&2
|
|
|
|
echo "yum install $missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-12-06 20:04:03 +00:00
|
|
|
else
|
2021-07-31 12:59:33 +00:00
|
|
|
for command in dot doxygen ant ditaa cython; do
|
2020-03-15 02:40:16 +00:00
|
|
|
if ! command -v "$command" > /dev/null; then
|
2011-12-06 20:04:03 +00:00
|
|
|
# add a space after old values
|
2020-03-15 02:40:16 +00:00
|
|
|
missing="${missing:+$missing }$command"
|
|
|
|
fi
|
2011-12-06 20:04:03 +00:00
|
|
|
done
|
|
|
|
if [ -n "$missing" ]; then
|
2020-03-15 03:36:02 +00:00
|
|
|
echo "$0: missing required command, please install them:" 1>&2
|
|
|
|
echo "$missing" 1>&2
|
2011-12-06 20:04:03 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-06-03 09:09:09 +00:00
|
|
|
# Don't enable -e until after running all the potentially-erroring checks
|
|
|
|
# for availability of commands
|
|
|
|
set -e
|
|
|
|
|
2016-01-05 23:49:18 +00:00
|
|
|
[ -z "$vdir" ] && vdir="$TOPDIR/build-doc/virtualenv"
|
2012-03-12 23:46:31 +00:00
|
|
|
|
2021-08-04 17:22:50 +00:00
|
|
|
md5=$vdir/md5
|
|
|
|
if test -f $md5 && md5sum --check $md5 > /dev/null; then
|
|
|
|
# reusing existing venv
|
|
|
|
:
|
|
|
|
else
|
2021-09-01 21:40:35 +00:00
|
|
|
python3 -m venv $vdir
|
2020-10-02 16:41:06 +00:00
|
|
|
|
2021-07-31 12:59:33 +00:00
|
|
|
$vdir/bin/pip install --quiet wheel
|
2021-03-31 18:44:23 +00:00
|
|
|
$vdir/bin/pip install --quiet \
|
2020-12-12 07:19:40 +00:00
|
|
|
-r $TOPDIR/admin/doc-requirements.txt \
|
|
|
|
-r $TOPDIR/admin/doc-python-common-requirements.txt
|
2021-03-31 18:44:23 +00:00
|
|
|
BUILD_DOC=1 $vdir/bin/pip install --quiet \
|
2020-12-12 07:09:49 +00:00
|
|
|
-r $TOPDIR/admin/doc-pybind.txt
|
2021-08-04 17:22:50 +00:00
|
|
|
md5sum \
|
|
|
|
$TOPDIR/admin/doc-requirements.txt \
|
|
|
|
$TOPDIR/admin/doc-python-common-requirements.txt \
|
|
|
|
$TOPDIR/admin/doc-pybind.txt \
|
|
|
|
> $md5
|
2021-03-31 18:44:23 +00:00
|
|
|
fi
|
2011-08-19 23:43:21 +00:00
|
|
|
|
|
|
|
install -d -m0755 \
|
2016-01-05 23:49:18 +00:00
|
|
|
$TOPDIR/build-doc/output/html \
|
|
|
|
$TOPDIR/build-doc/output/man
|
2015-12-01 14:30:01 +00:00
|
|
|
|
2020-12-11 13:33:41 +00:00
|
|
|
for opt in "$@"; do
|
|
|
|
case $opt in
|
|
|
|
html|man|livehtml)
|
|
|
|
sphinx_targets="$sphinx_targets $opt"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$sphinx_targets" ]; then
|
2017-03-21 04:22:57 +00:00
|
|
|
sphinx_targets="html man"
|
|
|
|
fi
|
2020-12-11 13:33:41 +00:00
|
|
|
|
2020-12-12 07:09:49 +00:00
|
|
|
cd build-doc
|
|
|
|
|
2017-03-21 04:22:57 +00:00
|
|
|
for target in $sphinx_targets; do
|
2020-12-11 13:33:41 +00:00
|
|
|
# Build with -W so that warnings are treated as errors and this fails
|
2017-03-21 04:22:57 +00:00
|
|
|
case $target in
|
|
|
|
html)
|
2020-12-11 13:33:41 +00:00
|
|
|
$vdir/bin/sphinx-build -W --keep-going -a -b dirhtml -d doctrees \
|
|
|
|
$TOPDIR/doc $TOPDIR/build-doc/output/$target
|
2017-03-21 04:22:57 +00:00
|
|
|
;;
|
|
|
|
man)
|
2020-12-11 13:33:41 +00:00
|
|
|
$vdir/bin/sphinx-build -W --keep-going -a -b man -t man -d doctrees \
|
2021-03-24 17:00:23 +00:00
|
|
|
-c $TOPDIR/man \
|
|
|
|
$TOPDIR/doc/man $TOPDIR/build-doc/output/$target
|
2020-12-11 13:33:41 +00:00
|
|
|
;;
|
|
|
|
livehtml)
|
2020-12-12 07:19:40 +00:00
|
|
|
$vdir/bin/pip install --quiet sphinx-autobuild
|
2021-04-14 08:29:39 +00:00
|
|
|
$vdir/bin/sphinx-autobuild --re-ignore '.*\.dot' -b dirhtml "$@" \
|
2020-12-11 13:33:41 +00:00
|
|
|
$TOPDIR/doc $TOPDIR/build-doc/output/html
|
2017-03-21 04:22:57 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2012-10-26 16:35:14 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build and install JavaDocs
|
|
|
|
#
|
|
|
|
JAVADIR=$TOPDIR/src/java
|
|
|
|
|
|
|
|
# Clean and build JavaDocs
|
|
|
|
rm -rf $JAVADIR/doc
|
|
|
|
ant -buildfile $JAVADIR/build.xml docs
|
|
|
|
|
|
|
|
# Create clean target directory
|
2020-03-12 10:14:31 +00:00
|
|
|
JAVA_OUTDIR=$TOPDIR/build-doc/output/html/cephfs/api/libcephfs-java/javadoc
|
2012-10-26 16:35:14 +00:00
|
|
|
rm -rf $JAVA_OUTDIR
|
|
|
|
mkdir $JAVA_OUTDIR
|
|
|
|
|
|
|
|
# Copy JavaDocs to target directory
|
|
|
|
cp -a $JAVADIR/doc/* $JAVA_OUTDIR/
|
2019-12-16 23:21:30 +00:00
|
|
|
|
|
|
|
echo "SUCCESS"
|