summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-08-08 19:03:39 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-10 15:37:58 -0400
commit7cabea7c9b10d2d15a4798be9f3130994393dd9c (patch)
treeac6b74f4e79cf78e7721ddb2339f16cdec1610ab
parent596db9a5f966643bcc9994d45f2f6ffb4037ad74 (diff)
downloadhaskell-7cabea7c9b10d2d15a4798be9f3130994393dd9c.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.
-rw-r--r--hadrian/bindist/Makefile10
1 files changed, 6 insertions, 4 deletions
diff --git a/hadrian/bindist/Makefile b/hadrian/bindist/Makefile
index 5159558c5f..a62cdca797 100644
--- a/hadrian/bindist/Makefile
+++ b/hadrian/bindist/Makefile
@@ -184,10 +184,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/"; \