gnu: deutex: Update to 5.2.1.
[jackhill/guix/guix.git] / gnu / packages / ntp.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
5 ;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages ntp)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages linux)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages tls)
32 #:use-module (gnu packages libevent)
33 #:use-module ((guix licenses) #:prefix l:)
34 #:use-module (guix packages)
35 #:use-module (guix utils)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix build-system gnu)
39 #:use-module (srfi srfi-1))
40
41 (define-public ntp
42 (package
43 (name "ntp")
44 (version "4.2.8p13")
45 (source
46 (origin
47 (method url-fetch)
48 (uri (list (string-append
49 "http://archive.ntp.org/ntp4/ntp-"
50 (version-major+minor version)
51 "/ntp-" version ".tar.gz")
52 (string-append
53 "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
54 (version-major+minor version)
55 "/ntp-" version ".tar.gz")))
56 (sha256
57 (base32 "0f1a4fya7v5s0426nim8ydvvlcashb8hicgs9xlm76ndrz7751r8"))
58 (modules '((guix build utils)))
59 (snippet
60 '(begin
61 ;; Remove the bundled copy of libevent, but we must keep
62 ;; sntp/libevent/build-aux since configure.ac contains
63 ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
64 (rename-file "sntp/libevent/build-aux"
65 "sntp/libevent:build-aux")
66 (delete-file-recursively "sntp/libevent")
67 (mkdir "sntp/libevent")
68 (rename-file "sntp/libevent:build-aux"
69 "sntp/libevent/build-aux")
70 #t))))
71 (native-inputs `(("which" ,which)
72 ("pkg-config" ,pkg-config)))
73 (inputs
74 `(("openssl" ,openssl)
75 ("libevent" ,libevent)
76 ;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd'
77 ;; to run as non-root (when invoked with '-u'.)
78 ,@(if (string-suffix? "-linux"
79 (or (%current-target-system) (%current-system)))
80 `(("libcap" ,libcap))
81 '())))
82 (arguments
83 `(#:phases
84 (modify-phases %standard-phases
85 (add-after 'unpack 'disable-network-test
86 (lambda _
87 (substitute* "tests/libntp/Makefile.in"
88 (("test-decodenetnum\\$\\(EXEEXT\\) ") ""))
89 #t)))))
90 (build-system gnu-build-system)
91 (synopsis "Real time clock synchronization system")
92 (description "NTP is a system designed to synchronize the clocks of
93 computers over a network.")
94 (license (l:x11-style
95 "http://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
96 "A non-copyleft free licence from the University of Delaware"))
97 (home-page "http://www.ntp.org")))
98
99 (define-public openntpd
100 (package
101 (name "openntpd")
102 (version "6.2p3")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append
106 "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz"))
107 (sha256
108 (base32
109 "0fn12i4kzsi0zkr4qp3dp9bycmirnfapajqvdfx02zhr4hanj0kv"))))
110 (build-system gnu-build-system)
111 (arguments
112 '(#:configure-flags `( "--with-privsep-user=ntpd"
113 "--localstatedir=/var"
114 ,(string-append "--with-cacert="
115 (assoc-ref %build-inputs "libressl")
116 "/etc/ssl/cert.pem"))
117 #:phases
118 (modify-phases %standard-phases
119 (add-after 'unpack 'modify-install-locations
120 (lambda _
121 ;; Don't try to create /var/run or /var/db
122 (substitute* "src/Makefile.in"
123 (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR"))
124 #t)))))
125 (inputs
126 `(("libressl" ,libressl))) ; enable TLS time constraints. See ntpd.conf(5).
127 (home-page "http://www.openntpd.org/")
128 (synopsis "NTP client and server by the OpenBSD Project")
129 (description "OpenNTPD is the OpenBSD Project's implementation of a client
130 and server for the Network Time Protocol. Its design goals include being
131 secure, easy to configure, and accurate enough for most purposes, so it's more
132 minimalist than ntpd.")
133 ;; A few of the source files are under bsd-3.
134 (license (list l:isc l:bsd-3))))
135
136 (define-public tlsdate
137 (package
138 (name "tlsdate")
139 (version "0.0.13")
140 (home-page "https://github.com/ioerror/tlsdate")
141 (source (origin
142 (method git-fetch)
143 (uri (git-reference
144 (commit (string-append "tlsdate-" version))
145 (url home-page)))
146 (sha256
147 (base32
148 "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl"))
149 (file-name (string-append name "-" version "-checkout"))))
150 (build-system gnu-build-system)
151 (arguments
152 `(;; Disable seccomp when it's not supported--e.g., on aarch64. See
153 ;; 'src/seccomp.c' for the list of supported systems.
154 #:configure-flags ,(if (any (lambda (system)
155 (string-contains (or
156 (%current-target-system)
157 (%current-system))
158 system))
159 '("x86_64" "i686" "arm"))
160 ''()
161 ''("--disable-seccomp-filter"))
162
163 #:phases (modify-phases %standard-phases
164 (add-after 'unpack 'autogen
165 (lambda _
166 ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the
167 ;; date that is recorded in binaries. It must be a
168 ;; "recent date" since it is used to detect bogus dates
169 ;; received from servers.
170 (setenv "COMPILE_DATE" (number->string 1530144000))
171 (invoke "sh" "autogen.sh"))))))
172 (inputs `(("openssl" ,openssl-1.0)
173 ("libevent" ,libevent)))
174 (native-inputs `(("pkg-config" ,pkg-config)
175 ("autoconf" ,autoconf)
176 ("automake" ,automake)
177 ("libtool" ,libtool)))
178 (synopsis "Extract remote time from TLS handshakes")
179 (description
180 "@command{tlsdate} sets the local clock by securely connecting with TLS
181 to remote servers and extracting the remote time out of the secure handshake.
182 Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a
183 remote HTTPS or TLS enabled service, and provides some protection against
184 adversaries that try to feed you malicious time information.")
185 (license l:bsd-3)))