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