Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
20bf5fce | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
722111ab | 3 | ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr> |
233e7676 | 4 | ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org> |
4e50f1f2 | 5 | ;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <mhw@netris.org> |
4c8425b7 | 6 | ;;; Copyright © 2014 Alex Kost <alezost@gmail.com> |
21a8fe1b | 7 | ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com> |
a55fbab7 | 8 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
7309045c | 9 | ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> |
ad3c9f18 | 10 | ;;; Copyright © 2016, 2018 Alex Vong <alexvong1995@gmail.com> |
b81d11e5 | 11 | ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org> |
da8e256a | 12 | ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> |
cd50b9f0 | 13 | ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com> |
acc2dab7 | 14 | ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org> |
c04e5116 | 15 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
b672a816 | 16 | ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> |
e3ce5d70 | 17 | ;;; |
233e7676 | 18 | ;;; This file is part of GNU Guix. |
e3ce5d70 | 19 | ;;; |
233e7676 | 20 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
e3ce5d70 LC |
21 | ;;; under the terms of the GNU General Public License as published by |
22 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
23 | ;;; your option) any later version. | |
24 | ;;; | |
233e7676 | 25 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
e3ce5d70 LC |
26 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
27 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 | ;;; GNU General Public License for more details. | |
29 | ;;; | |
30 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 31 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
e3ce5d70 | 32 | |
1ffa7090 | 33 | (define-module (gnu packages base) |
c6d7e299 | 34 | #:use-module ((guix licenses) |
7309045c | 35 | #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain)) |
59a43334 | 36 | #:use-module (gnu packages) |
1ffa7090 LC |
37 | #:use-module (gnu packages acl) |
38 | #:use-module (gnu packages bash) | |
5e8cb5e6 | 39 | #:use-module (gnu packages bison) |
b5ef82e0 | 40 | #:use-module (gnu packages ed) |
1ffa7090 LC |
41 | #:use-module (gnu packages guile) |
42 | #:use-module (gnu packages multiprecision) | |
c9505f3f | 43 | #:use-module (gnu packages compression) |
1ffa7090 LC |
44 | #:use-module (gnu packages perl) |
45 | #:use-module (gnu packages linux) | |
20bf5fce | 46 | #:use-module (gnu packages pcre) |
8fd6487e | 47 | #:use-module (gnu packages texinfo) |
21a8fe1b | 48 | #:use-module (gnu packages hurd) |
aa6b0d6b | 49 | #:use-module (gnu packages pkg-config) |
a635ed5c | 50 | #:use-module (gnu packages gettext) |
aee6180c | 51 | #:use-module (guix utils) |
e3ce5d70 | 52 | #:use-module (guix packages) |
87f5d366 | 53 | #:use-module (guix download) |
21a8fe1b | 54 | #:use-module (guix git-download) |
c9505f3f | 55 | #:use-module (guix build-system gnu) |
b09617da MR |
56 | #:use-module (guix build-system trivial) |
57 | #:use-module (ice-9 match) | |
4dab8c59 JN |
58 | #:export (glibc |
59 | libiconv-if-needed)) | |
e3ce5d70 LC |
60 | |
61 | ;;; Commentary: | |
62 | ;;; | |
1722d680 | 63 | ;;; Base packages of the Guix-based GNU user-land software distribution. |
e3ce5d70 LC |
64 | ;;; |
65 | ;;; Code: | |
66 | ||
67 | (define-public hello | |
68 | (package | |
17d8e33f ML |
69 | (name "hello") |
70 | (version "2.10") | |
71 | (source (origin | |
72 | (method url-fetch) | |
73 | (uri (string-append "mirror://gnu/hello/hello-" version | |
74 | ".tar.gz")) | |
75 | (sha256 | |
76 | (base32 | |
77 | "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) | |
78 | (build-system gnu-build-system) | |
79 | (synopsis "Hello, GNU world: An example GNU package") | |
80 | (description | |
81 | "GNU Hello prints the message \"Hello, world!\" and then exits. It | |
a22dc0c4 LC |
82 | serves as an example of standard GNU coding practices. As such, it supports |
83 | command-line arguments, multiple languages, and so on.") | |
6fd52309 | 84 | (home-page "https://www.gnu.org/software/hello/") |
17d8e33f | 85 | (license gpl3+))) |
d7672884 | 86 | |
6794b278 LC |
87 | (define-public grep |
88 | (package | |
89 | (name "grep") | |
63adf0fd | 90 | (version "3.1") |
6794b278 | 91 | (source (origin |
87f5d366 | 92 | (method url-fetch) |
0db342a5 | 93 | (uri (string-append "mirror://gnu/grep/grep-" |
6794b278 LC |
94 | version ".tar.xz")) |
95 | (sha256 | |
96 | (base32 | |
63adf0fd EF |
97 | "0zm0ywmyz9g8vn1plw14mn8kj74yipx5qsljndbyfgmvndx5qqnv")) |
98 | (patches (search-patches "grep-timing-sensitive-test.patch")))) | |
6794b278 | 99 | (build-system gnu-build-system) |
304e4f51 | 100 | (native-inputs `(("perl" ,perl))) ;some of the tests require it |
20bf5fce | 101 | (inputs `(("pcre" ,pcre))) |
1063d325 MW |
102 | (arguments |
103 | `(#:phases | |
104 | (modify-phases %standard-phases | |
8c8ded2c MB |
105 | (add-before 'check 'disable-failing-tests |
106 | (lambda _ | |
107 | ;; These tests are expected to fail due to a glibc bug which has | |
108 | ;; been fixed in 2.28, so they are unexpectedly passing. They | |
109 | ;; should be fixed for grep versions > 3.1. | |
110 | (substitute* "tests/Makefile.in" | |
111 | (("^[[:blank:]]+backref-alt[[:blank:]]+\\\\") "\\") | |
112 | (("^[[:blank:]]+triple-backref[[:blank:]]+\\\\") "\\")) | |
113 | #t)) | |
1063d325 MW |
114 | (add-after 'install 'fix-egrep-and-fgrep |
115 | ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its | |
116 | ;; absolute file name instead of searching for it in $PATH. | |
117 | (lambda* (#:key outputs #:allow-other-keys) | |
118 | (let* ((out (assoc-ref outputs "out")) | |
119 | (bin (string-append out "/bin"))) | |
120 | (substitute* (list (string-append bin "/egrep") | |
121 | (string-append bin "/fgrep")) | |
122 | (("^exec grep") | |
123 | (string-append "exec " bin "/grep"))) | |
124 | #t)))))) | |
f50d2669 | 125 | (synopsis "Print lines matching a pattern") |
d45122f5 | 126 | (description |
12bcf94a | 127 | "grep is a tool for finding text inside files. Text is found by |
a22dc0c4 | 128 | matching a pattern provided by the user in one or many files. The pattern |
79c311b8 LC |
129 | may be provided as a basic or extended regular expression, or as fixed |
130 | strings. By default, the matching text is simply printed to the screen, | |
131 | however the output can be greatly customized to include, for example, line | |
132 | numbers. GNU grep offers many extensions over the standard utility, | |
133 | including, for example, recursive directory searching.") | |
4a44e743 | 134 | (license gpl3+) |
6fd52309 | 135 | (home-page "https://www.gnu.org/software/grep/"))) |
6794b278 | 136 | |
8dcad9aa LC |
137 | (define-public sed |
138 | (package | |
139 | (name "sed") | |
301a4249 | 140 | (version "4.5") |
8dcad9aa | 141 | (source (origin |
87f5d366 | 142 | (method url-fetch) |
0db342a5 | 143 | (uri (string-append "mirror://gnu/sed/sed-" version |
7d7ea947 | 144 | ".tar.xz")) |
8dcad9aa LC |
145 | (sha256 |
146 | (base32 | |
301a4249 | 147 | "0h3b2jfj57wmz680vkbyavlsrkak556qhvs7m7fdlawwhg477bbs")))) |
8dcad9aa | 148 | (build-system gnu-build-system) |
f50d2669 | 149 | (synopsis "Stream editor") |
52b8e5fc | 150 | (arguments |
8a296947 LC |
151 | `(#:phases |
152 | (modify-phases %standard-phases | |
c8b44fc1 LC |
153 | (add-after 'unpack 'dont-rebuild-sed.1 |
154 | (lambda _ | |
155 | ;; Make sure we do not attempt to rebuild 'doc/sed.1', which does | |
156 | ;; not work when cross-compiling because we cannot run 'sed'. | |
157 | ;; This is fixed upstream as commit a0a25e3. | |
158 | (substitute* "Makefile.in" | |
159 | (("^doc/sed\\.1:.*") | |
160 | "doc/sed.1:\n")) | |
8a296947 | 161 | #t))))) |
301a4249 LC |
162 | (native-inputs |
163 | `(("perl" ,perl))) ;for tests | |
d45122f5 | 164 | (description |
a22dc0c4 LC |
165 | "Sed is a non-interactive, text stream editor. It receives a text |
166 | input from a file or from standard input and it then applies a series of text | |
167 | editing commands to the stream and prints its output to standard output. It | |
79c311b8 LC |
168 | is often used for substituting text patterns in a stream. The GNU |
169 | implementation offers several extensions over the standard utility.") | |
4a44e743 | 170 | (license gpl3+) |
7d7ea947 | 171 | (home-page "https://www.gnu.org/software/sed/"))) |
8dcad9aa | 172 | |
85240322 LC |
173 | (define-public tar |
174 | (package | |
175 | (name "tar") | |
ad3c9f18 | 176 | (version "1.30") |
85240322 | 177 | (source (origin |
87f5d366 | 178 | (method url-fetch) |
0db342a5 | 179 | (uri (string-append "mirror://gnu/tar/tar-" |
d6535cf1 | 180 | version ".tar.xz")) |
85240322 LC |
181 | (sha256 |
182 | (base32 | |
ad3c9f18 | 183 | "1lyjyk8z8hdddsxw0ikchrsfg3i0x3fsh7l63a8jgaz1n7dr5gzi")) |
45413064 MW |
184 | (patches (search-patches "tar-skip-unreliable-tests.patch" |
185 | "tar-remove-wholesparse-check.patch")))) | |
85240322 | 186 | (build-system gnu-build-system) |
74d63739 LC |
187 | ;; Note: test suite requires ~1GiB of disk space. |
188 | (arguments | |
c77835db | 189 | `(#:phases (modify-phases %standard-phases |
74d63739 LC |
190 | (add-before 'build 'set-shell-file-name |
191 | (lambda* (#:key inputs #:allow-other-keys) | |
192 | ;; Do not use "/bin/sh" to run programs. | |
193 | (let ((bash (assoc-ref inputs "bash"))) | |
194 | (substitute* "src/system.c" | |
195 | (("/bin/sh") | |
196 | (string-append bash "/bin/sh"))) | |
ad2e1422 LC |
197 | #t)))) |
198 | ||
c77835db LC |
199 | ;; Work around a cross-compilation bug whereby libgnu.a would provide |
200 | ;; '__mktime_internal', which conflicts with the one in libc.a. | |
201 | ,@(if (%current-target-system) | |
202 | `(#:configure-flags '("gl_cv_func_working_mktime=yes")) | |
203 | '()) | |
204 | ||
ad2e1422 LC |
205 | ;; Test #92 "link mismatch" expects "a/z: Not linked to a/y" but gets |
206 | ;; "a/y: Not linked to a/z" and fails, presumably due to differences in | |
207 | ;; the order in which 'diff' traverses directories. That leads to a | |
208 | ;; test failure even though conceptually the test passes. Skip it. | |
169c658f MB |
209 | ;; Test 117 and 118 are prone to race conditions too, particularly |
210 | ;; when cross-compiling, so we skip those as well. All issues have | |
211 | ;; been fixed upstream in these commits: | |
212 | ;; <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=847a36f> | |
213 | ;; <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=64b43fd> | |
214 | #:make-flags (list (string-append | |
215 | "TESTSUITEFLAGS= -k '!link mismatch," | |
216 | "!directory removed before reading," | |
217 | "!explicitly named directory removed before reading'")))) | |
bbe03294 LC |
218 | |
219 | ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able | |
220 | ;; to refer to the target Bash. | |
221 | (inputs (if (%current-target-system) | |
222 | `(("bash" ,bash)) | |
223 | '())) | |
224 | ||
f50d2669 | 225 | (synopsis "Managing tar archives") |
d45122f5 | 226 | (description |
a22dc0c4 LC |
227 | "Tar provides the ability to create tar archives, as well as the |
228 | ability to extract, update or list files in an existing archive. It is | |
229 | useful for combining many files into one larger file, while maintaining | |
230 | directory structure and file information such as permissions and | |
79c311b8 LC |
231 | creation/modification dates. GNU tar offers many extensions over the |
232 | standard utility.") | |
4a44e743 | 233 | (license gpl3+) |
6fd52309 | 234 | (home-page "https://www.gnu.org/software/tar/"))) |
85240322 | 235 | |
fbeec3d9 LC |
236 | (define-public patch |
237 | (package | |
238 | (name "patch") | |
ec07ba1f | 239 | (version "2.7.6") |
f6408bc5 LC |
240 | (source (origin |
241 | (method url-fetch) | |
242 | (uri (string-append "mirror://gnu/patch/patch-" | |
243 | version ".tar.xz")) | |
244 | (sha256 | |
245 | (base32 | |
ec07ba1f | 246 | "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc")) |
fc1adab1 | 247 | (patches (search-patches "patch-hurd-path-max.patch")))) |
fbeec3d9 | 248 | (build-system gnu-build-system) |
d3878d3d LC |
249 | (arguments |
250 | ;; Work around a cross-compilation bug whereby libpatch.a would provide | |
251 | ;; '__mktime_internal', which conflicts with the one in libc.a. | |
252 | (if (%current-target-system) | |
253 | `(#:configure-flags '("gl_cv_func_working_mktime=yes")) | |
254 | '())) | |
b3546174 | 255 | (native-inputs `(("ed" ,ed))) |
f50d2669 | 256 | (synopsis "Apply differences to originals, with optional backups") |
d45122f5 | 257 | (description |
a22dc0c4 | 258 | "Patch is a program that applies changes to files based on differences |
79c311b8 | 259 | laid out as by the program \"diff\". The changes may be applied to one or more |
a22dc0c4 LC |
260 | files depending on the contents of the diff file. It accepts several |
261 | different diff formats. It may also be used to revert previously applied | |
262 | differences.") | |
4a44e743 | 263 | (license gpl3+) |
6fd52309 | 264 | (home-page "https://savannah.gnu.org/projects/patch/"))) |
fbeec3d9 | 265 | |
04a32ee5 LC |
266 | (define-public diffutils |
267 | (package | |
268 | (name "diffutils") | |
03bcf7c3 | 269 | (version "3.6") |
04a32ee5 | 270 | (source (origin |
87f5d366 | 271 | (method url-fetch) |
0db342a5 | 272 | (uri (string-append "mirror://gnu/diffutils/diffutils-" |
04a32ee5 LC |
273 | version ".tar.xz")) |
274 | (sha256 | |
275 | (base32 | |
8d6cd085 LC |
276 | "1mivg0fy3a6fcn535ln8nkgfj6vxh5hsxxs5h6692wxmsjyyh8fn")) |
277 | (patches (search-patches "diffutils-getopt.patch")))) | |
04a32ee5 | 278 | (build-system gnu-build-system) |
f50d2669 | 279 | (synopsis "Comparing and merging files") |
d45122f5 | 280 | (description |
79c311b8 LC |
281 | "GNU Diffutils is a package containing tools for finding the |
282 | differences between files. The \"diff\" command is used to show how two files | |
e881752c | 283 | differ, while \"cmp\" shows the offsets and line numbers where they differ. |
79c311b8 | 284 | \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an |
a22dc0c4 | 285 | interactive means to merge two files.") |
4a44e743 | 286 | (license gpl3+) |
6fd52309 | 287 | (home-page "https://www.gnu.org/software/diffutils/"))) |
04a32ee5 | 288 | |
af5521ca LC |
289 | (define-public findutils |
290 | (package | |
291 | (name "findutils") | |
e80d2555 | 292 | (version "4.6.0") |
af5521ca | 293 | (source (origin |
87f5d366 | 294 | (method url-fetch) |
0db342a5 | 295 | (uri (string-append "mirror://gnu/findutils/findutils-" |
af5521ca LC |
296 | version ".tar.gz")) |
297 | (sha256 | |
298 | (base32 | |
e80d2555 | 299 | "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y")) |
da8e256a | 300 | (patches (search-patches |
2fa4066c | 301 | "findutils-gnulib-libio.patch" |
da8e256a | 302 | "findutils-localstatedir.patch" |
2fa4066c | 303 | "findutils-makedev.patch" |
acc2dab7 EB |
304 | "findutils-test-xargs.patch")) |
305 | (modules '((guix build utils))) | |
306 | (snippet | |
307 | '(begin | |
308 | ;; The gnulib test-lock test is prone to writer starvation | |
309 | ;; with our glibc@2.25, which prefers readers, so disable it. | |
310 | ;; The gnulib commit b20e8afb0b2 should fix this once | |
311 | ;; incorporated here. | |
312 | (substitute* "tests/Makefile.in" | |
313 | (("test-lock\\$\\(EXEEXT\\) ") "")) | |
314 | #t)))) | |
af5521ca | 315 | (build-system gnu-build-system) |
af5521ca | 316 | (arguments |
67dfa198 LC |
317 | `(#:configure-flags (list |
318 | ;; Tell 'updatedb' to write to /var. | |
319 | "--localstatedir=/var" | |
320 | ||
321 | ;; Work around cross-compilation failure. See | |
322 | ;; <http://savannah.gnu.org/bugs/?27299#comment1>. | |
323 | ,@(if (%current-target-system) | |
324 | '("gl_cv_func_wcwidth_works=yes") | |
325 | '())))) | |
f50d2669 | 326 | (synopsis "Operating on files matching given criteria") |
d45122f5 | 327 | (description |
a22dc0c4 LC |
328 | "Findutils supplies the basic file directory searching utilities of the |
329 | GNU system. It consists of two primary searching utilities: \"find\" | |
330 | recursively searches for files in a directory according to given criteria and | |
331 | \"locate\" lists files in a database that match a query. Two auxiliary tools | |
79c311b8 LC |
332 | are included: \"updatedb\" updates the file name database and \"xargs\" may be |
333 | used to apply commands with arbitrarily long arguments.") | |
4a44e743 | 334 | (license gpl3+) |
6fd52309 | 335 | (home-page "https://www.gnu.org/software/findutils/"))) |
2c957cd2 LC |
336 | |
337 | (define-public coreutils | |
338 | (package | |
339 | (name "coreutils") | |
a8dcf6ce | 340 | (version "8.30") |
2c957cd2 | 341 | (source (origin |
87f5d366 | 342 | (method url-fetch) |
0db342a5 | 343 | (uri (string-append "mirror://gnu/coreutils/coreutils-" |
2c957cd2 LC |
344 | version ".tar.xz")) |
345 | (sha256 | |
346 | (base32 | |
a8dcf6ce | 347 | "0mxhw43d4wpqmvg0l4znk1vm10fy92biyh90lzdnqjcic2lb6cg8")))) |
2c957cd2 | 348 | (build-system gnu-build-system) |
de59af4d | 349 | (inputs `(("acl" ,acl) ; TODO: add SELinux |
09cc7729 | 350 | ("gmp" ,gmp) ;bignums in 'expr', yay! |
62ea8865 LC |
351 | |
352 | ;; Drop the dependency on libcap when cross-compiling since it's | |
353 | ;; not quite cross-compilable. | |
354 | ,@(if (%current-target-system) | |
355 | '() | |
356 | `(("libcap" ,libcap))))) ;capability support is 'ls', etc. | |
2c1dea85 LC |
357 | (native-inputs |
358 | ;; Perl is needed to run tests in native builds, and to run the bundled | |
7f31c71c LC |
359 | ;; copy of help2man. However, don't pass it when cross-compiling since |
360 | ;; that would lead it to try to run programs to get their '--help' output | |
361 | ;; for help2man. | |
1cbd63f2 LC |
362 | (if (%current-target-system) |
363 | '() | |
364 | `(("perl" ,perl)))) | |
9bf62d9b | 365 | (outputs '("out" "debug")) |
2c957cd2 | 366 | (arguments |
8ba8aeb7 | 367 | `(#:parallel-build? #f ; help2man may be called too early |
656a5ba0 EF |
368 | #:phases (modify-phases %standard-phases |
369 | (add-before 'build 'patch-shell-references | |
370 | (lambda _ | |
371 | ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so | |
372 | ;; that tests pass, since /bin/sh isn't in the chroot. | |
373 | (setenv "SHELL" (which "sh")) | |
b47b2b52 | 374 | |
656a5ba0 EF |
375 | (substitute* (find-files "gnulib-tests" "\\.c$") |
376 | (("/bin/sh") (which "sh"))) | |
377 | (substitute* (find-files "tests" "\\.sh$") | |
a8dcf6ce MB |
378 | (("#!/bin/sh") (string-append "#!" (which "sh")))) |
379 | #t)) | |
380 | (add-before 'check 'disable-broken-test | |
381 | (lambda _ | |
382 | ;; This test hits the 127 character shebang limit in the build | |
383 | ;; environment due to the way "env -S" splits arguments into | |
384 | ;; shebangs. Note that "env-S-script.sh" works around this | |
385 | ;; specific issue, but "env-S.pl" is not adjusted for build | |
386 | ;; environments with long prefixes (/tmp/guix-build-...). | |
387 | (substitute* "Makefile" | |
388 | (("^.*tests/misc/env-S.pl.*$") "")) | |
f3c294a2 LC |
389 | #t))) |
390 | ||
391 | ;; Work around a cross-compilation bug whereby libcoreutils.a would | |
392 | ;; provide '__mktime_internal', which conflicts with the one in libc.a. | |
393 | ,@(if (%current-target-system) | |
394 | `(#:configure-flags '("gl_cv_func_working_mktime=yes")) | |
395 | '()))) | |
f50d2669 | 396 | (synopsis "Core GNU utilities (file, text, shell)") |
d45122f5 | 397 | (description |
79c311b8 | 398 | "GNU Coreutils includes all of the basic command-line tools that are |
a22dc0c4 LC |
399 | expected in a POSIX system. These provide the basic file, shell and text |
400 | manipulation functions of the GNU system. Most of these tools offer extended | |
401 | functionality beyond that which is outlined in the POSIX standard.") | |
4a44e743 | 402 | (license gpl3+) |
6fd52309 | 403 | (home-page "https://www.gnu.org/software/coreutils/"))) |
af5521ca | 404 | |
d0f74308 | 405 | (define-public coreutils-minimal |
28cbc587 LC |
406 | ;; Coreutils without its optional dependencies. |
407 | (package | |
408 | (inherit coreutils) | |
d0f74308 | 409 | (name "coreutils-minimal") |
28cbc587 LC |
410 | (outputs '("out")) |
411 | (inputs '()))) | |
412 | ||
ab776865 LC |
413 | (define-public gnu-make |
414 | (package | |
415 | (name "make") | |
6d2b94f2 | 416 | (version "4.2.1") |
ab776865 | 417 | (source (origin |
87f5d366 | 418 | (method url-fetch) |
0db342a5 | 419 | (uri (string-append "mirror://gnu/make/make-" version |
ab776865 LC |
420 | ".tar.bz2")) |
421 | (sha256 | |
422 | (base32 | |
6d2b94f2 | 423 | "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn")) |
e9b9ea1e MB |
424 | (patches (search-patches "make-impure-dirs.patch" |
425 | "make-glibc-compat.patch")))) | |
ab776865 | 426 | (build-system gnu-build-system) |
b3546174 | 427 | (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile |
ed41d48e | 428 | (inputs `(("guile" ,guile-2.0))) |
9bf62d9b | 429 | (outputs '("out" "debug")) |
ea8fbbf2 | 430 | (arguments |
e9b9ea1e MB |
431 | '(;; Work around faulty glob detection with glibc 2.27. See |
432 | ;; <https://lists.nongnu.org/archive/html/bug-make/2017-11/msg00027.html>. | |
433 | #:configure-flags '("make_cv_sys_gnu_glob=yes") | |
434 | #:phases | |
6cc83b68 EF |
435 | (modify-phases %standard-phases |
436 | (add-before 'build 'set-default-shell | |
437 | (lambda* (#:key inputs #:allow-other-keys) | |
438 | ;; Change the default shell from /bin/sh. | |
439 | (let ((bash (assoc-ref inputs "bash"))) | |
440 | (substitute* "job.c" | |
441 | (("default_shell =.*$") | |
60f3ad8c | 442 | (format #f "default_shell = \"~a/bin/sh\";\n" |
759ad069 MB |
443 | bash))) |
444 | #t)))))) | |
f50d2669 | 445 | (synopsis "Remake files automatically") |
d45122f5 | 446 | (description |
a22dc0c4 LC |
447 | "Make is a program that is used to control the production of |
448 | executables or other files from their source files. The process is | |
449 | controlled from a Makefile, in which the developer specifies how each file is | |
450 | generated from its source. It has powerful dependency resolution and the | |
451 | ability to determine when files have to be regenerated after their sources | |
79c311b8 | 452 | change. GNU make offers many powerful extensions over the standard utility.") |
4a44e743 | 453 | (license gpl3+) |
6fd52309 | 454 | (home-page "https://www.gnu.org/software/make/"))) |
ab776865 | 455 | |
8f6201a3 LC |
456 | (define-public binutils |
457 | (package | |
458 | (name "binutils") | |
6c470988 | 459 | (version "2.31.1") |
8f6201a3 | 460 | (source (origin |
87f5d366 | 461 | (method url-fetch) |
0db342a5 | 462 | (uri (string-append "mirror://gnu/binutils/binutils-" |
8f6201a3 LC |
463 | version ".tar.bz2")) |
464 | (sha256 | |
465 | (base32 | |
6c470988 | 466 | "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z")) |
ff19532f | 467 | (patches (search-patches "binutils-loongson-workaround.patch")))) |
8f6201a3 LC |
468 | (build-system gnu-build-system) |
469 | ||
470 | ;; TODO: Add dependency on zlib + those for Gold. | |
8f6201a3 | 471 | (arguments |
de80b504 | 472 | `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency |
01d45404 LC |
473 | ;; on GCC when bootstrapping. |
474 | "LDFLAGS=-static-libgcc" | |
8f6201a3 | 475 | |
ff19532f MB |
476 | ;; Turn on --enable-new-dtags by default to make the |
477 | ;; linker set RUNPATH instead of RPATH on binaries. | |
478 | ;; This is important because RUNPATH can be overriden | |
479 | ;; using LD_LIBRARY_PATH at runtime. | |
480 | "--enable-new-dtags" | |
481 | ||
01d45404 | 482 | ;; Don't search under /usr/lib & co. |
444c64b0 LC |
483 | "--with-lib-path=/no-ld-lib-path" |
484 | ||
6c95f363 LC |
485 | ;; Install BFD. It ends up in a hidden directory, |
486 | ;; but it's here. | |
cc0a1282 LC |
487 | "--enable-install-libbfd" |
488 | ||
489 | ;; Make sure 'ar' and 'ranlib' produce archives in a | |
490 | ;; deterministic fashion. | |
491 | "--enable-deterministic-archives"))) | |
8f6201a3 | 492 | |
f50d2669 | 493 | (synopsis "Binary utilities: bfd gas gprof ld") |
d45122f5 | 494 | (description |
a22dc0c4 | 495 | "GNU Binutils is a collection of tools for working with binary files. |
c5779c93 LC |
496 | Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler. |
497 | Other tools include programs to display binary profiling information, list | |
498 | the strings in a binary file, and utilities for working with archives. The | |
499 | \"bfd\" library for working with executable and object formats is also | |
500 | included.") | |
4a44e743 | 501 | (license gpl3+) |
6fd52309 | 502 | (home-page "https://www.gnu.org/software/binutils/"))) |
8f6201a3 | 503 | |
5bde4503 LC |
504 | (define* (make-ld-wrapper name #:key |
505 | (target (const #f)) | |
506 | binutils | |
78dea6f1 | 507 | (guile (canonical-package guile-2.2)) |
5bde4503 | 508 | (bash (canonical-package bash)) |
8fdd4101 LC |
509 | (guile-for-build guile)) |
510 | "Return a package called NAME that contains a wrapper for the 'ld' program | |
5bde4503 LC |
511 | of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The |
512 | wrapper uses GUILE and BASH. | |
513 | ||
514 | TARGET must be a one-argument procedure that, given a system type, returns a | |
515 | cross-compilation target triplet or #f. When the result is not #f, make a | |
516 | wrapper for the cross-linker for that target, called 'TARGET-ld'." | |
517 | ;; Note: #:system->target-triplet is a procedure so that the evaluation of | |
518 | ;; its result can be delayed until the 'arguments' field is evaluated, thus | |
519 | ;; in a context where '%current-system' is accurate. | |
8fdd4101 LC |
520 | (package |
521 | (name name) | |
522 | (version "0") | |
523 | (source #f) | |
524 | (build-system trivial-build-system) | |
525 | (inputs `(("binutils" ,binutils) | |
526 | ("guile" ,guile) | |
527 | ("bash" ,bash) | |
528 | ("wrapper" ,(search-path %load-path | |
c8bfa5b4 | 529 | "gnu/packages/ld-wrapper.in")))) |
8fdd4101 | 530 | (arguments |
5bde4503 LC |
531 | (let ((target (target (%current-system)))) |
532 | `(#:guile ,guile-for-build | |
533 | #:modules ((guix build utils)) | |
534 | #:builder (begin | |
535 | (use-modules (guix build utils) | |
536 | (system base compile)) | |
8fdd4101 | 537 | |
5bde4503 LC |
538 | (let* ((out (assoc-ref %outputs "out")) |
539 | (bin (string-append out "/bin")) | |
540 | (ld ,(if target | |
541 | `(string-append bin "/" ,target "-ld") | |
542 | '(string-append bin "/ld"))) | |
543 | (go (string-append ld ".go"))) | |
8fdd4101 | 544 | |
5bde4503 LC |
545 | (setvbuf (current-output-port) _IOLBF) |
546 | (format #t "building ~s/bin/ld wrapper in ~s~%" | |
547 | (assoc-ref %build-inputs "binutils") | |
548 | out) | |
8fdd4101 | 549 | |
5bde4503 LC |
550 | (mkdir-p bin) |
551 | (copy-file (assoc-ref %build-inputs "wrapper") ld) | |
552 | (substitute* ld | |
553 | (("@SELF@") | |
554 | ld) | |
555 | (("@GUILE@") | |
556 | (string-append (assoc-ref %build-inputs "guile") | |
557 | "/bin/guile")) | |
558 | (("@BASH@") | |
559 | (string-append (assoc-ref %build-inputs "bash") | |
560 | "/bin/bash")) | |
561 | (("@LD@") | |
562 | (string-append (assoc-ref %build-inputs "binutils") | |
563 | ,(if target | |
564 | (string-append "/bin/" | |
565 | target "-ld") | |
566 | "/bin/ld")))) | |
567 | (chmod ld #o555) | |
e3cfef22 MW |
568 | (compile-file ld #:output-file go) |
569 | #t))))) | |
8fdd4101 LC |
570 | (synopsis "The linker wrapper") |
571 | (description | |
572 | "The linker wrapper (or 'ld-wrapper') wraps the linker to add any | |
573 | missing '-rpath' flags, and to detect any misuse of libraries outside of the | |
574 | store.") | |
6fd52309 | 575 | (home-page "https://www.gnu.org/software/guix//") |
8fdd4101 LC |
576 | (license gpl3+))) |
577 | ||
578 | (export make-ld-wrapper) | |
579 | ||
2d546858 LC |
580 | (define-public glibc |
581 | ;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to | |
582 | ;; version 2.28, GNU/Hurd used a different glibc branch. | |
7cdeac02 LC |
583 | (package |
584 | (name "glibc") | |
c6bc8e22 MB |
585 | ;; Note: Always use a dot after the minor version since various places rely |
586 | ;; on "version-major+minor" to determine where locales are found. | |
e13b5474 | 587 | (version "2.28") |
7cdeac02 | 588 | (source (origin |
87f5d366 | 589 | (method url-fetch) |
5e8cb5e6 | 590 | (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz")) |
7cdeac02 LC |
591 | (sha256 |
592 | (base32 | |
e13b5474 | 593 | "10iha5ynvdj5m62vgpgqbq4cwvc2yhyl2w9yyyjgfxmdmx8h145i")) |
13990c73 LC |
594 | (snippet |
595 | ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is | |
596 | ;; required on LFS distros to avoid loading the distro's libc.so | |
597 | ;; instead of ours. | |
6cbee49d MW |
598 | '(begin |
599 | (substitute* "sysdeps/unix/sysv/linux/configure" | |
600 | (("use_ldconfig=yes") | |
601 | "use_ldconfig=no")) | |
602 | #t)) | |
1faca892 | 603 | (modules '((guix build utils))) |
c3052d6b | 604 | (patches (search-patches "glibc-ldd-x86_64.patch" |
e13b5474 | 605 | "glibc-2.28-git-fixes.patch" |
5e8cb5e6 | 606 | "glibc-hidden-visibility-ldconfig.patch" |
c3052d6b | 607 | "glibc-versioned-locpath.patch" |
6422bde9 | 608 | "glibc-allow-kernel-2.6.32.patch" |
1b9fb043 | 609 | "glibc-reinstate-prlimit64-fallback.patch" |
ef582109 | 610 | "glibc-hurd-magic-pid.patch" |
1b9fb043 | 611 | "glibc-supported-locales.patch")))) |
7cdeac02 | 612 | (build-system gnu-build-system) |
0a3da5b7 LC |
613 | |
614 | ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc | |
2d546858 LC |
615 | ;; users should automatically pull Linux headers as well. On GNU/Hurd, |
616 | ;; libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers, | |
617 | ;; so both should be propagated. | |
618 | (propagated-inputs | |
619 | (if (hurd-target?) | |
620 | `(("hurd-core-headers" ,hurd-core-headers)) | |
621 | `(("kernel-headers" ,linux-libre-headers)))) | |
0a3da5b7 | 622 | |
6dff905e LC |
623 | (outputs '("out" "debug" |
624 | "static")) ;9 MiB of .a files | |
7f614e49 | 625 | |
7cdeac02 | 626 | (arguments |
8197c978 | 627 | `(#:out-of-source? #t |
211db2f6 | 628 | |
112da588 | 629 | ;; The libraries have an empty RUNPATH, but some, such as the versioned |
67fcf235 | 630 | ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since |
112da588 LC |
631 | ;; these libraries are always going to be found anyway, just skip |
632 | ;; RUNPATH checks. | |
633 | #:validate-runpath? #f | |
634 | ||
6dff905e LC |
635 | #:modules ((ice-9 ftw) |
636 | (srfi srfi-26) | |
637 | (guix build utils) | |
638 | (guix build gnu-build-system)) | |
639 | ||
7cdeac02 | 640 | #:configure-flags |
5e8cb5e6 | 641 | (list "--sysconfdir=/etc" |
7f614e49 | 642 | |
97e11209 LC |
643 | ;; Installing a locale archive with all the locales is to |
644 | ;; expensive (~100 MiB), so we rely on users to install the | |
645 | ;; locales they really want. | |
646 | ;; | |
647 | ;; Set the default locale path. In practice, $LOCPATH may be | |
648 | ;; defined to point whatever locales users want. However, setuid | |
649 | ;; binaries don't honor $LOCPATH, so they'll instead look into | |
9f58fe3d | 650 | ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y, |
46bd6edd LC |
651 | ;; with the idea that it is going to be populated by the sysadmin. |
652 | ;; The "X.Y" sub-directory is because locale data formats are | |
653 | ;; incompatible across libc versions; see | |
654 | ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>. | |
97e11209 | 655 | ;; |
7f614e49 LC |
656 | ;; `--localedir' is not honored, so work around it. |
657 | ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>. | |
9f58fe3d | 658 | (string-append "libc_cv_complocaledir=/run/current-system/locale/" |
c6bc8e22 | 659 | ,(version-major+minor version)) |
7f614e49 | 660 | |
7cdeac02 | 661 | (string-append "--with-headers=" |
28dc10a4 LC |
662 | (assoc-ref ,(if (%current-target-system) |
663 | '%build-target-inputs | |
664 | '%build-inputs) | |
aeafff53 | 665 | "kernel-headers") |
7cdeac02 | 666 | "/include") |
5f456680 | 667 | |
67d527e3 | 668 | ;; This is the default for most architectures as of GNU libc 2.26, |
39ccbfad MW |
669 | ;; but we specify it explicitly for clarity and consistency. See |
670 | ;; "kernel-features.h" in the GNU libc for details. | |
67d527e3 | 671 | "--enable-kernel=3.2.0" |
5f456680 | 672 | |
6e32f6c0 | 673 | ;; Use our Bash instead of /bin/sh. |
8cd8e97c | 674 | (string-append "BASH_SHELL=" |
6e32f6c0 | 675 | (assoc-ref %build-inputs "bash") |
2d546858 LC |
676 | "/bin/bash") |
677 | ||
678 | ;; On GNU/Hurd we get discarded-qualifiers warnings for | |
679 | ;; 'device_write_inband' among other things. Ignore them. | |
680 | ,@(if (hurd-target?) | |
681 | '("--disable-werror") | |
682 | '())) | |
6e32f6c0 | 683 | |
7cdeac02 | 684 | #:tests? #f ; XXX |
57f65bcc LC |
685 | #:phases (modify-phases %standard-phases |
686 | (add-before | |
687 | 'configure 'pre-configure | |
688 | (lambda* (#:key inputs native-inputs outputs | |
689 | #:allow-other-keys) | |
690 | (let* ((out (assoc-ref outputs "out")) | |
691 | (bin (string-append out "/bin")) | |
692 | ;; FIXME: Normally we would look it up only in INPUTS | |
693 | ;; but cross-base uses it as a native input. | |
694 | (bash (or (assoc-ref inputs "static-bash") | |
695 | (assoc-ref native-inputs "static-bash")))) | |
57f65bcc LC |
696 | ;; Install the rpc data base file under `$out/etc/rpc'. |
697 | ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ]; | |
698 | (substitute* "sunrpc/Makefile" | |
699 | (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) | |
700 | (string-append out "/etc/rpc" suffix "\n")) | |
701 | (("^install-others =.*$") | |
702 | (string-append "install-others = " out "/etc/rpc\n"))) | |
703 | ||
704 | (substitute* "Makeconfig" | |
705 | ;; According to | |
706 | ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>, | |
707 | ;; linking against libgcc_s is not needed with GCC | |
708 | ;; 4.7.1. | |
709 | ((" -lgcc_s") "")) | |
710 | ||
711 | ;; Have `system' use that Bash. | |
712 | (substitute* "sysdeps/posix/system.c" | |
713 | (("#define[[:blank:]]+SHELL_PATH.*$") | |
714 | (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" | |
715 | bash))) | |
716 | ||
717 | ;; Same for `popen'. | |
718 | (substitute* "libio/iopopen.c" | |
719 | (("/bin/sh") | |
11b66876 | 720 | (string-append bash "/bin/sh"))) |
57f65bcc | 721 | |
d56f8d5e LC |
722 | ;; Same for the shell used by the 'exec' functions for |
723 | ;; scripts that lack a shebang. | |
724 | (substitute* (find-files "." "^paths\\.h$") | |
725 | (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$") | |
726 | (string-append "#define _PATH_BSHELL \"" | |
e4831391 | 727 | bash "/bin/sh\"\n"))) |
d56f8d5e | 728 | |
c5b65f7e LC |
729 | ;; Nscd uses __DATE__ and __TIME__ to create a string to |
730 | ;; make sure the client and server come from the same | |
731 | ;; libc. Use something deterministic instead. | |
732 | (substitute* "nscd/nscd_stat.c" | |
733 | (("static const char compilation\\[21\\] =.*$") | |
734 | (string-append | |
735 | "static const char compilation[21] = \"" | |
736 | (string-take (basename out) 20) "\";\n"))) | |
737 | ||
57f65bcc LC |
738 | ;; Make sure we don't retain a reference to the |
739 | ;; bootstrap Perl. | |
740 | (substitute* "malloc/mtrace.pl" | |
741 | (("^#!.*") | |
742 | ;; The shebang can be omitted, because there's the | |
743 | ;; "bilingual" eval/exec magic at the top of the file. | |
744 | "") | |
745 | (("exec @PERL@") | |
ab6e5690 MW |
746 | "exec perl")) |
747 | ||
748 | #t))) | |
6dff905e LC |
749 | |
750 | (add-after 'install 'move-static-libs | |
751 | (lambda* (#:key outputs #:allow-other-keys) | |
752 | ;; Move static libraries to the "static" output. | |
753 | (define (static-library? file) | |
754 | ;; Return true if FILE is a static library. The | |
755 | ;; "_nonshared.a" files are referred to by libc.so, | |
756 | ;; libpthread.so, etc., which are in fact linker | |
757 | ;; scripts. | |
758 | (and (string-suffix? ".a" file) | |
759 | (not (string-contains file "_nonshared")))) | |
760 | ||
761 | (define (linker-script? file) | |
762 | ;; Guess whether FILE, a ".a" file, is actually a | |
763 | ;; linker script. | |
764 | (and (not (ar-file? file)) | |
765 | (not (elf-file? file)))) | |
766 | ||
767 | (let* ((out (assoc-ref outputs "out")) | |
768 | (lib (string-append out "/lib")) | |
769 | (files (scandir lib static-library?)) | |
770 | (static (assoc-ref outputs "static")) | |
771 | (slib (string-append static "/lib"))) | |
772 | (mkdir-p slib) | |
773 | (for-each (lambda (base) | |
774 | (rename-file (string-append lib "/" base) | |
775 | (string-append slib "/" base))) | |
776 | files) | |
777 | ||
778 | ;; Usually libm.a is a linker script so we need to | |
779 | ;; change the file names in there to refer to STATIC | |
780 | ;; instead of OUT. | |
781 | (for-each (lambda (ld-script) | |
782 | (substitute* ld-script | |
783 | ((out) static))) | |
784 | (filter linker-script? | |
785 | (map (cut string-append slib "/" <>) | |
786 | files))) | |
2d546858 LC |
787 | #t))) |
788 | ||
789 | ,@(if (hurd-target?) | |
790 | '((add-after 'install 'augment-libc.so | |
791 | (lambda* (#:key outputs #:allow-other-keys) | |
792 | (let* ((out (assoc-ref outputs "out"))) | |
793 | (substitute* (string-append out "/lib/libc.so") | |
794 | (("/[^ ]+/lib/libc.so.0.3") | |
795 | (string-append out "/lib/libc.so.0.3" | |
796 | " libmachuser.so libhurduser.so")))) | |
797 | #t))) | |
798 | '())))) | |
7f614e49 | 799 | |
90d891fc | 800 | (inputs `(("static-bash" ,static-bash))) |
8fd6487e | 801 | |
6162b95d LC |
802 | ;; To build the manual, we need Texinfo and Perl. Gettext is needed to |
803 | ;; install the message catalogs, with 'msgfmt'. | |
8fd6487e | 804 | (native-inputs `(("texinfo" ,texinfo) |
6162b95d | 805 | ("perl" ,perl) |
5e8cb5e6 | 806 | ("bison" ,bison) |
2d546858 LC |
807 | ("gettext" ,gettext-minimal) |
808 | ||
809 | ,@(if (hurd-target?) | |
810 | `(("mig" ,mig) | |
ef582109 | 811 | ("perl" ,perl)) |
2d546858 | 812 | '()))) |
8fd6487e | 813 | |
d6718df4 LC |
814 | (native-search-paths |
815 | ;; Search path for packages that provide locale data. This is useful | |
85e57214 LC |
816 | ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than |
817 | ;; 'LOCPATH' to avoid interference with the host system's libc on foreign | |
818 | ;; distros. | |
d6718df4 | 819 | (list (search-path-specification |
fbb909ac | 820 | (variable "GUIX_LOCPATH") |
f211b2af | 821 | (files '("lib/locale"))))) |
d6718df4 | 822 | |
d45122f5 LC |
823 | (synopsis "The GNU C Library") |
824 | (description | |
7cdeac02 LC |
825 | "Any Unix-like operating system needs a C library: the library which |
826 | defines the \"system calls\" and other basic facilities such as open, malloc, | |
827 | printf, exit... | |
828 | ||
829 | The GNU C library is used as the C library in the GNU system and most systems | |
830 | with the Linux kernel.") | |
4a44e743 | 831 | (license lgpl2.0+) |
6fd52309 | 832 | (home-page "https://www.gnu.org/software/libc/"))) |
7cdeac02 | 833 | |
e13b5474 MB |
834 | ;; Below are old libc versions, which we use mostly to build locale data in |
835 | ;; the old format (which the new libc cannot cope with.) | |
836 | ||
837 | (define-public glibc-2.27 | |
ae66fdaf MB |
838 | (package |
839 | (inherit glibc) | |
e13b5474 | 840 | (version "2.27") |
ae66fdaf MB |
841 | (source (origin |
842 | (inherit (package-source glibc)) | |
843 | (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz")) | |
844 | (sha256 | |
845 | (base32 | |
e13b5474 MB |
846 | "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji")) |
847 | (patches (search-patches "glibc-ldd-x86_64.patch" | |
848 | "glibc-2.27-git-fixes.patch" | |
ae66fdaf | 849 | "glibc-hidden-visibility-ldconfig.patch" |
e13b5474 MB |
850 | "glibc-versioned-locpath.patch" |
851 | "glibc-allow-kernel-2.6.32.patch" | |
1b9fb043 MO |
852 | "glibc-reinstate-prlimit64-fallback.patch" |
853 | "glibc-supported-locales.patch")))))) | |
19ac2ba8 | 854 | |
5e8cb5e6 MB |
855 | (define-public glibc-2.26 |
856 | (package | |
857 | (inherit glibc) | |
858 | ;; This version number corresponds to the output of `git describe` and the | |
859 | ;; archive can be generated by checking out the commit ID and running: | |
860 | ;; git archive --prefix=$(git describe)/ HEAD | xz > $(git describe).tar.xz | |
861 | ;; See <https://bugs.gnu.org/29406> for why this was necessary. | |
862 | (version "2.26.105-g0890d5379c") | |
863 | (source (origin | |
864 | (inherit (package-source glibc)) | |
865 | (uri (string-append "https://alpha.gnu.org/gnu/guix/mirror/" | |
866 | "glibc-" (version-major+minor version) "-" | |
867 | (caddr (string-split version #\.)) ".tar.xz")) | |
868 | (sha256 | |
869 | (base32 | |
870 | "1jck0c1i248sn02rvsfjykk77qncma34bjq89dyy2irwm50d7s3g")) | |
871 | (patches (search-patches "glibc-ldd-x86_64.patch" | |
872 | "glibc-versioned-locpath.patch" | |
873 | "glibc-allow-kernel-2.6.32.patch")))))) | |
874 | ||
67d527e3 MB |
875 | (define-public glibc-2.25 |
876 | (package | |
877 | (inherit glibc) | |
878 | (version "2.25") | |
879 | (source (origin | |
880 | (inherit (package-source glibc)) | |
881 | (uri (string-append "mirror://gnu/glibc/glibc-" | |
882 | version ".tar.xz")) | |
883 | (sha256 | |
884 | (base32 | |
885 | "1813dzkgw6v8q8q1m4v96yfis7vjqc9pslqib6j9mrwh6fxxjyq6")) | |
886 | (patches (search-patches "glibc-ldd-x86_64.patch" | |
887 | "glibc-versioned-locpath.patch" | |
67d527e3 | 888 | "glibc-vectorized-strcspn-guards.patch" |
67d527e3 MB |
889 | "glibc-CVE-2017-1000366-pt1.patch" |
890 | "glibc-CVE-2017-1000366-pt2.patch" | |
891 | "glibc-CVE-2017-1000366-pt3.patch")))))) | |
892 | ||
7ca72ec4 EF |
893 | (define-public glibc-2.24 |
894 | (package | |
895 | (inherit glibc) | |
896 | (version "2.24") | |
897 | (source (origin | |
898 | (inherit (package-source glibc)) | |
899 | (uri (string-append "mirror://gnu/glibc/glibc-" | |
900 | version ".tar.xz")) | |
901 | (sha256 | |
902 | (base32 | |
665d6a59 EF |
903 | "1lxmprg9gm73gvafxd503x70z32phwjzcy74i0adfi6ixzla7m4r")) |
904 | (patches (search-patches "glibc-ldd-x86_64.patch" | |
905 | "glibc-versioned-locpath.patch" | |
ffc015be | 906 | "glibc-vectorized-strcspn-guards.patch" |
575e5e4e | 907 | "glibc-CVE-2015-5180.patch" |
665d6a59 EF |
908 | "glibc-CVE-2017-1000366-pt1.patch" |
909 | "glibc-CVE-2017-1000366-pt2.patch" | |
910 | "glibc-CVE-2017-1000366-pt3.patch")))))) | |
7ca72ec4 | 911 | |
19ac2ba8 LC |
912 | (define-public glibc-2.23 |
913 | (package | |
914 | (inherit glibc) | |
915 | (version "2.23") | |
916 | (source (origin | |
917 | (inherit (package-source glibc)) | |
918 | (uri (string-append "mirror://gnu/glibc/glibc-" | |
919 | version ".tar.xz")) | |
920 | (sha256 | |
921 | (base32 | |
665d6a59 EF |
922 | "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl")) |
923 | (patches (search-patches "glibc-ldd-x86_64.patch" | |
924 | "glibc-versioned-locpath.patch" | |
ffc015be | 925 | "glibc-vectorized-strcspn-guards.patch" |
a0ae64a3 EF |
926 | "glibc-CVE-2015-5180.patch" |
927 | "glibc-CVE-2016-3075.patch" | |
928 | "glibc-CVE-2016-3706.patch" | |
929 | "glibc-CVE-2016-4429.patch" | |
665d6a59 EF |
930 | "glibc-CVE-2017-1000366-pt1.patch" |
931 | "glibc-CVE-2017-1000366-pt2.patch" | |
932 | "glibc-CVE-2017-1000366-pt3.patch")))))) | |
19ac2ba8 | 933 | |
c2c54ebd | 934 | (define-public glibc-2.22 |
455859a5 | 935 | (package |
0832787e | 936 | (inherit glibc) |
c2c54ebd | 937 | (version "2.22") |
137d957e LC |
938 | (source (origin |
939 | (inherit (package-source glibc)) | |
940 | (uri (string-append "mirror://gnu/glibc/glibc-" | |
941 | version ".tar.xz")) | |
942 | (sha256 | |
943 | (base32 | |
c2c54ebd | 944 | "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb")) |
665d6a59 | 945 | (patches (search-patches "glibc-ldd-x86_64.patch" |
ca331eb8 | 946 | "glibc-o-largefile.patch" |
ffc015be | 947 | "glibc-vectorized-strcspn-guards.patch" |
edd08fb7 EF |
948 | "glibc-CVE-2015-5180.patch" |
949 | "glibc-CVE-2015-7547.patch" | |
950 | "glibc-CVE-2016-3075.patch" | |
951 | "glibc-CVE-2016-3706.patch" | |
952 | "glibc-CVE-2016-4429.patch" | |
665d6a59 EF |
953 | "glibc-CVE-2017-1000366-pt1.patch" |
954 | "glibc-CVE-2017-1000366-pt2.patch" | |
955 | "glibc-CVE-2017-1000366-pt3.patch")))) | |
38e9373b EF |
956 | (arguments |
957 | (substitute-keyword-arguments (package-arguments glibc) | |
958 | ((#:phases phases) | |
959 | `(modify-phases ,phases | |
960 | (add-before 'configure 'fix-pwd | |
961 | (lambda _ | |
6d833b13 | 962 | ;; Use `pwd' instead of `/bin/pwd' for glibc-2.22. |
38e9373b | 963 | (substitute* "configure" |
56ed97c8 MW |
964 | (("/bin/pwd") "pwd")) |
965 | #t)))))))) | |
137d957e | 966 | |
aee6180c LC |
967 | (define-public glibc-locales |
968 | (package | |
969 | (inherit glibc) | |
970 | (name "glibc-locales") | |
971 | (source (origin (inherit (package-source glibc)) | |
972 | (patches (cons (search-patch "glibc-locales.patch") | |
973 | (origin-patches (package-source glibc)))))) | |
974 | (synopsis "All the locales supported by the GNU C Library") | |
975 | (description | |
976 | "This package provides all the locales supported by the GNU C Library, | |
977 | more than 400 in total. To use them set the 'LOCPATH' environment variable to | |
978 | the 'share/locale' sub-directory of this package.") | |
979 | (outputs '("out")) ;110+ MiB | |
605217be | 980 | (native-search-paths '()) |
aee6180c LC |
981 | (arguments |
982 | (let ((args `(#:tests? #f #:strip-binaries? #f | |
983 | ,@(package-arguments glibc)))) | |
984 | (substitute-keyword-arguments args | |
985 | ((#:phases phases) | |
2320d4f0 EF |
986 | `(modify-phases ,phases |
987 | (replace 'build | |
988 | (lambda _ | |
bf8e8a74 MW |
989 | (invoke "make" "localedata/install-locales" |
990 | "-j" (number->string (parallel-job-count))))) | |
2bbd674b MB |
991 | (delete 'install) |
992 | (delete 'move-static-libs))) | |
aee6180c LC |
993 | ((#:configure-flags flags) |
994 | `(append ,flags | |
85e57214 | 995 | ;; Use $(libdir)/locale/X.Y as is the case by default. |
85860fdf | 996 | (list (string-append "libc_cv_complocaledir=" |
aee6180c | 997 | (assoc-ref %outputs "out") |
f2d7bbb5 | 998 | "/lib/locale/" |
c6bc8e22 MB |
999 | ,(version-major+minor |
1000 | (package-version glibc))))))))))) | |
aee6180c | 1001 | |
c9505f3f LC |
1002 | (define-public glibc-utf8-locales |
1003 | (package | |
1004 | (name "glibc-utf8-locales") | |
1005 | (version (package-version glibc)) | |
1006 | (source #f) | |
1007 | (build-system trivial-build-system) | |
1008 | (arguments | |
f2d7bbb5 | 1009 | `(#:modules ((guix build utils)) |
c9505f3f | 1010 | #:builder (begin |
44161fe1 | 1011 | (use-modules (guix build utils)) |
c9505f3f LC |
1012 | |
1013 | (let* ((libc (assoc-ref %build-inputs "glibc")) | |
1014 | (gzip (assoc-ref %build-inputs "gzip")) | |
1015 | (out (assoc-ref %outputs "out")) | |
f2d7bbb5 | 1016 | (localedir (string-append out "/lib/locale/" |
c6bc8e22 | 1017 | ,(version-major+minor version)))) |
c9505f3f LC |
1018 | ;; 'localedef' needs 'gzip'. |
1019 | (setenv "PATH" (string-append libc "/bin:" gzip "/bin")) | |
1020 | ||
1021 | (mkdir-p localedir) | |
44161fe1 MW |
1022 | (for-each (lambda (locale) |
1023 | (define file | |
1024 | ;; Use the "normalized codeset" by | |
1025 | ;; default--e.g., "en_US.utf8". | |
1026 | (string-append localedir "/" locale ".utf8")) | |
1027 | ||
1028 | (invoke "localedef" "--no-archive" | |
1029 | "--prefix" localedir | |
1030 | "-i" locale | |
1031 | "-f" "UTF-8" file) | |
1032 | ||
1033 | ;; For backward compatibility with Guix | |
1034 | ;; <= 0.8.3, add "xx_YY.UTF-8". | |
1035 | (symlink (string-append locale ".utf8") | |
1036 | (string-append localedir "/" | |
1037 | locale ".UTF-8"))) | |
1038 | ||
1039 | ;; These are the locales commonly used for | |
1040 | ;; tests---e.g., in Guile's i18n tests. | |
1041 | '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR")) | |
1042 | #t)))) | |
c9505f3f LC |
1043 | (inputs `(("glibc" ,glibc) |
1044 | ("gzip" ,gzip))) | |
1045 | (synopsis "Small sample of UTF-8 locales") | |
1046 | (description | |
1047 | "This package provides a small sample of UTF-8 locales mostly useful in | |
1048 | test environments.") | |
1049 | (home-page (package-home-page glibc)) | |
1050 | (license (package-license glibc)))) | |
aee6180c | 1051 | |
ce0614dd LC |
1052 | (define-public which |
1053 | (package | |
1054 | (name "which") | |
70ca2e94 | 1055 | (version "2.21") |
ce0614dd LC |
1056 | (source (origin |
1057 | (method url-fetch) | |
1058 | (uri (string-append "mirror://gnu/which/which-" | |
1059 | version ".tar.gz")) | |
1060 | (sha256 | |
1061 | (base32 | |
70ca2e94 | 1062 | "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl")))) |
ce0614dd LC |
1063 | (build-system gnu-build-system) |
1064 | (home-page "https://gnu.org/software/which/") | |
1065 | (synopsis "Find full path of shell commands") | |
1066 | (description | |
1067 | "The which program finds the location of executables in PATH, with a | |
1068 | variety of options. It is an alternative to the shell \"type\" built-in | |
1069 | command.") | |
1070 | (license gpl3+))) ; some files are under GPLv2+ | |
1071 | ||
21a8fe1b | 1072 | (define-public glibc/hurd-headers |
2d546858 | 1073 | (package (inherit glibc) |
21a8fe1b MR |
1074 | (name "glibc-hurd-headers") |
1075 | (outputs '("out")) | |
1076 | (propagated-inputs `(("gnumach-headers" ,gnumach-headers) | |
1077 | ("hurd-headers" ,hurd-headers))) | |
1078 | (arguments | |
2d546858 | 1079 | (substitute-keyword-arguments (package-arguments glibc) |
21a8fe1b MR |
1080 | ;; We just pass the flags really needed to build the headers. |
1081 | ((#:configure-flags _) | |
1082 | `(list "--enable-add-ons" | |
2d546858 | 1083 | "--host=i586-pc-gnu")) |
21a8fe1b | 1084 | ((#:phases _) |
c04e5116 TGR |
1085 | '(modify-phases %standard-phases |
1086 | (replace 'install | |
1087 | (lambda* (#:key outputs #:allow-other-keys) | |
1088 | (invoke "make" "install-headers") | |
1089 | ||
1090 | ;; Make an empty stubs.h to work around not being able to | |
1091 | ;; produce a valid stubs.h and causing the build to fail. See | |
1092 | ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>. | |
1093 | (let ((out (assoc-ref outputs "out"))) | |
1094 | (close-port | |
1095 | (open-output-file | |
b4c4f339 MW |
1096 | (string-append out "/include/gnu/stubs.h")))) |
1097 | #t)) | |
2d546858 | 1098 | (delete 'build))))))) ; nothing to build |
21a8fe1b | 1099 | |
e789d9a8 LC |
1100 | (define-public tzdata |
1101 | (package | |
1102 | (name "tzdata") | |
6069bb0a | 1103 | (version "2018e") |
e789d9a8 LC |
1104 | (source (origin |
1105 | (method url-fetch) | |
1106 | (uri (string-append | |
80b63e67 | 1107 | "https://www.iana.org/time-zones/repository/releases/tzdata" |
e789d9a8 LC |
1108 | version ".tar.gz")) |
1109 | (sha256 | |
1110 | (base32 | |
6069bb0a | 1111 | "0bk97fv2i5ns42prpmlaadsswdjwv0ifi7whj2s4q6l44rcqwa3b")))) |
e789d9a8 LC |
1112 | (build-system gnu-build-system) |
1113 | (arguments | |
1114 | '(#:tests? #f | |
1115 | #:make-flags (let ((out (assoc-ref %outputs "out")) | |
1116 | (tmp (getenv "TMPDIR"))) | |
1117 | (list (string-append "TOPDIR=" out) | |
1118 | (string-append "TZDIR=" out "/share/zoneinfo") | |
62868f12 LF |
1119 | (string-append "TZDEFAULT=" out |
1120 | "/share/zoneinfo/localtime") | |
e789d9a8 LC |
1121 | |
1122 | ;; Likewise for the C library routines. | |
1123 | (string-append "LIBDIR=" tmp "/lib") | |
1124 | (string-append "MANDIR=" tmp "/man") | |
1125 | ||
1126 | "AWK=awk" | |
1127 | "CC=gcc")) | |
1128 | #:modules ((guix build utils) | |
1129 | (guix build gnu-build-system) | |
1130 | (srfi srfi-1)) | |
1131 | #:phases | |
c8f35458 JD |
1132 | (modify-phases %standard-phases |
1133 | (replace 'unpack | |
1134 | (lambda* (#:key source inputs #:allow-other-keys) | |
408fcff6 MW |
1135 | (invoke "tar" "xvf" source) |
1136 | (invoke "tar" "xvf" (assoc-ref inputs "tzcode")))) | |
c8f35458 JD |
1137 | (add-after 'install 'post-install |
1138 | (lambda* (#:key outputs #:allow-other-keys) | |
1139 | ;; Move data in the right place. | |
1140 | (let ((out (assoc-ref outputs "out"))) | |
62868f12 LF |
1141 | ;; Discard zic, dump, and tzselect, already |
1142 | ;; provided by glibc. | |
1143 | (delete-file-recursively (string-append out "/usr")) | |
c8f35458 JD |
1144 | (symlink (string-append out "/share/zoneinfo") |
1145 | (string-append out "/share/zoneinfo/posix")) | |
1146 | (delete-file-recursively | |
1147 | (string-append out "/share/zoneinfo-posix")) | |
1148 | (copy-recursively (string-append out "/share/zoneinfo-leaps") | |
1149 | (string-append out "/share/zoneinfo/right")) | |
1150 | (delete-file-recursively | |
408fcff6 MW |
1151 | (string-append out "/share/zoneinfo-leaps")) |
1152 | #t))) | |
c8f35458 | 1153 | (delete 'configure)))) |
e789d9a8 LC |
1154 | (inputs `(("tzcode" ,(origin |
1155 | (method url-fetch) | |
1156 | (uri (string-append | |
1157 | "http://www.iana.org/time-zones/repository/releases/tzcode" | |
1158 | version ".tar.gz")) | |
1159 | (sha256 | |
1160 | (base32 | |
6069bb0a | 1161 | "1kpb02631s58i068mwq63xlamcv1ffj4p6y4wpb9kdl01vr0qd6a")))))) |
80b63e67 | 1162 | (home-page "https://www.iana.org/time-zones") |
e789d9a8 LC |
1163 | (synopsis "Database of current and historical time zones") |
1164 | (description "The Time Zone Database (often called tz or zoneinfo) | |
1165 | contains code and data that represent the history of local time for many | |
35b9e423 | 1166 | representative locations around the globe. It is updated periodically to |
e789d9a8 LC |
1167 | reflect changes made by political bodies to time zone boundaries, UTC offsets, |
1168 | and daylight-saving rules.") | |
1169 | (license public-domain))) | |
1170 | ||
75aea16f LF |
1171 | ;;; A "fixed" version of tzdata, which is used in the test suites of glib and R |
1172 | ;;; and a few other places. We can update this whenever we are able to rebuild | |
1173 | ;;; thousands of packages (for example, in a core-updates rebuild). This package | |
1174 | ;;; will typically be obsolete and should never be referred to by a built | |
1175 | ;;; package. | |
f9c3bd2e | 1176 | (define-public tzdata-for-tests |
cd50b9f0 MB |
1177 | (hidden-package |
1178 | (package | |
1179 | (inherit tzdata) | |
1180 | (version "2018d") | |
1181 | (source (origin | |
1182 | (method url-fetch) | |
1183 | (uri (string-append "https://www.iana.org/time-zones/repository" | |
1184 | "/releases/tzdata" version ".tar.gz")) | |
1185 | (sha256 | |
1186 | (base32 | |
1187 | "0m6020dnk9r40z7k36jp13fa06xip3hn0fdx3nly66jzxgffs1ji")))) | |
1188 | (inputs `(("tzcode" ,(origin | |
1189 | (method url-fetch) | |
1190 | (uri (string-append | |
1191 | "http://www.iana.org/time-zones/repository/releases/tzcode" | |
1192 | version ".tar.gz")) | |
1193 | (sha256 | |
1194 | (base32 | |
1195 | "1nd882yhsazmcfqmcqyfig3axycryl30gmizgqhqsx5dpa2lxr3x"))))))))) | |
3ffaec13 | 1196 | |
7309045c JN |
1197 | (define-public libiconv |
1198 | (package | |
1199 | (name "libiconv") | |
a55fbab7 | 1200 | (version "1.15") |
7309045c JN |
1201 | (source (origin |
1202 | (method url-fetch) | |
1203 | (uri (string-append "mirror://gnu/libiconv/libiconv-" | |
1204 | version ".tar.gz")) | |
1205 | (sha256 | |
1206 | (base32 | |
5c6b6827 | 1207 | "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc")) |
7309045c JN |
1208 | (modules '((guix build utils))) |
1209 | (snippet | |
1210 | ;; Work around "declared gets" error on glibc systems (fixed by | |
1211 | ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.) | |
6cbee49d MW |
1212 | '(begin |
1213 | (substitute* "srclib/stdio.in.h" | |
1214 | (("^#undef gets") "") | |
1215 | (("^_GL_WARN_ON_USE \\(gets.*") "")) | |
1216 | #t)))) | |
7309045c JN |
1217 | (build-system gnu-build-system) |
1218 | (synopsis "Character set conversion library") | |
1219 | (description | |
1220 | "libiconv provides an implementation of the iconv function for systems | |
1221 | that lack it. iconv is used to convert between character encodings in a | |
1222 | program. It supports a wide variety of different encodings.") | |
6fd52309 | 1223 | (home-page "https://www.gnu.org/software/libiconv/") |
7309045c JN |
1224 | (license lgpl3+))) |
1225 | ||
4dab8c59 JN |
1226 | (define* (libiconv-if-needed #:optional (target (%current-target-system))) |
1227 | "Return either a libiconv package specification to include in a dependency | |
1228 | list for platforms that have an incomplete libc, or the empty list. If a | |
1229 | package needs iconv ,@(libiconv-if-needed) should be added." | |
1230 | ;; POSIX C libraries provide iconv. Platforms with an incomplete libc | |
1231 | ;; without iconv, such as MinGW, must return the then clause. | |
1232 | (if (target-mingw? target) | |
1233 | `(("libiconv" ,libiconv)) | |
1234 | '())) | |
1235 | ||
bdb36958 LC |
1236 | (define-public (canonical-package package) |
1237 | ;; Avoid circular dependency by lazily resolving 'commencement'. | |
1238 | (let* ((iface (resolve-interface '(gnu packages commencement))) | |
1239 | (proc (module-ref iface 'canonical-package))) | |
1240 | (proc package))) | |
571aa6cd | 1241 | |
fb77c614 LC |
1242 | (define-public (%final-inputs) |
1243 | "Return the list of \"final inputs\"." | |
1244 | ;; Avoid circular dependency by lazily resolving 'commencement'. | |
1245 | (let ((iface (resolve-interface '(gnu packages commencement)))) | |
1246 | (module-ref iface '%final-inputs))) | |
1247 | ||
1722d680 | 1248 | ;;; base.scm ends here |