build: Build (guix import github) only when Guile-JSON is available.
[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-system.am
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/utils.scm \
42 guix/sets.scm \
43 guix/download.scm \
44 guix/git-download.scm \
45 guix/monads.scm \
46 guix/monad-repl.scm \
47 guix/gexp.scm \
48 guix/profiles.scm \
49 guix/serialization.scm \
50 guix/nar.scm \
51 guix/derivations.scm \
52 guix/grafts.scm \
53 guix/gnu-maintenance.scm \
54 guix/upstream.scm \
55 guix/licenses.scm \
56 guix/graph.scm \
57 guix/cve.scm \
58 guix/build-system.scm \
59 guix/build-system/cmake.scm \
60 guix/build-system/emacs.scm \
61 guix/build-system/glib-or-gtk.scm \
62 guix/build-system/gnu.scm \
63 guix/build-system/haskell.scm \
64 guix/build-system/perl.scm \
65 guix/build-system/python.scm \
66 guix/build-system/waf.scm \
67 guix/build-system/r.scm \
68 guix/build-system/ruby.scm \
69 guix/build-system/trivial.scm \
70 guix/ftp-client.scm \
71 guix/http-client.scm \
72 guix/gnupg.scm \
73 guix/elf.scm \
74 guix/store.scm \
75 guix/cvs-download.scm \
76 guix/svn-download.scm \
77 guix/ui.scm \
78 guix/build/download.scm \
79 guix/build/cmake-build-system.scm \
80 guix/build/emacs-build-system.scm \
81 guix/build/git.scm \
82 guix/build/glib-or-gtk-build-system.scm \
83 guix/build/gnu-build-system.scm \
84 guix/build/gnu-dist.scm \
85 guix/build/perl-build-system.scm \
86 guix/build/python-build-system.scm \
87 guix/build/r-build-system.scm \
88 guix/build/ruby-build-system.scm \
89 guix/build/waf-build-system.scm \
90 guix/build/haskell-build-system.scm \
91 guix/build/store-copy.scm \
92 guix/build/utils.scm \
93 guix/build/union.scm \
94 guix/build/profiles.scm \
95 guix/build/pull.scm \
96 guix/build/rpath.scm \
97 guix/build/cvs.scm \
98 guix/build/svn.scm \
99 guix/build/gremlin.scm \
100 guix/build/emacs-utils.scm \
101 guix/build/graft.scm \
102 guix/build/bournish.scm \
103 guix/search-paths.scm \
104 guix/packages.scm \
105 guix/import/utils.scm \
106 guix/import/gnu.scm \
107 guix/import/snix.scm \
108 guix/import/cabal.scm \
109 guix/import/cran.scm \
110 guix/import/hackage.scm \
111 guix/import/elpa.scm \
112 guix/scripts.scm \
113 guix/scripts/download.scm \
114 guix/scripts/build.scm \
115 guix/scripts/archive.scm \
116 guix/scripts/import.scm \
117 guix/scripts/package.scm \
118 guix/scripts/gc.scm \
119 guix/scripts/hash.scm \
120 guix/scripts/pull.scm \
121 guix/scripts/substitute.scm \
122 guix/scripts/authenticate.scm \
123 guix/scripts/refresh.scm \
124 guix/scripts/system.scm \
125 guix/scripts/lint.scm \
126 guix/scripts/challenge.scm \
127 guix/scripts/import/cran.scm \
128 guix/scripts/import/gnu.scm \
129 guix/scripts/import/nix.scm \
130 guix/scripts/import/hackage.scm \
131 guix/scripts/import/elpa.scm \
132 guix/scripts/environment.scm \
133 guix/scripts/publish.scm \
134 guix/scripts/edit.scm \
135 guix/scripts/size.scm \
136 guix/scripts/graph.scm \
137 guix/scripts/container.scm \
138 guix/scripts/container/exec.scm \
139 guix.scm \
140 $(GNU_SYSTEM_MODULES)
141
142 if HAVE_GUILE_JSON
143
144 MODULES += \
145 guix/import/github.scm \
146 guix/import/json.scm \
147 guix/import/pypi.scm \
148 guix/scripts/import/pypi.scm \
149 guix/import/cpan.scm \
150 guix/scripts/import/gem.scm \
151 guix/import/gem.scm
152
153 endif
154
155 if BUILD_SYSCALLS_MODULE
156
157 MODULES += \
158 guix/build/syscalls.scm
159
160 endif
161
162 if BUILD_DAEMON_OFFLOAD
163
164 MODULES += \
165 guix/scripts/offload.scm
166
167 endif BUILD_DAEMON_OFFLOAD
168
169 # Internal module with test suite support.
170 dist_noinst_DATA = guix/tests.scm
171
172 # Linux-Libre configurations.
173 KCONFIGS = \
174 gnu/packages/linux-libre-i686.conf \
175 gnu/packages/linux-libre-x86_64.conf \
176 gnu/packages/linux-libre-4.1-i686.conf \
177 gnu/packages/linux-libre-4.1-x86_64.conf
178
179 # Templates, examples.
180 EXAMPLES = \
181 gnu/system/examples/bare-bones.tmpl \
182 gnu/system/examples/desktop.tmpl
183
184 GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go guix/tests.go
185
186 nobase_dist_guilemodule_DATA = \
187 $(MODULES) $(KCONFIGS) $(EXAMPLES) \
188 $(MISC_DISTRO_FILES)
189 nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm
190
191 # Do we need to provide our own non-broken (srfi srfi-37) module?
192 if INSTALL_SRFI_37
193
194 nobase_nodist_guilemodule_DATA += srfi/srfi-37.scm
195 GOBJECTS += srfi/srfi-37.go
196
197 srfi/srfi-37.scm: srfi/srfi-37.scm.in
198 $(MKDIR_P) srfi
199 cp "$<" "$@"
200
201 endif INSTALL_SRFI_37
202
203 # Handy way to remove the .go files without removing all the rest.
204 clean-go:
205 -$(RM) -f $(GOBJECTS)
206
207
208 # Test extensions; has to be unconditional.
209 TEST_EXTENSIONS = .scm .sh
210
211 if CAN_RUN_TESTS
212
213 SCM_TESTS = \
214 tests/base32.scm \
215 tests/base64.scm \
216 tests/cpio.scm \
217 tests/hash.scm \
218 tests/pk-crypto.scm \
219 tests/pki.scm \
220 tests/sets.scm \
221 tests/gnu-maintenance.scm \
222 tests/substitute.scm \
223 tests/builders.scm \
224 tests/derivations.scm \
225 tests/grafts.scm \
226 tests/ui.scm \
227 tests/records.scm \
228 tests/utils.scm \
229 tests/build-utils.scm \
230 tests/packages.scm \
231 tests/snix.scm \
232 tests/hackage.scm \
233 tests/cran.scm \
234 tests/elpa.scm \
235 tests/store.scm \
236 tests/monads.scm \
237 tests/gexp.scm \
238 tests/nar.scm \
239 tests/union.scm \
240 tests/profiles.scm \
241 tests/syscalls.scm \
242 tests/gremlin.scm \
243 tests/lint.scm \
244 tests/publish.scm \
245 tests/scripts.scm \
246 tests/size.scm \
247 tests/graph.scm \
248 tests/challenge.scm \
249 tests/cve.scm \
250 tests/file-systems.scm \
251 tests/system.scm \
252 tests/services.scm \
253 tests/scripts-build.scm \
254 tests/containers.scm \
255 tests/import-utils.scm
256
257 if HAVE_GUILE_JSON
258
259 SCM_TESTS += \
260 tests/pypi.scm \
261 tests/cpan.scm \
262 tests/gem.scm
263
264 endif
265
266 SH_TESTS = \
267 tests/guix-build.sh \
268 tests/guix-download.sh \
269 tests/guix-gc.sh \
270 tests/guix-hash.sh \
271 tests/guix-package.sh \
272 tests/guix-package-net.sh \
273 tests/guix-system.sh \
274 tests/guix-archive.sh \
275 tests/guix-authenticate.sh \
276 tests/guix-environment.sh \
277 tests/guix-environment-container.sh \
278 tests/guix-graph.sh \
279 tests/guix-lint.sh
280
281 if BUILD_DAEMON
282
283 SH_TESTS += tests/guix-register.sh
284
285 endif BUILD_DAEMON
286
287
288 TESTS = $(SCM_TESTS) $(SH_TESTS)
289
290 AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)"
291
292 SCM_LOG_COMPILER = $(top_builddir)/test-env $(GUILE)
293 AM_SCM_LOG_FLAGS = --no-auto-compile -L "$(top_srcdir)"
294
295 SH_LOG_COMPILER = $(top_builddir)/test-env $(SHELL)
296 AM_SH_LOG_FLAGS = -x -e
297
298 # Make sure `tests/guix-gc.sh' runs last, after all the others. Otherwise it
299 # could end up removing files from the store while they are being used by
300 # other instances of the daemon.
301 tests/guix-gc.log: \
302 $(patsubst %.sh,%.log,$(filter-out tests/guix-gc.sh,$(SH_TESTS))) \
303 $(SCM_TESTS:%.scm=%.log)
304
305 else !CAN_RUN_TESTS
306
307 TESTS =
308 SH_TESTS =
309 SCM_TESTS =
310
311 # Automake always generates a 'check' target, so better not override it.
312 check-local:
313 @echo
314 @echo "Cannot run tests because file name limits would be exceeded." >&2
315 @echo "Look for 'length' in the 'config.log' file for details." >&2
316 @echo
317 @exit 1
318
319 endif !CAN_RUN_TESTS
320
321 # Public key used to sign substitutes from hydra.gnu.org.
322 dist_pkgdata_DATA = hydra.gnu.org.pub
323
324 # Bash completion file.
325 dist_bashcompletion_DATA = etc/completion/bash/guix
326
327 EXTRA_DIST = \
328 HACKING \
329 ROADMAP \
330 TODO \
331 CODE-OF-CONDUCT \
332 .dir-locals.el \
333 build-aux/build-self.scm \
334 build-aux/compile-all.scm \
335 build-aux/hydra/gnu-system.scm \
336 build-aux/hydra/demo-os.scm \
337 build-aux/hydra/guix.scm \
338 build-aux/check-available-binaries.scm \
339 build-aux/check-final-inputs-self-contained.scm \
340 build-aux/download.scm \
341 build-aux/make-binary-tarball.scm \
342 build-aux/generate-authors.scm \
343 srfi/srfi-37.scm.in \
344 srfi/srfi-64.scm \
345 srfi/srfi-64.upstream.scm \
346 tests/test.drv \
347 tests/signing-key.pub \
348 tests/signing-key.sec \
349 tests/cve-sample.xml \
350 build-aux/config.rpath \
351 bootstrap \
352 release.nix \
353 $(TESTS)
354
355 if !BUILD_DAEMON_OFFLOAD
356
357 EXTRA_DIST += \
358 guix/scripts/offload.scm
359
360 endif !BUILD_DAEMON_OFFLOAD
361
362 if !BUILD_SYSCALLS_MODULE
363
364 EXTRA_DIST += \
365 guix/build/syscalls.scm
366
367 endif !BUILD_SYSCALLS_MODULE
368
369
370 CLEANFILES = \
371 $(GOBJECTS) \
372 $(SCM_TESTS:tests/%.scm=%.log)
373
374 # Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if
375 # $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files in
376 # there that are newer than the local .scm files (for instance because the
377 # user ran 'make install' recently). When that happens, we end up loading
378 # those previously-installed .go files, which may be stale, thereby breaking
379 # the whole thing.
380 %.go: make-go ; @:
381 make-go: $(MODULES) guix/config.scm guix/tests.scm
382 $(AM_V_at)echo "Compiling Scheme modules..." ; \
383 unset GUILE_LOAD_COMPILED_PATH ; \
384 host=$(host) srcdir="$(top_srcdir)" \
385 $(top_builddir)/pre-inst-env \
386 $(GUILE) -L "$(top_builddir)" -L "$(top_srcdir)" \
387 --no-auto-compile \
388 -s "$(top_srcdir)"/build-aux/compile-all.scm $^
389
390 SUFFIXES = .go
391
392 # Make sure source files are installed first, so that the mtime of
393 # installed compiled files is greater than that of installed source
394 # files. See
395 # <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
396 # for details.
397 guix_install_go_files = install-nobase_nodist_guilemoduleDATA
398 $(guix_install_go_files): install-nobase_dist_guilemoduleDATA
399
400 # The above trick doesn't work for 'config.go' because both 'config.scm' and
401 # 'config.go' are listed in $(nobase_nodist_guilemodule_DATA). Thus, give it
402 # special treatment.
403 install-data-hook: set-bootstrap-executable-permissions
404 touch "$(DESTDIR)$(guilemoduledir)/guix/config.go"
405
406
407 SUBDIRS = po/guix po/packages
408 BUILT_SOURCES =
409
410 include doc.am
411
412 if BUILD_DAEMON
413
414 include daemon.am
415
416 endif BUILD_DAEMON
417
418 ACLOCAL_AMFLAGS = -I m4
419 AM_DISTCHECK_CONFIGURE_FLAGS = \
420 --with-libgcrypt-prefix="$(LIBGCRYPT_PREFIX)" \
421 --with-libgcrypt-libdir="$(LIBGCRYPT_LIBDIR)" \
422 --with-nix-prefix="$(NIX_PREFIX)" \
423 --enable-daemon
424
425 dist_emacsui_DATA = emacs/guix-main.scm
426 nodist_emacsui_DATA = emacs/guix-helper.scm
427 include emacs.am
428
429 # The self-contained tarball.
430 guix-binary.%.tar.xz:
431 $(AM_V_GEN)GUIX_PACKAGE_PATH= \
432 $(top_builddir)/pre-inst-env "$(GUILE)" \
433 "$(top_srcdir)/build-aux/make-binary-tarball.scm" "$*" "$@"
434
435
436 dist-hook: sync-descriptions gen-ChangeLog gen-AUTHORS
437 dist-hook: assert-no-store-file-names
438
439 distcheck-hook: assert-binaries-available assert-final-inputs-self-contained
440
441 sync-descriptions:
442 $(AM_V_at)GUIX_PACKAGE_PATH= \
443 $(top_builddir)/pre-inst-env guix lint --checkers=gnu-description
444
445 gen-ChangeLog:
446 $(AM_V_GEN)if test -d .git; then \
447 $(top_srcdir)/build-aux/gitlog-to-changelog \
448 > $(distdir)/cl-t; \
449 rm -f $(distdir)/ChangeLog; \
450 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
451 fi
452
453 gen-AUTHORS:
454 $(AM_V_GEN)if test -d .git; then \
455 rm -f "$(distdir)/AUTHORS"; \
456 $(top_builddir)/pre-inst-env "$(GUILE)" \
457 "$(top_srcdir)/build-aux/generate-authors.scm" \
458 "$(top_srcdir)" "$(distdir)/AUTHORS"; \
459 fi
460
461 # Make sure we're not shipping a file that embeds a local /gnu/store file name.
462 assert-no-store-file-names:
463 $(AM_V_at)if grep -r --exclude=*.texi --exclude=*.info \
464 "$(storedir)/[a-z0-9]{32}-" $(distdir) ; \
465 then \
466 echo "error: store file names embedded in the distribution" >&2 ; \
467 exit 1 ; \
468 fi
469
470 # Make sure hydra.gnu.org has the important binaries.
471 assert-binaries-available:
472 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
473 "$(top_srcdir)/build-aux/check-available-binaries.scm"
474
475 # Make sure the final inputs don't refer to bootstrap tools.
476 assert-final-inputs-self-contained:
477 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
478 "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm"
479
480 .PHONY: sync-descriptions gen-ChangeLog gen-AUTHORS clean-go make-go
481 .PHONY: assert-no-store-file-names assert-binaries-available
482 .PHONY: assert-final-inputs-self-contained
483
484 ## -------------- ##
485 ## Silent rules. ##
486 ## -------------- ##
487
488 AM_V_DL = $(AM_V_DL_$(V))
489 AM_V_DL_ = $(AM_V_DL_$(AM_DEFAULT_VERBOSITY))
490 AM_V_DL_0 = @echo " DL " $@;
491
492 AM_V_DOT = $(AM_V_DOT_$(V))
493 AM_V_DOT_ = $(AM_V_DOT_$(AM_DEFAULT_VERBOSITY))
494 AM_V_DOT_0 = @echo " DOT " $@;
495
496 AM_V_EMACS = $(AM_V_EMACS_$(V))
497 AM_V_EMACS_ = $(AM_V_EMACS_$(AM_DEFAULT_VERBOSITY))
498 AM_V_EMACS_0 = @echo " EMACS " $@;
499
500 AM_V_HELP2MAN = $(AM_V_HELP2MAN_$(V))
501 AM_V_HELP2MAN_ = $(AM_V_HELP2MAN_$(AM_DEFAULT_VERBOSITY))
502 AM_V_HELP2MAN_0 = @echo " HELP2MAN" $@;