avahi.scm 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. (build-system gnu-build-system)
  60. (arguments
  61. `(#:configure-flags '("--with-distro=none"
  62. "--disable-static"
  63. "--localstatedir=/var" ; for the DBus socket
  64. "--disable-python"
  65. "--disable-mono"
  66. "--disable-doxygen-doc"
  67. "--disable-xmltoman"
  68. "--enable-tests"
  69. "--disable-qt4" "--disable-qt5"
  70. "--disable-gtk" "--disable-gtk3"
  71. "--enable-compat-libdns_sd"
  72. ,@(if (%current-target-system)
  73. '("ac_cv_prog_have_pkg_config=yes")
  74. '()))
  75. #:modules ((srfi srfi-26)
  76. (guix build utils)
  77. (guix build gnu-build-system))
  78. #:phases
  79. ,#~(modify-phases %standard-phases
  80. (add-after 'patch-shebangs 'patch-more-shebangs
  81. (lambda* (#:key inputs #:allow-other-keys)
  82. (define path
  83. `(,(dirname (search-input-file inputs "bin/sh"))))
  84. (for-each
  85. (cut patch-shebang <> path)
  86. (find-files (string-append #$output "/etc/avahi"))))))))
  87. (inputs
  88. `(("bash-minimal" ,bash-minimal)
  89. ("dbus" ,dbus)
  90. ("expat" ,expat)
  91. ("gdbm" ,gdbm)
  92. ("glib" ,glib)
  93. ("libcap" ,libcap) ;to enable chroot support in avahi-daemon
  94. ("libdaemon" ,libdaemon)
  95. ("libevent" ,libevent)))
  96. (native-inputs
  97. `(("gettext" ,gettext-minimal)
  98. ("glib" ,glib "bin")
  99. ("pkg-config" ,pkg-config)))
  100. (synopsis "Implementation of mDNS/DNS-SD protocols")
  101. (description
  102. "Avahi is a system which facilitates service discovery on a local
  103. network. It is an implementation of the mDNS (for \"Multicast DNS\") and
  104. DNS-SD (for \"DNS-Based Service Discovery\") protocols.")
  105. (license lgpl2.1+)))
  106. (define-public nss-mdns
  107. (package
  108. (name "nss-mdns")
  109. (version "0.14.1")
  110. (home-page "https://github.com/lathiat/nss-mdns")
  111. (source (origin
  112. (method url-fetch)
  113. (uri (string-append home-page "/releases/download/v" version "/"
  114. name "-" version ".tar.gz"))
  115. (sha256
  116. (base32
  117. "134wdr0n9cm5ab4g6dwq76lvzqns9dcylr470i2xxjimnw0l22d2"))))
  118. (build-system gnu-build-system)
  119. (arguments
  120. ;; The Avahi daemon socket is expected by 'configure.ac' to be at
  121. ;; "$(localstatedir)/run/avahi-daemon/socket", but nowadays it lives in
  122. ;; /run/avahi-daemon/socket. Remove the "$(localstatedir)" bit.
  123. '(#:configure-flags '("AVAHI_SOCKET=/run/avahi-daemon/socket")))
  124. (synopsis "Multicast DNS Name Service Switch (@dfn{NSS}) plug-in")
  125. (description
  126. "Nss-mdns is a plug-in for the GNU C Library's Name Service Switch
  127. (@dfn{NSS}) that resolves host names via multicast DNS (@dfn{mDNS}). It is
  128. most often used in home and other small networks without a local name server,
  129. to resolve host names in the @samp{.local} top-level domain.")
  130. (license lgpl2.1+)))