Commit | Line | Data |
---|---|---|
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> |
0a8c2c98 | 7 | ;;; Copyright © 2018, 2019 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") | |
0a8c2c98 | 43 | (version "4.2.8p13") |
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 | |
0a8c2c98 | 56 | (base32 "0f1a4fya7v5s0426nim8ydvvlcashb8hicgs9xlm76ndrz7751r8")) |
d35de59b EF |
57 | (modules '((guix build utils))) |
58 | (snippet | |
59 | '(begin | |
60 | ;; Remove the bundled copy of libevent, but we must keep | |
61 | ;; sntp/libevent/build-aux since configure.ac contains | |
62 | ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux]) | |
63 | (rename-file "sntp/libevent/build-aux" | |
64 | "sntp/libevent:build-aux") | |
65 | (delete-file-recursively "sntp/libevent") | |
66 | (mkdir "sntp/libevent") | |
67 | (rename-file "sntp/libevent:build-aux" | |
68 | "sntp/libevent/build-aux") | |
69 | #t)))) | |
53a427cf MW |
70 | (native-inputs `(("which" ,which) |
71 | ("pkg-config" ,pkg-config))) | |
52b321e9 | 72 | (inputs |
53a427cf | 73 | `(("openssl" ,openssl) |
a60cd281 | 74 | ("libevent" ,libevent) |
53a427cf MW |
75 | ;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd' |
76 | ;; to run as non-root (when invoked with '-u'.) | |
77 | ,@(if (string-suffix? "-linux" | |
78 | (or (%current-target-system) (%current-system))) | |
79 | `(("libcap" ,libcap)) | |
80 | '()))) | |
a60cd281 MW |
81 | (arguments |
82 | `(#:phases | |
83 | (modify-phases %standard-phases | |
84 | (add-after 'unpack 'disable-network-test | |
85 | (lambda _ | |
86 | (substitute* "tests/libntp/Makefile.in" | |
87 | (("test-decodenetnum\\$\\(EXEEXT\\) ") "")) | |
88 | #t))))) | |
d99e12d2 | 89 | (build-system gnu-build-system) |
e881752c | 90 | (synopsis "Real time clock synchronization system") |
d99e12d2 JD |
91 | (description "NTP is a system designed to synchronize the clocks of |
92 | computers over a network.") | |
53a427cf | 93 | (license (l:x11-style |
d99e12d2 JD |
94 | "http://www.eecis.udel.edu/~mills/ntp/html/copyright.html" |
95 | "A non-copyleft free licence from the University of Delaware")) | |
96 | (home-page "http://www.ntp.org"))) | |
4ee69624 TUBK |
97 | |
98 | (define-public openntpd | |
99 | (package | |
100 | (name "openntpd") | |
6dbad376 | 101 | (version "6.2p3") |
4ee69624 TUBK |
102 | (source (origin |
103 | (method url-fetch) | |
4ee69624 | 104 | (uri (string-append |
644e5f17 | 105 | "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz")) |
4ee69624 TUBK |
106 | (sha256 |
107 | (base32 | |
6dbad376 | 108 | "0fn12i4kzsi0zkr4qp3dp9bycmirnfapajqvdfx02zhr4hanj0kv")))) |
4ee69624 | 109 | (build-system gnu-build-system) |
16718b67 EF |
110 | (arguments |
111 | '(#:configure-flags '("--with-privsep-user=ntpd" | |
112 | "--localstatedir=/var") | |
113 | #:phases | |
114 | (modify-phases %standard-phases | |
115 | (add-after 'unpack 'modify-install-locations | |
116 | (lambda _ | |
117 | ;; Don't try to create /var/run or /var/db | |
118 | (substitute* "src/Makefile.in" | |
119 | (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR")) | |
120 | #t))))) | |
080e023d LF |
121 | (inputs |
122 | `(("libressl" ,libressl))) ; enable TLS time constraints. See ntpd.conf(5). | |
4ee69624 TUBK |
123 | (home-page "http://www.openntpd.org/") |
124 | (synopsis "NTP client and server by the OpenBSD Project") | |
125 | (description "OpenNTPD is the OpenBSD Project's implementation of a client | |
126 | and server for the Network Time Protocol. Its design goals include being | |
127 | secure, easy to configure, and accurate enough for most purposes, so it's more | |
128 | minimalist than ntpd.") | |
129 | ;; A few of the source files are under bsd-3. | |
130 | (license (list l:isc l:bsd-3)))) | |
604d20a2 LC |
131 | |
132 | (define-public tlsdate | |
133 | (package | |
134 | (name "tlsdate") | |
135 | (version "0.0.13") | |
136 | (home-page "https://github.com/ioerror/tlsdate") | |
137 | (source (origin | |
138 | (method git-fetch) | |
139 | (uri (git-reference | |
140 | (commit (string-append "tlsdate-" version)) | |
141 | (url home-page))) | |
142 | (sha256 | |
143 | (base32 | |
144 | "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl")) | |
145 | (file-name (string-append name "-" version "-checkout")))) | |
146 | (build-system gnu-build-system) | |
147 | (arguments | |
0927b5be LC |
148 | `(;; Disable seccomp when it's not supported--e.g., on aarch64. See |
149 | ;; 'src/seccomp.c' for the list of supported systems. | |
150 | #:configure-flags ,(if (any (lambda (system) | |
151 | (string-contains (or | |
152 | (%current-target-system) | |
153 | (%current-system)) | |
154 | system)) | |
155 | '("x86_64" "i686" "arm")) | |
156 | ''() | |
157 | ''("--disable-seccomp-filter")) | |
158 | ||
159 | #:phases (modify-phases %standard-phases | |
604d20a2 LC |
160 | (add-after 'unpack 'autogen |
161 | (lambda _ | |
162 | ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the | |
163 | ;; date that is recorded in binaries. It must be a | |
164 | ;; "recent date" since it is used to detect bogus dates | |
165 | ;; received from servers. | |
23256858 | 166 | (setenv "COMPILE_DATE" (number->string 1530144000)) |
efc1fd32 | 167 | (invoke "sh" "autogen.sh")))))) |
604d20a2 LC |
168 | (inputs `(("openssl" ,openssl) |
169 | ("libevent" ,libevent))) | |
170 | (native-inputs `(("pkg-config" ,pkg-config) | |
171 | ("autoconf" ,autoconf) | |
172 | ("automake" ,automake) | |
173 | ("libtool" ,libtool))) | |
174 | (synopsis "Extract remote time from TLS handshakes") | |
175 | (description | |
176 | "@command{tlsdate} sets the local clock by securely connecting with TLS | |
177 | to remote servers and extracting the remote time out of the secure handshake. | |
178 | Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a | |
179 | remote HTTPS or TLS enabled service, and provides some protection against | |
180 | adversaries that try to feed you malicious time information.") | |
181 | (license l:bsd-3))) |