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