diff --git a/llvm/utils/release/build-docs.sh b/llvm/utils/release/build-docs.sh new file mode 100755 --- /dev/null +++ b/llvm/utils/release/build-docs.sh @@ -0,0 +1,105 @@ +#!/bin/sh +#===-- build-docs.sh - Tag the LLVM release candidates ---------------------===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===------------------------------------------------------------------------===# +# +# Build documentation for LLVM releases. +# +#===------------------------------------------------------------------------===# + +set -ex + +builddir=docs-build + +usage() { + echo "Build the documentation for an LLVM release. This only needs to be " + echo "done for -final releases." + echo "usage: `basename $0`" + echo " " + echo " -release The release version to build" + echo " -srcdir Path to llvm source directory with CMakeLists.txt" + echo " (optional) default: ../../" +} + +package_doxygen() { + + project=$1 + proj_dir=$2 + output=${project}_doxygen-$release + + mv $builddir/$proj_dir/docs/doxygen/html $output + tar -cJf $output.tar.xz $output +} + + +while [ $# -gt 0 ]; do + case $1 in + -release ) + shift + release=$1 + ;; + -srcdir ) + shift + srcdir=$1 + ;; + * ) + echo "unknown option: $1" + usage + exit 1 + ;; + esac + shift +done + +# Set default source directory if one is not supplied +if [ -z "$srcdir" ]; then + srcdir="../../" +fi + +# Validate the release +if [ -z "$release" ]; then + echo "error: need to specify a release version" + exit 1 +fi + +release_tag_commit=`git -C $srcdir rev-list -1 llvmorg-$release` +head_commit=`git -C $srcdir rev-parse HEAD` + +if [ "$release_tag_commit" != "$head_commit" ]; then + echo "error: llvmorg-$release is not currently checked out" + exit 1 +fi + + +cmake -G Ninja $srcdir -B $builddir \ + -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;libcxx;polly;flang" \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_ENABLE_DOXYGEN=ON \ + -DLLVM_ENABLE_SPHINX=ON \ + -DLLVM_INCLUDE_DOCS=ON \ + -DLLVM_DOXYGEN_SVG=ON \ + -DSPHINX_WARNINGS_AS_ERRORS=OFF + +ninja -C $builddir \ + docs-clang-html \ + docs-flang-html \ + docs-libcxx-html \ + docs-lld-html \ + docs-llvm-html \ + docs-polly-html \ + doxygen-clang \ + doxygen-clang-tools \ + doxygen-flang \ + doxygen-llvm \ + doxygen-mlir \ + doxygen-polly + + +package_doxygen llvm . +package_doxygen clang tools/clang +package_doxygen clang-tools-extra tools/clang/tools/extra +package_doxygen flang tools/flang