summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-08-08 19:03:39 -0400
committerBen Gamari <ben@smart-cactus.org>2022-08-15 17:11:26 -0400
commitf7322f2a176475611f34ecf695271e34799c08ec (patch)
tree090164058a438e8eb4bcc62c95c4126cb9b435da
parent088071e5038bcf26f96cbf517337c927c88ab590 (diff)
downloadhaskell-f7322f2a176475611f34ecf695271e34799c08ec.tar.gz
hadrian: Don't attempt to install documentation if doc/ doesn't exist
Previously we would attempt to install documentation even if the `doc` directory doesn't exist (e.g. due to `--docs=none`). This would result in the surprising side-effect of the entire contents of the bindist being installed in the destination documentation directory. Fix this. Fixes #21976. (cherry picked from commit 7cabea7c9b10d2d15a4798be9f3130994393dd9c)
-rw-r--r--hadrian/bindist/Makefile10
1 files changed, 6 insertions, 4 deletions
diff --git a/hadrian/bindist/Makefile b/hadrian/bindist/Makefile
index d46105a018..f0cebd65c9 100644
--- a/hadrian/bindist/Makefile
+++ b/hadrian/bindist/Makefile
@@ -181,10 +181,12 @@ install_lib: lib/settings
install_docs:
@echo "Copying docs to $(DESTDIR)$(docdir)"
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
- cd doc; $(FIND) . -type f -exec sh -c \
- '$(INSTALL_DIR) "$(DESTDIR)$(docdir)/`dirname $$1`" && \
- $(INSTALL_DATA) "$$1" "$(DESTDIR)$(docdir)/`dirname $$1`" \
- ' sh '{}' \;
+
+ if [ -d doc ]; then \
+ cd doc; $(FIND) . -type f -exec sh -c \
+ '$(INSTALL_DIR) "$(DESTDIR)$(docdir)/`dirname $$1`" && $(INSTALL_DATA) "$$1" "$(DESTDIR)$(docdir)/`dirname $$1`"' \
+ sh '{}' ';'; \
+ fi
if [ -d docs-utils ]; then \
$(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/libraries/"; \