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