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