[PATCH 0/3] Fix installation paths with "make install-doc"

STALE3715d

10 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH 0/3] Fix installation paths with "make install-doc"

From: John Keeping <hidden>
Date: 2016-06-15 22:56:08

When using the top-level install-doc target the html, info and man
target directories are inherited from the top-level Makefile by the
documentation Makefile as relative paths, which is not expected and
results in the files being installed in an unexpected location.

The first two patches are simple style fixes.  The third one fixes the
issue described above.

John Keeping (3):
  Documentation/Makefile: fix spaces around assignments
  Documentation/Makefile: move infodir to be with other '*dir's
  Documentation/Makefile: fix inherited {html,info,man}dir

 Documentation/Makefile | 88 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 32 deletions(-)

-- 
1.8.1.2

[PATCH 3/3] Documentation/Makefile: fix inherited {html,info,man}dir

From: John Keeping <hidden>
Date: 2016-06-15 22:56:08

Commit e14421b (Allow INSTALL, bindir, mandir to be set in main Makefile
- 2006-06-29) changed Documentation/Makefile to inherit the value of
mandir from the top-level Makefile when invoked as "make install-doc" at
the top-level.  This was inherited by infodir and htmldir when they were
added.

This was broken by commit 026fa0d (Move computation of absolute paths
from Makefile to runtime (in preparation for RUNTIME_PREFIX) -
2009-01-18) which changed these variables to have relative paths in the
top-level Makefile, causing the documentation to be installed into the
path without $(prefix) prepended.

Fix this by changing the defaults to be paths relative to $(prefix) and
introducing new variables {html,info,man}_instdir which contain the full
installation paths.

Signed-off-by: John Keeping <redacted>
---
I'm not sure if this is the best approach - the alternative would be to
change the top-level Makefile to use {html,info,man}dir_relative and
derive the {html,info,man}dir variables from that.

The top-level Makefile is inconsistent in the approach it takes - bindir
is derived from bindir_relative but gitexecdir and template_dir have
gitexec_instdir and template_instdir derived from them.

 Documentation/Makefile | 56 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 40 insertions(+), 16 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0cfdc36..34cd9f2 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -78,15 +78,21 @@ DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
 DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
 DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
 
+# The following variables can be relative paths due to the way they can be
+# inherited from the top-level Makefile:
+#   htmldir
+#   infodir
+#   mandir
+# Note that pdfdir is an exception to this since it is not used by git-help.
 prefix ?= $(HOME)
 bindir ?= $(prefix)/bin
-htmldir ?= $(prefix)/share/doc/git-doc
-infodir ?= $(prefix)/share/info
 pdfdir ?= $(prefix)/share/doc/git-doc
-mandir ?= $(prefix)/share/man
-man1dir = $(mandir)/man1
-man5dir = $(mandir)/man5
-man7dir = $(mandir)/man7
+htmldir ?= share/doc/git-doc
+infodir ?= share/info
+mandir ?= share/man
+man1dir = $(man_instdir)/man1
+man5dir = $(man_instdir)/man5
+man7dir = $(man_instdir)/man7
 # DESTDIR =
 
 ASCIIDOC = asciidoc
@@ -110,6 +116,24 @@ endif
 -include ../config.mak.autogen
 -include ../config.mak
 
+ifneq ($(filter /%,$(firstword $(htmldir))),)
+html_instdir = $(htmldir)
+else
+html_instdir = $(prefix)/$(htmldir)
+endif
+
+ifneq ($(filter /%,$(firstword $(infodir))),)
+info_instdir = $(infodir)
+else
+info_instdir = $(prefix)/$(infodir)
+endif
+
+ifneq ($(filter /%,$(firstword $(mandir))),)
+man_instdir = $(mandir)
+else
+man_instdir = $(prefix)/$(mandir)
+endif
+
 #
 # For docbook-xsl ...
 #	-1.68.1,	no extra settings are needed?
@@ -144,7 +168,7 @@ endif
 # Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
 # or similar.
 ifndef MAN_BASE_URL
-MAN_BASE_URL = file://$(htmldir)/
+MAN_BASE_URL = file://$(html_instdir)/
 endif
 XMLTO_EXTRA += -m manpage-base-url.xsl
 
@@ -220,13 +244,13 @@ install-man: man
 	$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 
 install-info: info
