7 install -d -m0755 build-doc
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"
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
22 elif command -v yum
>/dev
/null
; then
23 for package
in python-devel python-pip python-virtualenv doxygen ditaa ant libxml2-devel libxslt-devel Cython graphviz
; do
24 if ! rpm
-q $package >/dev
/null
; then
25 missing
="${missing:+$missing }$package"
28 if [ -n "$missing" ]; then
29 echo "$0: missing required packages, please install them:" 1>&2
30 echo "yum install $missing"
34 for command in virtualenv doxygen ant ditaa cython
; do
35 command -v "$command" > /dev
/null
;
37 if [ $ret_code -ne 0 ]; then
38 # add a space after old values
39 missing
="${missing:+$missing }$command"
42 if [ -n "$missing" ]; then
43 echo "$0: missing required command, please install them:" 1>&2
49 # Don't enable -e until after running all the potentially-erroring checks
50 # for availability of commands
53 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
57 [ -z "$vdir" ] && vdir="$TOPDIR/build-doc/virtualenv"
59 if [ ! -e $vdir ]; then
60 virtualenv
--system-site-packages $vdir -p python2
62 $vdir/bin
/pip
install --quiet -r $TOPDIR/admin
/doc-requirements.txt
65 $TOPDIR/build-doc
/output
/html \
66 $TOPDIR/build-doc
/output
/man
68 # To avoid having to build librbd to build the Python bindings to build the docs,
69 # create a dummy librbd.so that allows the module to be imported by sphinx.
70 # the module are imported by the "automodule::" directive.
72 export LD_LIBRARY_PATH
="$vdir/lib"
73 export PYTHONPATH
=$TOPDIR/src
/pybind
75 # FIXME(sileht): I dunno how to pass the include-dirs correctly with pip
76 # for build_ext step, it should be:
77 # --global-option=build_ext --global-option="--cython-include-dirs $TOPDIR/src/pybind/rados/"
78 # but that doesn't work, so copying the file in the rbd module directly, that's ok for docs
79 for bind in rados rbd cephfs rgw
; do
80 if [ ${bind} != rados
]; then
81 cp -f $TOPDIR/src
/pybind
/rados
/rados.pxd
$TOPDIR/src
/pybind
/${bind}/
83 ln -sf lib
${bind}.so
.1 $vdir/lib
/lib
${bind}.so
84 gcc
-shared -o $vdir/lib
/lib
${bind}.so
.1 -xc /dev
/null
86 CFLAGS
="-iquote$TOPDIR/src/include" \
87 CPPFLAGS
="-iquote$TOPDIR/src/include" \
88 LDFLAGS
="-L$vdir/lib -Wl,--no-as-needed" \
89 $vdir/bin
/pip
install $TOPDIR/src
/pybind
/${bind}
90 # rgwfile_version(), librgw_create(), rgw_mount()
91 nm
$vdir/lib
/python
*/*-packages/${bind}.so |
grep -E "U (lib)?${bind}" | \
92 awk '{ print "void "$2"(void) {}" }' | \
93 gcc
-shared -o $vdir/lib
/lib
${bind}.so
.1 -xc -
94 if [ ${bind} != rados
]; then
95 rm -f $TOPDIR/src
/pybind
/${bind}/rados.pxd
100 sphinx_targets
="html man"
104 for target
in $sphinx_targets; do
114 $vdir/bin
/sphinx-build
-a -b $builder $extra_opt -d doctrees \
115 $TOPDIR/doc
$TOPDIR/build-doc
/output
/$target
119 # Build and install JavaDocs
121 JAVADIR
=$TOPDIR/src
/java
123 # Clean and build JavaDocs
125 ant
-buildfile $JAVADIR/build.xml docs
127 # Create clean target directory
128 JAVA_OUTDIR
=$TOPDIR/build-doc
/output
/html
/api
/libcephfs-java
/javadoc
132 # Copy JavaDocs to target directory
133 cp -a $JAVADIR/doc
/* $JAVA_OUTDIR/