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