Skip to content

Commit 1867a72

Browse files
committed
docs: do not set HTML install tree to 0755 perms
Follow-on to 8ffe33f: do not set the dirs in the installed HTML files tree to have 0755 permissions because Automake doesn't do that when it creates directories. Instead, use "find ..." to find all directories and files in the generated _built/html tree and use the Automake-provided installer macros to create the target directories and install the target files with desireable permissions. Additionally, add a comment explaining why the install-data-hook rule exists, and why we are doing what we are doing in it. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent 3c95815 commit 1867a72

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

docs/Makefile.am

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,11 +889,32 @@ man1_MANS += \
889889
man3_MANS += $(OSHMEM_MAN3_BUILT)
890890
endif
891891

892+
# We do not know the names of all the generated HTML files: we only
893+
# know that the generated tree will of files be in _build/html/.
894+
# Unfortunately, Automake's installation process only handles
895+
# individual files -- not entire trees of files. Hence, we use a
896+
# "find ..." to copy the entire generated tree to the target
897+
# directory.
898+
#
899+
# Note: we do not use "cp -r ..." because if the source directory is
900+
# write-protected (e.g., during "make distcheck"), then the cp -r will
901+
# also write-protect the target directory. Instead, use the
902+
# Automake-provided install macros to set desirable permissions on the
903+
# target directories and files.
904+
#
905+
# Since this might be a VPATH build, first check to see if _build/html
906+
# exists in the source tree. If not, do the find+install from the
907+
# build tree.
892908
install-data-hook:
893909
$(MKDIR_P) $(DESTDIR)$(docdir)
894-
cp -r $(srcdir)/_build/html $(DESTDIR)$(docdir)
895-
find $(DESTDIR)$(docdir) -type d -exec chmod 0755 {} \;
896-
find $(DESTDIR)$(docdir) -type f -exec chmod 0644 {} \;
910+
if test -d $(srcdir)/_build/html; then \
911+
topdir=$(srcdir)/_build; \
912+
else \
913+
topdir=_build; \
914+
fi; \
915+
cd $$topdir; \
916+
find html -type d -exec $(mkinstalldirs) $(DESTDIR)$(docdir)/{} \; ; \
917+
find html -type f -exec $(INSTALL_DATA) {} $(DESTDIR)$(docdir)/{} \;
897918

898919
uninstall-hook:
899920
rm -rf $(DESTDIR)$(docdir)

0 commit comments

Comments
 (0)