Commit | Line | Data |
---|---|---|
233e7676 | 1 | # GNU Guix --- Functional package management for GNU |
65d13e30 | 2 | # Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
e71ad29d | 3 | # Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> |
c2033df4 | 4 | # |
233e7676 | 5 | # This file is part of GNU Guix. |
c2033df4 | 6 | # |
233e7676 | 7 | # GNU Guix is free software; you can redistribute it and/or modify it |
c2033df4 LC |
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 | # | |
233e7676 | 12 | # GNU Guix is distributed in the hope that it will be useful, but |
c2033df4 LC |
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 | |
233e7676 | 18 | # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
c2033df4 LC |
19 | |
20 | # | |
21 | # Integration of the `guix-daemon' code taken from upstream Nix. | |
22 | # | |
23 | ||
c0d2e7b1 | 24 | BUILT_SOURCES += %D%/libstore/schema.sql.hh |
751164bc | 25 | CLEANFILES += %D%/libstore/schema.sql.hh |
c2033df4 LC |
26 | |
27 | noinst_LIBRARIES = libformat.a libutil.a libstore.a | |
28 | ||
2bb04905 LC |
29 | # Use '-std=c++11' for 'std::shared_ptr', 'auto', lambdas, and more. |
30 | AM_CXXFLAGS = -Wall -std=c++11 | |
996ed6ac | 31 | |
c2033df4 | 32 | libformat_a_SOURCES = \ |
c0d2e7b1 ML |
33 | %D%/boost/format/free_funcs.cc \ |
34 | %D%/boost/format/parsing.cc \ | |
35 | %D%/boost/format/format_implementation.cc | |
c2033df4 LC |
36 | |
37 | libformat_headers = \ | |
c0d2e7b1 ML |
38 | %D%/boost/throw_exception.hpp \ |
39 | %D%/boost/format.hpp \ | |
40 | %D%/boost/assert.hpp \ | |
41 | %D%/boost/format/macros_default.hpp \ | |
42 | %D%/boost/format/format_fwd.hpp \ | |
43 | %D%/boost/format/format_class.hpp \ | |
44 | %D%/boost/format/exceptions.hpp \ | |
45 | %D%/boost/format/group.hpp \ | |
46 | %D%/boost/format/feed_args.hpp \ | |
47 | %D%/boost/format/internals_fwd.hpp \ | |
48 | %D%/boost/format/internals.hpp | |
c2033df4 LC |
49 | |
50 | libformat_a_CPPFLAGS = \ | |
51 | -I$(top_srcdir)/nix | |
52 | ||
53 | libutil_a_SOURCES = \ | |
c0d2e7b1 ML |
54 | %D%/libutil/archive.cc \ |
55 | %D%/libutil/affinity.cc \ | |
56 | %D%/libutil/serialise.cc \ | |
57 | %D%/libutil/util.cc \ | |
c0d2e7b1 ML |
58 | %D%/libutil/hash.cc \ |
59 | %D%/libutil/gcrypt-hash.cc | |
c2033df4 LC |
60 | |
61 | libutil_headers = \ | |
c0d2e7b1 ML |
62 | %D%/libutil/affinity.hh \ |
63 | %D%/libutil/hash.hh \ | |
64 | %D%/libutil/serialise.hh \ | |
c0d2e7b1 ML |
65 | %D%/libutil/util.hh \ |
66 | %D%/libutil/archive.hh \ | |
67 | %D%/libutil/types.hh \ | |
68 | %D%/libutil/gcrypt-hash.hh \ | |
69 | %D%/libutil/md5.h \ | |
70 | %D%/libutil/sha1.h \ | |
71 | %D%/libutil/sha256.h \ | |
72 | %D%/libutil/sha512.h | |
c2033df4 LC |
73 | |
74 | libutil_a_CPPFLAGS = \ | |
75 | -I$(top_builddir)/nix \ | |
c0d2e7b1 | 76 | -I$(top_srcdir)/%D%/libutil \ |
c2033df4 LC |
77 | $(libformat_a_CPPFLAGS) |
78 | ||
79 | libstore_a_SOURCES = \ | |
c0d2e7b1 ML |
80 | %D%/libstore/gc.cc \ |
81 | %D%/libstore/globals.cc \ | |
82 | %D%/libstore/misc.cc \ | |
83 | %D%/libstore/references.cc \ | |
84 | %D%/libstore/store-api.cc \ | |
85 | %D%/libstore/optimise-store.cc \ | |
86 | %D%/libstore/local-store.cc \ | |
87 | %D%/libstore/build.cc \ | |
88 | %D%/libstore/pathlocks.cc \ | |
7bed5d91 | 89 | %D%/libstore/derivations.cc \ |
94d92c77 | 90 | %D%/libstore/builtins.cc \ |
7bed5d91 | 91 | %D%/libstore/sqlite.cc |
c2033df4 LC |
92 | |
93 | libstore_headers = \ | |
c0d2e7b1 ML |
94 | %D%/libstore/references.hh \ |
95 | %D%/libstore/pathlocks.hh \ | |
96 | %D%/libstore/globals.hh \ | |
97 | %D%/libstore/worker-protocol.hh \ | |
98 | %D%/libstore/derivations.hh \ | |
99 | %D%/libstore/misc.hh \ | |
100 | %D%/libstore/local-store.hh \ | |
7bed5d91 | 101 | %D%/libstore/sqlite.hh \ |
94d92c77 | 102 | %D%/libstore/builtins.hh \ |
c0d2e7b1 | 103 | %D%/libstore/store-api.hh |
c2033df4 LC |
104 | |
105 | libstore_a_CPPFLAGS = \ | |
106 | $(libutil_a_CPPFLAGS) \ | |
c0d2e7b1 ML |
107 | -I$(top_srcdir)/%D%/libstore \ |
108 | -I$(top_builddir)/%D%/libstore \ | |
c2033df4 | 109 | -DNIX_STORE_DIR=\"$(storedir)\" \ |
f5768afa LC |
110 | -DNIX_STATE_DIR=\"$(localstatedir)/guix\" \ |
111 | -DNIX_LOG_DIR=\"$(localstatedir)/log/guix\" \ | |
9dd674db | 112 | -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \ |
959eaa1e | 113 | -DNIX_LIBEXEC_DIR=\"$(libexecdir)/guix\" \ |
c2033df4 | 114 | -DNIX_BIN_DIR=\"$(bindir)\" \ |
2bb04905 | 115 | -DDEFAULT_CHROOT_DIRS="\"\"" |
c2033df4 | 116 | |
06ea5c8f | 117 | libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \ |
c2033df4 LC |
118 | $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS) |
119 | ||
120 | bin_PROGRAMS = guix-daemon | |
121 | ||
122 | guix_daemon_SOURCES = \ | |
c0d2e7b1 ML |
123 | %D%/nix-daemon/nix-daemon.cc \ |
124 | %D%/nix-daemon/guix-daemon.cc | |
c2033df4 LC |
125 | |
126 | guix_daemon_CPPFLAGS = \ | |
7887bcbf | 127 | -DLOCALEDIR=\"$(localedir)\" \ |
c2033df4 | 128 | $(libutil_a_CPPFLAGS) \ |
c0d2e7b1 | 129 | -I$(top_srcdir)/%D%/libstore |
c2033df4 LC |
130 | |
131 | guix_daemon_LDADD = \ | |
f997137d | 132 | libstore.a libutil.a libformat.a -lz \ |
c2033df4 LC |
133 | $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) |
134 | ||
351782e2 | 135 | guix_daemon_headers = \ |
c0d2e7b1 | 136 | %D%/nix-daemon/shared.hh |
c2033df4 | 137 | |
f997137d LC |
138 | if HAVE_LIBBZ2 |
139 | ||
140 | guix_daemon_LDADD += -lbz2 | |
f997137d LC |
141 | |
142 | endif HAVE_LIBBZ2 | |
a7a4e6a4 | 143 | |
c2033df4 | 144 | noinst_HEADERS = \ |
351782e2 LC |
145 | $(libformat_headers) $(libutil_headers) $(libstore_headers) \ |
146 | $(guix_daemon_headers) | |
c2033df4 | 147 | |
3931c761 | 148 | %D%/libstore/schema.sql.hh: guix/store/schema.sql |
e71ad29d | 149 | $(AM_V_GEN)$(GUILE) --no-auto-compile -c \ |
c2033df4 LC |
150 | "(use-modules (rnrs io ports)) \ |
151 | (call-with-output-file \"$@\" \ | |
152 | (lambda (out) \ | |
153 | (call-with-input-file \"$^\" \ | |
154 | (lambda (in) \ | |
155 | (write (get-string-all in) out)))))" | |
156 | ||
f5c82e15 | 157 | nodist_pkglibexec_SCRIPTS = \ |
c0d2e7b1 | 158 | %D%/scripts/list-runtime-roots \ |
94d92c77 LC |
159 | %D%/scripts/substitute \ |
160 | %D%/scripts/download | |
f5c82e15 | 161 | |
49e6291a LC |
162 | if BUILD_DAEMON_OFFLOAD |
163 | ||
164 | nodist_pkglibexec_SCRIPTS += \ | |
c0d2e7b1 | 165 | %D%/scripts/offload |
49e6291a LC |
166 | |
167 | endif BUILD_DAEMON_OFFLOAD | |
168 | ||
0fe1fba4 LC |
169 | nodist_pkglibexec_SCRIPTS += \ |
170 | %D%/scripts/authenticate | |
7edccf4d | 171 | |
332d7903 | 172 | # The '.service' files for systemd. |
d2825c96 | 173 | systemdservicedir = $(libdir)/systemd/system |
332d7903 | 174 | nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service |
d2825c96 | 175 | |
332d7903 | 176 | etc/guix-%.service: etc/guix-%.service.in \ |
d2825c96 | 177 | $(top_builddir)/config.status |
5a5fc61f | 178 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
613d0895 | 179 | $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ |
5a5fc61f | 180 | "$<" > "$@.tmp"; \ |
d2825c96 LC |
181 | mv "$@.tmp" "$@" |
182 | ||
332d7903 | 183 | # The '.conf' jobs for Upstart. |
ad227484 | 184 | upstartjobdir = $(libdir)/upstart/system |
332d7903 | 185 | nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf |
ad227484 | 186 | |
332d7903 | 187 | etc/guix-%.conf: etc/guix-%.conf.in \ |
ad227484 | 188 | $(top_builddir)/config.status |
5a5fc61f | 189 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
613d0895 | 190 | $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ |
5a5fc61f | 191 | "$<" > "$@.tmp"; \ |
ad227484 MDRS |
192 | mv "$@.tmp" "$@" |
193 | ||
b20644ed LC |
194 | CLEANFILES += \ |
195 | $(nodist_systemdservice_DATA) \ | |
196 | $(nodist_upstartjob_DATA) | |
197 | ||
c2033df4 | 198 | EXTRA_DIST += \ |
c0d2e7b1 ML |
199 | %D%/AUTHORS \ |
200 | %D%/COPYING \ | |
fa54f44b LC |
201 | etc/guix-daemon.service.in \ |
202 | etc/guix-daemon.conf.in \ | |
203 | etc/guix-publish.service.in \ | |
204 | etc/guix-publish.conf.in | |
d23077dc | 205 | |
bb251307 LC |
206 | if CAN_RUN_TESTS |
207 | ||
d23077dc | 208 | AM_TESTS_ENVIRONMENT += \ |
69cfce50 | 209 | top_builddir="$(abs_top_builddir)" |
d23077dc LC |
210 | |
211 | TESTS += \ | |
212 | tests/guix-daemon.sh | |
213 | ||
bb251307 LC |
214 | endif CAN_RUN_TESTS |
215 | ||
d23077dc | 216 | clean-local: |
03fa2758 LC |
217 | -if test -d "$(GUIX_TEST_ROOT)"; then \ |
218 | find "$(GUIX_TEST_ROOT)" | xargs chmod +w; \ | |
219 | fi | |
69cfce50 | 220 | -rm -rf "$(GUIX_TEST_ROOT)" |