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