You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

230 lines
6.4 KiB

  1. # GNU Guix --- Functional package management for GNU
  2. # Copyright © 2012, 2013, 2014, 2015, 2016 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 += $(BUILT_SOURCES) etc/guix-daemon.service etc/guix-daemon.conf
  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_DATA_DIR=\"$(datadir)\" \
  98. -DNIX_STATE_DIR=\"$(localstatedir)/guix\" \
  99. -DNIX_LOG_DIR=\"$(localstatedir)/log/guix\" \
  100. -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \
  101. -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
  102. -DNIX_BIN_DIR=\"$(bindir)\" \
  103. -DOPENSSL_PATH="\"guix-authenticate\"" \
  104. -DDEFAULT_CHROOT_DIRS="\"\""
  105. libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \
  106. $(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS)
  107. bin_PROGRAMS = guix-daemon
  108. sbin_PROGRAMS = guix-register
  109. guix_daemon_SOURCES = \
  110. %D%/nix-daemon/nix-daemon.cc \
  111. %D%/nix-daemon/guix-daemon.cc
  112. guix_daemon_CPPFLAGS = \
  113. -DLOCALEDIR=\"$(localedir)\" \
  114. $(libutil_a_CPPFLAGS) \
  115. -I$(top_srcdir)/%D%/libstore
  116. guix_daemon_LDADD = \
  117. libstore.a libutil.a libformat.a -lbz2 \
  118. $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
  119. guix_daemon_headers = \
  120. %D%/nix-daemon/shared.hh
  121. guix_register_SOURCES = \
  122. %D%/guix-register/guix-register.cc
  123. guix_register_CPPFLAGS = \
  124. $(libutil_a_CPPFLAGS) \
  125. $(libstore_a_CPPFLAGS) \
  126. -I$(top_srcdir)/%D%/libstore
  127. # XXX: Should we start using shared libs?
  128. guix_register_LDADD = \
  129. libstore.a libutil.a libformat.a -lbz2 \
  130. $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
  131. noinst_HEADERS = \
  132. $(libformat_headers) $(libutil_headers) $(libstore_headers) \
  133. $(guix_daemon_headers)
  134. %D%/libstore/schema.sql.hh: %D%/libstore/schema.sql
  135. $(AM_V_GEN)$(GUILE) --no-auto-compile -c \
  136. "(use-modules (rnrs io ports)) \
  137. (call-with-output-file \"$@\" \
  138. (lambda (out) \
  139. (call-with-input-file \"$^\" \
  140. (lambda (in) \
  141. (write (get-string-all in) out)))))"
  142. nodist_pkglibexec_SCRIPTS = \
  143. %D%/scripts/list-runtime-roots \
  144. %D%/scripts/substitute \
  145. %D%/scripts/download
  146. if BUILD_DAEMON_OFFLOAD
  147. nodist_pkglibexec_SCRIPTS += \
  148. %D%/scripts/offload
  149. endif BUILD_DAEMON_OFFLOAD
  150. # XXX: It'd be better to hide it in $(pkglibexecdir).
  151. nodist_libexec_SCRIPTS = \
  152. %D%/scripts/guix-authenticate
  153. # The '.service' file for systemd.
  154. systemdservicedir = $(libdir)/systemd/system
  155. nodist_systemdservice_DATA = etc/guix-daemon.service
  156. etc/guix-daemon.service: etc/guix-daemon.service.in \
  157. $(top_builddir)/config.status
  158. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  159. $(SED) -e 's|@''bindir''@|$(bindir)|' < \
  160. "$(srcdir)/etc/guix-daemon.service.in" > "$@.tmp"; \
  161. mv "$@.tmp" "$@"
  162. # The '.conf' job for Upstart.
  163. upstartjobdir = $(libdir)/upstart/system
  164. nodist_upstartjob_DATA = etc/guix-daemon.conf
  165. etc/guix-daemon.conf: etc/guix-daemon.conf.in \
  166. $(top_builddir)/config.status
  167. $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
  168. $(SED) -e 's|@''bindir''@|$(bindir)|' < \
  169. "$(srcdir)/etc/guix-daemon.conf.in" > "$@.tmp"; \
  170. mv "$@.tmp" "$@"
  171. EXTRA_DIST += \
  172. %D%/libstore/schema.sql \
  173. %D%/AUTHORS \
  174. %D%/COPYING \
  175. etc/guix-daemon.service.in \
  176. etc/guix-daemon.conf.in
  177. if CAN_RUN_TESTS
  178. AM_TESTS_ENVIRONMENT += \
  179. top_builddir="$(abs_top_builddir)"
  180. TESTS += \
  181. tests/guix-daemon.sh
  182. endif CAN_RUN_TESTS
  183. clean-local:
  184. -if test -d "$(GUIX_TEST_ROOT)"; then \
  185. find "$(GUIX_TEST_ROOT)" | xargs chmod +w; \
  186. fi
  187. -rm -rf "$(GUIX_TEST_ROOT)"