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