projects/guix·blob python-team · refs

415 lines · 18.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 John Darrington <[email protected]>
3;;; Copyright © 2014, 2015 Mark H Weaver <[email protected]>
4;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <[email protected]>
5;;; Copyright © 2015, 2018 Ludovic Courtès <[email protected]>
6;;; Copyright © 2016, 2017, 2018, 2022, 2025 Efraim Flashner <[email protected]>
7;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <[email protected]>
8;;; Copyright © 2019 Maxim Cournoyer <[email protected]>
9;;; Copyright © 2021 Marius Bakke <[email protected]>
10;;; Copyright © 2021 Brice Waegeneire <[email protected]>
11;;; Copyright © 2022 Petr Hodina <[email protected]>
12;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
13;;; Copyright © 2024 Zheng Junjie <[email protected]>
14;;; Copyright © 2025 Ashish SHUKLA <[email protected]>
15;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages ntp)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages build-tools)
38 #:use-module (gnu packages gps)
39 #:use-module (gnu packages guile)
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages m4)
43 #:use-module (gnu packages nettle)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages readline)
49 #:use-module (gnu packages ruby-xyz)
50 #:use-module (gnu packages time)
51 #:use-module (gnu packages tls)
52 #:use-module (gnu packages web)
53 #:use-module (guix build-system gnu)
54 #:use-module (guix build-system waf)
55 #:use-module (guix download)
56 #:use-module (guix gexp)
57 #:use-module (guix git-download)
58 #:use-module ((guix licenses) #:prefix l:)
59 #:use-module (guix packages)
60 #:use-module (guix utils)
61 #:use-module (srfi srfi-1))
62
63(define-public chrony
64 (package
65 (name "chrony")
66 (version "4.8")
67 (source
68 (origin
69 (method git-fetch)
70 (uri (git-reference
71 (url "https://gitlab.com/chrony/chrony.git/")
72 (commit version)))
73 (file-name (git-file-name name version))
74 (sha256
75 (base32 "0pw1c6wkm4pxc92m1ykxs467azk6gmhvb8m49qkzw0s0agpg49nm"))))
76 (build-system gnu-build-system)
77 (arguments
78 (list
79 #:modules
80 '((srfi srfi-26)
81 (guix build utils)
82 (guix build gnu-build-system))
83 #:configure-flags
84 #~(list "--enable-scfilter"
85 "--with-ntp-era=0"
86 "--with-sendmail=sendmail"
87 "--with-user=chrony")
88 #:phases
89 #~(modify-phases %standard-phases
90 (add-after 'unpack 'set-CC
91 (lambda _
92 (setenv "CC" #$(cc-for-target))))
93 #$@(if (this-package-native-input "ruby-asciidoctor")
94 #~()
95 #~((add-after 'unpack 'adjust-makefile
96 (lambda _
97 (substitute* "doc/Makefile.in"
98 (("install:")
99 (string-append "install:\n\n"
100 "not-install:")))))))
101 (add-after 'unpack 'stay-inside-out
102 ;; Simply setting CHRONYVARDIR to something nonsensical at install
103 ;; time would result in nonsense file names in man pages.
104 (lambda _
105 (substitute* "Makefile.in"
106 (("mkdir -p \\$\\(DESTDIR\\)\\$\\(CHRONYVARDIR\\)") ":"))))
107 (add-after 'install 'install-more-documentation
108 (lambda _
109 (let* ((doc (string-append #$output "/share/doc/"
110 #$name "-" #$version)))
111 (for-each (cut install-file <> doc)
112 (list "README"))
113 (copy-recursively "examples"
114 (string-append doc "/examples"))))))))
115 (native-inputs
116 (append (list bison
117 pkg-config)
118 (if (supported-package? ruby-asciidoctor/minimal)
119 (list ruby-asciidoctor/minimal)
120 '())))
121 (inputs
122 (list gnutls libcap libseccomp nettle))
123 (home-page "https://chrony-project.org/")
124 (synopsis "System clock synchronization service that speaks NTP")
125 (description
126 "Chrony keeps your system time accurate. It synchronises your computer's
127clock with @acronym{NTP, Network Time Protocol} servers, reference clocks such
128as GPS receivers, or even manual input of the correct time from a wristwatch.
129
130Chrony will determine the rate at which the computer gains or loses time, and
131compensate for it. It can also operate as an
132NTPv4 (@url{https://www.rfc-editor.org/rfc/rfc5905, RFC 5905}) server and peer to
133tell time to other computers on the network.
134
135It's designed to perform well even under adverse conditions: congested
136networks, unreliable clocks drifting with changes in temperature, and devices
137or virtual machines that are frequently turned off and connect to the Internet
138for only a few minutes at a time.
139
140Typical accuracy when synchronised over the Internet is several milliseconds.
141On a local network this can reach tens of microseconds. With hardware
142time-stamping or reference clock, sub-microsecond accuracy is possible.")
143 (license l:gpl2)))
144
145(define-public ntp
146 (package
147 (name "ntp")
148 (version "4.2.8p18")
149 (source
150 (origin
151 (method url-fetch)
152 (uri (list (string-append
153 "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
154 (version-major+minor version) "/ntp-" version ".tar.gz")
155 (string-append "http://archive.ntp.org/ntp4/ntp-"
156 (version-major+minor version) "/ntp-" version
157 ".tar.gz")))
158 (sha256
159 (base32 "1rb8yksqxjcsjvww9kwnw1242qzszwixh916jj254a8szgrwb16g"))
160 (patches (search-patches
161 "ntp-fix-dereferencing-the-wrong-variable.patch"))
162 (modules '((guix build utils)))
163 (snippet '(begin
164 ;; Remove the bundled copy of libevent, but we must keep
165 ;; sntp/libevent/build-aux since configure.ac contains
166 ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
167 (rename-file "sntp/libevent/build-aux"
168 "sntp/libevent:build-aux")
169 (delete-file-recursively "sntp/libevent")
170 (mkdir "sntp/libevent")
171 (rename-file "sntp/libevent:build-aux"
172 "sntp/libevent/build-aux")))))
173 (native-inputs (list which pkg-config))
174 (inputs (cons* guile-3.0 ; for wrap-script
175 libevent
176 openssl-3.0
177 perl
178 perl-http-tiny
179 perl-io-socket-ssl
180 perl-net-ssleay
181 ;; Build with POSIX capabilities support on GNU/Linux. This allows
182 ;; 'ntpd' to run as non-root (when invoked with '-u'.)
183 (if (target-linux?)
184 (list libcap)
185 '())))
186 (arguments
187 (list
188 ;; Pass "--with-yielding-select=yes" so that 'configure' knows whether
189 ;; 'select' yields when using pthreads in a cross-compilation context.
190 #:configure-flags
191 #~(list
192 "CFLAGS=-g -O2 -Wno-error=int-conversion"
193 "--with-yielding-select=yes")
194 #:phases
195 #~(modify-phases %standard-phases
196 (add-after 'unpack 'disable-network-test
197 (lambda _
198 (substitute* "tests/libntp/Makefile.in"
199 (("test-decodenetnum\\$\\(EXEEXT\\) ")
200 ""))))
201 (add-after 'unpack 'update-leap-file-source
202 ;; Follow the text redirect from the IETF.
203 (lambda _
204 (substitute* '("scripts/update-leap/invoke-update-leap.texi"
205 "scripts/update-leap/update-leap.in")
206 (("https://www.ietf.org/timezones/data/leap-seconds.list")
207 "https://data.iana.org/time-zones/data/leap-seconds.list"))))
208 (add-after 'unpack 'use-absolute-path-in-files
209 (lambda _
210 (substitute* "scripts/lib/NTP/Util.pm"
211 (("(ntpq_path = ')ntpq(';)" _ first last)
212 (string-append first #$output "/bin/ntpq" last))
213 (("(sntp_path = ')sntp(';)" _ first last)
214 (string-append first #$output "/bin/sntp" last)))
215 (substitute* "scripts/calc_tickadj/calc_tickadj.in"
216 (("`tickadj`")
217 (string-append "`" #$output "/bin/tickadj`")))))
218 (add-after 'install 'adjust-scripts
219 (lambda _
220 (substitute* (string-append #$output "/bin/calc_tickadj")
221 (("/etc/ntp/drift")
222 "/var/run/ntpd/ntp.drift"))
223 (wrap-script (string-append #$output "/bin/update-leap")
224 `("PERL5LIB" ":" prefix
225 (,(getenv "PERL5LIB")))))))))
226 (build-system gnu-build-system)
227 (synopsis "Real time clock synchronization system")
228 (description "NTP is a system designed to synchronize the clocks of
229computers over a network.")
230 (license (l:x11-style
231 "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
232 "A non-copyleft free licence from the University of Delaware"))
233 (home-page "https://www.ntp.org")))
234
235(define-public ntpsec
236 (package
237 (name "ntpsec")
238 (version "1.2.4")
239 (source
240 (origin
241 (method git-fetch)
242 (uri (git-reference
243 (url "https://gitlab.com/NTPsec/ntpsec.git")
244 (commit (string-append "NTPsec_"
245 (string-replace-substring version "." "_")))))
246 (file-name (git-file-name name version))
247 (sha256
248 (base32 "1m23mzsj3iq36d14ncj0w74hy152blv61nxd8w4xcs52vsh48mps"))))
249 (native-inputs (list bison
250 m4
251 pkg-config
252 pps-tools
253 waf
254 ruby-asciidoctor/minimal))
255 (inputs (cons* gpsd openssl
256 ;; Build with POSIX capabilities and syscall filtering
257 ;; support on GNU/Linux, for extra security features.
258 (if (target-linux?)
259 (list libcap libseccomp)
260 '())))
261 (arguments
262 (list
263 #:configure-flags
264 #~(list "--refclock=all"
265 "--enable-manpage"
266 "--disable-doc"
267 #$@(if (target-linux?)
268 '("--enable-seccomp")
269 '())
270 "--enable-mssntp")
271 #:phases
272 #~(modify-phases %standard-phases
273 (add-after 'unpack 'disable-network-test
274 (lambda _
275 (substitute* "tests/wscript"
276 (("\"libntp/decodenetnum.c\",")
277 ""))
278 (substitute* "tests/common/tests_main.c"
279 (("RUN_TEST_GROUP\\(decodenetnum\\);")
280 ""))))
281 ;; Tests fail without this. PYTHONPATH is ignored, unfortunately.
282 (add-before 'build 'symlink-python-gps
283 (lambda* (#:key inputs #:allow-other-keys)
284 (mkdir-p "build/main/tests/pylib")
285 (let ((python-version #$(version-major+minor (package-version
286 python))))
287 (symlink (string-append (assoc-ref inputs "gpsd")
288 "/lib/python" python-version
289 "/site-packages/gps")
290 "build/main/tests/pylib/gps")))))))
291 (build-system waf-build-system)
292 (synopsis "Real time clock synchronization system and utilities")
293 (description
294 "@acronym{NTP, Network Time Protocol}, the protocol, is used to keep
295computer clocks accurate by synchronizing them over the Internet or a
296local network, or by following an accurate hardware receiver that interprets
297GPS, DCF-77, or similar time signals.
298
299NTPsec is a hardened and improved implementation derived from the original
300@url{https://www.ntp.org, NTP project}. NTPsec supports
301@acronym{NTS, Network Time Security} which provides cryptographically
302authenticated time.
303
304This package contains the NTP daemon and utility programs. An NTP daemon
305needs to be running on each host that is to have its clock accuracy controlled
306by NTP. The same NTP daemon is also used to provide NTP service to other hosts.")
307 ;; All licenses are in file://LICENSES/
308 (license (list l:bsd-2
309 l:bsd-3
310 l:bsd-4
311 l:isc
312 l:expat
313 l:asl2.0
314 l:cc-by4.0
315 (l:non-copyleft "file://LICENSES/Beerware.txt"
316 "See LICENSES/Beerware.txt in the distribution.")
317 (l:x11-style
318 "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
319 "A non-copyleft free licence from the University of Delaware")))
320 (home-page "https://www.ntpsec.org")))
321
322(define-public openntpd
323 (package
324 (name "openntpd")
325 (version "7.2")
326 (source
327 (origin
328 (method git-fetch)
329 (uri (git-reference
330 (url "https://github.com/openntpd-portable/openntpd-portable")
331 (commit "cf202d14cb46d1b37638a13e7ed5c1d4143878fe")))
332 (file-name (git-file-name name version))
333 (sha256
334 (base32 "1l7xp5yscdwc4llnb55z2k0vcw197qd9zcwb4gm2vi1m7an3aygx"))))
335 (build-system gnu-build-system)
336 (arguments
337 `(#:modules ((srfi srfi-1)
338 (guix build utils)
339 (guix build gnu-build-system))
340 #:configure-flags
341 (let* ((libressl (assoc-ref %build-inputs "libressl"))
342 (libressl-version ,(package-version
343 (car (assoc-ref (package-inputs this-package)
344 "libressl")))))
345 (list "--with-privsep-user=ntpd"
346 "--localstatedir=/var"
347 (string-append "--with-cacert=" libressl
348 "/share/libressl-" libressl-version
349 "/cert.pem")))
350 #:phases
351 (modify-phases %standard-phases
352 (add-after 'unpack 'copy-openbsd
353 (lambda* (#:key inputs #:allow-other-keys)
354 (mkdir-p "openbsd")
355 (for-each
356 (lambda (subdir)
357 (copy-recursively ;; copy required to invoke patch(1).
358 (in-vicinity (assoc-ref inputs "openbsd") subdir)
359 (in-vicinity "openbsd/src" subdir)))
360 ;; refer to update.sh for the required files.
361 '("etc" "include" "lib/libc" "lib/libcrypto/arc4random"
362 "lib/libutil" "usr.sbin/ntpd"))))
363 ;; the update.sh script is invoked from the 'bootstrap phase which is
364 ;; run before 'patch-source-shebangs. Hence, fix it manually here.
365 (add-after 'unpack 'fix-update-script
366 (lambda* (#:key inputs #:allow-other-keys)
367 (substitute* "update.sh"
368 ;; fix shebang
369 (("#!/bin/sh")
370 (string-append
371 "#!"
372 (search-input-file inputs "/bin/sh")))
373 ;; do not invoke git.
374 (("git") "true"))))
375 (add-after 'unpack 'modify-install-locations
376 (lambda _
377 ;; Don't try to create /var/run or /var/db
378 (substitute* "src/Makefile.am"
379 (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR"))))
380 ;; Remove the OpenBSD source from the C_INCLUDE_PATH.
381 (add-after 'set-paths 'adjust-C_INCLUDE_PATH
382 (lambda* (#:key inputs #:allow-other-keys)
383 (let ((openbsd (assoc-ref inputs "openbsd")))
384 (setenv "C_INCLUDE_PATH"
385 (string-join
386 (delete
387 (string-append openbsd "/include")
388 (string-split (getenv "C_INCLUDE_PATH") #\:))
389 ":"))
390 (format #t
391 "environment variable `C_INCLUDE_PATH' changed to ~a~%"
392 (getenv "C_INCLUDE_PATH"))))))))
393 (inputs
394 `(("openbsd"
395 ,(origin
396 (method git-fetch)
397 (uri (git-reference
398 (url "https://github.com/openbsd/src")
399 ;; the commit hash for the 7.2 release in OpenBSD.
400 (commit "b3121f2f06d5822c63d53f93b0df3f0c846d8fce")))
401 (file-name (git-file-name name version))
402 (sha256
403 (base32 "0dif6vcli9i7gx0aw93an9vk164729gayyfbm1z1w9hqvwq4r4dm"))))
404 ;; enable TLS time constraints. See ntpd.conf(5).
405 ("libressl" ,libressl)))
406 (native-inputs
407 (list autoconf automake bison libtool))
408 (home-page "https://www.openntpd.org/")
409 (synopsis "NTP client and server by the OpenBSD Project")
410 (description "OpenNTPD is the OpenBSD Project's implementation of a client
411and server for the Network Time Protocol. Its design goals include being
412secure, easy to configure, and accurate enough for most purposes, so it's more
413minimalist than ntpd.")
414 ;; A few of the source files are under bsd-3.
415 (license (list l:isc l:bsd-3))))