-	$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
-	$(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
-	if test -r $(DESTDIR)$(infodir)/dir; then \
-	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
-	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
+	$(INSTALL) -d -m 755 $(DESTDIR)$(info_instdir)
+	$(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(info_instdir)
+	if test -r $(DESTDIR)$(info_instdir)/dir; then \
+	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(info_instdir) git.info ;\
+	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(info_instdir) gitman.info ;\
 	else \
-	  echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
+	  echo "No directory found in $(DESTDIR)$(info_instdir)" >&2 ; \
 	fi
 
 install-pdf: pdf
@@ -234,7 +258,7 @@ install-pdf: pdf
 	$(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 
 install-html: html
-	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
+	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(html_instdir)
 
 ../GIT-VERSION-FILE: FORCE
 	$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
@@ -402,14 +426,14 @@ require-manrepo::
 	then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
 
 quick-install-man: require-manrepo
-	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
+	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(man_instdir)
 
 require-htmlrepo::
 	@if test ! -d $(HTML_REPO); \
 	then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
 
 quick-install-html: require-htmlrepo
-	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
+	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(html_instdir)
 
 print-man1:
 	@for i in $(MAN1_TXT); do echo $$i; done
-- 
1.8.1.2

[PATCH 1/3] Documentation/Makefile: fix spaces around assignments

From: John Keeping <hidden>
Date: 2016-06-15 22:56:08

A simple style fix; no functional change.

Signed-off-by: John Keeping <redacted>
---
 Documentation/Makefile | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 62dbd9a..af3d8a4 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -31,11 +31,11 @@ MAN7_TXT += gittutorial.txt
 MAN7_TXT += gitworkflows.txt
 
 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
-MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
-MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
+MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT))
+MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
 
 OBSOLETE_HTML = git-remote-helpers.html
-DOC_HTML=$(MAN_HTML) $(OBSOLETE_HTML)
+DOC_HTML = $(MAN_HTML) $(OBSOLETE_HTML)
 
 ARTICLES = howto-index
 ARTICLES += everyday
@@ -74,35 +74,35 @@ SP_ARTICLES += technical/api-index
 
 DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
 
-DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
-DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
-DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
+DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
+DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
+DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
 
-prefix?=$(HOME)
-bindir?=$(prefix)/bin
-htmldir?=$(prefix)/share/doc/git-doc
-pdfdir?=$(prefix)/share/doc/git-doc
-mandir?=$(prefix)/share/man
-man1dir=$(mandir)/man1
-man5dir=$(mandir)/man5
-man7dir=$(mandir)/man7
-# DESTDIR=
+prefix ?= $(HOME)
+bindir ?= $(prefix)/bin
+htmldir ?= $(prefix)/share/doc/git-doc
+pdfdir ?= $(prefix)/share/doc/git-doc
+mandir ?= $(prefix)/share/man
+man1dir = $(mandir)/man1
+man5dir = $(mandir)/man5
+man7dir = $(mandir)/man7
+# DESTDIR =
 
 ASCIIDOC = asciidoc
 ASCIIDOC_EXTRA =
 MANPAGE_XSL = manpage-normal.xsl
 XMLTO = xmlto
 XMLTO_EXTRA =
-INSTALL?=install
+INSTALL ?= install
 RM ?= rm -f
 MAN_REPO = ../../git-manpages
 HTML_REPO = ../../git-htmldocs
 
-infodir?=$(prefix)/share/info
-MAKEINFO=makeinfo
-INSTALL_INFO=install-info
-DOCBOOK2X_TEXI=docbook2x-texi
-DBLATEX=dblatex
+infodir ?= $(prefix)/share/info
+MAKEINFO = makeinfo
+INSTALL_INFO = install-info
+DOCBOOK2X_TEXI = docbook2x-texi
+DBLATEX = dblatex
 ifndef PERL_PATH
 	PERL_PATH = /usr/bin/perl
 endif
-- 
1.8.1.2

[PATCH 2/3] Documentation/Makefile: move infodir to be with other '*dir's

From: John Keeping <hidden>
Date: 2016-06-15 22:56:08

Signed-off-by: John Keeping <redacted>
---
 Documentation/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index af3d8a4..0cfdc36 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -81,6 +81,7 @@ DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
 prefix ?= $(HOME)
 bindir ?= $(prefix)/bin
 htmldir ?= $(prefix)/share/doc/git-doc
+infodir ?= $(prefix)/share/info
 pdfdir ?= $(prefix)/share/doc/git-doc
 mandir ?= $(prefix)/share/man
 man1dir = $(mandir)/man1
@@ -98,7 +99,6 @@ RM ?= rm -f
 MAN_REPO = ../../git-manpages
 HTML_REPO = ../../git-htmldocs
 
-infodir ?= $(prefix)/share/info
 MAKEINFO = makeinfo
 INSTALL_INFO = install-info
 DOCBOOK2X_TEXI = docbook2x-texi
-- 
1.8.1.2

Re: [PATCH 1/3] Documentation/Makefile: fix spaces around assignments

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:56:09

Hi,

John Keeping wrote:
[Subject: [PATCH 1/3] Documentation/Makefile: fix spaces around assignments]
It's not so much "fix spaces" as "use consistent spacing", no?

Aside from that nit, looks like a sensible no-op to me, so
Reviewed-by: Jonathan Nieder <redacted>

Thanks.

Re: [PATCH 2/3] Documentation/Makefile: move infodir to be with other '*dir's

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:56:09

John Keeping wrote:
Signed-off-by: John Keeping <redacted>
[...]
quoted hunk
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -81,6 +81,7 @@ DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
 prefix ?= $(HOME)
 bindir ?= $(prefix)/bin
 htmldir ?= $(prefix)/share/doc/git-doc
+infodir ?= $(prefix)/share/info
 pdfdir ?= $(prefix)/share/doc/git-doc
 mandir ?= $(prefix)/share/man
 man1dir = $(mandir)/man1
@@ -98,7 +99,6 @@ RM ?= rm -f
 MAN_REPO = ../../git-manpages
 HTML_REPO = ../../git-htmldocs
 
-infodir ?= $(prefix)/share/info
 MAKEINFO = makeinfo
Is this another stylefix or is there a functional reason for this
change?

Re: [PATCH 2/3] Documentation/Makefile: move infodir to be with other '*dir's

From: John Keeping <hidden>
Date: 2016-06-15 22:56:09

On Tue, Feb 12, 2013 at 01:01:38PM -0800, Jonathan Nieder wrote:
John Keeping wrote:
quoted
Signed-off-by: John Keeping <redacted>
[...]
quoted
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -81,6 +81,7 @@ DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
 prefix ?= $(HOME)
 bindir ?= $(prefix)/bin
 htmldir ?= $(prefix)/share/doc/git-doc
+infodir ?= $(prefix)/share/info
 pdfdir ?= $(prefix)/share/doc/git-doc
 mandir ?= $(prefix)/share/man
 man1dir = $(mandir)/man1
@@ -98,7 +99,6 @@ RM ?= rm -f
 MAN_REPO = ../../git-manpages
 HTML_REPO = ../../git-htmldocs
 
-infodir ?= $(prefix)/share/info
 MAKEINFO = makeinfo
Is this another stylefix or is there a functional reason for this
change?
Another stylefix - this arrangement seems more logical to me and makes
the comment in the next patch simpler.

Re: [PATCH 0/3] Fix installation paths with "make install-doc"

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:56:09

John Keeping wrote:
  Documentation/Makefile: fix inherited {html,info,man}dir
This doesn't seem to have hit the list.

Thanks,
Jonathan

Re: [PATCH 0/3] Fix installation paths with "make install-doc"

From: John Keeping <hidden>
Date: 2016-06-15 22:56:09

On Tue, Feb 12, 2013 at 02:25:08PM -0800, Jonathan Nieder wrote:
John Keeping wrote:
quoted
  Documentation/Makefile: fix inherited {html,info,man}dir
This doesn't seem to have hit the list.
Hmm... it made it to gmane:

http://article.gmane.org/gmane.comp.version-control.git/216188

Re: [PATCH 0/3] Fix installation paths with "make install-doc"

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:56:09

John Keeping wrote:
On Tue, Feb 12, 2013 at 02:25:08PM -0800, Jonathan Nieder wrote:
quoted
John Keeping wrote:
quoted
quoted
  Documentation/Makefile: fix inherited {html,info,man}dir
This doesn't seem to have hit the list.
Hmm... it made it to gmane:

http://article.gmane.org/gmane.comp.version-control.git/216188
So it did.  Sorry for the noise --- I'll grab it from there.

Sincerely,
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help