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 --whatprovides $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
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 --upgrade $TOPDIR/src
/pybind
/${bind}
90 # rgwfile_version(), librgw_create(), rgw_mount()
91 # since py3.5, distutils adds postfix in between ${bind} and so
92 lib_fn
=$vdir/lib
/python
*/*-packages/${bind}.
*.so
93 if [ ! -e $lib_fn ]; then
94 lib_fn
=$vdir/lib
/python
*/*-packages/${bind}.so
96 nm
$lib_fn |
grep -E "U (lib)?${bind}" | \
97 awk '{ print "void "$2"(void) {}" }' | \
98 gcc
-shared -o $vdir/lib
/lib
${bind}.so
.1 -xc -
99 if [ ${bind} != rados
]; then
100 rm -f $TOPDIR/src
/pybind
/${bind}/rados.pxd
105 sphinx_targets
="html man"
109 for target
in $sphinx_targets; do
114 extra_opt
="-D graphviz_output_format=svg"
120 # Build with -W so that warnings are treated as errors and this fails
121 $vdir/bin
/sphinx-build
-W -a -b $builder $extra_opt -d doctrees \
122 $TOPDIR/doc
$TOPDIR/build-doc
/output
/$target
127 # build the releases.json. this reads in the yaml version and dumps
128 # out the json representation of the same file. the resulting releases.json
129 # should be served from the root of hosted site.
130 $vdir/bin
/python
<< EOF > $TOPDIR/build-doc/output/html/releases.json
131 from __future__ import print_function
136 def json_serialize(obj):
137 if isinstance(obj, datetime.date):
138 return obj.isoformat()
140 with open("$TOPDIR/doc/releases/releases.yml", 'r') as fp:
141 releases = yaml.load(fp)
142 print(json.dumps(releases, indent=2, default=json_serialize))
146 # Build and install JavaDocs
148 JAVADIR
=$TOPDIR/src
/java
150 # Clean and build JavaDocs
152 ant
-buildfile $JAVADIR/build.xml docs
154 # Create clean target directory
155 JAVA_OUTDIR
=$TOPDIR/build-doc
/output
/html
/api
/libcephfs-java
/javadoc
159 # Copy JavaDocs to target directory
160 cp -a $JAVADIR/doc
/* $JAVA_OUTDIR/