avahi.scm 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  6. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu packages avahi)
  23. #:use-module ((guix licenses) #:select (lgpl2.1+))
  24. #:use-module (guix packages)
  25. #:use-module (guix gexp)
  26. #:use-module (guix download)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (gnu packages)
  29. #:use-module (gnu packages bash)
  30. #:use-module (gnu packages dbm)
  31. #:use-module (gnu packages gettext)
  32. #:use-module (gnu packages glib)
  33. #:use-module (gnu packages libdaemon)
  34. #:use-module (gnu packages libevent)
  35. #:use-module (gnu packages linux)
  36. #:use-module (gnu packages pkg-config)
  37. #:use-module (gnu packages xml))
  38. (define-public avahi
  39. (package
  40. (name "avahi")
  41. (version "0.8")
  42. (home-page "https://avahi.org")
  43. (source (origin
  44. (method url-fetch)
  45. (uri (string-append home-page "/download/avahi-"
  46. version ".tar.gz"))
  47. (sha256
  48. (base32
  49. "1npdixwxxn3s9q1f365x9n9rc5xgfz39hxf23faqvlrklgbhj0q6"))
  50. (patches (search-patches "avahi-localstatedir.patch"))
  51. (modules '((guix build utils)))
  52. (snippet
  53. '(begin
  54. ;; Fix version constraint in the avahi-libevent pkg-config file.
  55. ;; This can be removed for Avahi versions > 0.8.
  56. (substitute* "avahi-libevent.pc.in"
  57. (("libevent-2\\.1\\.5")
  58. "libevent >= 2.1.5"))
  59. #t))))
  60. (build-system gnu-build-system)
  61. (arguments
  62. `(#:configure-flags '("--with-distro=none"
  63. "--disable-static"
  64. "--localstatedir=/var" ; for the DBus socket
  65. "--disable-python"
  66. "--disable-mono"
  67. "--disable-doxygen-doc"
  68. "--disable-xmltoman"
  69. "--enable-tests"
  70. "--disable-qt4" "--disable-qt5"
  71. "--disable-gtk" "--disable-gtk3"
  72. "--enable-compat-libdns_sd"
  73. ,@(if (%current-target-system)
  74. '("ac_cv_prog_have_pkg_config=yes")
  75. '()))
  76. ;; TODO(core-updates): Make this unconditional.
  77. ,@(if (%current-target-system)
  78. `(#:modules ((srfi srfi-26)
  79. (guix build utils)
  80. (guix build gnu-build-system))
  81. #:phases
  82. ,#~(modify-phases %standard-phases
  83. (add-after 'patch-shebangs 'patch-more-shebangs
  84. (lambda* (#:key inputs #:allow-other-keys)
  85. (define path
  86. `(,(dirname (search-input-file inputs "bin/sh"))))
  87. (for-each
  88. (cut patch-shebang <> path)
  89. (find-files (string-append #$output "/etc/avahi")))))))
  90. '())))
  91. (inputs
  92. ;; TODO(core-updates): Make this input unconditional.
  93. `(,@(if (%current-target-system)
  94. `(("bash-minimal" ,bash-minimal))
  95. '())
  96. ("dbus" ,dbus)
  97. ("expat" ,expat)
  98. ("gdbm" ,gdbm)
  99. ("glib" ,glib)
  100. ("libcap" ,libcap) ;to enable chroot support in avahi-daemon
  101. ("libdaemon" ,libdaemon)
  102. ("libevent" ,libevent)))
  103. (native-inputs
  104. `(("gettext" ,gettext-minimal)
  105. ("glib" ,glib "bin")
  106. ("pkg-config" ,pkg-config)))
  107. (synopsis "Implementation of mDNS/DNS-SD protocols")
  108. (description
  109. "Avahi is a system which facilitates service discovery on a local
  110. network. It is an implementation of the mDNS (for \"Multicast DNS\") and
  111. DNS-SD (for \"DNS-Based Service Discovery\") protocols.")
  112. (license lgpl2.1+)))
  113. (define-public nss-mdns
  114. (package
  115. (name "nss-mdns")
  116. (version "0.14.1")
  117. (home-page "https://github.com/lathiat/nss-mdns")
  118. (source (origin
  119. (method url-fetch)
  120. (uri (string-append home-page "/releases/download/v" version "/"
  121. name "-" version ".tar.gz"))
  122. (sha256
  123. (base32
  124. "134wdr0n9cm5ab4g6dwq76lvzqns9dcylr470i2xxjimnw0l22d2"))))
  125. (build-system gnu-build-system)
  126. (arguments
  127. ;; The Avahi daemon socket is expected by 'configure.ac' to be at
  128. ;; "$(localstatedir)/run/avahi-daemon/socket", but nowadays it lives in
  129. ;; /run/avahi-daemon/socket. Remove the "$(localstatedir)" bit.
  130. '(#:configure-flags '("AVAHI_SOCKET=/run/avahi-daemon/socket")))
  131. (synopsis "Multicast DNS Name Service Switch (@dfn{NSS}) plug-in")
  132. (description
  133. "Nss-mdns is a plug-in for the GNU C Library's Name Service Switch
  134. (@dfn{NSS}) that resolves host names via multicast DNS (@dfn{mDNS}). It is
  135. most often used in home and other small networks without a local name server,
  136. to resolve host names in the @samp{.local} top-level domain.")
  137. (license lgpl2.1+)))