projects/guix·blob javascript-team · refs

1792 lines · 80.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2025 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014, 2019 Andreas Enge <[email protected]>
4;;; Copyright © 2012 Nikita Karetnikov <[email protected]>
5;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <[email protected]>
6;;; Copyright © 2014 Alex Kost <[email protected]>
7;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <[email protected]>
8;;; Copyright © 2016, 2017, 2019-2023, 2025 Efraim Flashner <[email protected]>
9;;; Copyright © 2016, 2020, 2023, 2024, 2025 Janneke Nieuwenhuizen <[email protected]>
10;;; Copyright © 2016, 2018 Alex Vong <[email protected]>
11;;; Copyright © 2017 Rene Saavedra <[email protected]>
12;;; Copyright © 2017, 2020 Mathieu Othacehe <[email protected]>
13;;; Copyright © 2017, 2018, 2020, 2022 Marius Bakke <[email protected]>
14;;; Copyright © 2017 Eric Bavier <[email protected]>
15;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
16;;; Copyright © 2018, 2019, 2022 Ricardo Wurmus <[email protected]>
17;;; Copyright © 2020 Vitaliy Shatrov <[email protected]>
18;;; Copyright © 2020 Chris Marusich <[email protected]>
19;;; Copyright © 2021 Leo Le Bouter <[email protected]>
20;;; Copyright © 2021 Maxime Devos <[email protected]>
21;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
22;;; Copyright © 2021, 2024 Maxim Cournoyer <[email protected]>
23;;; Copyright © 2022 zamfofex <[email protected]>
24;;; Copyright © 2022, 2026 John Kehayias <[email protected]>
25;;; Copyright © 2023 Josselin Poiret <[email protected]>
26;;; Copyright © 2024, 2025 Zheng Junjie <[email protected]>
27;;;
28;;; This file is part of GNU Guix.
29;;;
30;;; GNU Guix is free software; you can redistribute it and/or modify it
31;;; under the terms of the GNU General Public License as published by
32;;; the Free Software Foundation; either version 3 of the License, or (at
33;;; your option) any later version.
34;;;
35;;; GNU Guix is distributed in the hope that it will be useful, but
36;;; WITHOUT ANY WARRANTY; without even the implied warranty of
37;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38;;; GNU General Public License for more details.
39;;;
40;;; You should have received a copy of the GNU General Public License
41;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
42
43;;; Commentary:
44;;;
45;;; Base packages of the Guix-based GNU user-land software distribution.
46;;;
47;;; Code:
48
49(define-module (gnu packages base)
50 #:use-module ((guix licenses)
51 #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
52 #:use-module (gnu packages)
53 #:use-module (gnu packages acl)
54 #:use-module (gnu packages algebra)
55 #:use-module (gnu packages attr)
56 #:use-module (gnu packages autotools)
57 #:use-module (gnu packages bash)
58 #:use-module (gnu packages bison)
59 #:use-module (gnu packages build-tools)
60 #:use-module (gnu packages gcc)
61 #:use-module (gnu packages guile)
62 #:use-module (gnu packages multiprecision)
63 #:use-module (gnu packages compression)
64 #:use-module (gnu packages perl)
65 #:use-module (gnu packages linux)
66 #:use-module (gnu packages pcre)
67 #:use-module (gnu packages texinfo)
68 #:use-module (gnu packages text-editors)
69 #:use-module (gnu packages hurd)
70 #:use-module (gnu packages pkg-config)
71 #:use-module (gnu packages python)
72 #:use-module (gnu packages gettext)
73 #:use-module (guix i18n)
74 #:use-module (guix utils)
75 #:use-module (guix gexp)
76 #:use-module (guix packages)
77 #:use-module (guix download)
78 #:use-module (guix git-download)
79 #:use-module (guix build-system gnu)
80 #:use-module (guix build-system trivial)
81 #:use-module (guix search-paths)
82 #:use-module (ice-9 format)
83 #:use-module (ice-9 match)
84 #:use-module (ice-9 optargs)
85 #:use-module (srfi srfi-1)
86 #:use-module (srfi srfi-26)
87 #:export (glibc
88 libc-for-target
89 libc-locales-for-target
90 libc-utf8-locales-for-target
91 make-ld-wrapper
92 libiconv-if-needed
93
94 ;; Beware: the following should not be used the top level to avoid
95 ;; introducing circular module dependencies.
96 canonical-package
97 %final-inputs))
98
99(define-public hello
100 (package
101 (name "hello")
102 (version "2.12.3")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "mirror://gnu/hello/hello-" version
106 ".tar.gz"))
107 (sha256
108 (base32
109 "183a6rxnhixiyykd7qis0y9g9cfqhpkk872a245y3zl28can0pqd"))))
110 (build-system gnu-build-system)
111 (synopsis "Example GNU package")
112 (description
113 "GNU Hello prints the message \"Hello, world!\" and then exits. It
114serves as an example of standard GNU coding practices. As such, it supports
115command-line arguments, multiple languages, and so on.")
116 (home-page "https://www.gnu.org/software/hello/")
117 (license gpl3+)))
118
119(define-public grep
120 (package
121 (name "grep")
122 (version "3.11")
123 (source (origin
124 (method url-fetch)
125 (uri (string-append "mirror://gnu/grep/grep-"
126 version ".tar.xz"))
127 (sha256
128 (base32
129 "1avf4x8skxbqrjp5j2qr9sp5vlf8jkw2i5bdn51fl3cxx3fsxchx"))
130 (patches (search-patches "grep-timing-sensitive-test.patch"))))
131 (build-system gnu-build-system)
132 (native-inputs (list perl)) ;some of the tests require it
133 (inputs (list pcre2))
134 (arguments
135 (list #:configure-flags #~(list "--enable-perl-regexp")
136 #:phases
137 #~(modify-phases %standard-phases
138 (add-after 'install 'fix-egrep-and-fgrep
139 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
140 ;; absolute file name instead of searching for it in $PATH.
141 (lambda* (#:key outputs #:allow-other-keys)
142 (let* ((out (assoc-ref outputs "out"))
143 (bin (string-append out "/bin")))
144 (substitute* (list (string-append bin "/egrep")
145 (string-append bin "/fgrep"))
146 (("^exec grep")
147 (string-append "exec " bin "/grep"))))))
148 #$@(if (target-hurd64?)
149 #~((add-after 'unpack 'patch-sigsegv
150 (lambda _
151 ;; Stack overflow recovery does not compile
152 (substitute* "lib/sigsegv.in.h"
153 (("__GNU__") "__XGNU__")))))
154 #~())
155 ;; XXX: On 32-bit Hurd platforms, 'time_t' is defined as a 32-bit
156 ;; integer in 'hurd_types.defs', so this Gnulib test always fails.
157 ;; Use a phase instead of XFAIL_TESTS to not override
158 ;; xfailing tests in grep
159 #$@(if (target-hurd32?)
160 #~((add-after 'unpack 'skip-year2038-test
161 (lambda _
162 (substitute* "gnulib-tests/test-year2038.c"
163 (("(^| )main *\\(.*" all)
164 (string-append all "{\n return 77;//"))))))
165 #~())
166 #$@(if (system-hurd?)
167 #~((add-before 'check 'skip-test
168 (lambda _
169 (substitute* ;; This test hangs
170 '("tests/hash-collision-perf"
171 ;; This test fails
172 "tests/file")
173 (("^#!.*" all)
174 (string-append all "exit 77;\n"))))))
175 #~())
176 #$@(if (system-hurd64?)
177 #~((add-before 'check 'skip-test
178 (lambda _
179 (substitute* "tests/stack-overflow" ;This test hangs
180 (("^#!.*" all)
181 (string-append all "exit 77;\n"))))))
182 #~()))))
183 (synopsis "Print lines matching a pattern")
184 (description
185 "grep is a tool for finding text inside files. Text is found by
186matching a pattern provided by the user in one or many files. The pattern
187may be provided as a basic or extended regular expression, or as fixed
188strings. By default, the matching text is simply printed to the screen,
189however the output can be greatly customized to include, for example, line
190numbers. GNU grep offers many extensions over the standard utility,
191including, for example, recursive directory searching.")
192 (license gpl3+)
193 (home-page "https://www.gnu.org/software/grep/")))
194
195(define-public sed
196 (package
197 (name "sed")
198 (version "4.9")
199 (source (origin
200 (method url-fetch)
201 (uri (string-append "mirror://gnu/sed/sed-" version
202 ".tar.gz"))
203 (sha256
204 (base32
205 "0bi808vfkg3szmpy9g5wc7jnn2yk6djiz412d30km9rky0c8liyi"))))
206 (build-system gnu-build-system)
207 (synopsis "Stream editor")
208 (native-inputs (append (if (target-loongarch64?)
209 (list config)
210 '())
211 (list perl))) ;for tests
212 (arguments (if (target-loongarch64?)
213 (list #:phases
214 #~(modify-phases %standard-phases
215 (add-after 'unpack 'update-config-scripts
216 (lambda* (#:key inputs native-inputs #:allow-other-keys)
217 ;; Replace outdated config.guess and config.sub.
218 (for-each (lambda (file)
219 (install-file
220 (search-input-file
221 (or native-inputs inputs)
222 (string-append "/bin/" file)) "./build-aux"))
223 '("config.guess" "config.sub"))))))
224 '()))
225 (description
226 "Sed is a non-interactive, text stream editor. It receives a text
227input from a file or from standard input and it then applies a series of text
228editing commands to the stream and prints its output to standard output. It
229is often used for substituting text patterns in a stream. The GNU
230implementation offers several extensions over the standard utility.")
231 (license gpl3+)
232 (home-page "https://www.gnu.org/software/sed/")))
233
234(define-public tar
235 (package
236 (name "tar")
237 (version "1.35")
238 (source (origin
239 (method url-fetch)
240 (uri (string-append "mirror://gnu/tar/tar-"
241 version ".tar.xz"))
242 (sha256
243 (base32
244 "05nw7q7sazkana11hnf3f77lmybw1j9j6lsk93bsxirf6hvzyqjd"))
245 (patches (search-patches "tar-skip-unreliable-tests.patch"
246 "tar-remove-wholesparse-check.patch"))))
247 (build-system gnu-build-system)
248 ;; Note: test suite requires ~1GiB of disk space.
249 (arguments
250 `(,@(cond
251 ((target-hurd?)
252 '(#:make-flags
253 (list (string-append
254 "TESTSUITEFLAGS= -k '"
255 "!sparse"
256 ",!renamed dirs in incrementals"
257 ",!--exclude-tag option in incremental pass"
258 ",!incremental dumps with -C"
259 ",!incremental dumps of nested directories"
260 ",!incremental restores with -C"
261 ",!concatenated incremental archives (renames)"
262 ",!renamed directory containing subdirectories"
263 ",!renamed subdirectories"
264 ",!chained renames"
265 ",!Directory"
266 "'"))))
267 ;; 'storing sparse files > 8G' fails on powerpc-linux, likely
268 ;; due to the small HDD and RAM present on these devices.
269 ((target-ppc32?)
270 '(#:make-flags (list (string-append "TESTSUITEFLAGS= -k "
271 "'!tricky time stamps"
272 ",!storing sparse files > 8G'"))))
273 ;; https://lists.gnu.org/archive/html/bug-tar/2021-10/msg00007.html
274 ;; tar-1.34 isn't aware of 64-bit time_t and upstream suggests
275 ;; skipping the test for this release on 32-bit systems.
276 ((target-32bit?)
277 '(#:make-flags (list "TESTSUITEFLAGS= -k '!tricky time stamps'")))
278 (else '()))
279 ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
280 ,@(if (target-hurd32?)
281 (list #:configure-flags ''("--disable-year2038"))
282 '())
283 #:phases (modify-phases %standard-phases
284 (add-before 'build 'set-shell-file-name
285 (lambda* (#:key inputs #:allow-other-keys)
286 ;; Do not use "/bin/sh" to run programs.
287 (let ((bash (assoc-ref inputs "bash")))
288 (substitute* "src/system.c"
289 (("/bin/sh")
290 (string-append bash "/bin/sh")))))))))
291
292 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
293 ;; to refer to the target Bash.
294 (inputs (if (%current-target-system)
295 (list bash)
296 '()))
297
298 (synopsis "Managing tar archives")
299 (description
300 "Tar provides the ability to create tar archives, as well as the
301ability to extract, update or list files in an existing archive. It is
302useful for combining many files into one larger file, while maintaining
303directory structure and file information such as permissions and
304creation/modification dates. GNU tar offers many extensions over the
305standard utility.")
306 (license gpl3+)
307 (home-page "https://www.gnu.org/software/tar/")))
308
309;;; TODO: Replace/merge with 'patch' on core-updates.
310(define-public patch/pinned
311 (hidden-package
312 (package
313 (name "patch")
314 (version "2.7.6")
315 (source (origin
316 (method url-fetch)
317 (uri (string-append "mirror://gnu/patch/patch-"
318 version ".tar.xz"))
319 (sha256
320 (base32
321 "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc"))
322 (patches (search-patches "patch-hurd-path-max.patch"))))
323 (build-system gnu-build-system)
324 (arguments
325 ;; Work around a cross-compilation bug whereby libpatch.a would provide
326 ;; '__mktime_internal', which conflicts with the one in libc.a.
327 (if (%current-target-system)
328 `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
329 '()))
330 (native-inputs (list ed))
331 (synopsis "Apply differences to originals, with optional backups")
332 (description
333 "Patch is a program that applies changes to files based on differences
334laid out as by the program \"diff\". The changes may be applied to one or more
335files depending on the contents of the diff file. It accepts several
336different diff formats. It may also be used to revert previously applied
337differences.")
338 (license gpl3+)
339 (home-page "https://savannah.gnu.org/projects/patch/"))))
340
341(define-public patch
342 (package
343 (inherit patch/pinned)
344 (name "patch")
345 (version "2.8")
346 (source (origin
347 (method url-fetch)
348 (uri (string-append "mirror://gnu/patch/patch-"
349 version ".tar.xz"))
350 (sha256
351 (base32
352 "1qssgwgy3mfahkpgg99a35gl38vamlqb15m3c2zzrd62xrlywz7q"))))
353 (arguments
354 (substitute-keyword-arguments (package-arguments patch/pinned)
355 ((#:configure-flags flags #~'())
356 (if (target-hurd32?)
357 #~(cons* "--disable-year2038"
358 #$flags)
359 flags))))
360 (properties '())))
361
362(define-public diffutils
363 (package
364 (name "diffutils")
365 (version "3.12")
366 (source (origin
367 (method url-fetch)
368 (uri (string-append "mirror://gnu/diffutils/diffutils-"
369 version ".tar.xz"))
370 (sha256
371 (base32
372 "1zbxf8vv7z18ypddwqgzj51n426k959fiv4wxbyl34b0r2gpz2vw"))))
373 (build-system gnu-build-system)
374 (arguments
375 (list
376 ;; XXX: On 32-bit Hurd platforms, 'time_t' is defined as a 32-bit
377 ;; integer in 'hurd_types.defs', so this Gnulib test always fails.
378 #:make-flags
379 #~#$(cond ((and (not (%current-target-system))
380 (target-hurd32?))
381 #~'("XFAIL_TESTS=test-year2038"))
382 ;; TODO: Figure out why these gnulib tests are failing.
383 ((and (not (%current-target-system))
384 (target-powerpc?))
385 #~'("XFAIL_TESTS=test-float-h large-subopt"))
386 (else
387 #~'()))
388
389 #:configure-flags
390 #~#$(if (%current-target-system)
391 ;; Fix for crosscompiling; on GNU system strcasecmp always works
392 #~'("ac_cv_func_strcasecmp=yes" "gl_cv_func_strcasecmp_works=yes")
393 #~'())
394
395 #:phases (if (system-hurd?)
396 #~(modify-phases %standard-phases
397 (add-after 'unpack 'skip-tests
398 (lambda _
399 (substitute* "tests/large-subopt"
400 (("^#!.*" all)
401 (string-append all "exit 77;\n"))))))
402 #~%standard-phases)))
403 (native-inputs (list perl))
404 (synopsis "Comparing and merging files")
405 (description
406 "GNU Diffutils is a package containing tools for finding the
407differences between files. The \"diff\" command is used to show how two files
408differ, while \"cmp\" shows the offsets and line numbers where they differ.
409\"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
410interactive means to merge two files.")
411 (license gpl3+)
412 (home-page "https://www.gnu.org/software/diffutils/")))
413
414(define-public findutils
415 (package
416 (name "findutils")
417 (version "4.10.0")
418 (source (origin
419 (method url-fetch)
420 (uri (string-append "mirror://gnu/findutils/findutils-"
421 version ".tar.xz"))
422 (sha256
423 (base32
424 "1xd4y24qfsdfp3ndz7d5j49lkhbhpzgr13wrvsmx4izjgyvf11qk"))
425 (patches (search-patches "findutils-localstatedir.patch"))))
426 (build-system gnu-build-system)
427 (arguments
428 `(#:configure-flags (list
429 ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
430 ,@(if (target-hurd32?)
431 '("--disable-year2038")
432 '())
433 ;; Tell 'updatedb' to write to /var.
434 "--localstatedir=/var")
435 #:phases (modify-phases %standard-phases
436 (add-before 'check 'adjust-test-shebangs
437 (lambda _
438 (substitute* '("tests/xargs/verbose-quote.sh"
439 "tests/find/exec-plus-last-file.sh")
440 (("#!/bin/sh")
441 (string-append "#!" (which "sh"))))))
442 ,@(if (system-hurd?)
443 '((add-after 'unpack 'skip-tests
444 (lambda _
445 (substitute*
446 ;; This test fails non-deterministically
447 "gnulib-tests/test-strerror_r.c"
448 (("(^| )main *\\(.*" all)
449 (string-append all "{\n exit (77);//"))))))
450 '()))))
451 (synopsis "Operating on files matching given criteria")
452 (description
453 "Findutils supplies the basic file directory searching utilities of the
454GNU system. It consists of two primary searching utilities: \"find\"
455recursively searches for files in a directory according to given criteria and
456\"locate\" lists files in a database that match a query. Two auxiliary tools
457are included: \"updatedb\" updates the file name database and \"xargs\" may be
458used to apply commands with arbitrarily long arguments.")
459 (license gpl3+)
460 (home-page "https://www.gnu.org/software/findutils/")))
461
462(define-public coreutils
463 (package
464 (name "coreutils")
465 (version "9.1")
466 (source (origin
467 (method url-fetch)
468 (uri (string-append "mirror://gnu/coreutils/coreutils-"
469 version ".tar.xz"))
470 (sha256
471 (base32
472 "08q4b0w7mwfxbqjs712l6wrwl2ijs7k50kssgbryg9wbsw8g98b1"))))
473 (build-system gnu-build-system)
474 (inputs `(,acl ;TODO: add SELinux
475 ,attr ;for xattrs in ls, mv, etc
476 ,gmp ;bignums in 'expr', yay!
477
478 ;; Do not use libcap when cross-compiling since it's not quite
479 ;; cross-compilable; and use it only for supported systems.
480 ,@(if (and (not (%current-target-system))
481 (member (%current-system)
482 (package-supported-systems libcap)))
483 `(,libcap) ;capability support in 'ls', etc.
484 '())))
485 (native-inputs
486 ;; Perl is needed to run tests in native builds, and to run the bundled
487 ;; copy of help2man. However, don't pass it when cross-compiling since
488 ;; that would lead it to try to run programs to get their '--help' output
489 ;; for help2man.
490 (if (%current-target-system)
491 '()
492 (list perl)))
493 (outputs '("out" "debug"))
494 (arguments
495 `(#:parallel-build? #f ; help2man may be called too early
496 ,@(if (system-hurd?)
497 '(#:make-flags ; these tests fail deterministically
498 (list (string-append "XFAIL_TESTS="
499 ;; Gnulib tests.
500 " test-fdutimensat"
501 " test-futimens"
502 " test-linkat"
503 " test-renameat"
504 " test-renameatu"
505 " test-utimensat")))
506 '())
507 #:phases (modify-phases %standard-phases
508 (add-before 'build 'patch-shell-references
509 (lambda _
510 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
511 ;; that tests pass, since /bin/sh isn't in the chroot.
512 (setenv "SHELL" (which "sh"))
513
514 (substitute* (find-files "gnulib-tests" "\\.c$")
515 (("/bin/sh") (which "sh")))
516 (substitute* (find-files "tests" "\\.sh$")
517 (("#!/bin/sh") (string-append "#!" (which "sh"))))))
518 (add-after 'unpack 'remove-tests
519 (lambda _
520 ,@(if (system-hurd?)
521 '((substitute*
522 ;; These tests hang
523 '("tests/cp/sparse-to-pipe.sh"
524 "tests/split/fail.sh"
525 ;; These tests error
526 "tests/dd/nocache.sh"
527 ;; These tests fail
528 "tests/cp/parent-perm-race.sh"
529 "tests/cp/sparse.sh"
530 "tests/cp/special-f.sh"
531 "tests/dd/bytes.sh"
532 "tests/dd/stats.sh"
533 "tests/ls/dangle.sh"
534 "tests/ls/follow-slink.sh"
535 "tests/ls/hyperlink.sh"
536 "tests/ls/infloop.sh"
537 "tests/ls/inode.sh"
538 "tests/ls/selinux-segfault.sh"
539 "tests/misc/env-S.pl"
540 "tests/misc/factor-parallel.sh"
541 "tests/misc/ls-misc.pl"
542 "tests/misc/nice.sh"
543 "tests/misc/pwd-long.sh"
544 "tests/misc/shred-passes.sh"
545 "tests/misc/stat-slash.sh"
546 "tests/rm/fail-eperm.xpl"
547 "tests/split/filter.sh")
548 (("^#!.*" all)
549 (string-append all "exit 77;\n")))
550 (substitute* "gnulib-tests/Makefile.in"
551 ;; This test sometimes fails and sometimes
552 ;; passes, but it does this consistently, so
553 ;; there might be some environmental factor
554 ;; here
555 ((" test-tls\\$\\(EXEEXT\\) ") " ")))
556 '())
557 ,@(if (system-hurd64?)
558 '((substitute*
559 ;; These tests fail
560 '("tests/misc/sort-NaN-infloop.sh")
561 (("^#!.*" all)
562 (string-append all "exit 77;\n"))))
563 '())
564 ;; These tests can fail on btrfs.
565 (substitute* "tests/cp/reflink-auto.sh"
566 (("^#!.*" all)
567 (string-append all "exit 77;\n")))
568 (substitute* "Makefile.in"
569 ;; fails on filesystems where inotify cannot be used,
570 ;; more info in #47935
571 (("^ *tests/tail-2/inotify-dir-recreate.sh.*") "")))))))
572 (synopsis "Core GNU utilities (file, text, shell)")
573 (description
574 "GNU Coreutils package includes all of the basic command-line tools that
575are expected in a POSIX system, excluding shell. This package is the union of
576the GNU fileutils, sh-utils, and textutils packages. Most of these tools
577offer extended functionality beyond that which is outlined in the POSIX
578standard.")
579 (license gpl3+)
580 (home-page "https://www.gnu.org/software/coreutils/")))
581
582(define-public coreutils-minimal
583 ;; Coreutils without its optional dependencies.
584 (package
585 (inherit coreutils)
586 (name "coreutils-minimal")
587 (outputs '("out"))
588 (native-inputs '())
589 (inputs '())))
590
591(define-public coreutils-8.30
592 ;; XXX: This version is kept just so we can run PRoot tests.
593 (hidden-package
594 (package
595 (inherit coreutils-minimal)
596 (version "8.30")
597 (source (origin
598 (method url-fetch)
599 (uri (string-append "mirror://gnu/coreutils/coreutils-"
600 version ".tar.xz"))
601 (sha256
602 (base32
603 "0mxhw43d4wpqmvg0l4znk1vm10fy92biyh90lzdnqjcic2lb6cg8"))))
604 (arguments
605 (substitute-keyword-arguments arguments
606 ((#:phases phases '%standard-phases)
607 `(modify-phases ,phases
608 (add-before 'check 'disable-broken-test
609 (lambda _
610 ;; This test hits the 127 character shebang limit in the build
611 ;; environment due to the way "env -S" splits arguments into
612 ;; shebangs. Note that "env-S-script.sh" works around this
613 ;; specific issue, but "env-S.pl" is not adjusted for build
614 ;; environments with long prefixes (/tmp/guix-build-...).
615 (substitute* "Makefile"
616 (("^.*tests/misc/env-S.pl.*$") "")))))))))))
617
618(define-public gnu-make
619 (package
620 (name "make")
621 (version "4.4.1")
622 (source (origin
623 (method url-fetch)
624 (uri (string-append "mirror://gnu/make/make-" version
625 ".tar.gz"))
626 (sha256
627 (base32
628 "1cwgcmwdn7gqn5da2ia91gkyiqs9birr10sy5ykpkaxzcwfzn5nx"))
629 (patches (search-patches "make-impure-dirs.patch"))))
630 (build-system gnu-build-system)
631 (native-inputs (list pkg-config)) ;to detect Guile
632 (inputs (list guile-3.0))
633 (outputs '("out" "debug"))
634 (arguments
635 `(,@(if (target-hurd?)
636 '(#:configure-flags '("CFLAGS=-D__alloca=alloca"
637 "ac_cv_func_posix_spawn=no"))
638 '())
639 #:phases
640 (modify-phases %standard-phases
641 (add-before 'build 'set-default-shell
642 (lambda* (#:key inputs #:allow-other-keys)
643 ;; Change the default shell from /bin/sh.
644 (let ((bash (assoc-ref inputs "bash")))
645 (substitute* "src/job.c"
646 (("default_shell =.*$")
647 (format #f "default_shell = \"~a/bin/sh\";\n"
648 bash)))))))))
649 (synopsis "Remake files automatically")
650 (description
651 "Make is a program that is used to control the production of
652executables or other files from their source files. The process is
653controlled from a Makefile, in which the developer specifies how each file is
654generated from its source. It has powerful dependency resolution and the
655ability to determine when files have to be regenerated after their sources
656change. GNU make offers many powerful extensions over the standard utility.")
657 (license gpl3+)
658 (home-page "https://www.gnu.org/software/make/")))
659
660(define-public gnu-make-4.2
661 (package
662 (inherit gnu-make)
663 (version "4.2.1")
664 (source (origin
665 (method url-fetch)
666 (uri (string-append "mirror://gnu/make/make-" version
667 ".tar.bz2"))
668 (sha256
669 (base32
670 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))))
671 (arguments
672 `(#:configure-flags '("CFLAGS=-D__alloca=alloca -D__stat=stat")
673 #:phases
674 (modify-phases %standard-phases
675 (add-before 'build 'set-default-shell
676 (lambda* (#:key inputs #:allow-other-keys)
677 ;; Change the default shell from /bin/sh.
678 (let ((bash (assoc-ref inputs "bash")))
679 (substitute* "job.c"
680 (("default_shell =.*$")
681 (format #f "default_shell = \"~a/bin/sh\";\n"
682 bash)))))))))))
683
684(define-public binutils
685 (package
686 (name "binutils")
687 (version "2.44")
688 (source
689 (origin
690 (method url-fetch)
691 (uri (string-append "mirror://gnu/binutils/binutils-"
692 version ".tar.bz2"))
693 (sha256
694 (base32 "0fnwaasfglbphqzvz5n25js9gl695p7pjbmb1z81g8gsc6k90qzn"))
695 (patches (search-patches
696 "binutils-2.41-fix-cross.patch"
697 "binutils-loongson-workaround.patch"))))
698 (build-system gnu-build-system)
699 (arguments
700 (list #:out-of-source? #t ;recommended in the README
701 #:configure-flags #~'(;; Add `-static-libgcc' to not retain a dependency
702 ;; on GCC when bootstrapping.
703 "LDFLAGS=-static-libgcc"
704
705 ;; Turn on --enable-new-dtags by default to make the
706 ;; linker set RUNPATH instead of RPATH on binaries.
707 ;; This is important because RUNPATH can be overriden
708 ;; using LD_LIBRARY_PATH at runtime.
709 "--enable-new-dtags"
710
711 ;; Don't search under /usr/lib & co.
712 "--with-lib-path=/no-ld-lib-path"
713
714 ;; Install BFD. It ends up in a hidden directory,
715 ;; but it's here.
716 "--enable-install-libbfd"
717
718 ;; Make sure 'ar' and 'ranlib' produce archives in a
719 ;; deterministic fashion.
720 "--enable-deterministic-archives"
721
722 "--enable-64-bit-bfd"
723 "--enable-compressed-debug-sections=all"
724 "--enable-lto"
725 "--enable-separate-code"
726 "--enable-threads")
727
728 ;; For some reason, the build machinery insists on rebuilding .info
729 ;; files, even though they're already provided by the tarball.
730 #:make-flags #~'("MAKEINFO=true")))
731 (native-inputs (list bison)) ;needed to build 'gprofng'
732 (synopsis "Binary utilities: bfd gas gprof ld")
733 (description
734 "GNU Binutils is a collection of tools for working with binary files.
735Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
736Other tools include programs to display binary profiling information, list
737the strings in a binary file, and utilities for working with archives. The
738\"bfd\" library for working with executable and object formats is also
739included.")
740 (license gpl3+)
741 (home-page "https://www.gnu.org/software/binutils/")))
742
743;; FIXME: ath9k-firmware-htc-binutils.patch do not apply on 2.34 because of a
744;; big refactoring of xtensa-modules.c (commit 567607c11fbf7105 upstream).
745;; Keep this version around until the patch is updated.
746(define-public binutils-2.33
747 (package
748 (inherit binutils)
749 (version "2.33.1")
750 (source (origin
751 (inherit (package-source binutils))
752 (uri (string-append "mirror://gnu/binutils/binutils-"
753 version ".tar.bz2"))
754 (sha256
755 (base32
756 "1cmd0riv37bqy9mwbg6n3523qgr8b3bbm5kwj19sjrasl4yq9d0c"))
757 (patches '())))
758 (arguments
759 (substitute-keyword-arguments arguments
760 ((#:make-flags _ #~'()) #~'())))
761 (native-inputs '())
762 (properties '())))
763
764(define-public binutils-gold
765 (package
766 (inherit binutils)
767 (name "binutils-gold")
768 (version "2.44")
769 (source
770 (origin
771 (inherit (package-source binutils))
772 (uri (string-append "mirror://gnu/binutils/binutils-with-gold-"
773 version ".tar.bz2"))
774 (sha256
775 (base32 "1j64m2czn9ygd5g1cjjcw7q43b18xh6qkrdl1pkm03ncjnj3wwrl"))))
776 (arguments
777 (substitute-keyword-arguments arguments
778 ((#:configure-flags flags)
779 #~(cons* "--enable-gold=default"
780 (delete "LDFLAGS=-static-libgcc" #$flags)))
781 ((#:phases phases '%standard-phases)
782 #~(modify-phases #$phases
783 (add-after 'patch-source-shebangs 'patch-more-shebangs
784 (lambda _
785 (substitute* "gold/Makefile.in"
786 (("/bin/sh") (which "sh")))))
787 ;; Multiple failing tests on some architectures in the gold testsuite.
788 #$@(if (or (target-arm?)
789 (target-ppc32?))
790 #~((add-after 'unpack 'skip-gold-testsuite
791 (lambda _
792 (substitute* "gold/Makefile.in"
793 ((" testsuite") " ")))))
794 #~())))))
795 (native-inputs (modify-inputs native-inputs
796 (append bc)))))
797
798(define-public libbfd
799 (package/inherit binutils
800 (name "libbfd")
801 (inputs
802 (modify-inputs (package-native-inputs binutils)
803 (append texinfo))) ; because makeinfo is needed when building bfd alone
804 (arguments
805 (substitute-keyword-arguments arguments
806 ;; Only build as a shared library
807 ((#:configure-flags flags)
808 #~(append #$flags '("--enable-shared" "--disable-static")))
809 ;; Only build and install bfd
810 ((#:phases phases #~%standard-phases)
811 #~(modify-phases #$phases
812 (replace 'build
813 (lambda _
814 (invoke "make" "-j" (number->string (parallel-job-count))
815 "all-bfd")))
816 (replace 'check
817 (lambda _
818 (invoke "make" "check-bfd"
819 "-j" (number->string (parallel-job-count))
820 "MAKEINFO=true")))
821 (replace 'install
822 (lambda _ (invoke "make" "install-bfd")))))))
823 (synopsis "GNU BFD library for operating on object files")
824 (description "This package provides a standalone shared library version of
825BFD, which is otherwise distributed and installed as part of the Binutils
826package release.")))
827
828(define* (make-ld-wrapper name #:key
829 (target (const #f))
830 binutils
831 (linker "ld")
832 (guile (canonical-package guile-3.0))
833 (bash (canonical-package bash))
834 (guile-for-build guile))
835 "Return a package called NAME that contains a wrapper for the 'ld' program
836of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
837wrapper uses GUILE and BASH.
838
839TARGET must be a one-argument procedure that, given a system type, returns a
840cross-compilation target triplet or #f. When the result is not #f, make a
841wrapper for the cross-linker for that target, called 'TARGET-ld'. To use a
842different linker than the default \"ld\", such as \"ld.gold\" the linker name
843can be provided via the LINKER argument."
844 ;; Note: #:system->target-triplet is a procedure so that the evaluation of
845 ;; its result can be delayed until the 'arguments' field is evaluated, thus
846 ;; in a context where '%current-system' is accurate.
847 (package
848 (name name)
849 (version "0")
850 (source #f)
851 (build-system trivial-build-system)
852 (inputs `(("binutils" ,binutils)
853 ("guile" ,guile)
854 ("bash" ,bash)
855 ("wrapper" ,(search-path %load-path
856 "gnu/packages/ld-wrapper.in"))))
857 (arguments
858 (let ((target (target (%current-system))))
859 `(#:guile ,guile-for-build
860 #:modules ((guix build utils))
861 #:builder (begin
862 (use-modules (guix build utils)
863 (system base compile))
864
865 (let* ((out (assoc-ref %outputs "out"))
866 (bin (string-append out "/bin"))
867 (ld ,(if target
868 `(string-append bin "/" ,target "-"
869 ,linker)
870 `(string-append bin "/" ,linker)))
871 (go (string-append ld ".go")))
872
873 (setvbuf (current-output-port)
874 (cond-expand (guile-2.0 _IOLBF)
875 (else 'line)))
876 (format #t "building ~s/bin/ld wrapper in ~s~%"
877 (assoc-ref %build-inputs "binutils")
878 out)
879
880 (mkdir-p bin)
881 (copy-file (assoc-ref %build-inputs "wrapper") ld)
882 (substitute* ld
883 (("@SELF@")
884 ld)
885 (("@GUILE@")
886 (string-append (assoc-ref %build-inputs "guile")
887 "/bin/guile"))
888 (("@BASH@")
889 (string-append (assoc-ref %build-inputs "bash")
890 "/bin/bash"))
891 (("@LD@")
892 (string-append (assoc-ref %build-inputs "binutils")
893 ,(if target
894 (string-append "/bin/"
895 target "-" linker)
896 (string-append "/bin/" linker)))))
897 (chmod ld #o555)
898 (compile-file ld #:output-file go))))))
899 (synopsis "The linker wrapper")
900 (description
901 "The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any
902missing @code{-rpath} flags, and to detect any misuse of libraries outside of
903the store.")
904 (home-page "https://www.gnu.org/software/guix//")
905 (license gpl3+)))
906
907(define %glibc-patches
908 (list "glibc-ldd-powerpc.patch"
909 "glibc-2.41-ldd-x86_64.patch"
910 "glibc-2.40-dl-cache.patch"
911 "glibc-2.37-versioned-locpath.patch"
912 ;; "glibc-allow-kernel-2.6.32.patch"
913 "glibc-guix-locpath.patch"
914 "glibc-reinstate-prlimit64-fallback.patch"
915 "glibc-supported-locales.patch"
916 "glibc-2.37-hurd-clock_t_centiseconds.patch"
917 "glibc-2.41-hurd-local-clock_gettime_MONOTONIC.patch"
918 "glibc-hurd-mach-print.patch"
919 "glibc-hurd-gettyent.patch"
920 "glibc-hurd-getauxval.patch"
921 "glibc-hurd-pthread_setcancelstate.patch"
922 "glibc-hurd-signal-fpe-exception.patch"
923 "glibc-hurd-xstate.patch"
924 "glibc-hurd-2.41-pthread-once.patch"
925 "glibc-hurd-2.41-pthread-sigmask.patch"
926 "glibc-hurd-2.41-symlink.patch"
927 "glibc-hurd64-gcc-14.2-tls-bug.patch"))
928
929(define-public glibc
930 ;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to
931 ;; version 2.28, GNU/Hurd used a different glibc branch.
932 (package
933 (name "glibc")
934 (version "2.41")
935 (source (origin
936 (method url-fetch)
937 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
938 (sha256
939 (base32
940 "00g95047sshv0zxk9ja3mi7lzwi8wh8qx0nxngbvgmj5yli6p8m5"))
941 (patches (map search-patch %glibc-patches))))
942 (properties `((lint-hidden-cve . ("CVE-2024-2961"
943 "CVE-2024-33601" "CVE-2024-33602"
944 "CVE-2024-33600" "CVE-2024-33599"))))
945 (build-system gnu-build-system)
946
947 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
948 ;; users should automatically pull Linux headers as well. On GNU/Hurd,
949 ;; libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
950 ;; so both should be propagated.
951 (propagated-inputs
952 (if (target-hurd?)
953 `(("hurd-core-headers" ,hurd-core-headers))
954 `(("kernel-headers" ,linux-libre-headers))))
955
956 (outputs '("out" "debug"
957 "static")) ;9 MiB of .a files
958
959 (arguments
960 `(#:out-of-source? #t
961
962 ;; The libraries have an empty RUNPATH, but some, such as the versioned
963 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
964 ;; these libraries are always going to be found anyway, just skip
965 ;; RUNPATH checks.
966 #:validate-runpath? #f
967
968 #:modules ((ice-9 ftw)
969 (srfi srfi-1)
970 (srfi srfi-26)
971 (guix build utils)
972 (guix build gnu-build-system))
973
974 ;; Strip binaries but preserve the symbol table needed by Valgrind:
975 ;; <https://lists.gnu.org/archive/html/help-guix/2022-03/msg00036.html>.
976 #:strip-flags '("--strip-debug")
977
978 #:configure-flags
979 (list "--sysconfdir=/etc"
980
981 ;; Installing a locale archive with all the locales is to
982 ;; expensive (~100 MiB), so we rely on users to install the
983 ;; locales they really want.
984 ;;
985 ;; Set the default locale path. In practice, $LOCPATH may be
986 ;; defined to point whatever locales users want. However, setuid
987 ;; binaries don't honor $LOCPATH, so they'll instead look into
988 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
989 ;; with the idea that it is going to be populated by the sysadmin.
990 ;; The "X.Y" sub-directory is because locale data formats are
991 ;; incompatible across libc versions; see
992 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
993 ;;
994 ;; `--localedir' is not honored, so work around it.
995 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
996 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
997 ,(version-major+minor version))
998
999 (string-append "--with-headers="
1000 (assoc-ref ,(if (%current-target-system)
1001 '%build-target-inputs
1002 '%build-inputs)
1003 "kernel-headers")
1004 "/include")
1005
1006 ;; This is the default for most architectures as of GNU libc 2.26,
1007 ;; but we specify it explicitly for clarity and consistency. See
1008 ;; "kernel-features.h" in the GNU libc for details.
1009 "--enable-kernel=3.2.0"
1010
1011 ;; Use our Bash instead of /bin/sh.
1012 (string-append "BASH_SHELL="
1013 (assoc-ref %build-inputs "bash")
1014 "/bin/bash")
1015
1016 ;; On GNU/Hurd we get discarded-qualifiers warnings for
1017 ;; 'device_write_inband' among other things. Ignore them.
1018 ,@(if (target-hurd?)
1019 `("--disable-werror")
1020 '()))
1021
1022 #:tests? #f ; XXX
1023 #:phases (modify-phases %standard-phases
1024 (add-before
1025 'configure 'pre-configure
1026 (lambda* (#:key inputs native-inputs outputs
1027 #:allow-other-keys)
1028 (let* ((out (assoc-ref outputs "out"))
1029 (bin (string-append out "/bin"))
1030 ;; FIXME: Normally we would look it up only in INPUTS
1031 ;; but cross-base uses it as a native input.
1032 (bash (or (assoc-ref inputs "static-bash")
1033 (assoc-ref native-inputs "static-bash"))))
1034 ;; Install the rpc data base file under `$out/etc/rpc'.
1035 (substitute* "inet/Makefile"
1036 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
1037 (string-append out "/etc/rpc" suffix "\n"))
1038 (("^install-others =.*$")
1039 (string-append "install-others = " out "/etc/rpc\n")))
1040
1041 (substitute* "Makeconfig"
1042 ;; According to
1043 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
1044 ;; linking against libgcc_s is not needed with GCC
1045 ;; 4.7.1.
1046 ((" -lgcc_s") ""))
1047
1048 ;; Tell the ld.so cache code where the store is.
1049 (substitute* "elf/dl-cache.c"
1050 (("@STORE_DIRECTORY@")
1051 (string-append "\"" (%store-directory) "\"")))
1052
1053 ;; Have `system' use that Bash.
1054 (substitute* "sysdeps/posix/system.c"
1055 (("#define[[:blank:]]+SHELL_PATH.*$")
1056 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
1057 bash)))
1058
1059 ;; Same for `popen'.
1060 (substitute* "libio/iopopen.c"
1061 (("/bin/sh")
1062 (string-append bash "/bin/sh")))
1063
1064 ;; Same for the shell used by the 'exec' functions for
1065 ;; scripts that lack a shebang.
1066 (substitute* (find-files "." "^paths\\.h$")
1067 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
1068 (string-append "#define _PATH_BSHELL \""
1069 bash "/bin/sh\"\n")))
1070
1071 ;; Make sure we don't retain a reference to the
1072 ;; bootstrap Perl.
1073 (substitute* "malloc/mtrace.pl"
1074 (("^#!.*")
1075 ;; The shebang can be omitted, because there's the
1076 ;; "bilingual" eval/exec magic at the top of the file.
1077 "")
1078 (("exec @PERL@")
1079 "exec perl")))))
1080
1081 (add-after 'install 'move-static-libs
1082 (lambda* (#:key outputs #:allow-other-keys)
1083 ;; Move static libraries to the "static" output.
1084 ;; Note: As of GNU libc 2.34, the contents of some ".a"
1085 ;; files have been moved into "libc.so", and *both* empty
1086 ;; ".so" and ".a" files have been introduced to avoid
1087 ;; breaking existing executables and existing builds
1088 ;; respectively. The intent of the seemingly redundant
1089 ;; empty ".a" files is to avoid newly-compiled executables
1090 ;; from having dependencies on the empty shared libraries,
1091 ;; and as such, it is useful to have these ".a" files in
1092 ;; OUT in addition to STATIC.
1093
1094 (define (empty-static-library? file)
1095 ;; Return true if FILE is an 'ar' archive with nothing
1096 ;; beyond the header.
1097 (let ((file (string-append (assoc-ref outputs "out")
1098 "/lib/" file)))
1099 (and (ar-file? file)
1100 (= (stat:size (stat file)) 8))))
1101
1102 (define (static-library? file)
1103 ;; Return true if FILE is a static library. The
1104 ;; "_nonshared.a" files are referred to by libc.so,
1105 ;; libpthread.so, etc., which are in fact linker
1106 ;; scripts.
1107 (and (string-suffix? ".a" file)
1108 (not (string-contains file "_nonshared"))
1109 (not (empty-static-library? file))))
1110
1111 (define (linker-script? file)
1112 ;; Guess whether FILE, a ".a" file, is actually a
1113 ;; linker script.
1114 (and (not (ar-file? file))
1115 (not (elf-file? file))))
1116
1117 (let* ((out (assoc-ref outputs "out"))
1118 (lib (string-append out "/lib"))
1119 (files (scandir lib static-library?))
1120 (empty (scandir lib empty-static-library?))
1121 (static (assoc-ref outputs "static"))
1122 (slib (string-append static "/lib")))
1123 (mkdir-p slib)
1124 (for-each (lambda (base)
1125 (rename-file (string-append lib "/" base)
1126 (string-append slib "/" base)))
1127 files)
1128 (for-each (lambda (base)
1129 (copy-file (string-append lib "/" base)
1130 (string-append slib "/" base)))
1131 empty)
1132
1133 ;; Usually libm.a is a linker script so we need to
1134 ;; change the file names in there to refer to STATIC
1135 ;; instead of OUT.
1136 (for-each (lambda (ld-script)
1137 (substitute* ld-script
1138 ((out) static)))
1139 (filter linker-script?
1140 (map (cut string-append slib "/" <>)
1141 files))))))
1142
1143 (add-after 'install 'install-utf8-c-locale
1144 (lambda* (#:key outputs #:allow-other-keys)
1145 ;; Install the C.UTF-8 locale so there's always a UTF-8
1146 ;; locale around.
1147 (let* ((out (assoc-ref outputs "out"))
1148 (bin (string-append out "/bin"))
1149 (locale (string-append out "/lib/locale/"
1150 ,(package-version
1151 this-package))))
1152 (mkdir-p locale)
1153
1154 ;; FIXME: When cross-compiling, attempt to use
1155 ;; 'localedef' from the same libc version.
1156 (invoke ,(if (%current-target-system)
1157 "true"
1158 '(string-append bin "/localedef"))
1159 "--no-archive" "--prefix" locale
1160 "-i" "C" "-f" "UTF-8"
1161 (string-append locale "/C.UTF-8")))))
1162
1163 ,@(if (target-hurd?)
1164 `((add-after 'install 'augment-libc.so
1165 (lambda* (#:key outputs #:allow-other-keys)
1166 (let ((out (assoc-ref outputs "out")))
1167 (substitute* (string-append out "/lib/libc.so")
1168 (("/[^ ]+/lib/libc.so.0.3")
1169 (string-append out "/lib/libc.so.0.3"
1170 " libmachuser.so libhurduser.so"))))))
1171 (add-after 'install 'create-machine-symlink
1172 (lambda* (#:key outputs #:allow-other-keys)
1173 (let* ((out (assoc-ref outputs "out"))
1174 (cpu ,(match (or (%current-target-system)
1175 (%current-system))
1176 ((? target-x86-32?)
1177 "i386")
1178 ((? target-x86-64?)
1179 "x86_64")))
1180 (machine (string-append
1181 out "/include/mach/machine")))
1182 (unless (file-exists? machine)
1183 (symlink cpu machine))))))
1184 '()))))
1185
1186 (inputs `(("static-bash" ,static-bash)))
1187
1188 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
1189 ;; install the message catalogs, with 'msgfmt'.
1190 (native-inputs `(("texinfo" ,texinfo)
1191 ("perl" ,perl)
1192 ("bison" ,bison)
1193 ("gettext" ,gettext-minimal)
1194 ("python" ,python-minimal)
1195
1196 ,@(if (target-hurd?)
1197 `(("mig" ,mig)
1198 ("perl" ,perl))
1199 '())))
1200
1201 (native-search-paths
1202 ;; Search path for packages that provide locale data. This is useful
1203 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
1204 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
1205 ;; distros.
1206 (list (search-path-specification
1207 (variable "GUIX_LOCPATH")
1208 (files '("lib/locale")))
1209 $TZDIR))
1210
1211 (synopsis "The GNU C Library")
1212 (description
1213 "Any Unix-like operating system needs a C library: the library which
1214defines the \"system calls\" and other basic facilities such as open, malloc,
1215printf, exit...
1216
1217The GNU C library is used as the C library in the GNU system and most systems
1218with the Linux kernel.")
1219 (license lgpl2.0+)
1220 (home-page "https://www.gnu.org/software/libc/")))
1221
1222;; Define a variation of glibc which uses the default /etc/ld.so.cache, useful
1223;; in FHS containers.
1224(define-public glibc-for-fhs
1225 (hidden-package
1226 (package/inherit glibc
1227 (name "glibc-for-fhs")
1228 (source (origin (inherit (package-source glibc))
1229 ;; Remove Guix's patch to read ld.so.cache from /gnu/store
1230 ;; directories, re-enabling the default /etc/ld.so.cache
1231 ;; behavior.
1232 (patches
1233 (delete (search-patch "glibc-2.40-dl-cache.patch")
1234 (origin-patches (package-source glibc)))))))))
1235
1236;; Below are old libc versions, which we use mostly to build locale data in
1237;; the old format (which the new libc cannot cope with.)
1238
1239(define-public glibc-2.39
1240 (package
1241 (inherit glibc)
1242 (version "2.39")
1243 (source (origin
1244 (method url-fetch)
1245 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
1246 (sha256
1247 (base32
1248 "09nrwb0ksbah9k35jchd28xxp2hidilqdgz7b8v5f30pz1yd8yzp"))
1249 (patches (search-patches "glibc-2.39-git-updates.patch"
1250 "glibc-ldd-powerpc.patch"
1251 "glibc-2.38-ldd-x86_64.patch"
1252 "glibc-dl-cache.patch"
1253 "glibc-2.37-versioned-locpath.patch"
1254 ;; "glibc-allow-kernel-2.6.32.patch"
1255 "glibc-reinstate-prlimit64-fallback.patch"
1256 "glibc-supported-locales.patch"
1257 "glibc-2.37-hurd-clock_t_centiseconds.patch"
1258 ;; "glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch"
1259 "glibc-hurd-mach-print.patch"
1260 "glibc-hurd-gettyent.patch"
1261 "glibc-hurd-getauxval.patch"))))))
1262
1263(define-public glibc-2.35
1264 (package
1265 (inherit glibc)
1266 (version "2.35")
1267 (source (origin
1268 (method url-fetch)
1269 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
1270 (sha256
1271 (base32
1272 "0bpm1kfi09dxl4c6aanc5c9951fmf6ckkzay60cx7k37dcpp68si"))
1273 (patches (search-patches "glibc-2.35-CVE-2023-4911.patch"
1274 "glibc-ldd-powerpc.patch"
1275 "glibc-ldd-x86_64.patch"
1276 "glibc-dl-cache.patch"
1277 "glibc-versioned-locpath.patch"
1278 "glibc-allow-kernel-2.6.32.patch"
1279 "glibc-reinstate-prlimit64-fallback.patch"
1280 "glibc-supported-locales.patch"
1281 "glibc-cross-objdump.patch"
1282 "glibc-cross-objcopy.patch" ;must come 2nd
1283 "glibc-hurd-clock_t_centiseconds.patch"
1284 "glibc-hurd-clock_gettime_monotonic.patch"
1285 "glibc-hurd-mach-print.patch"
1286 "glibc-hurd-gettyent.patch"))))
1287 (arguments
1288 (substitute-keyword-arguments arguments
1289 ((#:configure-flags flags #~'())
1290 #~(cons* "CFLAGS=-g -O2 -Wno-error=builtin-declaration-mismatch"
1291 "--enable-crypt"
1292 ;; We do not want to use the C++ compiler, because its
1293 ;; libstdc++ is linked against a newer glibc, and so relies
1294 ;; on those newer symbols. Pretend it doesn't link (the test
1295 ;; doesn't actually check that the compiler works with new
1296 ;; libstdc++ and older glibc).
1297 "libc_cv_cxx_link_ok=no"
1298 #$flags))
1299 ((#:phases phases)
1300 ;; The C.UTF-8 fails to build in glibc 2.35:
1301 ;; <https://sourceware.org/bugzilla/show_bug.cgi?id=28861>.
1302 ;; It is missing altogether in versions earlier than 2.35.
1303 `(modify-phases ,phases
1304 (delete 'install-utf8-c-locale)))))))
1305
1306(define-public glibc-2.33
1307 (package
1308 (inherit glibc)
1309 (name "glibc")
1310 (version "2.33")
1311 (source (origin
1312 (method url-fetch)
1313 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
1314 (sha256
1315 (base32
1316 "1zvp0qdfbdyqrzydz18d9zg3n5ygy8ps7cmny1bvsp8h1q05c99f"))
1317 (patches
1318 (cons (search-patch "glibc-2.33-riscv64-miscompilation.patch")
1319 ;; Remove patches that are irrelevant or do not apply to
1320 ;; this version.
1321 (remove
1322 (lambda (patch)
1323 (member (basename patch)
1324 '("glibc-2.35-CVE-2023-4911.patch"
1325 "glibc-hurd-clock_gettime_monotonic.patch")))
1326 (origin-patches (package-source glibc-2.35)))))))
1327 (arguments
1328 (substitute-keyword-arguments arguments
1329 ((#:configure-flags flags #~'())
1330 #~(cons* #$(string-append
1331 "CFLAGS=-g -O2"
1332 " -Wno-error=builtin-declaration-mismatch"
1333 " -Wno-error=format-overflow"
1334 " -Wno-error=stringop-overflow"
1335 " -Wno-error=use-after-free")
1336 "--enable-crypt"
1337 ;; We do not want to use the C++ compiler, because its
1338 ;; libstdc++ is linked against a newer glibc, and so relies
1339 ;; on those newer symbols. Pretend it doesn't link (the test
1340 ;; doesn't actually check that the compiler works with new
1341 ;; libstdc++ and older glibc).
1342 "libc_cv_cxx_link_ok=no"
1343 #$flags))
1344 ((#:phases phases)
1345 `(modify-phases ,phases
1346 ;; This phase fails trying to create /etc/ld.so.cache
1347 (delete 'install-utf8-c-locale)))))))
1348
1349(define-public (make-gcc-libc base-gcc libc)
1350 "Return a GCC that targets LIBC."
1351 (package (inherit base-gcc)
1352 (name (string-append (package-name base-gcc) "-"
1353 (package-name libc) "-"
1354 (package-version libc)))
1355 (arguments
1356 (ensure-keyword-arguments (package-arguments base-gcc)
1357 '(#:implicit-inputs? #f)))
1358 (native-inputs
1359 `(,@(package-native-inputs base-gcc)
1360 ,@(append (fold alist-delete (%final-inputs) '("libc" "libc:static")))
1361 ("libc" ,libc)
1362 ("libc:static" ,libc "static")))))
1363
1364(define-public (make-glibc-locales glibc)
1365 (package
1366 (inherit glibc)
1367 (name "glibc-locales")
1368 (source (origin (inherit (package-source glibc))
1369 (patches (cons (search-patch "glibc-locales.patch")
1370 (origin-patches (package-source glibc))))))
1371 (synopsis "All the locales supported by the GNU C Library")
1372 (description
1373 "This package provides all the locales supported by the GNU C Library,
1374more than 400 in total. To use them set the @code{LOCPATH} environment variable
1375to the @code{share/locale} sub-directory of this package.")
1376 (outputs '("out")) ;110+ MiB
1377 (native-search-paths '())
1378 (arguments
1379 (let ((args `(#:tests? #f #:strip-binaries? #f
1380 ,@(package-arguments glibc))))
1381 (substitute-keyword-arguments args
1382 ((#:modules modules '((guix build utils)
1383 (guix build gnu-build-system)))
1384 `((srfi srfi-11)
1385 (gnu build locale)
1386 ,@modules))
1387 ((#:imported-modules modules '())
1388 `((gnu build locale)
1389 ,@%default-gnu-imported-modules))
1390 ((#:phases phases)
1391 #~(modify-phases #$phases
1392 (replace 'build
1393 (lambda _
1394 (invoke "make" "localedata/install-locales"
1395 "-j" (number->string (parallel-job-count)))))
1396 (add-after 'build 'symlink-normalized-codesets
1397 (lambda* (#:key outputs #:allow-other-keys)
1398 ;; The above phase does not install locales with names using
1399 ;; the "normalized codeset." Thus, create symlinks like:
1400 ;; en_US.utf8 -> en_US.UTF-8
1401 (define (locale-directory? file stat)
1402 (and (file-is-directory? file)
1403 (string-index (basename file) #\_)
1404 (string-rindex (basename file) #\.)))
1405
1406 (let* ((locales (find-files #$output locale-directory?
1407 #:directories? #t)))
1408 (for-each (lambda (directory)
1409 (let*-values (((base)
1410 (basename directory))
1411 ((name codeset)
1412 (locale->name+codeset base))
1413 ((normalized)
1414 (normalize-codeset codeset)))
1415 (unless (string=? codeset normalized)
1416 (symlink base
1417 (string-append (dirname directory)
1418 "/" name "."
1419 normalized)))))
1420 locales))))
1421 #$@(if (target-hurd?)
1422 #~((delete 'augment-libc.so)
1423 (delete 'create-machine-symlink))
1424 #~())
1425 (delete 'install)
1426 (delete 'install-utf8-c-locale)
1427 (delete 'move-static-libs)))
1428 ((#:configure-flags flags)
1429 #~(append #$flags
1430 ;; Use $(libdir)/locale/X.Y as is the case by default.
1431 (list (string-append "libc_cv_complocaledir="
1432 #$output
1433 "/lib/locale/"
1434 #$(version-major+minor
1435 (package-version glibc)))))))))
1436 (properties `((upstream-name . "glibc")))))
1437
1438(define %default-utf8-locales
1439 ;; These are the locales commonly used for tests---e.g., in Guile's i18n
1440 ;; tests.
1441 '("C" "de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
1442
1443(define*-public (make-glibc-utf8-locales glibc #:key
1444 (locales %default-utf8-locales)
1445 (name "glibc-utf8-locales"))
1446 (define default-locales?
1447 (equal? locales %default-utf8-locales))
1448
1449 (package
1450 (name name)
1451 (version (package-version glibc))
1452 (source #f)
1453 (build-system trivial-build-system)
1454 (arguments
1455 (list #:modules '((guix build utils))
1456 #:builder
1457 #~(begin
1458 (use-modules (guix build utils))
1459
1460 (let* ((libc (dirname
1461 (search-input-file %build-inputs
1462 "/bin/localedef")))
1463 (gzip (dirname
1464 (search-input-file %build-inputs
1465 "/bin/gzip")))
1466 (out #$output)
1467 (localedir (string-append out "/lib/locale/"
1468 #$(version-major+minor
1469 (package-version this-package)))))
1470 ;; 'localedef' needs 'gzip'.
1471 (setenv "PATH" (string-append libc ":" gzip ""))
1472
1473 (mkdir-p localedir)
1474 (for-each (lambda (locale)
1475 (define file
1476 ;; Use the "normalized codeset" by
1477 ;; default--e.g., "en_US.utf8".
1478 (string-append localedir "/" locale ".utf8"))
1479
1480 (invoke "localedef" "--no-archive"
1481 "--prefix" localedir
1482 "-i" locale
1483 "-f" "UTF-8" file)
1484
1485 ;; For backward compatibility with Guix
1486 ;; <= 0.8.3, add "xx_YY.UTF-8".
1487 (symlink (string-append locale ".utf8")
1488 (string-append localedir "/"
1489 locale ".UTF-8")))
1490
1491 ;; The C.UTF-8 locale was introduced in 2.35 but it
1492 ;; fails to build there:
1493 ;; <https://sourceware.org/bugzilla/show_bug.cgi?id=28861>.
1494 '#$(if (version>? (package-version this-package)
1495 "2.35")
1496 locales
1497 (delete "C" locales)))))))
1498 (native-inputs (list glibc gzip))
1499 (synopsis (if default-locales?
1500 (P_ "Small sample of UTF-8 locales")
1501 (P_ "Customized sample of UTF-8 locales")))
1502 (description
1503 (if default-locales?
1504 (P_ "This package provides a small sample of UTF-8 locales mostly useful in
1505test environments.")
1506 (format #f (P_ "This package provides the following UTF-8 locales:
1507@itemize
1508~{@item ~a~%~}
1509@end itemize~%")
1510 locales)))
1511 (home-page (package-home-page glibc))
1512 (license (package-license glibc))))
1513
1514(define-public glibc-locales
1515 (make-glibc-locales glibc))
1516(define-public glibc-utf8-locales
1517 (hidden-package
1518 (make-glibc-utf8-locales glibc)))
1519
1520;; Packages provided to ease use of binaries linked against the previous libc.
1521(define-public glibc-locales-2.35
1522 (package (inherit (make-glibc-locales glibc-2.35))
1523 (name "glibc-locales-2.35")))
1524(define-public glibc-locales-2.33
1525 (package (inherit (make-glibc-locales glibc-2.33))
1526 (name "glibc-locales-2.33")))
1527
1528(define-public which
1529 (package
1530 (name "which")
1531 (version "2.21")
1532 (source (origin
1533 (method url-fetch)
1534 (uri (string-append "mirror://gnu/which/which-"
1535 version ".tar.gz"))
1536 (sha256
1537 (base32
1538 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
1539 (build-system gnu-build-system)
1540 (home-page "https://gnu.org/software/which/")
1541 (synopsis "Find full path of shell commands")
1542 (description
1543 "The which program finds the location of executables in PATH, with a
1544variety of options. It is an alternative to the shell \"type\" built-in
1545command.")
1546 (license gpl3+))) ; some files are under GPLv2+
1547
1548(define-public glibc/hurd glibc)
1549
1550(define-public glibc/hurd-headers
1551 (package/inherit glibc/hurd
1552 (name "glibc-hurd-headers")
1553 (outputs '("out"))
1554 (propagated-inputs (list gnumach-headers hurd-headers))
1555 (native-inputs
1556 (modify-inputs (package-native-inputs glibc/hurd)
1557 (prepend (if (%current-target-system)
1558 (let* ((cross-base (resolve-interface '(gnu packages cross-base)))
1559 (cross-mig (module-ref cross-base 'cross-mig)))
1560 (cross-mig (%current-target-system)))
1561 mig))))
1562 (arguments
1563 (substitute-keyword-arguments (package-arguments glibc/hurd)
1564 ;; We just pass the flags really needed to build the headers.
1565 ((#:configure-flags flags)
1566 `(list "--enable-add-ons"))
1567 ((#:phases _)
1568 '(modify-phases %standard-phases
1569 (replace 'install
1570 (lambda* (#:key outputs #:allow-other-keys)
1571 (invoke "make" "install-headers")
1572
1573 ;; Make an empty stubs.h to work around not being able to
1574 ;; produce a valid stubs.h and causing the build to fail. See
1575 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
1576 (let ((out (assoc-ref outputs "out")))
1577 (close-port
1578 (open-output-file
1579 (string-append out "/include/gnu/stubs.h"))))))
1580 (delete 'build))))) ; nothing to build
1581 (supported-systems %hurd-systems)))
1582
1583(define-public glibc-utf8-locales/hurd
1584 ;; Locales for the libc version used on GNU/Hurd.
1585 (hidden-package
1586 (make-glibc-utf8-locales glibc/hurd)))
1587
1588(define* (libc-for-target #:optional
1589 (target (or (%current-target-system)
1590 (%current-system))))
1591 (match target
1592 ((? target-hurd?)
1593 glibc/hurd)
1594 (_
1595 glibc)))
1596
1597(define-public glibc-locales/hurd
1598 ;; Locales again; hide them because their 'supported-systems' field suggests
1599 ;; they're Hurd-only, making them non-installable on GNU/Linux.
1600 (hidden-package
1601 (make-glibc-locales glibc/hurd)))
1602
1603(define* (libc-locales-for-target #:optional
1604 (target (or (%current-target-system)
1605 (%current-system))))
1606 (if (target-hurd? target)
1607 glibc-locales/hurd
1608 glibc-locales))
1609
1610(define* (libc-utf8-locales-for-target #:optional
1611 (target (or (%current-target-system)
1612 (%current-system))))
1613 "Return the glibc UTF-8 locale package for TARGET."
1614 ;; Note: To avoid circular dependencies (such as: texinfo ->
1615 ;; glibc-utf8-locales -> glibc -> texinfo), refer to
1616 ;; 'glibc-utf8-locales-final' via 'canonical-package'.
1617 (canonical-package
1618 (if (target-hurd? target)
1619 glibc-utf8-locales/hurd
1620 glibc-utf8-locales)))
1621
1622(define-public tzdata
1623 (package
1624 (name "tzdata")
1625 ;; This package should be kept in sync with python-pytz and python-tzdata
1626 ;; in (gnu packages time).
1627 (version "2025a")
1628 (source (origin
1629 (method url-fetch)
1630 (uri (string-append
1631 "https://data.iana.org/time-zones/releases/tzdata"
1632 version ".tar.gz"))
1633 (sha256
1634 (base32
1635 "1l7hnlgc4wgy2gmaj5zmswpzbyq23h7vsndnw2zhwibw5k3wnpsd"))))
1636 (build-system gnu-build-system)
1637 (arguments
1638 (list #:tests? #f
1639
1640 ;; This consists purely of (architecture-independent) data, so
1641 ;; ‘cross-compilation’ is pointless here! (The binaries zic,
1642 ;; dump, and tzselect are deleted in the post-install phase.)
1643 #:target #f
1644
1645 #:make-flags
1646 #~(let ((out #$output)
1647 (tmp (getenv "TMPDIR")))
1648 (list (string-append "TOPDIR=" out)
1649 (string-append "TZDIR=" out "/share/zoneinfo")
1650 (string-append "TZDEFAULT=" out
1651 "/share/zoneinfo/localtime")
1652
1653 ;; Likewise for the C library routines.
1654 (string-append "LIBDIR=" tmp "/lib")
1655 (string-append "MANDIR=" tmp "/man")
1656
1657 ;; XXX: tzdata 2020b changed the on-disk format
1658 ;; of the time zone files from 'fat' to 'slim'.
1659 ;; Many packages (particularly evolution-data-server)
1660 ;; can not yet handle the latter, so we stick with
1661 ;; 'fat' for now.
1662 #$@(if (version>=? (package-version this-package)
1663 "2020b")
1664 '("CPPFLAGS=-DZIC_BLOAT_DEFAULT='\"fat\"'")
1665 '())
1666
1667 "AWK=awk"
1668 "CC=gcc"))
1669 #:modules '((guix build utils)
1670 (guix build gnu-build-system)
1671 (srfi srfi-1))
1672 #:phases
1673 #~(modify-phases %standard-phases
1674 (replace 'unpack
1675 (lambda* (#:key source inputs #:allow-other-keys)
1676 (invoke "tar" "xvf" source)
1677 (invoke "tar" "xvf"
1678 #$(match (package-inputs this-package)
1679 (((_ tzcode)) tzcode)))))
1680 (add-after 'install 'post-install
1681 (lambda* (#:key outputs #:allow-other-keys)
1682 ;; Move data in the right place.
1683 (let ((out (assoc-ref outputs "out")))
1684 ;; Discard zic, dump, and tzselect, already
1685 ;; provided by glibc.
1686 (delete-file-recursively (string-append out "/usr"))
1687 (symlink (string-append out "/share/zoneinfo")
1688 (string-append out "/share/zoneinfo/posix"))
1689 (delete-file-recursively
1690 (string-append out "/share/zoneinfo-posix"))
1691 (copy-recursively (string-append out "/share/zoneinfo-leaps")
1692 (string-append out "/share/zoneinfo/right"))
1693 (delete-file-recursively
1694 (string-append out "/share/zoneinfo-leaps")))))
1695 (delete 'configure))))
1696 (inputs (list (origin
1697 (method url-fetch)
1698 (uri (string-append
1699 "https://data.iana.org/time-zones/releases/tzcode"
1700 version ".tar.gz"))
1701 (sha256
1702 (base32
1703 "0qahpwp1zlyvi7qrlm4r74pmj3c7sx3jlg9xw2siwj3nkzapk5hi")))))
1704 (home-page "https://www.iana.org/time-zones")
1705 (synopsis "Database of current and historical time zones")
1706 (description "The Time Zone Database (often called tz or zoneinfo)
1707contains code and data that represent the history of local time for many
1708representative locations around the globe. It is updated periodically to
1709reflect changes made by political bodies to time zone boundaries, UTC offsets,
1710and daylight-saving rules.")
1711 (license public-domain)))
1712
1713;;; A "fixed" version of tzdata, which is used in the test suites of glib and R
1714;;; and a few other places. We can update this whenever we are able to rebuild
1715;;; thousands of packages (for example, in a core-updates rebuild). This package
1716;;; will typically be obsolete and should never be referred to by a built
1717;;; package.
1718;;;
1719;;; Please make this a hidden-package if it is different from the primary tzdata
1720;;; package.
1721(define-public tzdata-for-tests tzdata)
1722
1723;;; TODO: Move the 'install-leap-seconds' phase into the main package's
1724;;; 'post-install' phase on the next rebuild cycle.
1725(define-public tzdata/leap-seconds
1726 (hidden-package
1727 (package/inherit tzdata
1728 (arguments
1729 (substitute-keyword-arguments arguments
1730 ((#:phases phases)
1731 #~(modify-phases #$phases
1732 (add-after 'post-install 'install-leap-seconds
1733 (lambda _
1734 (install-file "leap-seconds.list"
1735 (string-append #$output "/share/zoneinfo")))))))))))
1736
1737(define-public libiconv
1738 (package
1739 (name "libiconv")
1740 (version "1.19")
1741 (source (origin
1742 (method url-fetch)
1743 (uri (string-append "mirror://gnu/libiconv/libiconv-"
1744 version ".tar.gz"))
1745 (sha256
1746 (base32
1747 "19lsl729bh2zwabp7ri1hgkqxk9irmhax4f79waclkj6q2l9dpc8"))
1748 (modules '((guix build utils)))
1749 (snippet
1750 ;; Work around "declared gets" error on glibc systems (fixed by
1751 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1752 '(substitute* "srclib/stdio.in.h"
1753 (("^#undef gets") "")
1754 (("^_GL_WARN_ON_USE \\(gets.*") "")))))
1755 (build-system gnu-build-system)
1756 (synopsis "Character set conversion library")
1757 (description
1758 "libiconv provides an implementation of the iconv function for systems
1759that lack it. iconv is used to convert between character encodings in a
1760program. It supports a wide variety of different encodings.")
1761 (home-page "https://www.gnu.org/software/libiconv/")
1762 (license lgpl3+)))
1763
1764(define* (libiconv-if-needed #:optional (target (%current-target-system)))
1765 "Return either a libiconv package specification to include in a dependency
1766list for platforms that have an incomplete libc, or the empty list. If a
1767package needs iconv ,@(libiconv-if-needed) should be added."
1768 ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
1769 ;; without iconv, such as MinGW, must return the then clause.
1770 (if (target-mingw? target)
1771 (list libiconv)
1772 '()))
1773
1774;;; Beware: canonical-package should not be used at the top level, to avoid
1775;;; eagerly resolving (gnu packages commencement), which would introduce
1776;;; circular module dependencies.
1777(define (canonical-package package)
1778 ;; Avoid circular dependency by lazily resolving 'commencement'.
1779 (let* ((iface (resolve-interface '(gnu packages commencement)))
1780 (proc (module-ref iface 'canonical-package)))
1781 (proc package)))
1782
1783;;; Beware: %final-inputs should not be used at the top level, to avoid
1784;;; eagerly resolving (gnu packages commencement), which would introduce
1785;;; circular module dependencies.
1786(define* (%final-inputs #:optional (system (%current-system)))
1787 "Return the list of \"final inputs\"."
1788 ;; Avoid circular dependency by lazily resolving 'commencement'.
1789 (let ((iface (resolve-interface '(gnu packages commencement))))
1790 ((module-ref iface '%final-inputs) system)))
1791
1792;;; base.scm ends here