local.mk 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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_BIN_DIR=\"$(bindir)\" \
  101. -DDEFAULT_CHROOT_DIRS="\"\""
  102. libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \
  103. $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS)
  104. bin_PROGRAMS = guix-daemon
  105. guix_daemon_SOURCES = \
  106. %D%/nix-daemon/nix-daemon.cc \
  107. %D%/nix-daemon/guix-daemon.cc
  108. guix_daemon_CPPFLAGS = \
  109. -DLOCALEDIR=\"$(localedir)\" \
  110. $(libutil_a_CPPFLAGS) \
  111. -I$(top_srcdir)/%D%/libstore
  112. guix_daemon_LDADD = \
  113. libstore.a libutil.a libformat.a -lz \
  114. $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
  115. guix_daemon_headers = \
  116. %D%/nix-daemon/shared.hh
  117. if HAVE_LIBBZ2
  118. guix_daemon_LDADD += -lbz2
  119. endif HAVE_LIBBZ2
  120. noinst_HEADERS = \
  121. $(libformat_headers) $(libutil_headers) $(libstore_headers) \
  122. $(guix_daemon_headers)
  123. %D%/libstore/schema.sql.hh: guix/store/schema.sql
  124. $(AM_V_GEN)$(GUILE) --no-auto-compile -c \
  125. "(use-modules (rnrs io ports)) \
  126. (call-with-output-file \"$@\" \
  127. (lambda (out) \
  128. (call-with-input-file \"$^\" \
  129. (lambda (in) \
  130. (write (get-string-all in) out)))))"
  131. # The '.service' files for systemd.
  132. systemdservicedir = $(libdir)/systemd/system
  133. nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service
  134. etc/guix-%.service: etc/guix-%.service.in \
  135. $(top_builddir)/config.status
  136. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  137. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  138. "$<" > "$@.tmp"; \
  139. mv "$@.tmp" "$@"
  140. # The '.conf' jobs for Upstart.
  141. upstartjobdir = $(libdir)/upstart/system
  142. nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
  143. etc/guix-%.conf: etc/guix-%.conf.in \
  144. $(top_builddir)/config.status
  145. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  146. $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \
  147. "$<" > "$@.tmp"; \
  148. mv "$@.tmp" "$@"
  149. CLEANFILES += \
  150. $(nodist_systemdservice_DATA) \
  151. $(nodist_upstartjob_DATA)
  152. EXTRA_DIST += \
  153. %D%/AUTHORS \
  154. %D%/COPYING \
  155. etc/guix-daemon.service.in \
  156. etc/guix-daemon.conf.in \
  157. etc/guix-publish.service.in \
  158. etc/guix-publish.conf.in
  159. if CAN_RUN_TESTS
  160. AM_TESTS_ENVIRONMENT += \
  161. top_builddir="$(abs_top_builddir)"
  162. TESTS += \
  163. tests/guix-daemon.sh
  164. endif CAN_RUN_TESTS
  165. clean-local:
  166. -if test -d "$(GUIX_TEST_ROOT)"; then \
  167. find "$(GUIX_TEST_ROOT)" | xargs chmod +w; \
  168. fi
  169. -rm -rf "$(GUIX_TEST_ROOT)"