[AArch64] Fix SDNode type mismatches between *.td files and ISel (#116523)
[llvm-project.git] / llvm / utils / release / build-docs.sh
blobfb2173d39daf8dfdf0a77a9fe7e933bacbc47779
1 #!/bin/bash
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.
12 # Required Packages:
13 # * Fedora:
14 # * dnf install doxygen texlive-epstopdf ghostscript \
15 # ninja-build gcc-c++
16 # * pip install --user -r ./llvm/docs/requirements.txt
17 # * Ubuntu:
18 # * apt-get install doxygen \
19 # ninja-build graphviz texlive-font-utils
20 # * pip install --user -r ./llvm/docs/requirements.txt
21 #===------------------------------------------------------------------------===#
23 set -e
25 builddir=docs-build
26 srcdir=$(readlink -f $(dirname "$(readlink -f "$0")")/../..)
28 usage() {
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`"
32 echo " "
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"
41 package_doxygen() {
43 project=$1
44 proj_dir=$2
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
53 case $1 in
54 -release )
55 shift
56 release=$1
58 -srcdir )
59 shift
60 custom_srcdir=$1
62 -no-doxygen )
63 no_doxygen="yes"
65 -no-sphinx )
66 no_sphinx="yes"
68 * )
69 echo "unknown option: $1"
70 usage
71 exit 1
73 esac
74 shift
75 done
77 if [ -n "$release" -a -n "$custom_srcdir" ]; then
78 echo "error: Cannot specify both -srcdir and -release options"
79 exit 1
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"
91 exit 1
93 mkdir -p llvm-project
94 pushd llvm-project
95 curl -L https://github.com/llvm/llvm-project/archive/$git_ref.tar.gz | tar --strip-components=1 -xzf -
96 popd
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!"
102 exit 1
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"
109 else
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"
117 else
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 \
125 $sphinx_flag \
126 $doxygen_flag
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 \
136 docs-libcxx-html \
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
146 exit 0
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/
154 done
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/
160 done