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