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