2 #===-- build-docs.sh - Tag the LLVM release candidates ---------------------===#
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===------------------------------------------------------------------------===#
10 # Build documentation for LLVM releases.
14 # * dnf install doxygen texlive-epstopdf ghostscript \
16 # * pip install --user -r ./llvm/docs/requirements.txt
18 # * apt-get install doxygen \
19 # ninja-build graphviz texlive-font-utils
20 # * pip install --user -r ./llvm/docs/requirements.txt
21 #===------------------------------------------------------------------------===#
26 srcdir
=$
(readlink
-f $
(dirname "$(readlink -f "$0")")/..
/..
)
29 echo "Build the documentation for an LLVM release. This only needs to be "
30 echo "done for -final releases."
31 echo "usage: `basename $0`"
33 echo " -release <num> Fetch the tarball for release <num> and build the "
34 echo " documentation from that source."
35 echo " -srcdir <dir> Path to llvm source directory with CMakeLists.txt"
36 echo " (optional) default: $srcdir"
37 echo " -no-doxygen Don't build Doxygen docs"
38 echo " -no-sphinx Don't build Spinx docs"
45 output
=${project}_doxygen-
$release
47 mv $builddir/$proj_dir/docs
/doxygen
/html
$output
48 tar -cJf $output.
tar.xz
$output
52 while [ $# -gt 0 ]; do
69 echo "unknown option: $1"
77 if [ -n "$release" -a -n "$custom_srcdir" ]; then
78 echo "error: Cannot specify both -srcdir and -release options"
82 if [ -n "$custom_srcdir" ]; then
83 srcdir
="$custom_srcdir"
86 # Set default source directory if one is not supplied
87 if [ -n "$release" ]; then
88 git_ref
=llvmorg-
$release
89 if [ -d llvm-project
]; then
90 echo "error llvm-project directory already exists"
95 curl
-L https
://github.com
/llvm
/llvm-project
/archive
/$git_ref.
tar.gz |
tar --strip-components=1 -xzf -
97 srcdir
="./llvm-project/llvm"
100 if [ "$no_doxygen" == "yes" ] && [ "$no_sphinx" == "yes" ]; then
101 echo "You can't specify both -no-doxygen and -no-sphinx, we have nothing to build then!"
105 if [ "$no_sphinx" != "yes" ]; then
106 echo "Sphinx: enabled"
107 sphinx_targets
="docs-clang-html docs-clang-tools-html docs-flang-html docs-lld-html docs-llvm-html docs-polly-html"
108 sphinx_flag
=" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF"
110 echo "Sphinx: disabled"
113 if [ "$no_doxygen" != "yes" ]; then
114 echo "Doxygen: enabled"
115 doxygen_targets
="$docs_target doxygen-clang doxygen-clang-tools doxygen-flang doxygen-llvm doxygen-mlir doxygen-polly"
116 doxygen_flag
=" -DLLVM_ENABLE_DOXYGEN=ON -DLLVM_DOXYGEN_SVG=ON"
118 echo "Doxygen: disabled"
121 cmake
-G Ninja
$srcdir -B $builddir \
122 -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;polly;flang" \
123 -DCMAKE_BUILD_TYPE=Release \
124 -DLLVM_BUILD_DOCS=ON \
128 ninja
-C $builddir $sphinx_targets $doxygen_targets
130 cmake
-G Ninja
$srcdir/..
/runtimes
-B $builddir/runtimes-doc \
131 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
132 -DLLVM_ENABLE_SPHINX=ON \
133 -DSPHINX_WARNINGS_AS_ERRORS=OFF
135 ninja
-C $builddir/runtimes-doc \
138 if [ "$no_doxygen" != "yes" ]; then
139 package_doxygen llvm .
140 package_doxygen clang tools
/clang
141 package_doxygen clang-tools-extra tools
/clang
/tools
/extra
142 package_doxygen flang tools
/flang
145 if [ "$no_sphinx" == "yes" ]; then
149 html_dir
=$builddir/html-export
/
151 for d
in docs
/ tools
/clang
/docs
/ tools
/lld
/docs
/ tools
/clang
/tools
/extra
/docs
/ tools
/polly
/docs
/ tools
/flang
/docs
/; do
152 mkdir
-p $html_dir/$d
153 mv $builddir/$d/html
/* $html_dir/$d/
156 # Keep the documentation for the runtimes under /projects/ to avoid breaking existing links.
157 for d
in libcxx
/docs
/; do
158 mkdir
-p $html_dir/projects
/$d
159 mv $builddir/runtimes-doc
/$d/html
/* $html_dir/projects
/$d/