From 47d0894f1339efd3f43a9aaaad2694238ed49f98 Mon Sep 17 00:00:00 2001
From: Roger Leigh <[EMAIL REDACTED]>
Date: Sat, 11 Jun 2022 09:51:12 +0100
Subject: [PATCH] build: Distribute and install HTML documentation
---
doc/CMakeLists.txt | 4 ++++
doc/Makefile.am | 20 ++++++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 83b46fb8..14a00d8f 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -137,6 +137,10 @@ if (BUILD_SPHINX AND SPHINX_BUILD)
WORKING_DIRECTORY "${sphinx_srcdir}"
DEPENDS doc-linkcheck)
add_dependencies(doc-locallinkcheck ${PROJECT_NAME}-doc-locallinkcheck)
+elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/html-prebuilt/")
+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/html-prebuilt/"
+ DESTINATION "${CMAKE_INSTALL_DOCDIR}/manual/html"
+ COMPONENT "runtime")
else()
message(WARNING "Manual pages and HTML manual will not be generated or installed")
endif()
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8bf82325..87938d21 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -34,7 +34,6 @@ doc-html:
-d "$(builddir)/cache" \
-b html \
"$(srcdir)" "$(builddir)/html"
-endif
html/index.html: doc-html
@@ -44,15 +43,21 @@ clean-local:
rm -r html
rm -r cache
-install-data-local:
- find html -type d | sed -e 's;^html;;' | while read dir; do \
+html_installdir = html
+else
+html_installdir = $(srcdir)/html-prebuilt
+endif
+
+
+install-data-local: all-local
+ find $(html_installdir) -type d | sed -e 's;^$(html_installdir);;' | while read dir; do \
echo " $(MKDIR_P) '$(DESTDIR)$(docdir)$$dir'"; \
$(MKDIR_P) "$(DESTDIR)$(docdir)$$dir" || exit 1; \
done
- find html -type f | sed -e 's;^html;;' | while read docfile; do \
+ find $(html_installdir) -type f | sed -e 's;^$(html_installdir);;' | while read docfile; do \
docsubdir=$$(dirname $$docfile); \
- echo "$(INSTALL_DATA) 'html$$docfile' '$(DESTDIR)$(docdir)$$docsubdir'"; \
- $(INSTALL_DATA) "html$$docfile" "$(DESTDIR)$(docdir)$$docsubdir"; \
+ echo "$(INSTALL_DATA) '$(html_installdir)$$docfile' '$(DESTDIR)$(docdir)$$docsubdir'"; \
+ $(INSTALL_DATA) "$(html_installdir)$$docfile" "$(DESTDIR)$(docdir)$$docsubdir"; \
done
uninstall-local:
@@ -147,4 +152,7 @@ EXTRA_DIST = \
static \
$(rst_sources)
+dist-hook: doc-html
+ cp -r html $(distdir)/html-prebuilt
+
.PHONY: doc-html