nls: Update translations.
[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, 2020 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, 2021 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 # If adding a language, update the following variables, and info_TEXINFOS.
25 MANUAL_LANGUAGES = de es fa fi fr it ko pt_BR ru sk zh_CN
26 COOKBOOK_LANGUAGES = de es fa fi fr ko ru sk zh_Hans
27
28 # Arg1: A list of languages codes.
29 # Arg2: The file name stem.
30 lang_to_texinfo = $(foreach lang,$(1),%D%/$(2).$(lang).texi)
31
32 # Automake does not understand GNU Make non-standard extensions,
33 # unfortunately, so we cannot use the above patsubst-based function here.
34 info_TEXINFOS = %D%/guix.texi \
35 %D%/guix.de.texi \
36 %D%/guix.es.texi \
37 %D%/guix.fa.texi \
38 %D%/guix.fi.texi \
39 %D%/guix.fr.texi \
40 %D%/guix.it.texi \
41 %D%/guix.ko.texi \
42 %D%/guix.pt_BR.texi \
43 %D%/guix.ru.texi \
44 %D%/guix.sk.texi \
45 %D%/guix.zh_CN.texi \
46 %D%/guix-cookbook.texi \
47 %D%/guix-cookbook.de.texi \
48 %D%/guix-cookbook.es.texi \
49 %D%/guix-cookbook.fa.texi \
50 %D%/guix-cookbook.fi.texi \
51 %D%/guix-cookbook.fr.texi \
52 %D%/guix-cookbook.ko.texi \
53 %D%/guix-cookbook.ru.texi \
54 %D%/guix-cookbook.sk.texi \
55 %D%/guix-cookbook.zh_Hans.texi
56
57 %C%_guix_TEXINFOS = \
58 %D%/contributing.texi \
59 %D%/fdl-1.3.texi
60
61 DOT_FILES = \
62 %D%/images/bootstrap-graph.dot \
63 %D%/images/bootstrap-packages.dot \
64 %D%/images/coreutils-graph.dot \
65 %D%/images/coreutils-bag-graph.dot \
66 %D%/images/gcc-core-mesboot0-graph.dot \
67 %D%/images/service-graph.dot \
68 %D%/images/shepherd-graph.dot
69
70 DOT_VECTOR_GRAPHICS = \
71 $(DOT_FILES:%.dot=%.eps) \
72 $(DOT_FILES:%.dot=%.pdf)
73
74 EXTRA_DIST += \
75 %D%/htmlxref.cnf \
76 $(DOT_FILES) \
77 $(DOT_VECTOR_GRAPHICS) \
78 %D%/images/coreutils-size-map.eps \
79 %D%/environment-gdb.scm \
80 %D%/package-hello.scm \
81 %D%/package-hello.json
82
83 OS_CONFIG_EXAMPLES_TEXI = \
84 %D%/os-config-bare-bones.texi \
85 %D%/os-config-desktop.texi \
86 %D%/os-config-lightweight-desktop.texi \
87 %D%/he-config-bare-bones.scm
88
89 TRANSLATED_INFO = \
90 $(call lang_to_texinfo,$(MANUAL_LANGUAGES),guix) \
91 $(call lang_to_texinfo,$(MANUAL_LANGUAGES),contributing) \
92 $(call lang_to_texinfo,$(COOKBOOK_LANGUAGES),guix-cookbook)
93
94 # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
95 BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
96 EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
97 MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
98
99 PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
100 PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
101 PO4A_PARAMS += -f texinfo # texinfo format
102
103 # When a change to guix.texi occurs, it is not translated immediately.
104 # Because @pxref and @xref commands are references to sections by name, they
105 # should be translated. If a modification adds a reference to a section, this
106 # reference is not translated, which means it references a section that does not
107 # exist.
108 define xref_command
109 $(top_srcdir)/pre-inst-env $(GUILE) --no-auto-compile \
110 "$(top_srcdir)/build-aux/convert-xref.scm" \
111 $@.tmp $<
112 endef
113
114 $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi guix/build/po.go
115 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
116 -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
117 -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command)
118 -mv "$@.tmp" "$@"
119
120 $(srcdir)/%D%/guix-cookbook.%.texi: po/doc/guix-cookbook.%.po guix/build/po.go
121 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix-cookbook.texi" -p "$<" -l "$@.tmp"
122 -sed -i "s|guix-cookbook\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
123 -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command)
124 -mv "$@.tmp" "$@"
125
126 $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po guix/build/po.go
127 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
128 -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command)
129 -mv "$@.tmp" "$@"
130
131 %D%/os-config-%.texi: gnu/system/examples/%.tmpl
132 $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
133 cp "$<" "$@"
134
135 infoimagedir = $(infodir)/images
136 dist_infoimage_DATA = \
137 $(DOT_FILES:%.dot=%.png) \
138 %D%/images/coreutils-size-map.png \
139 %D%/images/installer-network.png \
140 %D%/images/installer-partitions.png \
141 %D%/images/installer-resume.png
142
143 # Ask for warnings about cross-referenced manuals that are not listed in
144 # htmlxref.cnf.
145 AM_MAKEINFOHTMLFLAGS = --set-customization-variable CHECK_HTMLXREF=true
146
147 # Try hard to obtain an image size and aspect that's reasonable for inclusion
148 # in an Info or PDF document.
149 DOT_OPTIONS = \
150 -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
151 -Nfontsize=9 -Nheight=.1 -Nwidth=.1
152
153 .dot.png:
154 $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
155 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
156
157 .dot.pdf:
158 $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
159 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
160
161 .dot.eps:
162 $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
163 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
164
165 .png.eps:
166 $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
167 mv "$@-tmp.eps" "$@"
168
169 # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake)
170 # Extending"). Using the `-local' rules is imperfect, because they may be
171 # triggered after the main rule. Oh, well.
172 pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
173 info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
174 ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
175 $(top_srcdir)/%D%/images/coreutils-size-map.eps
176 dvi-local: ps-local
177
178 ## ----------- ##
179 ## Man pages. ##
180 ## ----------- ##
181
182 # The man pages are generated using GNU Help2man. In makefiles rules they
183 # depend not on the binary, but on the source files. This usage allows a
184 # manual page to be generated by the maintainer and included in the
185 # distribution without requiring the end-user to have 'help2man' installed.
186 # They are built in $(srcdir) like info manuals.
187
188 sub_commands_mans = \
189 $(srcdir)/%D%/guix-archive.1 \
190 $(srcdir)/%D%/guix-build.1 \
191 $(srcdir)/%D%/guix-challenge.1 \
192 $(srcdir)/%D%/guix-deploy.1 \
193 $(srcdir)/%D%/guix-download.1 \
194 $(srcdir)/%D%/guix-edit.1 \
195 $(srcdir)/%D%/guix-environment.1 \
196 $(srcdir)/%D%/guix-gc.1 \
197 $(srcdir)/%D%/guix-hash.1 \
198 $(srcdir)/%D%/guix-import.1 \
199 $(srcdir)/%D%/guix-lint.1 \
200 $(srcdir)/%D%/guix-package.1 \
201 $(srcdir)/%D%/guix-publish.1 \
202 $(srcdir)/%D%/guix-pull.1 \
203 $(srcdir)/%D%/guix-refresh.1 \
204 $(srcdir)/%D%/guix-size.1 \
205 $(srcdir)/%D%/guix-system.1 \
206 $(srcdir)/%D%/guix-time-machine.1 \
207 $(srcdir)/%D%/guix-weather.1
208
209 # Assume that cross-compiled commands cannot be executed.
210 if !CROSS_COMPILING
211
212 dist_man1_MANS = \
213 $(srcdir)/%D%/guix.1 \
214 $(sub_commands_mans)
215
216 endif
217
218 gen_man = \
219 LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \
220 $(HELP2MANFLAGS)
221
222 HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
223
224 $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
225 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
226
227 # The 'case' ensures the man pages are only generated if the corresponding
228 # source script (the first prerequisite) has been changed. The $(GOBJECTS)
229 # prerequisite is solely meant to force these docs to be made only after all
230 # Guile modules have been compiled.
231 $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
232 -@case '$?' in \
233 *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
234 $(gen_man) --output="$@" "guix $*";; \
235 *) : ;; \
236 esac
237
238 if BUILD_DAEMON
239 if !CROSS_COMPILING
240
241 dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1
242
243 $(srcdir)/%D%/guix-daemon.1: guix-daemon$(EXEEXT)
244 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
245
246 endif
247 endif