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