local.mk 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. #
  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. # Integration of the `guix-daemon' code taken from upstream Nix.
  21. #
  22. BUILT_SOURCES += %D%/libstore/schema.sql.hh
  23. CLEANFILES += %D%/libstore/schema.sql.hh
  24. noinst_LIBRARIES = libformat.a libutil.a libstore.a
  25. # Use '-std=c++11' for 'std::shared_ptr', 'auto', lambdas, and more.
  26. AM_CXXFLAGS = -Wall -std=c++11
  27. libformat_a_SOURCES = \
  28. %D%/boost/format/free_funcs.cc \
  29. %D%/boost/format/parsing.cc \
  30. %D%/boost/format/format_implementation.cc
  31. libformat_headers = \
  32. %D%/boost/throw_exception.hpp \
  33. %D%/boost/format.hpp \
  34. %D%/boost/assert.hpp \
  35. %D%/boost/format/macros_default.hpp \
  36. %D%/boost/format/format_fwd.hpp \
  37. %D%/boost/format/format_class.hpp \
  38. %D%/boost/format/exceptions.hpp \
  39. %D%/boost/format/group.hpp \
  40. %D%/boost/format/feed_args.hpp \
  41. %D%/boost/format/internals_fwd.hpp \
  42. %D%/boost/format/internals.hpp
  43. libformat_a_CPPFLAGS = \
  44. -I$(top_srcdir)/nix
  45. libutil_a_SOURCES = \
  46. %D%/libutil/archive.cc \
  47. %D%/libutil/affinity.cc \
  48. %D%/libutil/serialise.cc \
  49. %D%/libutil/util.cc \
  50. %D%/libutil/hash.cc \
  51. %D%/libutil/gcrypt-hash.cc
  52. libutil_headers = \
  53. %D%/libutil/affinity.hh \
  54. %D%/libutil/hash.hh \
  55. %D%/libutil/serialise.hh \
  56. %D%/libutil/util.hh \
  57. %D%/libutil/archive.hh \
  58. %D%/libutil/types.hh \
  59. %D%/libutil/gcrypt-hash.hh \
  60. %D%/libutil/md5.h \
  61. %D%/libutil/sha1.h \
  62. %D%/libutil/sha256.h \
  63. %D%/libutil/sha512.h
  64. libutil_a_CPPFLAGS = \
  65. -I$(top_builddir)/nix \
  66. -I$(top_srcdir)/%D%/libutil \
  67. $(libformat_a_CPPFLAGS)
  68. libstore_a_SOURCES = \
  69. %D%/libstore/gc.cc \
  70. %D%/libstore/globals.cc \
  71. %D%/libstore/misc.cc \
  72. %D%/libstore/references.cc \
  73. %D%/libstore/store-api.cc \
  74. %D%/libstore/optimise-store.cc \
  75. %D%/libstore/local-store.cc \
  76. %D%/libstore/build.cc \
  77. %D%/libstore/pathlocks.cc \
  78. %D%/libstore/derivations.cc \
  79. %D%/libstore/builtins.cc \
  80. %D%/libstore/sqlite.cc
  81. libstore_headers = \
  82. %D%/libstore/references.hh \
  83. %D%/libstore/pathlocks.hh \
  84. %D%/libstore/globals.hh \
  85. %D%/libstore/worker-protocol.hh \
  86. %D%/libstore/derivations.hh \
  87. %D%/libstore/misc.hh \
  88. %D%/libstore/local-store.hh \
  89. %D%/libstore/sqlite.hh \
  90. %D%/libstore/builtins.hh \
  91. %D%/libstore/store-api.hh
  92. libstore_a_CPPFLAGS = \
  93. $(libutil_a_CPPFLAGS) \
  94. -I$(top_srcdir)/%D%/libstore \
  95. -I$(top_builddir)/%D%/libstore \
  96. -DNIX_STORE_DIR=\"$(storedir)\" \
  97. -DNIX_STATE_DIR=\"$(localstatedir)/guix\" \
  98. -DNIX_LOG_DIR=\"$(localstatedir)/log/guix\" \
  99. -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \
  100. -DNIX_LIBEXEC_DIR=\"$(libexecdir)/guix\" \
  101. -DNIX_BIN_DIR=\"$(bindir)\" \
  102. -DDEFAULT_CHROOT_DIRS="\"\""
  103. libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \
  104. $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS)
  105. bin_PROGRAMS = guix-daemon
  106. guix_daemon_SOURCES = \
  107. %D%/nix-daemon/nix-daemon.cc \
  108. %D%/nix-daemon/guix-daemon.cc
  109. guix_daemon_CPPFLAGS = \
  110. -DLOCALEDIR=\"$(localedir)\" \
  111. $(libutil_a_CPPFLAGS) \
  112. -I$(top_srcdir)/%D%/libstore
  113. guix_daemon_LDADD = \
  114. libstore.a libutil.a libformat.a -lz \
  115. $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
  116. guix_daemon_headers = \
  117. %D%/nix-daemon/shared.hh
  118. if HAVE_LIBBZ2
  119. guix_daemon_LDADD += -lbz2
  120. endif HAVE_LIBBZ2
  121. noinst_HEADERS = \
  122. $(libformat_headers) $(libutil_headers) $(libstore_headers) \
  123. $(guix_daemon_headers)
  124. %D%/libstore/schema.sql.hh: guix/store/schema.sql
  125. $(AM_V_GEN)$(GUILE) --no-auto-compile -c \
  126. "(use-modules (rnrs io ports)) \
  127. (call-with-output-file \"$@\" \
  128. (lambda (out) \
  129. (call-with-input-file \"$^\" \
  130. (lambda (in) \
  131. (write (get-string-all in) out)))))"
  132. nodist_pkglibexec_SCRIPTS = \
  133. %D%/scripts/list-runtime-roots \
  134. %D%/scripts/substitute \
  135. %D%/scripts/download
  136. if BUILD_DAEMON_OFFLOAD
  137. nodist_pkglibexec_SCRIPTS += \
  138. %D%/scripts/offload
  139. endif BUILD_DAEMON_OFFLOAD
  140. nodist_pkglibexec_SCRIPTS += \
  141. %D%/scripts/authenticate
  142. # The '.service' files for systemd.
  143. systemdservicedir = $(libdir)/systemd/system
  144. nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service
  145. etc/guix-%.service: etc/guix-%.service.in \
  146. $(top_builddir)/config.status
  147. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  148. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  149. "$<" > "$@.tmp"; \
  150. mv "$@.tmp" "$@"
  151. # The '.conf' jobs for Upstart.
  152. upstartjobdir = $(libdir)/upstart/system
  153. nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
  154. etc/guix-%.conf: etc/guix-%.conf.in \
  155. $(top_builddir)/config.status
  156. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  157. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  158. "$<" > "$@.tmp"; \
  159. mv "$@.tmp" "$@"
  160. CLEANFILES += \
  161. $(nodist_systemdservice_DATA) \
  162. $(nodist_upstartjob_DATA)
  163. EXTRA_DIST += \
  164. %D%/AUTHORS \
  165. %D%/COPYING \
  166. etc/guix-daemon.service.in \
  167. etc/guix-daemon.conf.in \
  168. etc/guix-publish.service.in \
  169. etc/guix-publish.conf.in
  170. if CAN_RUN_TESTS
  171. AM_TESTS_ENVIRONMENT += \
  172. top_builddir="$(abs_top_builddir)"
  173. TESTS += \
  174. tests/guix-daemon.sh
  175. endif CAN_RUN_TESTS
  176. clean-local:
  177. -if test -d "$(GUIX_TEST_ROOT)"; then \
  178. find "$(GUIX_TEST_ROOT)" | xargs chmod +w; \
  179. fi
  180. -rm -rf "$(GUIX_TEST_ROOT)"