build: Add a Guile custom test driver using SRFI-64.
[jackhill/guix/guix.git] / Makefile.am
CommitLineData
233e7676 1# GNU Guix --- Functional package management for GNU
bb251307 2# Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
f2499672 3# Copyright © 2013 Andreas Enge <andreas@enge.fr>
a8ac45b1 4# Copyright © 2015 Alex Kost <alezost@gmail.com>
8c3d8894 5# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
adddd5ba 6# Copyright © 2016 Mark H Weaver <mhw@netris.org>
af51c820 7#
233e7676 8# This file is part of GNU Guix.
af51c820 9#
233e7676 10# GNU Guix is free software; you can redistribute it and/or modify it
af51c820
LC
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#
233e7676 15# GNU Guix is distributed in the hope that it will be useful, but
af51c820
LC
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
233e7676 21# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
af51c820 22
c52a5bf0 23bin_SCRIPTS = \
e49951eb 24 scripts/guix
14a1c319 25
58867ae7
MW
26nodist_noinst_SCRIPTS = \
27 pre-inst-env \
28 test-env
29
d516736c
LC
30include gnu-system.am
31
af51c820 32MODULES = \
ddc29a78 33 guix/base32.scm \
e9c6c584 34 guix/base64.scm \
7a18c3cc 35 guix/cpio.scm \
c0cd1b3e 36 guix/records.scm \
4862bc4a 37 guix/gcrypt.scm \
72626a71 38 guix/hash.scm \
3476ded9 39 guix/pk-crypto.scm \
8b420f74 40 guix/pki.scm \
73fbb904 41 guix/utils.scm \
d326767e 42 guix/sets.scm \
de1355f1 43 guix/download.scm \
9b5b5c17 44 guix/git-download.scm \
b860f382 45 guix/monads.scm \
b9b86078 46 guix/monad-repl.scm \
21b679f6 47 guix/gexp.scm \
cc4ecc2d 48 guix/profiles.scm \
0f41c26f
LC
49 guix/serialization.scm \
50 guix/nar.scm \
af51c820 51 guix/derivations.scm \
7adf9b84 52 guix/grafts.scm \
22189ed1 53 guix/gnu-maintenance.scm \
0a7c5a09 54 guix/upstream.scm \
838d78e3 55 guix/licenses.scm \
8fb58371 56 guix/graph.scm \
0eef7551 57 guix/cve.scm \
208f7cd1 58 guix/build-system.scm \
5f7a1a4d 59 guix/build-system/ant.scm \
c6bded8a 60 guix/build-system/cmake.scm \
e9137a53 61 guix/build-system/emacs.scm \
be3425e5 62 guix/build-system/glib-or-gtk.scm \
208f7cd1 63 guix/build-system/gnu.scm \
ce6fc7d6 64 guix/build-system/haskell.scm \
08fd1ebe 65 guix/build-system/perl.scm \
40506d5d 66 guix/build-system/python.scm \
a677c726 67 guix/build-system/waf.scm \
f8f3bef6 68 guix/build-system/r.scm \
c08f9818 69 guix/build-system/ruby.scm \
be13fbfa 70 guix/build-system/trivial.scm \
457dd86d 71 guix/ftp-client.scm \
3b8258c5 72 guix/http-client.scm \
0fdd3bea 73 guix/gnupg.scm \
d5d16686 74 guix/elf.scm \
af51c820 75 guix/store.scm \
89328d24 76 guix/cvs-download.scm \
b3acf365 77 guix/svn-download.scm \
073c34d7 78 guix/ui.scm \
5f7a1a4d 79 guix/build/ant-build-system.scm \
62cab99c 80 guix/build/download.scm \
c6bded8a 81 guix/build/cmake-build-system.scm \
e9137a53 82 guix/build/emacs-build-system.scm \
9b5b5c17 83 guix/build/git.scm \
be3425e5 84 guix/build/glib-or-gtk-build-system.scm \
af51c820 85 guix/build/gnu-build-system.scm \
fe12c345 86 guix/build/gnu-dist.scm \
08fd1ebe 87 guix/build/perl-build-system.scm \
40506d5d 88 guix/build/python-build-system.scm \
f8f3bef6 89 guix/build/r-build-system.scm \
c08f9818 90 guix/build/ruby-build-system.scm \
a677c726 91 guix/build/waf-build-system.scm \
9fd6c2ba 92 guix/build/haskell-build-system.scm \
6fd1a796 93 guix/build/store-copy.scm \
1273d44a 94 guix/build/utils.scm \
c8c88afa 95 guix/build/union.scm \
611adb1e 96 guix/build/profiles.scm \
3dbeecd2 97 guix/build/pull.scm \
3309e3a1 98 guix/build/rpath.scm \
89328d24 99 guix/build/cvs.scm \
b3acf365 100 guix/build/svn.scm \
15aa2c38 101 guix/build/gremlin.scm \
75f3b1a1 102 guix/build/emacs-utils.scm \
fb59e275 103 guix/build/graft.scm \
f2e4805b 104 guix/build/bournish.scm \
e89431bf 105 guix/search-paths.scm \
e3ce5d70 106 guix/packages.scm \
1b3e9685 107 guix/import/utils.scm \
7047133f 108 guix/import/gnu.scm \
1b3e9685 109 guix/import/snix.scm \
a4154748 110 guix/import/cabal.scm \
e1248602 111 guix/import/cran.scm \
a4154748 112 guix/import/hackage.scm \
7f74a931 113 guix/import/elpa.scm \
88981dd3 114 guix/scripts.scm \
de1355f1
LC
115 guix/scripts/download.scm \
116 guix/scripts/build.scm \
760c60d6 117 guix/scripts/archive.scm \
de1355f1
LC
118 guix/scripts/import.scm \
119 guix/scripts/package.scm \
120 guix/scripts/gc.scm \
121 guix/scripts/hash.scm \
122 guix/scripts/pull.scm \
2c74fde0 123 guix/scripts/substitute.scm \
526382ff 124 guix/scripts/authenticate.scm \
de1355f1 125 guix/scripts/refresh.scm \
523e4896 126 guix/scripts/system.scm \
b4f5e0e8 127 guix/scripts/lint.scm \
d23c20f1 128 guix/scripts/challenge.scm \
e1248602 129 guix/scripts/import/cran.scm \
7047133f 130 guix/scripts/import/gnu.scm \
1b3e9685 131 guix/scripts/import/nix.scm \
a4154748 132 guix/scripts/import/hackage.scm \
7f74a931 133 guix/scripts/import/elpa.scm \
372c4bbc 134 guix/scripts/environment.scm \
aff8ce7c 135 guix/scripts/publish.scm \
39bee8a2 136 guix/scripts/edit.scm \
fcc58db6 137 guix/scripts/size.scm \
88856916 138 guix/scripts/graph.scm \
32efa254
DT
139 guix/scripts/container.scm \
140 guix/scripts/container/exec.scm \
e3ce5d70 141 guix.scm \
d516736c 142 $(GNU_SYSTEM_MODULES)
af51c820 143
bb251307
LC
144if HAVE_GUILE_JSON
145
146MODULES += \
70161842 147 guix/import/github.scm \
bb251307
LC
148 guix/import/json.scm \
149 guix/import/pypi.scm \
150 guix/scripts/import/pypi.scm \
151 guix/import/cpan.scm \
152 guix/scripts/import/gem.scm \
153 guix/import/gem.scm
154
155endif
156
12e5b266
LC
157if BUILD_SYSCALLS_MODULE
158
159MODULES += \
160 guix/build/syscalls.scm
161
162endif
163
49e6291a
LC
164if BUILD_DAEMON_OFFLOAD
165
166MODULES += \
167 guix/scripts/offload.scm
168
169endif BUILD_DAEMON_OFFLOAD
170
c1bc358f 171# Internal module with test suite support.
02754a5e 172dist_noinst_DATA = guix/tests.scm
c1bc358f 173
a94546ec
LC
174# Linux-Libre configurations.
175KCONFIGS = \
75b314a6
MW
176 gnu/packages/linux-libre-4.5-i686.conf \
177 gnu/packages/linux-libre-4.5-x86_64.conf \
178 gnu/packages/linux-libre-4.4-i686.conf \
179 gnu/packages/linux-libre-4.4-x86_64.conf \
adddd5ba
MW
180 gnu/packages/linux-libre-4.1-i686.conf \
181 gnu/packages/linux-libre-4.1-x86_64.conf
1959fb04 182
ebc32b31
LC
183# Templates, examples.
184EXAMPLES = \
36ffaca2 185 gnu/system/examples/bare-bones.tmpl \
d038b674
LC
186 gnu/system/examples/desktop.tmpl \
187 gnu/system/examples/lightweight-desktop.tmpl
ebc32b31 188
c1bc358f 189GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go guix/tests.go
af51c820 190
74574fd1
RW
191nobase_dist_guilemodule_DATA = \
192 $(MODULES) $(KCONFIGS) $(EXAMPLES) \
193 $(MISC_DISTRO_FILES)
1959fb04 194nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm
800cdeef 195
1959fb04
LC
196# Do we need to provide our own non-broken (srfi srfi-37) module?
197if INSTALL_SRFI_37
198
199nobase_nodist_guilemodule_DATA += srfi/srfi-37.scm
200GOBJECTS += srfi/srfi-37.go
201
202srfi/srfi-37.scm: srfi/srfi-37.scm.in
203 $(MKDIR_P) srfi
204 cp "$<" "$@"
205
206endif INSTALL_SRFI_37
ac5aa288 207
70a9c720
LC
208# Handy way to remove the .go files without removing all the rest.
209clean-go:
210 -$(RM) -f $(GOBJECTS)
211
af51c820 212
bb251307
LC
213# Test extensions; has to be unconditional.
214TEST_EXTENSIONS = .scm .sh
215
216if CAN_RUN_TESTS
217
30dd8310 218SCM_TESTS = \
ddc29a78 219 tests/base32.scm \
e9c6c584 220 tests/base64.scm \
7a18c3cc 221 tests/cpio.scm \
69927e78 222 tests/hash.scm \
3476ded9 223 tests/pk-crypto.scm \
8b420f74 224 tests/pki.scm \
d326767e 225 tests/sets.scm \
202440e0 226 tests/gnu-maintenance.scm \
2c74fde0 227 tests/substitute.scm \
af51c820
LC
228 tests/builders.scm \
229 tests/derivations.scm \
7adf9b84 230 tests/grafts.scm \
299112d3 231 tests/ui.scm \
c0cd1b3e 232 tests/records.scm \
f1eacbaf 233 tests/upstream.scm \
e3ce5d70 234 tests/utils.scm \
b0e0d0e9 235 tests/build-utils.scm \
c8c88afa 236 tests/packages.scm \
10226c05 237 tests/snix.scm \
a4154748 238 tests/hackage.scm \
e1248602 239 tests/cran.scm \
7f74a931 240 tests/elpa.scm \
3259877d 241 tests/store.scm \
b860f382 242 tests/monads.scm \
21b679f6 243 tests/gexp.scm \
53c63ee9 244 tests/nar.scm \
a2078770 245 tests/union.scm \
29fa45f4 246 tests/profiles.scm \
b4f5e0e8 247 tests/syscalls.scm \
15aa2c38 248 tests/gremlin.scm \
aff8ce7c 249 tests/lint.scm \
fcc58db6 250 tests/publish.scm \
88981dd3 251 tests/scripts.scm \
c1f6a0c2 252 tests/size.scm \
88856916 253 tests/graph.scm \
d23c20f1 254 tests/challenge.scm \
0eef7551 255 tests/cve.scm \
661a1d79 256 tests/file-systems.scm \
6b779207 257 tests/system.scm \
0adfe95a 258 tests/services.scm \
629a064f 259 tests/scripts-build.scm \
a132f7d6
BW
260 tests/containers.scm \
261 tests/import-utils.scm
30dd8310 262
1b3e9685
DT
263if HAVE_GUILE_JSON
264
d45dc6da
EB
265SCM_TESTS += \
266 tests/pypi.scm \
a96524cc
DT
267 tests/cpan.scm \
268 tests/gem.scm
1b3e9685
DT
269
270endif
271
30dd8310 272SH_TESTS = \
0afdc485 273 tests/guix-build.sh \
37d19403 274 tests/guix-download.sh \
fe8ff028 275 tests/guix-gc.sh \
ccbce848 276 tests/guix-hash.sh \
0820098d 277 tests/guix-package.sh \
57b86237 278 tests/guix-package-net.sh \
c1202fb1 279 tests/guix-system.sh \
760c60d6 280 tests/guix-archive.sh \
dd7c013d 281 tests/guix-authenticate.sh \
cad25264 282 tests/guix-environment.sh \
f535dcbe 283 tests/guix-environment-container.sh \
88856916 284 tests/guix-graph.sh \
dd7c013d 285 tests/guix-lint.sh
af51c820 286
a7a4e6a4
LC
287if BUILD_DAEMON
288
289SH_TESTS += tests/guix-register.sh
290
291endif BUILD_DAEMON
292
293
30dd8310
LC
294TESTS = $(SCM_TESTS) $(SH_TESTS)
295
a9edb211 296AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" GUILE_AUTO_COMPILE=0
352ec143 297
a9edb211
ML
298SCM_LOG_DRIVER = $(top_builddir)/test-env $(GUILE) --no-auto-compile \
299 -e main $(top_srcdir)/build-aux/test-driver.scm
300AM_SCM_LOG_DRIVER_FLAGS = --brief=yes
97298ffa 301
69cfce50 302SH_LOG_COMPILER = $(top_builddir)/test-env $(SHELL)
97298ffa 303AM_SH_LOG_FLAGS = -x -e
af51c820 304
3a33730a
LC
305# Make sure `tests/guix-gc.sh' runs last, after all the others. Otherwise it
306# could end up removing files from the store while they are being used by
307# other instances of the daemon.
308tests/guix-gc.log: \
309 $(patsubst %.sh,%.log,$(filter-out tests/guix-gc.sh,$(SH_TESTS))) \
310 $(SCM_TESTS:%.scm=%.log)
311
bb251307
LC
312else !CAN_RUN_TESTS
313
314TESTS =
315SH_TESTS =
316SCM_TESTS =
317
318# Automake always generates a 'check' target, so better not override it.
319check-local:
320 @echo
321 @echo "Cannot run tests because file name limits would be exceeded." >&2
322 @echo "Look for 'length' in the 'config.log' file for details." >&2
323 @echo
324 @exit 1
325
326endif !CAN_RUN_TESTS
327
bf59c06d 328# Public key used to sign substitutes from hydra.gnu.org.
6c110833 329dist_pkgdata_DATA = hydra.gnu.org.pub
3a33730a 330
ee3e157d
LC
331# Bash completion file.
332dist_bashcompletion_DATA = etc/completion/bash/guix
333
81f61c17
LC
334EXTRA_DIST = \
335 HACKING \
336 ROADMAP \
337 TODO \
e15fcdd1 338 CODE-OF-CONDUCT \
81f61c17 339 .dir-locals.el \
f81ac34d 340 build-aux/build-self.scm \
de6af327 341 build-aux/compile-all.scm \
81f61c17
LC
342 build-aux/hydra/gnu-system.scm \
343 build-aux/hydra/demo-os.scm \
344 build-aux/hydra/guix.scm \
345 build-aux/check-available-binaries.scm \
346 build-aux/check-final-inputs-self-contained.scm \
347 build-aux/download.scm \
8bc35f85 348 build-aux/make-binary-tarball.scm \
1c2ae810 349 build-aux/generate-authors.scm \
81f61c17
LC
350 srfi/srfi-37.scm.in \
351 srfi/srfi-64.scm \
352 srfi/srfi-64.upstream.scm \
353 tests/test.drv \
354 tests/signing-key.pub \
355 tests/signing-key.sec \
0eef7551 356 tests/cve-sample.xml \
81f61c17
LC
357 build-aux/config.rpath \
358 bootstrap \
359 release.nix \
ed795c06 360 $(TESTS)
d7672884 361
49e6291a
LC
362if !BUILD_DAEMON_OFFLOAD
363
364EXTRA_DIST += \
365 guix/scripts/offload.scm
366
367endif !BUILD_DAEMON_OFFLOAD
368
12e5b266
LC
369if !BUILD_SYSCALLS_MODULE
370
371EXTRA_DIST += \
372 guix/build/syscalls.scm
373
374endif !BUILD_SYSCALLS_MODULE
375
49e6291a 376
30dd8310
LC
377CLEANFILES = \
378 $(GOBJECTS) \
9bff16b3 379 $(SCM_TESTS:tests/%.scm=%.log)
af51c820 380
28561d85
LC
381# Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if
382# $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files in
383# there that are newer than the local .scm files (for instance because the
384# user ran 'make install' recently). When that happens, we end up loading
385# those previously-installed .go files, which may be stale, thereby breaking
386# the whole thing.
de6af327
TUBK
387%.go: make-go ; @:
388make-go: $(MODULES) guix/config.scm guix/tests.scm
389 $(AM_V_at)echo "Compiling Scheme modules..." ; \
28561d85 390 unset GUILE_LOAD_COMPILED_PATH ; \
de6af327 391 host=$(host) srcdir="$(top_srcdir)" \
671d8f5e 392 $(top_builddir)/pre-inst-env \
de6af327
TUBK
393 $(GUILE) -L "$(top_builddir)" -L "$(top_srcdir)" \
394 --no-auto-compile \
395 -s "$(top_srcdir)"/build-aux/compile-all.scm $^
af51c820
LC
396
397SUFFIXES = .go
398
399# Make sure source files are installed first, so that the mtime of
400# installed compiled files is greater than that of installed source
401# files. See
402# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
403# for details.
404guix_install_go_files = install-nobase_nodist_guilemoduleDATA
405$(guix_install_go_files): install-nobase_dist_guilemoduleDATA
f68b0893 406
6005bd07
LC
407# The above trick doesn't work for 'config.go' because both 'config.scm' and
408# 'config.go' are listed in $(nobase_nodist_guilemodule_DATA). Thus, give it
409# special treatment.
410install-data-hook: set-bootstrap-executable-permissions
411 touch "$(DESTDIR)$(guilemoduledir)/guix/config.go"
412
413
ee764179 414SUBDIRS = po/guix po/packages
931c132a 415BUILT_SOURCES =
a9424c08
LC
416
417include doc.am
568717fd 418
c2033df4
LC
419if BUILD_DAEMON
420
421include daemon.am
422
423endif BUILD_DAEMON
424
f68b0893 425ACLOCAL_AMFLAGS = -I m4
ef5f5c86
LC
426
427# Pass an explicit '--localstatedir' so that configure does not error out if
428# it finds an existing installation with a different localstatedir.
e76bdf8b 429AM_DISTCHECK_CONFIGURE_FLAGS = \
ef5f5c86 430 --localstatedir="$$dc_install_base/var" \
d388c2c4 431 --with-libgcrypt-prefix="$(LIBGCRYPT_PREFIX)" \
14af289e 432 --with-libgcrypt-libdir="$(LIBGCRYPT_LIBDIR)" \
aca54b39
LC
433 --with-nix-prefix="$(NIX_PREFIX)" \
434 --enable-daemon
0e993428 435
457f60fa
AK
436dist_emacsui_DATA = emacs/guix-main.scm
437nodist_emacsui_DATA = emacs/guix-helper.scm
438include emacs.am
439
9d3fb6c7
LC
440# The self-contained tarball.
441guix-binary.%.tar.xz:
e71ad29d 442 $(AM_V_GEN)GUIX_PACKAGE_PATH= \
9d3fb6c7
LC
443 $(top_builddir)/pre-inst-env "$(GUILE)" \
444 "$(top_srcdir)/build-aux/make-binary-tarball.scm" "$*" "$@"
445
446
a8ac45b1
AK
447dist-hook: sync-descriptions gen-ChangeLog gen-AUTHORS
448dist-hook: assert-no-store-file-names
449
81f61c17 450distcheck-hook: assert-binaries-available assert-final-inputs-self-contained
e793178a 451
668d48a6 452sync-descriptions:
e71ad29d 453 $(AM_V_at)GUIX_PACKAGE_PATH= \
36c45230 454 $(top_builddir)/pre-inst-env guix lint --checkers=gnu-description
e793178a
LC
455
456gen-ChangeLog:
e71ad29d 457 $(AM_V_GEN)if test -d .git; then \
e793178a
LC
458 $(top_srcdir)/build-aux/gitlog-to-changelog \
459 > $(distdir)/cl-t; \
460 rm -f $(distdir)/ChangeLog; \
461 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
462 fi
463
a8ac45b1 464gen-AUTHORS:
e71ad29d 465 $(AM_V_GEN)if test -d .git; then \
ac140f79
LC
466 rm -f "$(distdir)/AUTHORS"; \
467 $(top_builddir)/pre-inst-env "$(GUILE)" \
468 "$(top_srcdir)/build-aux/generate-authors.scm" \
469 "$(top_srcdir)" "$(distdir)/AUTHORS"; \
470 fi
a8ac45b1 471
834129e0 472# Make sure we're not shipping a file that embeds a local /gnu/store file name.
a463ffd9 473assert-no-store-file-names:
e71ad29d 474 $(AM_V_at)if grep -r --exclude=*.texi --exclude=*.info \
a463ffd9
LC
475 "$(storedir)/[a-z0-9]{32}-" $(distdir) ; \
476 then \
477 echo "error: store file names embedded in the distribution" >&2 ; \
478 exit 1 ; \
479 fi
480
56fbf262
LC
481# Make sure hydra.gnu.org has the important binaries.
482assert-binaries-available:
e71ad29d 483 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
56fbf262
LC
484 "$(top_srcdir)/build-aux/check-available-binaries.scm"
485
81f61c17
LC
486# Make sure the final inputs don't refer to bootstrap tools.
487assert-final-inputs-self-contained:
e71ad29d 488 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
81f61c17
LC
489 "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm"
490
de6af327 491.PHONY: sync-descriptions gen-ChangeLog gen-AUTHORS clean-go make-go
56fbf262 492.PHONY: assert-no-store-file-names assert-binaries-available
81f61c17 493.PHONY: assert-final-inputs-self-contained
8c3d8894
ML
494
495## -------------- ##
496## Silent rules. ##
497## -------------- ##
498
499AM_V_DL = $(AM_V_DL_$(V))
500AM_V_DL_ = $(AM_V_DL_$(AM_DEFAULT_VERBOSITY))
501AM_V_DL_0 = @echo " DL " $@;
4c48878d
ML
502
503AM_V_DOT = $(AM_V_DOT_$(V))
504AM_V_DOT_ = $(AM_V_DOT_$(AM_DEFAULT_VERBOSITY))
505AM_V_DOT_0 = @echo " DOT " $@;
71ed439b
ML
506
507AM_V_EMACS = $(AM_V_EMACS_$(V))
508AM_V_EMACS_ = $(AM_V_EMACS_$(AM_DEFAULT_VERBOSITY))
509AM_V_EMACS_0 = @echo " EMACS " $@;
8dddedf7
ML
510
511AM_V_HELP2MAN = $(AM_V_HELP2MAN_$(V))
512AM_V_HELP2MAN_ = $(AM_V_HELP2MAN_$(AM_DEFAULT_VERBOSITY))
513AM_V_HELP2MAN_0 = @echo " HELP2MAN" $@;