Skip to content

Commit 4739809

Browse files
dakhubgitgitster
authored andcommitted
Add support for an info version of the user manual
These patches use docbook2x in order to create an info version of the git user manual. No existing Makefile targets (including "all") are touched, so you need to explicitly say make info sudo make install-info to get git.info created and installed. If the info target directory does not already contain a "dir" file, no directory entry is created. This facilitates $(DESTDIR)-based installations. The same could be achieved with sudo make INSTALL_INFO=: install-info explicitly. perl is used for patching up sub-par file and directory information in the Texinfo file. It would be cleaner to place the respective info straight into user-manual.txt or the conversion configurations, but I find myself unable to find out how to do this with Asciidoc/Texinfo. Signed-off-by: David Kastrup <dak@gnu.org>
1 parent fa54870 commit 4739809

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

Documentation/Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ INSTALL?=install
4444
RM ?= rm -f
4545
DOC_REF = origin/man
4646

47+
infodir?=$(prefix)/share/info
48+
MAKEINFO=makeinfo
49+
INSTALL_INFO=install-info
50+
DOCBOOK2X_TEXI=docbook2x-texi
51+
4752
-include ../config.mak.autogen
4853
-include ../config.mak
4954

@@ -67,6 +72,8 @@ man1: $(DOC_MAN1)
6772
man5: $(DOC_MAN5)
6873
man7: $(DOC_MAN7)
6974

75+
info: git.info
76+
7077
install: man
7178
$(INSTALL) -d -m755 $(DESTDIR)$(man1dir)
7279
$(INSTALL) -d -m755 $(DESTDIR)$(man5dir)
@@ -75,6 +82,14 @@ install: man
7582
$(INSTALL) -m644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
7683
$(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
7784

85+
install-info: info
86+
$(INSTALL) -d -m755 $(DESTDIR)$(infodir)
87+
$(INSTALL) -m644 git.info $(DESTDIR)$(infodir)
88+
if test -r $(DESTDIR)$(infodir)/dir; then \
89+
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
90+
else \
91+
echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
92+
fi
7893

7994
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
8095
$(MAKE) -C ../ GIT-VERSION-FILE
@@ -110,7 +125,7 @@ cmd-list.made: cmd-list.perl $(MAN1_TXT)
110125
git.7 git.html: git.txt core-intro.txt
111126

112127
clean:
113-
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 howto-index.txt howto/*.html doc.dep
128+
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
114129
$(RM) $(cmds_txt) *.made
115130

116131
%.html : %.txt
@@ -138,6 +153,13 @@ XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
138153
user-manual.html: user-manual.xml
139154
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
140155

156+
git.info: user-manual.xml
157+
$(RM) $@ $*.texi $*.texi+
158+
$(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
159+
perl fix-texi.perl <$*.texi+ >$*.texi
160+
$(MAKEINFO) --no-split $*.texi
161+
$(RM) $*.texi $*.texi+
162+
141163
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
142164
$(RM) $@+ $@
143165
sh ./howto-index.sh $(wildcard howto/*.txt) >$@+

Documentation/fix-texi.perl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/perl -w
2+
3+
while (<>) {
4+
if (/^\@setfilename/) {
5+
$_ = "\@setfilename git.info\n";
6+
} elsif (/^\@direntry/) {
7+
print '@dircategory Development
8+
@direntry
9+
* Git: (git). A fast distributed revision control system
10+
@end direntry
11+
'; }
12+
unless (/^\@direntry/../^\@end direntry/) {
13+
print;
14+
}
15+
}

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,9 @@ perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS
913913
doc:
914914
$(MAKE) -C Documentation all
915915

916+
info:
917+
$(MAKE) -C Documentation info
918+
916919
TAGS:
917920
$(RM) TAGS
918921
$(FIND) . -name '*.[hcS]' -print | xargs etags -a
@@ -1005,6 +1008,9 @@ endif
10051008
install-doc:
10061009
$(MAKE) -C Documentation install
10071010

1011+
install-info:
1012+
$(MAKE) -C Documentation install-info
1013+
10081014
quick-install-doc:
10091015
$(MAKE) -C Documentation quick-install
10101016

0 commit comments

Comments
 (0)