| 1 | # GNU Guix --- Functional package management for GNU |
| 2 | # Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | # Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> |
| 4 | # Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
| 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 | # |
| 22 | # Integration of the `guix-daemon' code taken from upstream Nix. |
| 23 | # |
| 24 | |
| 25 | BUILT_SOURCES += %D%/libstore/schema.sql.hh |
| 26 | CLEANFILES += %D%/libstore/schema.sql.hh |
| 27 | |
| 28 | noinst_LIBRARIES = libformat.a libutil.a libstore.a |
| 29 | |
| 30 | # Use '-std=c++11' for 'std::shared_ptr', 'auto', lambdas, and more. |
| 31 | AM_CXXFLAGS = -Wall -std=c++11 |
| 32 | |
| 33 | libformat_a_SOURCES = \ |
| 34 | %D%/boost/format/free_funcs.cc \ |
| 35 | %D%/boost/format/parsing.cc \ |
| 36 | %D%/boost/format/format_implementation.cc |
| 37 | |
| 38 | libformat_headers = \ |
| 39 | %D%/boost/throw_exception.hpp \ |
| 40 | %D%/boost/format.hpp \ |
| 41 | %D%/boost/assert.hpp \ |
| 42 | %D%/boost/format/macros_default.hpp \ |
| 43 | %D%/boost/format/format_fwd.hpp \ |
| 44 | %D%/boost/format/format_class.hpp \ |
| 45 | %D%/boost/format/exceptions.hpp \ |
| 46 | %D%/boost/format/group.hpp \ |
| 47 | %D%/boost/format/feed_args.hpp \ |
| 48 | %D%/boost/format/internals_fwd.hpp \ |
| 49 | %D%/boost/format/internals.hpp |
| 50 | |
| 51 | libformat_a_CPPFLAGS = \ |
| 52 | -I$(top_srcdir)/nix |
| 53 | |
| 54 | libutil_a_SOURCES = \ |
| 55 | %D%/libutil/archive.cc \ |
| 56 | %D%/libutil/affinity.cc \ |
| 57 | %D%/libutil/serialise.cc \ |
| 58 | %D%/libutil/util.cc \ |
| 59 | %D%/libutil/hash.cc \ |
| 60 | %D%/libutil/gcrypt-hash.cc |
| 61 | |
| 62 | libutil_headers = \ |
| 63 | %D%/libutil/affinity.hh \ |
| 64 | %D%/libutil/hash.hh \ |
| 65 | %D%/libutil/serialise.hh \ |
| 66 | %D%/libutil/util.hh \ |
| 67 | %D%/libutil/archive.hh \ |
| 68 | %D%/libutil/types.hh \ |
| 69 | %D%/libutil/gcrypt-hash.hh \ |
| 70 | %D%/libutil/md5.h \ |
| 71 | %D%/libutil/sha1.h \ |
| 72 | %D%/libutil/sha256.h \ |
| 73 | %D%/libutil/sha512.h |
| 74 | |
| 75 | libutil_a_CPPFLAGS = \ |
| 76 | -I$(top_builddir)/nix \ |
| 77 | -I$(top_srcdir)/%D%/libutil \ |
| 78 | $(libformat_a_CPPFLAGS) |
| 79 | |
| 80 | libstore_a_SOURCES = \ |
| 81 | %D%/libstore/gc.cc \ |
| 82 | %D%/libstore/globals.cc \ |
| 83 | %D%/libstore/misc.cc \ |
| 84 | %D%/libstore/references.cc \ |
| 85 | %D%/libstore/store-api.cc \ |
| 86 | %D%/libstore/optimise-store.cc \ |
| 87 | %D%/libstore/local-store.cc \ |
| 88 | %D%/libstore/build.cc \ |
| 89 | %D%/libstore/pathlocks.cc \ |
| 90 | %D%/libstore/derivations.cc \ |
| 91 | %D%/libstore/builtins.cc \ |
| 92 | %D%/libstore/sqlite.cc |
| 93 | |
| 94 | libstore_headers = \ |
| 95 | %D%/libstore/references.hh \ |
| 96 | %D%/libstore/pathlocks.hh \ |
| 97 | %D%/libstore/globals.hh \ |
| 98 | %D%/libstore/worker-protocol.hh \ |
| 99 | %D%/libstore/derivations.hh \ |
| 100 | %D%/libstore/misc.hh \ |
| 101 | %D%/libstore/local-store.hh \ |
| 102 | %D%/libstore/sqlite.hh \ |
| 103 | %D%/libstore/builtins.hh \ |
| 104 | %D%/libstore/store-api.hh |
| 105 | |
| 106 | libstore_a_CPPFLAGS = \ |
| 107 | $(libutil_a_CPPFLAGS) \ |
| 108 | -I$(top_srcdir)/%D%/libstore \ |
| 109 | -I$(top_builddir)/%D%/libstore \ |
| 110 | -DNIX_STORE_DIR=\"$(storedir)\" \ |
| 111 | -DNIX_STATE_DIR=\"$(localstatedir)/guix\" \ |
| 112 | -DNIX_LOG_DIR=\"$(localstatedir)/log/guix\" \ |
| 113 | -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \ |
| 114 | -DNIX_BIN_DIR=\"$(bindir)\" \ |
| 115 | -DDEFAULT_CHROOT_DIRS="\"\"" |
| 116 | |
| 117 | libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \ |
| 118 | $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS) |
| 119 | |
| 120 | bin_PROGRAMS = guix-daemon |
| 121 | |
| 122 | guix_daemon_SOURCES = \ |
| 123 | %D%/nix-daemon/nix-daemon.cc \ |
| 124 | %D%/nix-daemon/guix-daemon.cc |
| 125 | |
| 126 | guix_daemon_CPPFLAGS = \ |
| 127 | -DLOCALEDIR=\"$(localedir)\" \ |
| 128 | $(libutil_a_CPPFLAGS) \ |
| 129 | -I$(top_srcdir)/%D%/libstore |
| 130 | |
| 131 | guix_daemon_LDADD = \ |
| 132 | libstore.a libutil.a libformat.a -lz \ |
| 133 | $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) |
| 134 | |
| 135 | guix_daemon_headers = \ |
| 136 | %D%/nix-daemon/shared.hh |
| 137 | |
| 138 | if HAVE_LIBBZ2 |
| 139 | |
| 140 | guix_daemon_LDADD += -lbz2 |
| 141 | |
| 142 | endif HAVE_LIBBZ2 |
| 143 | |
| 144 | noinst_HEADERS = \ |
| 145 | $(libformat_headers) $(libutil_headers) $(libstore_headers) \ |
| 146 | $(guix_daemon_headers) |
| 147 | |
| 148 | %D%/libstore/schema.sql.hh: guix/store/schema.sql |
| 149 | $(AM_V_GEN)$(GUILE) --no-auto-compile -c \ |
| 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 | |
| 157 | # The '.service' files for systemd. |
| 158 | systemdservicedir = $(libdir)/systemd/system |
| 159 | nodist_systemdservice_DATA = \ |
| 160 | etc/gnu-store.mount \ |
| 161 | etc/guix-daemon.service \ |
| 162 | etc/guix-publish.service |
| 163 | |
| 164 | etc/%.mount: etc/%.mount.in \ |
| 165 | $(top_builddir)/config.status |
| 166 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
| 167 | $(SED) -e 's|@''storedir''@|$(storedir)|' < \ |
| 168 | "$<" > "$@.tmp"; \ |
| 169 | mv "$@.tmp" "$@" |
| 170 | |
| 171 | etc/guix-%.service: etc/guix-%.service.in \ |
| 172 | $(top_builddir)/config.status |
| 173 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
| 174 | $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ |
| 175 | "$<" > "$@.tmp"; \ |
| 176 | mv "$@.tmp" "$@" |
| 177 | |
| 178 | sysvinitservicedir = $(sysconfdir)/init.d |
| 179 | nodist_sysvinitservice_DATA = etc/init.d/guix-daemon |
| 180 | |
| 181 | etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \ |
| 182 | $(top_builddir)/config.status |
| 183 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
| 184 | $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ |
| 185 | "$<" > "$@.tmp"; \ |
| 186 | mv "$@.tmp" "$@" |
| 187 | |
| 188 | # The '.conf' jobs for Upstart. |
| 189 | upstartjobdir = $(libdir)/upstart/system |
| 190 | nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf |
| 191 | |
| 192 | etc/guix-%.conf: etc/guix-%.conf.in \ |
| 193 | $(top_builddir)/config.status |
| 194 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
| 195 | $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ |
| 196 | "$<" > "$@.tmp"; \ |
| 197 | mv "$@.tmp" "$@" |
| 198 | |
| 199 | CLEANFILES += \ |
| 200 | $(nodist_systemdservice_DATA) \ |
| 201 | $(nodist_upstartjob_DATA) \ |
| 202 | $(nodist_sysvinitservice_DATA) |
| 203 | |
| 204 | EXTRA_DIST += \ |
| 205 | %D%/AUTHORS \ |
| 206 | %D%/COPYING \ |
| 207 | etc/guix-daemon.service.in \ |
| 208 | etc/guix-daemon.conf.in \ |
| 209 | etc/guix-publish.service.in \ |
| 210 | etc/guix-publish.conf.in \ |
| 211 | etc/init.d/guix-daemon.in |
| 212 | |
| 213 | if CAN_RUN_TESTS |
| 214 | |
| 215 | AM_TESTS_ENVIRONMENT += \ |
| 216 | top_builddir="$(abs_top_builddir)" |
| 217 | |
| 218 | TESTS += \ |
| 219 | tests/guix-daemon.sh |
| 220 | |
| 221 | endif CAN_RUN_TESTS |
| 222 | |
| 223 | clean-local: |
| 224 | -if test -d "$(GUIX_TEST_ROOT)"; then \ |
| 225 | find "$(GUIX_TEST_ROOT)" | xargs chmod +w; \ |
| 226 | fi |
| 227 | -rm -rf "$(GUIX_TEST_ROOT)" |