services: Add 'imap4d-service-type'.
[jackhill/guix/guix.git] / doc / local.mk
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
3 # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
4 # Copyright © 2013 Andreas Enge <andreas@enge.fr>
5 # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
6 # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
7 # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
8 #
9 # This file is part of GNU Guix.
10 #
11 # GNU Guix is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or (at
14 # your option) any later version.
15 #
16 # GNU Guix is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 info_TEXINFOS = %D%/guix.texi \
25 %D%/guix.fr.texi \
26 %D%/guix.de.texi
27
28 %C%_guix_TEXINFOS = \
29 %D%/contributing.texi \
30 %D%/fdl-1.3.texi
31
32 DOT_FILES = \
33 %D%/images/bootstrap-graph.dot \
34 %D%/images/bootstrap-packages.dot \
35 %D%/images/coreutils-graph.dot \
36 %D%/images/coreutils-bag-graph.dot \
37 %D%/images/service-graph.dot \
38 %D%/images/shepherd-graph.dot
39
40 DOT_VECTOR_GRAPHICS = \
41 $(DOT_FILES:%.dot=%.eps) \
42 $(DOT_FILES:%.dot=%.pdf)
43
44 EXTRA_DIST += \
45 %D%/htmlxref.cnf \
46 $(DOT_FILES) \
47 $(DOT_VECTOR_GRAPHICS) \
48 %D%/images/coreutils-size-map.eps \
49 %D%/environment-gdb.scm \
50 %D%/package-hello.scm
51
52 OS_CONFIG_EXAMPLES_TEXI = \
53 %D%/os-config-bare-bones.texi \
54 %D%/os-config-desktop.texi \
55 %D%/os-config-lightweight-desktop.texi
56
57 TRANSLATED_INFO = \
58 %D%/guix.de.texi \
59 %D%/guix.fr.texi \
60 %D%/contributing.de.texi \
61 %D%/contributing.fr.texi
62
63 # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
64 BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
65 EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
66 MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
67
68 PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
69 PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
70 PO4A_PARAMS += -f texinfo # texinfo format
71
72 # When a change to guix.texi occurs, it is not translated immediately.
73 # Because @pxref and @xref commands are reference to a section by name, they
74 # should be translated. If a modification adds a reference to a section, this
75 # reference is not translated, which means it references a section that does not
76 # exist.
77 # This command loops through the translated files looking for references. For
78 # each of these references, it tries to find the translation and replaces the
79 # reference name, even in untranslated strings.
80 # The last sed is a multiline sed because some references span multiple lines.
81 define xref_command
82 cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
83 tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
84 sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
85 line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
86 ((line++)) ;\
87 if [ "$$line" != "1" ]; then \
88 translation=$$(head -n $$line "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
89 if [ "$$translation" != "" ]; then \
90 sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
91 fi ;\
92 fi ;\
93 done
94 endef
95
96 $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi
97 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
98 -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
99 -$(AM_V_POXREF)$(xref_command)
100 -mv "$@.tmp" "$@"
101
102 $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po
103 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
104 -$(AM_V_POXREF)$(xref_command)
105 -mv "$@.tmp" "$@"
106
107 %D%/os-config-%.texi: gnu/system/examples/%.tmpl
108 $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
109 cp "$<" "$@"
110
111 infoimagedir = $(infodir)/images
112 dist_infoimage_DATA = \
113 $(DOT_FILES:%.dot=%.png) \
114 %D%/images/coreutils-size-map.png \
115 %D%/images/installer-network.png \
116 %D%/images/installer-partitions.png \
117 %D%/images/installer-resume.png
118
119 # Try hard to obtain an image size and aspect that's reasonable for inclusion
120 # in an Info or PDF document.
121 DOT_OPTIONS = \
122 -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
123 -Nfontsize=9 -Nheight=.1 -Nwidth=.1
124
125 .dot.png:
126 $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
127 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
128
129 .dot.pdf:
130 $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
131 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
132
133 .dot.eps:
134 $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
135 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
136
137 .png.eps:
138 $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
139 mv "$@-tmp.eps" "$@"
140
141 # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake)
142 # Extending"). Using the `-local' rules is imperfect, because they may be
143 # triggered after the main rule. Oh, well.
144 pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
145 info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
146 ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
147 $(top_srcdir)/%D%/images/coreutils-size-map.eps
148 dvi-local: ps-local
149
150 ## ----------- ##
151 ## Man pages. ##
152 ## ----------- ##
153
154 # The man pages are generated using GNU Help2man. In makefiles rules they
155 # depend not on the binary, but on the source files. This usage allows a
156 # manual page to be generated by the maintainer and included in the
157 # distribution without requiring the end-user to have 'help2man' installed.
158 # They are built in $(srcdir) like info manuals.
159
160 sub_commands_mans = \
161 $(srcdir)/%D%/guix-archive.1 \
162 $(srcdir)/%D%/guix-build.1 \
163 $(srcdir)/%D%/guix-challenge.1 \
164 $(srcdir)/%D%/guix-download.1 \
165 $(srcdir)/%D%/guix-edit.1 \
166 $(srcdir)/%D%/guix-environment.1 \
167 $(srcdir)/%D%/guix-gc.1 \
168 $(srcdir)/%D%/guix-hash.1 \
169 $(srcdir)/%D%/guix-import.1 \
170 $(srcdir)/%D%/guix-lint.1 \
171 $(srcdir)/%D%/guix-package.1 \
172 $(srcdir)/%D%/guix-publish.1 \
173 $(srcdir)/%D%/guix-pull.1 \
174 $(srcdir)/%D%/guix-refresh.1 \
175 $(srcdir)/%D%/guix-size.1 \
176 $(srcdir)/%D%/guix-system.1
177
178 dist_man1_MANS = \
179 $(srcdir)/%D%/guix.1 \
180 $(sub_commands_mans)
181
182 gen_man = \
183 LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \
184 $(HELP2MANFLAGS)
185
186 HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
187
188 $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
189 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
190
191 # The 'case' ensures the man pages are only generated if the corresponding
192 # source script (the first prerequisite) has been changed. The $(GOBJECTS)
193 # prerequisite is solely meant to force these docs to be made only after all
194 # Guile modules have been compiled.
195 $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
196 -@case '$?' in \
197 *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
198 $(gen_man) --output="$@" "guix $*";; \
199 *) : ;; \
200 esac
201
202 if BUILD_DAEMON
203
204 dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1
205
206 $(srcdir)/%D%/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
207 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
208
209 endif