2011-08-19 23:43:21 +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
|
2015-12-01 14:20:01 +00:00
|
|
|
for package in python-dev python-pip python-virtualenv doxygen ditaa ant libxml2-dev libxslt1-dev cython; do
|
2011-12-06 20:04:03 +00:00
|
|
|
if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
|
|
|
|
# add a space after old values
|
|
|
|
missing="${missing:+$missing }$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: missing required packages, please install them:" 1>&2
|
|
|
|
echo "sudo apt-get install $missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-02-11 13:18:53 +00:00
|
|
|
elif command -v yum >/dev/null; then
|
2015-12-01 14:20:01 +00:00
|
|
|
for package in python-devel python-pip python-virtualenv doxygen ditaa ant libxml-devel libxslt-devel Cython; do
|
2015-02-11 13:18:53 +00:00
|
|
|
if ! rpm -q $package >/dev/null ; then
|
|
|
|
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
|
2015-12-01 14:20:01 +00:00
|
|
|
for command in virtualenv doxygen ant ditaa cython; do
|
2014-03-12 17:09:59 +00:00
|
|
|
command -v "$command" > /dev/null;
|
|
|
|
ret_code=$?
|
|
|
|
if [ $ret_code -ne 0 ]; then
|
2011-12-06 20:04:03 +00:00
|
|
|
# add a space after old values
|
2014-03-12 17:09:59 +00:00
|
|
|
missing="${missing:+$missing }$command"
|
2011-12-06 20:04:03 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$missing" ]; then
|
|
|
|
echo "$0: missing required command, please install them:" 1>&2
|
|
|
|
echo "$missing"
|
|
|
|
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
|
|
|
cat $TOPDIR/src/osd/PG.h $TOPDIR/src/osd/PG.cc | $TOPDIR/doc/scripts/gen_state_diagram.py > $TOPDIR/doc/dev/peering_graph.generated.dot
|
2011-11-30 00:24:35 +00:00
|
|
|
|
2011-08-19 23:43:21 +00:00
|
|
|
cd build-doc
|
|
|
|
|
2016-01-05 23:49:18 +00:00
|
|
|
[ -z "$vdir" ] && vdir="$TOPDIR/build-doc/virtualenv"
|
2012-03-12 23:46:31 +00:00
|
|
|
|
|
|
|
if [ ! -e $vdir ]; then
|
2015-12-01 14:20:01 +00:00
|
|
|
virtualenv --system-site-packages $vdir
|
2011-08-19 23:43:21 +00:00
|
|
|
fi
|
2016-01-05 23:49:18 +00:00
|
|
|
$vdir/bin/pip install --quiet -r $TOPDIR/admin/doc-requirements.txt
|
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
|
|
|
|
|
|
|
# To avoid having to build librbd to build the Python bindings to build the docs,
|
|
|
|
# create a dummy librbd.so that allows the module to be imported by sphinx.
|
|
|
|
mkdir -p $vdir/lib
|
|
|
|
export LD_LIBRARY_PATH="$vdir/lib"
|
2016-01-05 23:49:18 +00:00
|
|
|
export PYTHONPATH=$TOPDIR/src/pybind
|
2015-12-01 14:30:01 +00:00
|
|
|
ln -sf librbd.so.1 $vdir/lib/librbd.so
|
|
|
|
gcc -shared -o $vdir/lib/librbd.so.1 -xc /dev/null
|
2016-01-05 23:49:18 +00:00
|
|
|
CFLAGS="-iquote $TOPDIR/src/include" \
|
|
|
|
CPPFLAGS="-iquote $TOPDIR/src/include" \
|
2015-12-01 14:30:01 +00:00
|
|
|
LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
|
2016-01-05 23:49:18 +00:00
|
|
|
$vdir/bin/pip install $TOPDIR/src/pybind
|
2015-12-01 14:30:01 +00:00
|
|
|
nm $vdir/lib/python*/*-packages/rbd.so | grep 'U rbd_' | \
|
|
|
|
awk '{ print "void "$2"(void) {}" }' | \
|
|
|
|
gcc -shared -o $vdir/lib/librbd.so.1 -xc -
|
|
|
|
|
2016-01-05 23:49:18 +00:00
|
|
|
$vdir/bin/sphinx-build -a -n -b dirhtml -d doctrees $TOPDIR/doc $TOPDIR/build-doc/output/html
|
|
|
|
$vdir/bin/sphinx-build -a -b man -d doctrees $TOPDIR/doc $TOPDIR/build-doc/output/man
|
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
|
2016-01-05 23:49:18 +00:00
|
|
|
JAVA_OUTDIR=$TOPDIR/build-doc/output/html/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/
|