libdaemon.scm 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2020 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  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. (define-module (gnu packages libdaemon)
  20. #:use-module (gnu packages autotools)
  21. #:use-module (guix licenses)
  22. #:use-module (guix packages)
  23. #:use-module (guix utils)
  24. #:use-module (guix download)
  25. #:use-module (guix build-system gnu))
  26. (define-public libdaemon
  27. (package
  28. (name "libdaemon")
  29. (version "0.14")
  30. (source (origin
  31. (method url-fetch)
  32. (uri (list
  33. (string-append
  34. "mirror://debian/pool/main/libd/libdaemon/libdaemon_"
  35. version ".orig.tar.gz")
  36. "http://pkgs.fedoraproject.org/repo/pkgs/libdaemon/libdaemon-0.14.tar.gz/509dc27107c21bcd9fbf2f95f5669563/libdaemon-0.14.tar.gz"
  37. ;; This used to be the canonical URL but it vanished.
  38. ;; See <http://bugs.gnu.org/18639>.
  39. ;; (string-append
  40. ;; "http://0pointer.de/lennart/projects/libdaemon/libdaemon-"
  41. ;; version ".tar.gz")
  42. ))
  43. (sha256
  44. (base32
  45. "0d5qlq5ab95wh1xc87rqrh1vx6i8lddka1w3f1zcqvcqdxgyn8zx"))
  46. (file-name (string-append name "-" version ".tar.gz"))))
  47. (build-system gnu-build-system)
  48. (native-inputs
  49. (if (and=> (%current-target-system) target-aarch64?)
  50. `(("config" ,config)) ; for config.sub
  51. '()))
  52. (arguments
  53. `(,@(if (%current-target-system)
  54. ;; The 'setpgrp' test cannot provide an answer when cross-compiling,
  55. ;; so provide the right one for glibc.
  56. `(#:configure-flags (list "ac_cv_func_setpgrp_void=yes"
  57. ;; TODO: Move this globally on the next
  58. ;; rebuild cycle.
  59. ;; Set a valid localstatedir for the
  60. ;; benefit of the default
  61. ;; 'daemon_pid_file_proc', used by the
  62. ;; Hurd's console client.
  63. "--localstatedir=/var"))
  64. '())
  65. ,@(if (and=> (%current-target-system) target-aarch64?)
  66. `(#:phases
  67. (modify-phases %standard-phases
  68. (add-before 'configure 'update-config.sub
  69. (lambda _
  70. ;; Replace outdated config.sub such that aarch64
  71. ;; will be recognised as an architecture.
  72. (delete-file "config.sub")
  73. (symlink (which "config.sub") "config.sub")))))
  74. '())))
  75. ;; XXX: Stale URL, missing replacement. See <http://bugs.gnu.org/18639>.
  76. (home-page "http://0pointer.de/lennart/projects/libdaemon/")
  77. (synopsis "Lightweight C library that eases the writing of UNIX daemons")
  78. (description
  79. "Libdaemon is a lightweight C library that eases the writing of UNIX
  80. daemons. It consists of the following parts:
  81. • A wrapper around fork() which does the correct daemonization procedure of
  82. a process
  83. • A wrapper around syslog() for simpler and compatible log output to Syslog
  84. or STDERR
  85. • An API for writing PID files
  86. • An API for serializing UNIX signals into a pipe for usage with select() or
  87. poll()
  88. • An API for running subprocesses with STDOUT and STDERR redirected to
  89. syslog.
  90. APIs like these are used in most daemon software available. It is not that
  91. simple to get it done right and code duplication is not a goal.")
  92. (license lgpl2.1+)))