guix hash: Interpret '-' as standard input.
[jackhill/guix/guix.git] / Makefile.am
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 # Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 # Copyright © 2015 Alex Kost <alezost@gmail.com>
5 # Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
6 # Copyright © 2016 Mark H Weaver <mhw@netris.org>
7 #
8 # This file is part of GNU Guix.
9 #
10 # GNU Guix is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or (at
13 # your option) any later version.
14 #
15 # GNU Guix is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 bin_SCRIPTS = \
24 scripts/guix
25
26 nodist_noinst_SCRIPTS = \
27 pre-inst-env \
28 test-env
29
30 include gnu/local.mk
31
32 MODULES = \
33 guix/base32.scm \
34 guix/base64.scm \
35 guix/cpio.scm \
36 guix/records.scm \
37 guix/gcrypt.scm \
38 guix/hash.scm \
39 guix/pk-crypto.scm \
40 guix/pki.scm \
41 guix/combinators.scm \
42 guix/utils.scm \
43 guix/sets.scm \
44 guix/modules.scm \
45 guix/download.scm \
46 guix/git-download.scm \
47 guix/hg-download.scm \
48 guix/monads.scm \
49 guix/monad-repl.scm \
50 guix/gexp.scm \
51 guix/profiles.scm \
52 guix/serialization.scm \
53 guix/nar.scm \
54 guix/derivations.scm \
55 guix/grafts.scm \
56 guix/gnu-maintenance.scm \
57 guix/upstream.scm \
58 guix/licenses.scm \
59 guix/graph.scm \
60 guix/cve.scm \
61 guix/zlib.scm \
62 guix/build-system.scm \
63 guix/build-system/ant.scm \
64 guix/build-system/cmake.scm \
65 guix/build-system/emacs.scm \
66 guix/build-system/asdf.scm \
67 guix/build-system/glib-or-gtk.scm \
68 guix/build-system/gnu.scm \
69 guix/build-system/haskell.scm \
70 guix/build-system/perl.scm \
71 guix/build-system/python.scm \
72 guix/build-system/waf.scm \
73 guix/build-system/r.scm \
74 guix/build-system/ruby.scm \
75 guix/build-system/trivial.scm \
76 guix/ftp-client.scm \
77 guix/http-client.scm \
78 guix/gnupg.scm \
79 guix/elf.scm \
80 guix/store.scm \
81 guix/cvs-download.scm \
82 guix/svn-download.scm \
83 guix/ui.scm \
84 guix/build/ant-build-system.scm \
85 guix/build/download.scm \
86 guix/build/cmake-build-system.scm \
87 guix/build/emacs-build-system.scm \
88 guix/build/asdf-build-system.scm \
89 guix/build/git.scm \
90 guix/build/hg.scm \
91 guix/build/glib-or-gtk-build-system.scm \
92 guix/build/gnu-build-system.scm \
93 guix/build/gnu-dist.scm \
94 guix/build/perl-build-system.scm \
95 guix/build/python-build-system.scm \
96 guix/build/r-build-system.scm \
97 guix/build/ruby-build-system.scm \
98 guix/build/waf-build-system.scm \
99 guix/build/haskell-build-system.scm \
100 guix/build/store-copy.scm \
101 guix/build/utils.scm \
102 guix/build/union.scm \
103 guix/build/profiles.scm \
104 guix/build/pull.scm \
105 guix/build/rpath.scm \
106 guix/build/cvs.scm \
107 guix/build/svn.scm \
108 guix/build/syscalls.scm \
109 guix/build/gremlin.scm \
110 guix/build/emacs-utils.scm \
111 guix/build/lisp-utils.scm \
112 guix/build/graft.scm \
113 guix/build/bournish.scm \
114 guix/build/qt-utils.scm \
115 guix/search-paths.scm \
116 guix/packages.scm \
117 guix/import/utils.scm \
118 guix/import/gnu.scm \
119 guix/import/snix.scm \
120 guix/import/cabal.scm \
121 guix/import/cran.scm \
122 guix/import/hackage.scm \
123 guix/import/elpa.scm \
124 guix/scripts.scm \
125 guix/scripts/download.scm \
126 guix/scripts/build.scm \
127 guix/scripts/archive.scm \
128 guix/scripts/import.scm \
129 guix/scripts/package.scm \
130 guix/scripts/gc.scm \
131 guix/scripts/hash.scm \
132 guix/scripts/pull.scm \
133 guix/scripts/substitute.scm \
134 guix/scripts/authenticate.scm \
135 guix/scripts/refresh.scm \
136 guix/scripts/system.scm \
137 guix/scripts/lint.scm \
138 guix/scripts/challenge.scm \
139 guix/scripts/import/cran.scm \
140 guix/scripts/import/gnu.scm \
141 guix/scripts/import/nix.scm \
142 guix/scripts/import/hackage.scm \
143 guix/scripts/import/elpa.scm \
144 guix/scripts/environment.scm \
145 guix/scripts/publish.scm \
146 guix/scripts/edit.scm \
147 guix/scripts/size.scm \
148 guix/scripts/graph.scm \
149 guix/scripts/container.scm \
150 guix/scripts/container/exec.scm \
151 guix.scm \
152 $(GNU_SYSTEM_MODULES)
153
154 if HAVE_GUILE_JSON
155
156 MODULES += \
157 guix/import/github.scm \
158 guix/import/json.scm \
159 guix/import/pypi.scm \
160 guix/scripts/import/pypi.scm \
161 guix/import/cpan.scm \
162 guix/scripts/import/gem.scm \
163 guix/import/gem.scm
164
165 endif
166
167 if BUILD_DAEMON_OFFLOAD
168
169 MODULES += \
170 guix/scripts/offload.scm
171
172 endif BUILD_DAEMON_OFFLOAD
173
174 # Internal module with test suite support.
175 dist_noinst_DATA = guix/tests.scm
176
177 # Linux-Libre configurations.
178 KCONFIGS = \
179 gnu/packages/linux-libre-4.8-i686.conf \
180 gnu/packages/linux-libre-4.8-x86_64.conf \
181 gnu/packages/linux-libre-4.4-i686.conf \
182 gnu/packages/linux-libre-4.4-x86_64.conf \
183 gnu/packages/linux-libre-4.1-i686.conf \
184 gnu/packages/linux-libre-4.1-x86_64.conf
185
186 # Templates, examples.
187 EXAMPLES = \
188 gnu/system/examples/bare-bones.tmpl \
189 gnu/system/examples/desktop.tmpl \
190 gnu/system/examples/lightweight-desktop.tmpl
191
192 GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go guix/tests.go
193
194 nobase_dist_guilemodule_DATA = \
195 $(MODULES) $(KCONFIGS) $(EXAMPLES) \
196 $(MISC_DISTRO_FILES)
197 nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm
198
199 # Do we need to provide our own non-broken (srfi srfi-37) module?
200 if INSTALL_SRFI_37
201
202 nobase_nodist_guilemodule_DATA += srfi/srfi-37.scm
203 GOBJECTS += srfi/srfi-37.go
204
205 srfi/srfi-37.scm: srfi/srfi-37.scm.in
206 $(MKDIR_P) srfi
207 cp "$<" "$@"
208
209 endif INSTALL_SRFI_37
210
211 # Handy way to remove the .go files without removing all the rest.
212 clean-go:
213 -$(RM) -f $(GOBJECTS)
214 @find . -name '*.go' -print | \
215 if test -t 1; then \
216 xargs -r echo -e "\033[31mwarning:\033[0m stray .go files:"; \
217 else \
218 xargs -r echo "warning: stray .go files:"; \
219 fi
220
221
222 # Test extensions; has to be unconditional.
223 TEST_EXTENSIONS = .scm .sh
224
225 if CAN_RUN_TESTS
226
227 SCM_TESTS = \
228 tests/base32.scm \
229 tests/base64.scm \
230 tests/cpio.scm \
231 tests/hash.scm \
232 tests/pk-crypto.scm \
233 tests/pki.scm \
234 tests/sets.scm \
235 tests/modules.scm \
236 tests/gnu-maintenance.scm \
237 tests/substitute.scm \
238 tests/builders.scm \
239 tests/derivations.scm \
240 tests/grafts.scm \
241 tests/ui.scm \
242 tests/records.scm \
243 tests/upstream.scm \
244 tests/combinators.scm \
245 tests/utils.scm \
246 tests/build-utils.scm \
247 tests/packages.scm \
248 tests/snix.scm \
249 tests/hackage.scm \
250 tests/cran.scm \
251 tests/elpa.scm \
252 tests/store.scm \
253 tests/monads.scm \
254 tests/gexp.scm \
255 tests/nar.scm \
256 tests/union.scm \
257 tests/profiles.scm \
258 tests/syscalls.scm \
259 tests/gremlin.scm \
260 tests/bournish.scm \
261 tests/lint.scm \
262 tests/publish.scm \
263 tests/scripts.scm \
264 tests/size.scm \
265 tests/graph.scm \
266 tests/challenge.scm \
267 tests/cve.scm \
268 tests/zlib.scm \
269 tests/file-systems.scm \
270 tests/system.scm \
271 tests/services.scm \
272 tests/scripts-build.scm \
273 tests/containers.scm \
274 tests/import-utils.scm
275
276 if HAVE_GUILE_JSON
277
278 SCM_TESTS += \
279 tests/pypi.scm \
280 tests/cpan.scm \
281 tests/gem.scm
282
283 endif
284
285 SH_TESTS = \
286 tests/guix-build.sh \
287 tests/guix-download.sh \
288 tests/guix-gc.sh \
289 tests/guix-hash.sh \
290 tests/guix-package.sh \
291 tests/guix-package-net.sh \
292 tests/guix-system.sh \
293 tests/guix-archive.sh \
294 tests/guix-authenticate.sh \
295 tests/guix-environment.sh \
296 tests/guix-environment-container.sh \
297 tests/guix-graph.sh \
298 tests/guix-lint.sh
299
300 if BUILD_DAEMON
301
302 SH_TESTS += tests/guix-register.sh
303
304 endif BUILD_DAEMON
305
306
307 TESTS = $(SCM_TESTS) $(SH_TESTS)
308
309 AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" GUILE_AUTO_COMPILE=0
310
311 SCM_LOG_DRIVER = \
312 $(top_builddir)/test-env --quiet-stderr \
313 $(GUILE) --no-auto-compile -e main \
314 $(top_srcdir)/build-aux/test-driver.scm
315
316 AM_SCM_LOG_DRIVER_FLAGS = --brief=yes
317
318 SH_LOG_COMPILER = $(top_builddir)/test-env $(SHELL)
319 AM_SH_LOG_FLAGS = -x -e
320
321 # Make sure `tests/guix-gc.sh' runs last, after all the others. Otherwise it
322 # could end up removing files from the store while they are being used by
323 # other instances of the daemon.
324 tests/guix-gc.log: \
325 $(patsubst %.sh,%.log,$(filter-out tests/guix-gc.sh,$(SH_TESTS))) \
326 $(SCM_TESTS:%.scm=%.log)
327
328 else !CAN_RUN_TESTS
329
330 TESTS =
331 SH_TESTS =
332 SCM_TESTS =
333
334 # Automake always generates a 'check' target, so better not override it.
335 check-local:
336 @echo
337 @echo "Cannot run tests because file name limits would be exceeded." >&2
338 @echo "Look for 'length' in the 'config.log' file for details." >&2
339 @echo
340 @exit 1
341
342 endif !CAN_RUN_TESTS
343
344 check-system: $(GOBJECTS)
345 $(AM_V_at)$(top_builddir)/pre-inst-env \
346 $(GUILE) --no-auto-compile \
347 -e '(@@ (run-system-tests) run-system-tests)' \
348 $(top_srcdir)/build-aux/run-system-tests.scm
349
350 # Public key used to sign substitutes from hydra.gnu.org.
351 dist_pkgdata_DATA = hydra.gnu.org.pub
352
353 # Bash completion file.
354 dist_bashcompletion_DATA = etc/completion/bash/guix
355
356 # Zsh completion file.
357 dist_zshcompletion_DATA = etc/completion/zsh/_guix
358
359 EXTRA_DIST = \
360 HACKING \
361 ROADMAP \
362 TODO \
363 CODE-OF-CONDUCT \
364 .dir-locals.el \
365 build-aux/build-self.scm \
366 build-aux/compile-all.scm \
367 build-aux/hydra/evaluate.scm \
368 build-aux/hydra/gnu-system.scm \
369 build-aux/hydra/demo-os.scm \
370 build-aux/hydra/guix.scm \
371 build-aux/check-available-binaries.scm \
372 build-aux/check-final-inputs-self-contained.scm \
373 build-aux/download.scm \
374 build-aux/make-binary-tarball.scm \
375 build-aux/generate-authors.scm \
376 build-aux/test-driver.scm \
377 build-aux/run-system-tests.scm \
378 srfi/srfi-37.scm.in \
379 srfi/srfi-64.scm \
380 srfi/srfi-64.upstream.scm \
381 tests/test.drv \
382 tests/signing-key.pub \
383 tests/signing-key.sec \
384 tests/cve-sample.xml \
385 build-aux/config.rpath \
386 bootstrap \
387 release.nix \
388 $(TESTS)
389
390 if !BUILD_DAEMON_OFFLOAD
391
392 EXTRA_DIST += \
393 guix/scripts/offload.scm
394
395 endif !BUILD_DAEMON_OFFLOAD
396
397
398 CLEANFILES = \
399 $(GOBJECTS) \
400 $(SCM_TESTS:tests/%.scm=%.log)
401
402 # Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if
403 # $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files in
404 # there that are newer than the local .scm files (for instance because the
405 # user ran 'make install' recently). When that happens, we end up loading
406 # those previously-installed .go files, which may be stale, thereby breaking
407 # the whole thing. Likewise, set 'XDG_CACHE_HOME' to avoid loading possibly
408 # stale files from ~/.cache/guile/ccache.
409 %.go: make-go ; @:
410 make-go: $(MODULES) guix/config.scm guix/tests.scm
411 $(AM_V_at)echo "Compiling Scheme modules..." ; \
412 unset GUILE_LOAD_COMPILED_PATH ; \
413 XDG_CACHE_HOME=/nowhere \
414 host=$(host) srcdir="$(top_srcdir)" \
415 $(top_builddir)/pre-inst-env \
416 $(GUILE) -L "$(top_builddir)" -L "$(top_srcdir)" \
417 --no-auto-compile \
418 -s "$(top_srcdir)"/build-aux/compile-all.scm $^
419
420 SUFFIXES = .go
421
422 # Make sure source files are installed first, so that the mtime of
423 # installed compiled files is greater than that of installed source
424 # files. See
425 # <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
426 # for details.
427 guix_install_go_files = install-nobase_nodist_guilemoduleDATA
428 $(guix_install_go_files): install-nobase_dist_guilemoduleDATA
429
430 # The above trick doesn't work for 'config.go' because both 'config.scm' and
431 # 'config.go' are listed in $(nobase_nodist_guilemodule_DATA). Thus, give it
432 # special treatment.
433 install-data-hook: set-bootstrap-executable-permissions
434 touch "$(DESTDIR)$(guilemoduledir)/guix/config.go"
435
436
437 SUBDIRS = po/guix po/packages
438 BUILT_SOURCES =
439
440 include doc/local.mk
441
442 if BUILD_DAEMON
443
444 include nix/local.mk
445
446 endif BUILD_DAEMON
447
448 ACLOCAL_AMFLAGS = -I m4
449
450 # Pass an explicit '--localstatedir' so that configure does not error out if
451 # it finds an existing installation with a different localstatedir.
452 AM_DISTCHECK_CONFIGURE_FLAGS = \
453 --localstatedir="$$dc_install_base/var" \
454 --with-libgcrypt-prefix="$(LIBGCRYPT_PREFIX)" \
455 --with-libgcrypt-libdir="$(LIBGCRYPT_LIBDIR)" \
456 --with-nix-prefix="$(NIX_PREFIX)" \
457 --enable-daemon
458
459 dist_emacsui_DATA = emacs/guix-main.scm
460 nodist_emacsui_DATA = emacs/guix-helper.scm
461 include emacs/local.mk
462
463 # The self-contained tarball.
464 guix-binary.%.tar.xz:
465 $(AM_V_GEN)GUIX_PACKAGE_PATH= \
466 $(top_builddir)/pre-inst-env "$(GUILE)" \
467 "$(top_srcdir)/build-aux/make-binary-tarball.scm" "$*" "$@"
468
469
470 dist-hook: sync-descriptions gen-ChangeLog gen-AUTHORS
471 dist-hook: assert-no-store-file-names
472
473 distcheck-hook: assert-binaries-available assert-final-inputs-self-contained
474
475 sync-descriptions:
476 $(AM_V_at)GUIX_PACKAGE_PATH= \
477 $(top_builddir)/pre-inst-env guix lint --checkers=gnu-description
478
479 gen-ChangeLog:
480 $(AM_V_GEN)if test -d .git; then \
481 $(top_srcdir)/build-aux/gitlog-to-changelog \
482 > $(distdir)/cl-t; \
483 rm -f $(distdir)/ChangeLog; \
484 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
485 fi
486
487 gen-AUTHORS:
488 $(AM_V_GEN)if test -d .git; then \
489 rm -f "$(distdir)/AUTHORS"; \
490 $(top_builddir)/pre-inst-env "$(GUILE)" \
491 "$(top_srcdir)/build-aux/generate-authors.scm" \
492 "$(top_srcdir)" "$(distdir)/AUTHORS"; \
493 fi
494
495 # Make sure we're not shipping a file that embeds a local /gnu/store file name.
496 assert-no-store-file-names:
497 $(AM_V_at)if grep -r --exclude=*.texi --exclude=*.info \
498 --exclude=*.info-[0-9] --exclude=*.dot \
499 --exclude=*.eps --exclude-dir=bootstrap \
500 --exclude=guix-prettify.el \
501 -E "$(storedir)/[a-z0-9]{32}-" $(distdir) ; \
502 then \
503 echo "error: store file names embedded in the distribution" >&2 ; \
504 exit 1 ; \
505 fi
506
507 # Make sure hydra.gnu.org has the important binaries.
508 assert-binaries-available: $(GOBJECTS)
509 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
510 "$(top_srcdir)/build-aux/check-available-binaries.scm"
511
512 # Make sure the final inputs don't refer to bootstrap tools.
513 assert-final-inputs-self-contained: $(GOBJECTS)
514 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
515 "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm"
516
517 # Compute the Hydra jobs and write them in the target file.
518 hydra-jobs.scm: $(GOBJECTS)
519 $(AM_V_at)$(MKDIR_P) "`dirname "$@"`"
520 $(AM_V_GEN)$(top_builddir)/pre-inst-env "$(GUILE)" \
521 "$(top_srcdir)/build-aux/hydra/evaluate.scm" \
522 "$(top_srcdir)/build-aux/hydra/gnu-system.scm" > "$@.tmp"
523 $(AM_V_at)mv "$@.tmp" "$@"
524
525 .PHONY: sync-descriptions gen-ChangeLog gen-AUTHORS clean-go make-go
526 .PHONY: assert-no-store-file-names assert-binaries-available
527 .PHONY: assert-final-inputs-self-contained
528
529 ## -------------- ##
530 ## Silent rules. ##
531 ## -------------- ##
532
533 AM_V_DL = $(AM_V_DL_$(V))
534 AM_V_DL_ = $(AM_V_DL_$(AM_DEFAULT_VERBOSITY))
535 AM_V_DL_0 = @echo " DL " $@;
536
537 AM_V_DOT = $(AM_V_DOT_$(V))
538 AM_V_DOT_ = $(AM_V_DOT_$(AM_DEFAULT_VERBOSITY))
539 AM_V_DOT_0 = @echo " DOT " $@;
540
541 AM_V_EMACS = $(AM_V_EMACS_$(V))
542 AM_V_EMACS_ = $(AM_V_EMACS_$(AM_DEFAULT_VERBOSITY))
543 AM_V_EMACS_0 = @echo " EMACS " $@;
544
545 AM_V_HELP2MAN = $(AM_V_HELP2MAN_$(V))
546 AM_V_HELP2MAN_ = $(AM_V_HELP2MAN_$(AM_DEFAULT_VERBOSITY))
547 AM_V_HELP2MAN_0 = @echo " HELP2MAN" $@;