gnu: nnn: Don't use NAME in source URI.
[jackhill/guix/guix.git] / gnu / packages / ntp.scm
CommitLineData
d99e12d2 1;;; GNU Guix --- Functional package management for GNU
53a427cf 2;;; Copyright © 2014 John Darrington <jmd@gnu.org>
b7921ba5 3;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4ee69624 4;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
0927b5be 5;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
16718b67 6;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
efc1fd32 7;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
d99e12d2
JD
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages ntp)
25 #:use-module (gnu packages)
ce0614dd 26 #:use-module (gnu packages base)
52b321e9 27 #:use-module (gnu packages linux)
604d20a2 28 #:use-module (gnu packages autotools)
53a427cf 29 #:use-module (gnu packages pkg-config)
cc2b77df 30 #:use-module (gnu packages tls)
a60cd281 31 #:use-module (gnu packages libevent)
53a427cf 32 #:use-module ((guix licenses) #:prefix l:)
d99e12d2 33 #:use-module (guix packages)
53a427cf 34 #:use-module (guix utils)
d99e12d2 35 #:use-module (guix download)
604d20a2 36 #:use-module (guix git-download)
d99e12d2
JD
37 #:use-module (guix build-system gnu)
38 #:use-module (srfi srfi-1))
39
40(define-public ntp
41 (package
42 (name "ntp")
e2749d75 43 (version "4.2.8p12")
d35de59b
EF
44 (source
45 (origin
46 (method url-fetch)
47 (uri (list (string-append
48 "http://archive.ntp.org/ntp4/ntp-"
49 (version-major+minor version)
50 "/ntp-" version ".tar.gz")
51 (string-append
52 "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
53 (version-major+minor version)
54 "/ntp-" version ".tar.gz")))
55 (sha256
56 (base32
e2749d75 57 "0m04ndn0674kcf9x0aggjya07a3hlig2nlzzpwk7vmqka0mj56vh"))
d35de59b
EF
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))))
53a427cf
MW
71 (native-inputs `(("which" ,which)
72 ("pkg-config" ,pkg-config)))
52b321e9 73 (inputs
53a427cf 74 `(("openssl" ,openssl)
a60cd281 75 ("libevent" ,libevent)
53a427cf
MW
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 '())))
a60cd281
MW
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)))))
d99e12d2 90 (build-system gnu-build-system)
e881752c 91 (synopsis "Real time clock synchronization system")
d99e12d2
JD
92 (description "NTP is a system designed to synchronize the clocks of
93computers over a network.")
53a427cf 94 (license (l:x11-style
d99e12d2
JD
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")))
4ee69624
TUBK
98
99(define-public openntpd
100 (package
101 (name "openntpd")
6dbad376 102 (version "6.2p3")
4ee69624
TUBK
103 (source (origin
104 (method url-fetch)
4ee69624 105 (uri (string-append
644e5f17 106 "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz"))
4ee69624
TUBK
107 (sha256
108 (base32
6dbad376 109 "0fn12i4kzsi0zkr4qp3dp9bycmirnfapajqvdfx02zhr4hanj0kv"))))
4ee69624 110 (build-system gnu-build-system)
16718b67
EF
111 (arguments
112 '(#:configure-flags '("--with-privsep-user=ntpd"
113 "--localstatedir=/var")
114 #:phases
115 (modify-phases %standard-phases
116 (add-after 'unpack 'modify-install-locations
117 (lambda _
118 ;; Don't try to create /var/run or /var/db
119 (substitute* "src/Makefile.in"
120 (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR"))
121 #t)))))
080e023d
LF
122 (inputs
123 `(("libressl" ,libressl))) ; enable TLS time constraints. See ntpd.conf(5).
4ee69624
TUBK
124 (home-page "http://www.openntpd.org/")
125 (synopsis "NTP client and server by the OpenBSD Project")
126 (description "OpenNTPD is the OpenBSD Project's implementation of a client
127and server for the Network Time Protocol. Its design goals include being
128secure, easy to configure, and accurate enough for most purposes, so it's more
129minimalist than ntpd.")
130 ;; A few of the source files are under bsd-3.
131 (license (list l:isc l:bsd-3))))
604d20a2
LC
132
133(define-public tlsdate
134 (package
135 (name "tlsdate")
136 (version "0.0.13")
137 (home-page "https://github.com/ioerror/tlsdate")
138 (source (origin
139 (method git-fetch)
140 (uri (git-reference
141 (commit (string-append "tlsdate-" version))
142 (url home-page)))
143 (sha256
144 (base32
145 "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl"))
146 (file-name (string-append name "-" version "-checkout"))))
147 (build-system gnu-build-system)
148 (arguments
0927b5be
LC
149 `(;; Disable seccomp when it's not supported--e.g., on aarch64. See
150 ;; 'src/seccomp.c' for the list of supported systems.
151 #:configure-flags ,(if (any (lambda (system)
152 (string-contains (or
153 (%current-target-system)
154 (%current-system))
155 system))
156 '("x86_64" "i686" "arm"))
157 ''()
158 ''("--disable-seccomp-filter"))
159
160 #:phases (modify-phases %standard-phases
604d20a2
LC
161 (add-after 'unpack 'autogen
162 (lambda _
163 ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the
164 ;; date that is recorded in binaries. It must be a
165 ;; "recent date" since it is used to detect bogus dates
166 ;; received from servers.
23256858 167 (setenv "COMPILE_DATE" (number->string 1530144000))
efc1fd32 168 (invoke "sh" "autogen.sh"))))))
604d20a2
LC
169 (inputs `(("openssl" ,openssl)
170 ("libevent" ,libevent)))
171 (native-inputs `(("pkg-config" ,pkg-config)
172 ("autoconf" ,autoconf)
173 ("automake" ,automake)
174 ("libtool" ,libtool)))
175 (synopsis "Extract remote time from TLS handshakes")
176 (description
177 "@command{tlsdate} sets the local clock by securely connecting with TLS
178to remote servers and extracting the remote time out of the secure handshake.
179Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a
180remote HTTPS or TLS enabled service, and provides some protection against
181adversaries that try to feed you malicious time information.")
182 (license l:bsd-3)))