local.mk 6.8 KB

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