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