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