local.mk 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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-publish.service \
  132. etc/guix-gc.service
  133. etc/%.mount: etc/%.mount.in \
  134. $(top_builddir)/config.status
  135. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  136. $(SED) -e 's|@''storedir''@|$(storedir)|' < \
  137. "$<" > "$@.tmp"; \
  138. mv "$@.tmp" "$@"
  139. etc/guix-%.service: etc/guix-%.service.in \
  140. $(top_builddir)/config.status
  141. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  142. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  143. "$<" > "$@.tmp"; \
  144. mv "$@.tmp" "$@"
  145. # The service script for sysvinit.
  146. sysvinitservicedir = $(sysconfdir)/init.d
  147. nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
  148. etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \
  149. $(top_builddir)/config.status
  150. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  151. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  152. "$<" > "$@.tmp"; \
  153. mv "$@.tmp" "$@"
  154. # The service script for openrc.
  155. openrcservicedir = $(sysconfdir)/openrc
  156. nodist_openrcservice_DATA = etc/openrc/guix-daemon
  157. etc/openrc/guix-daemon: etc/openrc/guix-daemon.in \
  158. $(top_builddir)/config.status
  159. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  160. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  161. "$<" > "$@.tmp"; \
  162. mv "$@.tmp" "$@"
  163. # The '.conf' jobs for Upstart.
  164. upstartjobdir = $(libdir)/upstart/system
  165. nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
  166. etc/guix-%.conf: etc/guix-%.conf.in \
  167. $(top_builddir)/config.status
  168. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  169. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  170. "$<" > "$@.tmp"; \
  171. mv "$@.tmp" "$@"
  172. CLEANFILES += \
  173. $(nodist_systemdservice_DATA) \
  174. $(nodist_upstartjob_DATA) \
  175. $(nodist_sysvinitservice_DATA) \
  176. $(nodist_openrcservice_DATA)
  177. EXTRA_DIST += \
  178. %D%/AUTHORS \
  179. %D%/COPYING \
  180. etc/gnu-store.mount.in \
  181. etc/guix-daemon.service.in \
  182. etc/guix-daemon.conf.in \
  183. etc/guix-publish.service.in \
  184. etc/guix-publish.conf.in \
  185. etc/guix-gc.service.in \
  186. etc/guix-gc.timer \
  187. etc/init.d/guix-daemon.in \
  188. etc/openrc/guix-daemon.in
  189. if CAN_RUN_TESTS
  190. AM_TESTS_ENVIRONMENT += \
  191. top_builddir="$(abs_top_builddir)"
  192. TESTS += \
  193. tests/guix-daemon.sh
  194. endif CAN_RUN_TESTS
  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)"