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