Skip to content

Commit 516e8b7

Browse files
committed
configure: Honour --disable-werror for Sphinx
If we are not making warnings fatal for compilation, make them non-fatal when building the Sphinx documentation also. (For instance Sphinx 3.0 warns about some constructs that older versions were happy with, which is a build failure if we use the warnings-as-errors flag.) This provides a workaround at least for LP:1872113. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-id: [email protected] Reviewed-by: Alex Bennée <[email protected]>
1 parent e5910d4 commit 516e8b7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
10761076
# Note the use of different doctree for each (manual, builder) tuple;
10771077
# this works around Sphinx not handling parallel invocation on
10781078
# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
1079-
build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
1079+
build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
10801080
# We assume all RST files in the manual's directory are used in it
10811081
manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
10821082
$(SRC_PATH)/docs/defs.rst.inc \

configure

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4928,6 +4928,12 @@ if check_include sys/kcov.h ; then
49284928
kcov=yes
49294929
fi
49304930

4931+
# If we're making warnings fatal, apply this to Sphinx runs as well
4932+
sphinx_werror=""
4933+
if test "$werror" = "yes"; then
4934+
sphinx_werror="-W"
4935+
fi
4936+
49314937
# Check we have a new enough version of sphinx-build
49324938
has_sphinx_build() {
49334939
# This is a bit awkward but works: create a trivial document and
@@ -4936,7 +4942,7 @@ has_sphinx_build() {
49364942
# sphinx-build doesn't exist at all or if it is too old.
49374943
mkdir -p "$TMPDIR1/sphinx"
49384944
touch "$TMPDIR1/sphinx/index.rst"
4939-
"$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
4945+
"$sphinx_build" $sphinx_werror -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
49404946
}
49414947

49424948
# Check if tools are available to build documentation.
@@ -7631,6 +7637,7 @@ echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
76317637
echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
76327638
echo "PYTHON=$python" >> $config_host_mak
76337639
echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
7640+
echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
76347641
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
76357642
echo "CC=$cc" >> $config_host_mak
76367643
if $iasl -h > /dev/null 2>&1; then

0 commit comments

Comments
 (0)