substitute: Pass the cache URL instead of <cache> objects.
[guix.git] / daemon.am
blobeecfea1c7ee821e77693423017a9e88aeb0c3cf9
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
4 # This file is part of GNU Guix.
6 # GNU Guix is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or (at
9 # your option) any later version.
11 # GNU Guix is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
20 # Integration of the `guix-daemon' code taken from upstream Nix.
23 BUILT_SOURCES += nix/libstore/schema.sql.hh
24 CLEANFILES += $(BUILT_SOURCES)
26 noinst_LIBRARIES = libformat.a libutil.a libstore.a
28 # Use '-std=c++11' for 'std::shared_ptr', 'auto', lambdas, and more.
29 AM_CXXFLAGS = -Wall -std=c++11
31 libformat_a_SOURCES =                           \
32   nix/boost/format/free_funcs.cc                \
33   nix/boost/format/parsing.cc                   \
34   nix/boost/format/format_implementation.cc
36 libformat_headers =                             \
37   nix/boost/throw_exception.hpp                 \
38   nix/boost/format.hpp                          \
39   nix/boost/assert.hpp                          \
40   nix/boost/format/macros_default.hpp           \
41   nix/boost/format/format_fwd.hpp               \
42   nix/boost/format/format_class.hpp             \
43   nix/boost/format/exceptions.hpp               \
44   nix/boost/format/group.hpp                    \
45   nix/boost/format/feed_args.hpp                \
46   nix/boost/format/internals_fwd.hpp            \
47   nix/boost/format/internals.hpp
49 libformat_a_CPPFLAGS =                          \
50   -I$(top_srcdir)/nix
52 libutil_a_SOURCES =                             \
53   nix/libutil/archive.cc                        \
54   nix/libutil/affinity.cc                       \
55   nix/libutil/serialise.cc                      \
56   nix/libutil/util.cc                           \
57   nix/libutil/xml-writer.cc                     \
58   nix/libutil/hash.cc                           \
59   nix/libutil/gcrypt-hash.cc
61 libutil_headers =                               \
62   nix/libutil/affinity.hh                       \
63   nix/libutil/hash.hh                           \
64   nix/libutil/serialise.hh                      \
65   nix/libutil/xml-writer.hh                     \
66   nix/libutil/util.hh                           \
67   nix/libutil/archive.hh                        \
68   nix/libutil/types.hh                          \
69   nix/libutil/gcrypt-hash.hh                    \
70   nix/libutil/md5.h                             \
71   nix/libutil/sha1.h                            \
72   nix/libutil/sha256.h
74 libutil_a_CPPFLAGS =                            \
75   -I$(top_builddir)/nix                         \
76   -I$(top_srcdir)/nix/libutil                   \
77   $(libformat_a_CPPFLAGS)
79 libstore_a_SOURCES =                            \
80   nix/libstore/gc.cc                            \
81   nix/libstore/globals.cc                       \
82   nix/libstore/misc.cc                          \
83   nix/libstore/references.cc                    \
84   nix/libstore/store-api.cc                     \
85   nix/libstore/optimise-store.cc                \
86   nix/libstore/local-store.cc                   \
87   nix/libstore/remote-store.cc                  \
88   nix/libstore/build.cc                         \
89   nix/libstore/pathlocks.cc                     \
90   nix/libstore/derivations.cc
92 libstore_headers =                              \
93   nix/libstore/references.hh                    \
94   nix/libstore/pathlocks.hh                     \
95   nix/libstore/globals.hh                       \
96   nix/libstore/schema.sql.hh                    \
97   nix/libstore/worker-protocol.hh               \
98   nix/libstore/remote-store.hh                  \
99   nix/libstore/derivations.hh                   \
100   nix/libstore/misc.hh                          \
101   nix/libstore/local-store.hh                   \
102   nix/libstore/store-api.hh
104 libstore_a_CPPFLAGS =                           \
105   $(libutil_a_CPPFLAGS)                         \
106   -I$(top_srcdir)/nix/libstore                  \
107   -I$(top_builddir)/nix/libstore                \
108   -DNIX_STORE_DIR=\"$(storedir)\"               \
109   -DNIX_DATA_DIR=\"$(datadir)\"                 \
110   -DNIX_STATE_DIR=\"$(localstatedir)/guix\"     \
111   -DNIX_LOG_DIR=\"$(localstatedir)/log/guix\"   \
112   -DNIX_CONF_DIR=\"$(sysconfdir)/guix\"         \
113   -DNIX_LIBEXEC_DIR=\"$(libexecdir)\"           \
114   -DNIX_BIN_DIR=\"$(bindir)\"                   \
115   -DOPENSSL_PATH="\"guix-authenticate\""        \
116   -DDEFAULT_CHROOT_DIRS="\"\""
118 libstore_a_CXXFLAGS = $(AM_CXXFLAGS)            \
119   $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS)
121 bin_PROGRAMS = guix-daemon
122 sbin_PROGRAMS = guix-register
124 guix_daemon_SOURCES =                           \
125   nix/nix-daemon/nix-daemon.cc                  \
126   nix/nix-daemon/guix-daemon.cc
128 guix_daemon_CPPFLAGS =                          \
129   -DLOCALEDIR=\"$(localedir)\"                  \
130   $(libutil_a_CPPFLAGS)                         \
131   -I$(top_srcdir)/nix/libstore
133 guix_daemon_LDADD =                             \
134   libstore.a libutil.a libformat.a -lbz2        \
135   $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
137 guix_daemon_headers =                           \
138   nix/nix-daemon/shared.hh
141 guix_register_SOURCES =                         \
142   nix/guix-register/guix-register.cc
144 guix_register_CPPFLAGS =                        \
145   $(libutil_a_CPPFLAGS)                         \
146   $(libstore_a_CPPFLAGS)                        \
147   -I$(top_srcdir)/nix/libstore
149 # XXX: Should we start using shared libs?
150 guix_register_LDADD =                           \
151   libstore.a libutil.a libformat.a -lbz2        \
152   $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
155 noinst_HEADERS =                                                \
156   $(libformat_headers) $(libutil_headers) $(libstore_headers)   \
157   $(guix_daemon_headers)
159 nix/libstore/schema.sql.hh: nix/libstore/schema.sql
160         $(GUILE) --no-auto-compile -c                           \
161           "(use-modules (rnrs io ports))                        \
162            (call-with-output-file \"$@\"                        \
163              (lambda (out)                                      \
164                (call-with-input-file \"$^\"                     \
165                  (lambda (in)                                   \
166                    (write (get-string-all in) out)))))"
168 nodist_pkglibexec_SCRIPTS =                     \
169   nix/scripts/list-runtime-roots                \
170   nix/scripts/substitute
172 if BUILD_DAEMON_OFFLOAD
174 nodist_pkglibexec_SCRIPTS +=                    \
175   nix/scripts/offload
177 endif BUILD_DAEMON_OFFLOAD
180 # XXX: It'd be better to hide it in $(pkglibexecdir).
181 nodist_libexec_SCRIPTS =                        \
182   nix/scripts/guix-authenticate
184 EXTRA_DIST +=                                   \
185   nix/libstore/schema.sql                       \
186   nix/AUTHORS                                   \
187   nix/COPYING
189 AM_TESTS_ENVIRONMENT +=                         \
190   top_builddir="$(abs_top_builddir)"
192 TESTS +=                                        \
193   tests/guix-daemon.sh
195 clean-local:
196         -if test -d "$(GUIX_TEST_ROOT)"; then           \
197           find "$(GUIX_TEST_ROOT)" | xargs chmod +w;    \
198          fi
199         -rm -rf "$(GUIX_TEST_ROOT)"