Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
3f11f01f | 2 | ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> |
722111ab | 3 | ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr> |
233e7676 | 4 | ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org> |
232010f8 | 5 | ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> |
4c8425b7 | 6 | ;;; Copyright © 2014 Alex Kost <alezost@gmail.com> |
e3ce5d70 | 7 | ;;; |
233e7676 | 8 | ;;; This file is part of GNU Guix. |
e3ce5d70 | 9 | ;;; |
233e7676 | 10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
e3ce5d70 LC |
11 | ;;; under the terms of the GNU General Public License as published by |
12 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
13 | ;;; your option) any later version. | |
14 | ;;; | |
233e7676 | 15 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
e3ce5d70 LC |
16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;;; GNU General Public License for more details. | |
19 | ;;; | |
20 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
e3ce5d70 | 22 | |
1ffa7090 | 23 | (define-module (gnu packages base) |
c6d7e299 | 24 | #:use-module ((guix licenses) |
e789d9a8 | 25 | #:select (gpl3+ lgpl2.0+ public-domain)) |
59a43334 | 26 | #:use-module (gnu packages) |
1ffa7090 LC |
27 | #:use-module (gnu packages acl) |
28 | #:use-module (gnu packages bash) | |
b5ef82e0 | 29 | #:use-module (gnu packages ed) |
1ffa7090 LC |
30 | #:use-module (gnu packages guile) |
31 | #:use-module (gnu packages multiprecision) | |
c9505f3f | 32 | #:use-module (gnu packages compression) |
1ffa7090 LC |
33 | #:use-module (gnu packages perl) |
34 | #:use-module (gnu packages linux) | |
8fd6487e | 35 | #:use-module (gnu packages texinfo) |
aa6b0d6b | 36 | #:use-module (gnu packages pkg-config) |
a635ed5c | 37 | #:use-module (gnu packages gettext) |
aee6180c | 38 | #:use-module (guix utils) |
e3ce5d70 | 39 | #:use-module (guix packages) |
87f5d366 | 40 | #:use-module (guix download) |
c9505f3f LC |
41 | #:use-module (guix build-system gnu) |
42 | #:use-module (guix build-system trivial)) | |
e3ce5d70 LC |
43 | |
44 | ;;; Commentary: | |
45 | ;;; | |
1722d680 | 46 | ;;; Base packages of the Guix-based GNU user-land software distribution. |
e3ce5d70 LC |
47 | ;;; |
48 | ;;; Code: | |
49 | ||
50 | (define-public hello | |
51 | (package | |
52 | (name "hello") | |
7bcf372e | 53 | (version "2.10") |
90c68be8 | 54 | (source (origin |
87f5d366 | 55 | (method url-fetch) |
0db342a5 | 56 | (uri (string-append "mirror://gnu/hello/hello-" version |
90c68be8 | 57 | ".tar.gz")) |
e3ce5d70 | 58 | (sha256 |
7bcf372e | 59 | (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) |
e3ce5d70 | 60 | (build-system gnu-build-system) |
f50d2669 | 61 | (synopsis "Hello, GNU world: An example GNU package") |
a22dc0c4 LC |
62 | (description |
63 | "GNU Hello prints the message \"Hello, world!\" and then exits. It | |
64 | serves as an example of standard GNU coding practices. As such, it supports | |
65 | command-line arguments, multiple languages, and so on.") | |
45753b65 | 66 | (home-page "http://www.gnu.org/software/hello/") |
4a44e743 | 67 | (license gpl3+))) |
d7672884 | 68 | |
6794b278 LC |
69 | (define-public grep |
70 | (package | |
71 | (name "grep") | |
c4a298c5 | 72 | (version "2.21") |
6794b278 | 73 | (source (origin |
87f5d366 | 74 | (method url-fetch) |
0db342a5 | 75 | (uri (string-append "mirror://gnu/grep/grep-" |
6794b278 LC |
76 | version ".tar.xz")) |
77 | (sha256 | |
78 | (base32 | |
a068dba7 MW |
79 | "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j")) |
80 | (patches (list (search-patch "grep-CVE-2015-1345.patch"))))) | |
6794b278 | 81 | (build-system gnu-build-system) |
f50d2669 | 82 | (synopsis "Print lines matching a pattern") |
d45122f5 | 83 | (description |
12bcf94a | 84 | "grep is a tool for finding text inside files. Text is found by |
a22dc0c4 | 85 | matching a pattern provided by the user in one or many files. The pattern |
79c311b8 LC |
86 | may be provided as a basic or extended regular expression, or as fixed |
87 | strings. By default, the matching text is simply printed to the screen, | |
88 | however the output can be greatly customized to include, for example, line | |
89 | numbers. GNU grep offers many extensions over the standard utility, | |
90 | including, for example, recursive directory searching.") | |
4a44e743 | 91 | (license gpl3+) |
6794b278 LC |
92 | (home-page "http://www.gnu.org/software/grep/"))) |
93 | ||
8dcad9aa LC |
94 | (define-public sed |
95 | (package | |
96 | (name "sed") | |
847e7725 | 97 | (version "4.2.2") |
8dcad9aa | 98 | (source (origin |
87f5d366 | 99 | (method url-fetch) |
0db342a5 | 100 | (uri (string-append "mirror://gnu/sed/sed-" version |
8dcad9aa LC |
101 | ".tar.bz2")) |
102 | (sha256 | |
103 | (base32 | |
56eba3d1 MR |
104 | "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h")) |
105 | (patches (list (search-patch "sed-hurd-path-max.patch"))))) | |
8dcad9aa | 106 | (build-system gnu-build-system) |
f50d2669 | 107 | (synopsis "Stream editor") |
52b8e5fc | 108 | (arguments |
c8c6bba5 LC |
109 | (if (%current-target-system) |
110 | '() | |
111 | `(#:phases (alist-cons-before | |
112 | 'patch-source-shebangs 'patch-test-suite | |
113 | (lambda* (#:key inputs #:allow-other-keys) | |
114 | (let ((bash (assoc-ref inputs "bash"))) | |
115 | (patch-makefile-SHELL "testsuite/Makefile.tests") | |
116 | (substitute* '("testsuite/bsd.sh" | |
117 | "testsuite/bug-regex9.c") | |
118 | (("/bin/sh") | |
119 | (string-append bash "/bin/bash"))))) | |
120 | %standard-phases)))) | |
d45122f5 | 121 | (description |
a22dc0c4 LC |
122 | "Sed is a non-interactive, text stream editor. It receives a text |
123 | input from a file or from standard input and it then applies a series of text | |
124 | editing commands to the stream and prints its output to standard output. It | |
79c311b8 LC |
125 | is often used for substituting text patterns in a stream. The GNU |
126 | implementation offers several extensions over the standard utility.") | |
4a44e743 | 127 | (license gpl3+) |
8dcad9aa LC |
128 | (home-page "http://www.gnu.org/software/sed/"))) |
129 | ||
85240322 LC |
130 | (define-public tar |
131 | (package | |
132 | (name "tar") | |
d6535cf1 | 133 | (version "1.28") |
85240322 | 134 | (source (origin |
87f5d366 | 135 | (method url-fetch) |
0db342a5 | 136 | (uri (string-append "mirror://gnu/tar/tar-" |
d6535cf1 | 137 | version ".tar.xz")) |
85240322 LC |
138 | (sha256 |
139 | (base32 | |
94d915d0 | 140 | "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4")) |
d3b4c135 LC |
141 | (patches (map search-patch |
142 | '("tar-d_ino_in_dirent-fix.patch" | |
143 | "tar-skip-unreliable-tests.patch"))))) | |
85240322 | 144 | (build-system gnu-build-system) |
f50d2669 | 145 | (synopsis "Managing tar archives") |
d45122f5 | 146 | (description |
a22dc0c4 LC |
147 | "Tar provides the ability to create tar archives, as well as the |
148 | ability to extract, update or list files in an existing archive. It is | |
149 | useful for combining many files into one larger file, while maintaining | |
150 | directory structure and file information such as permissions and | |
79c311b8 LC |
151 | creation/modification dates. GNU tar offers many extensions over the |
152 | standard utility.") | |
4a44e743 | 153 | (license gpl3+) |
85240322 LC |
154 | (home-page "http://www.gnu.org/software/tar/"))) |
155 | ||
fbeec3d9 LC |
156 | (define-public patch |
157 | (package | |
158 | (name "patch") | |
266d26df | 159 | (version "2.7.5") |
f6408bc5 LC |
160 | (source (origin |
161 | (method url-fetch) | |
162 | (uri (string-append "mirror://gnu/patch/patch-" | |
163 | version ".tar.xz")) | |
164 | (sha256 | |
165 | (base32 | |
16cae799 MR |
166 | "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx")) |
167 | (patches (list (search-patch "patch-hurd-path-max.patch"))))) | |
fbeec3d9 | 168 | (build-system gnu-build-system) |
00e79195 | 169 | (native-inputs `(("ed", ed))) |
f50d2669 | 170 | (synopsis "Apply differences to originals, with optional backups") |
d45122f5 | 171 | (description |
a22dc0c4 | 172 | "Patch is a program that applies changes to files based on differences |
79c311b8 | 173 | laid out as by the program \"diff\". The changes may be applied to one or more |
a22dc0c4 LC |
174 | files depending on the contents of the diff file. It accepts several |
175 | different diff formats. It may also be used to revert previously applied | |
176 | differences.") | |
4a44e743 | 177 | (license gpl3+) |
fbeec3d9 LC |
178 | (home-page "http://savannah.gnu.org/projects/patch/"))) |
179 | ||
04a32ee5 LC |
180 | (define-public diffutils |
181 | (package | |
182 | (name "diffutils") | |
d83ae724 | 183 | (version "3.3") |
04a32ee5 | 184 | (source (origin |
87f5d366 | 185 | (method url-fetch) |
0db342a5 | 186 | (uri (string-append "mirror://gnu/diffutils/diffutils-" |
04a32ee5 LC |
187 | version ".tar.xz")) |
188 | (sha256 | |
189 | (base32 | |
d83ae724 | 190 | "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2")))) |
04a32ee5 | 191 | (build-system gnu-build-system) |
f50d2669 | 192 | (synopsis "Comparing and merging files") |
d45122f5 | 193 | (description |
79c311b8 LC |
194 | "GNU Diffutils is a package containing tools for finding the |
195 | differences between files. The \"diff\" command is used to show how two files | |
e881752c | 196 | differ, while \"cmp\" shows the offsets and line numbers where they differ. |
79c311b8 | 197 | \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an |
a22dc0c4 | 198 | interactive means to merge two files.") |
4a44e743 | 199 | (license gpl3+) |
04a32ee5 LC |
200 | (home-page "http://www.gnu.org/software/diffutils/"))) |
201 | ||
af5521ca LC |
202 | (define-public findutils |
203 | (package | |
204 | (name "findutils") | |
205 | (version "4.4.2") | |
206 | (source (origin | |
87f5d366 | 207 | (method url-fetch) |
0db342a5 | 208 | (uri (string-append "mirror://gnu/findutils/findutils-" |
af5521ca LC |
209 | version ".tar.gz")) |
210 | (sha256 | |
211 | (base32 | |
de80b504 | 212 | "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3")) |
67dfa198 LC |
213 | (patches (map search-patch |
214 | '("findutils-absolute-paths.patch" | |
215 | "findutils-localstatedir.patch"))))) | |
af5521ca | 216 | (build-system gnu-build-system) |
af5521ca | 217 | (arguments |
67dfa198 LC |
218 | `(#:configure-flags (list |
219 | ;; Tell 'updatedb' to write to /var. | |
220 | "--localstatedir=/var" | |
221 | ||
222 | ;; Work around cross-compilation failure. See | |
223 | ;; <http://savannah.gnu.org/bugs/?27299#comment1>. | |
224 | ,@(if (%current-target-system) | |
225 | '("gl_cv_func_wcwidth_works=yes") | |
226 | '())))) | |
f50d2669 | 227 | (synopsis "Operating on files matching given criteria") |
d45122f5 | 228 | (description |
a22dc0c4 LC |
229 | "Findutils supplies the basic file directory searching utilities of the |
230 | GNU system. It consists of two primary searching utilities: \"find\" | |
231 | recursively searches for files in a directory according to given criteria and | |
232 | \"locate\" lists files in a database that match a query. Two auxiliary tools | |
79c311b8 LC |
233 | are included: \"updatedb\" updates the file name database and \"xargs\" may be |
234 | used to apply commands with arbitrarily long arguments.") | |
4a44e743 | 235 | (license gpl3+) |
af5521ca | 236 | (home-page "http://www.gnu.org/software/findutils/"))) |
2c957cd2 LC |
237 | |
238 | (define-public coreutils | |
239 | (package | |
240 | (name "coreutils") | |
c2ba49ef | 241 | (version "8.24") |
2c957cd2 | 242 | (source (origin |
87f5d366 | 243 | (method url-fetch) |
0db342a5 | 244 | (uri (string-append "mirror://gnu/coreutils/coreutils-" |
2c957cd2 LC |
245 | version ".tar.xz")) |
246 | (sha256 | |
247 | (base32 | |
c2ba49ef | 248 | "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2")))) |
2c957cd2 | 249 | (build-system gnu-build-system) |
de59af4d | 250 | (inputs `(("acl" ,acl) ; TODO: add SELinux |
09cc7729 LC |
251 | ("gmp" ,gmp) ;bignums in 'expr', yay! |
252 | ("libcap" ,libcap))) ;capability support is 'ls','dir', 'vdir' | |
2c1dea85 LC |
253 | (native-inputs |
254 | ;; Perl is needed to run tests in native builds, and to run the bundled | |
7f31c71c LC |
255 | ;; copy of help2man. However, don't pass it when cross-compiling since |
256 | ;; that would lead it to try to run programs to get their '--help' output | |
257 | ;; for help2man. | |
258 | (if (%current-target-system) | |
259 | '() | |
260 | `(("perl" ,perl)))) | |
9bf62d9b | 261 | (outputs '("out" "debug")) |
2c957cd2 | 262 | (arguments |
8ba8aeb7 LC |
263 | `(#:parallel-build? #f ; help2man may be called too early |
264 | #:phases (alist-cons-before | |
265 | 'build 'patch-shell-references | |
266 | (lambda* (#:key inputs #:allow-other-keys) | |
267 | (let ((bash (assoc-ref inputs "bash"))) | |
b47b2b52 LC |
268 | ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so |
269 | ;; that tests pass, since /bin/sh isn't in the chroot. | |
270 | (setenv "SHELL" (which "sh")) | |
271 | ||
272 | (substitute* (find-files "gnulib-tests" "\\.c$") | |
8ba8aeb7 LC |
273 | (("/bin/sh") |
274 | (format #f "~a/bin/sh" bash))) | |
275 | (substitute* (find-files "tests" "\\.sh$") | |
276 | (("#!/bin/sh") | |
b47b2b52 | 277 | (format #f "#!~a/bin/sh" bash))))) |
56c092ce | 278 | %standard-phases))) |
f50d2669 | 279 | (synopsis "Core GNU utilities (file, text, shell)") |
d45122f5 | 280 | (description |
79c311b8 | 281 | "GNU Coreutils includes all of the basic command-line tools that are |
a22dc0c4 LC |
282 | expected in a POSIX system. These provide the basic file, shell and text |
283 | manipulation functions of the GNU system. Most of these tools offer extended | |
284 | functionality beyond that which is outlined in the POSIX standard.") | |
4a44e743 | 285 | (license gpl3+) |
2c957cd2 | 286 | (home-page "http://www.gnu.org/software/coreutils/"))) |
af5521ca | 287 | |
28cbc587 LC |
288 | (define-public coreutils-light |
289 | ;; Coreutils without its optional dependencies. | |
290 | (package | |
291 | (inherit coreutils) | |
292 | (name "coreutils-light") | |
293 | (outputs '("out")) | |
294 | (inputs '()))) | |
295 | ||
ab776865 LC |
296 | (define-public gnu-make |
297 | (package | |
298 | (name "make") | |
6178ae9c | 299 | (version "4.1") |
ab776865 | 300 | (source (origin |
87f5d366 | 301 | (method url-fetch) |
0db342a5 | 302 | (uri (string-append "mirror://gnu/make/make-" version |
ab776865 LC |
303 | ".tar.bz2")) |
304 | (sha256 | |
305 | (base32 | |
6178ae9c | 306 | "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb")) |
de80b504 | 307 | (patches (list (search-patch "make-impure-dirs.patch"))))) |
ab776865 | 308 | (build-system gnu-build-system) |
aa6b0d6b | 309 | (native-inputs `(("pkg-config", pkg-config))) ; to detect Guile |
ed41d48e | 310 | (inputs `(("guile" ,guile-2.0))) |
9bf62d9b | 311 | (outputs '("out" "debug")) |
ea8fbbf2 | 312 | (arguments |
de80b504 | 313 | '(#:phases (alist-cons-before |
ea8fbbf2 LC |
314 | 'build 'set-default-shell |
315 | (lambda* (#:key inputs #:allow-other-keys) | |
316 | ;; Change the default shell from /bin/sh. | |
317 | (let ((bash (assoc-ref inputs "bash"))) | |
318 | (substitute* "job.c" | |
6178ae9c MW |
319 | (("default_shell =.*$") |
320 | (format #f "default_shell = \"~a/bin/bash\";\n" | |
ea8fbbf2 LC |
321 | bash))))) |
322 | %standard-phases))) | |
f50d2669 | 323 | (synopsis "Remake files automatically") |
d45122f5 | 324 | (description |
a22dc0c4 LC |
325 | "Make is a program that is used to control the production of |
326 | executables or other files from their source files. The process is | |
327 | controlled from a Makefile, in which the developer specifies how each file is | |
328 | generated from its source. It has powerful dependency resolution and the | |
329 | ability to determine when files have to be regenerated after their sources | |
79c311b8 | 330 | change. GNU make offers many powerful extensions over the standard utility.") |
4a44e743 | 331 | (license gpl3+) |
ab776865 LC |
332 | (home-page "http://www.gnu.org/software/make/"))) |
333 | ||
8f6201a3 LC |
334 | (define-public binutils |
335 | (package | |
336 | (name "binutils") | |
f02c902c | 337 | (version "2.25.1") |
8f6201a3 | 338 | (source (origin |
87f5d366 | 339 | (method url-fetch) |
0db342a5 | 340 | (uri (string-append "mirror://gnu/binutils/binutils-" |
8f6201a3 LC |
341 | version ".tar.bz2")) |
342 | (sha256 | |
343 | (base32 | |
f02c902c | 344 | "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm")) |
2c1ceeac | 345 | (patches (list (search-patch "binutils-ld-new-dtags.patch") |
6c95f363 | 346 | (search-patch "binutils-loongson-workaround.patch"))))) |
8f6201a3 LC |
347 | (build-system gnu-build-system) |
348 | ||
349 | ;; TODO: Add dependency on zlib + those for Gold. | |
8f6201a3 | 350 | (arguments |
de80b504 | 351 | `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency |
01d45404 LC |
352 | ;; on GCC when bootstrapping. |
353 | "LDFLAGS=-static-libgcc" | |
8f6201a3 | 354 | |
01d45404 | 355 | ;; Don't search under /usr/lib & co. |
444c64b0 LC |
356 | "--with-lib-path=/no-ld-lib-path" |
357 | ||
358 | ;; Glibc 2.17 has a "comparison of unsigned | |
359 | ;; expression >= 0 is always true" in wchar.h. | |
6c95f363 LC |
360 | "--disable-werror" |
361 | ||
362 | ;; Install BFD. It ends up in a hidden directory, | |
363 | ;; but it's here. | |
cc0a1282 LC |
364 | "--enable-install-libbfd" |
365 | ||
366 | ;; Make sure 'ar' and 'ranlib' produce archives in a | |
367 | ;; deterministic fashion. | |
368 | "--enable-deterministic-archives"))) | |
8f6201a3 | 369 | |
f50d2669 | 370 | (synopsis "Binary utilities: bfd gas gprof ld") |
d45122f5 | 371 | (description |
a22dc0c4 | 372 | "GNU Binutils is a collection of tools for working with binary files. |
c5779c93 LC |
373 | Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler. |
374 | Other tools include programs to display binary profiling information, list | |
375 | the strings in a binary file, and utilities for working with archives. The | |
376 | \"bfd\" library for working with executable and object formats is also | |
377 | included.") | |
4a44e743 | 378 | (license gpl3+) |
8f6201a3 LC |
379 | (home-page "http://www.gnu.org/software/binutils/"))) |
380 | ||
4a740d0f LC |
381 | (define* (make-ld-wrapper name #:key binutils |
382 | (guile (canonical-package guile-2.0)) | |
383 | (bash (canonical-package bash)) target | |
8fdd4101 LC |
384 | (guile-for-build guile)) |
385 | "Return a package called NAME that contains a wrapper for the 'ld' program | |
4a740d0f LC |
386 | of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When |
387 | TARGET is not #f, make a wrapper for the cross-linker for TARGET, called | |
388 | 'TARGET-ld'. The wrapper uses GUILE and BASH." | |
8fdd4101 LC |
389 | (package |
390 | (name name) | |
391 | (version "0") | |
392 | (source #f) | |
393 | (build-system trivial-build-system) | |
394 | (inputs `(("binutils" ,binutils) | |
395 | ("guile" ,guile) | |
396 | ("bash" ,bash) | |
397 | ("wrapper" ,(search-path %load-path | |
c8bfa5b4 | 398 | "gnu/packages/ld-wrapper.in")))) |
8fdd4101 LC |
399 | (arguments |
400 | `(#:guile ,guile-for-build | |
401 | #:modules ((guix build utils)) | |
402 | #:builder (begin | |
403 | (use-modules (guix build utils) | |
404 | (system base compile)) | |
405 | ||
406 | (let* ((out (assoc-ref %outputs "out")) | |
407 | (bin (string-append out "/bin")) | |
4a740d0f LC |
408 | (ld ,(if target |
409 | `(string-append bin "/" ,target "-ld") | |
410 | '(string-append bin "/ld"))) | |
411 | (go (string-append ld ".go"))) | |
8fdd4101 LC |
412 | |
413 | (setvbuf (current-output-port) _IOLBF) | |
414 | (format #t "building ~s/bin/ld wrapper in ~s~%" | |
415 | (assoc-ref %build-inputs "binutils") | |
416 | out) | |
417 | ||
418 | (mkdir-p bin) | |
419 | (copy-file (assoc-ref %build-inputs "wrapper") ld) | |
420 | (substitute* ld | |
9bab6bea LC |
421 | (("@SELF@") |
422 | ld) | |
8fdd4101 LC |
423 | (("@GUILE@") |
424 | (string-append (assoc-ref %build-inputs "guile") | |
425 | "/bin/guile")) | |
426 | (("@BASH@") | |
427 | (string-append (assoc-ref %build-inputs "bash") | |
428 | "/bin/bash")) | |
429 | (("@LD@") | |
430 | (string-append (assoc-ref %build-inputs "binutils") | |
4a740d0f LC |
431 | ,(if target |
432 | (string-append "/bin/" | |
433 | target "-ld") | |
434 | "/bin/ld")))) | |
8fdd4101 LC |
435 | (chmod ld #o555) |
436 | (compile-file ld #:output-file go))))) | |
437 | (synopsis "The linker wrapper") | |
438 | (description | |
439 | "The linker wrapper (or 'ld-wrapper') wraps the linker to add any | |
440 | missing '-rpath' flags, and to detect any misuse of libraries outside of the | |
441 | store.") | |
442 | (home-page "http://www.gnu.org/software/guix/") | |
443 | (license gpl3+))) | |
444 | ||
445 | (export make-ld-wrapper) | |
446 | ||
7cdeac02 LC |
447 | (define-public glibc |
448 | (package | |
449 | (name "glibc") | |
28cbc587 | 450 | (version "2.22") |
7cdeac02 | 451 | (source (origin |
87f5d366 | 452 | (method url-fetch) |
0db342a5 | 453 | (uri (string-append "mirror://gnu/glibc/glibc-" |
7cdeac02 LC |
454 | version ".tar.xz")) |
455 | (sha256 | |
456 | (base32 | |
28cbc587 | 457 | "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb")) |
13990c73 LC |
458 | (snippet |
459 | ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is | |
460 | ;; required on LFS distros to avoid loading the distro's libc.so | |
461 | ;; instead of ours. | |
462 | '(substitute* "sysdeps/unix/sysv/linux/configure" | |
463 | (("use_ldconfig=yes") | |
464 | "use_ldconfig=no"))) | |
1faca892 | 465 | (modules '((guix build utils))) |
fdaae613 | 466 | (patches (list (search-patch "glibc-ldd-x86_64.patch"))))) |
7cdeac02 | 467 | (build-system gnu-build-system) |
0a3da5b7 LC |
468 | |
469 | ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc | |
470 | ;; users should automatically pull Linux headers as well. | |
124b1767 | 471 | (propagated-inputs `(("linux-headers" ,linux-libre-headers))) |
0a3da5b7 | 472 | |
97e11209 | 473 | (outputs '("out" "debug")) |
7f614e49 | 474 | |
7cdeac02 | 475 | (arguments |
8197c978 | 476 | `(#:out-of-source? #t |
211db2f6 LC |
477 | |
478 | ;; In version 2.21, there a race in the 'elf' directory, see | |
479 | ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>. | |
480 | #:parallel-build? #f | |
481 | ||
112da588 | 482 | ;; The libraries have an empty RUNPATH, but some, such as the versioned |
28cbc587 | 483 | ;; libraries (libdl-2.22.so, etc.) have ld.so marked as NEEDED. Since |
112da588 LC |
484 | ;; these libraries are always going to be found anyway, just skip |
485 | ;; RUNPATH checks. | |
486 | #:validate-runpath? #f | |
487 | ||
7cdeac02 LC |
488 | #:configure-flags |
489 | (list "--enable-add-ons" | |
490 | "--sysconfdir=/etc" | |
7f614e49 | 491 | |
97e11209 LC |
492 | ;; Installing a locale archive with all the locales is to |
493 | ;; expensive (~100 MiB), so we rely on users to install the | |
494 | ;; locales they really want. | |
495 | ;; | |
496 | ;; Set the default locale path. In practice, $LOCPATH may be | |
497 | ;; defined to point whatever locales users want. However, setuid | |
498 | ;; binaries don't honor $LOCPATH, so they'll instead look into | |
499 | ;; $libc_cv_localedir; we choose /run/current-system/locale, with | |
500 | ;; the idea that it is going to be populated by the sysadmin. | |
501 | ;; | |
7f614e49 LC |
502 | ;; `--localedir' is not honored, so work around it. |
503 | ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>. | |
97e11209 | 504 | (string-append "libc_cv_localedir=/run/current-system/locale") |
7f614e49 | 505 | |
7cdeac02 LC |
506 | (string-append "--with-headers=" |
507 | (assoc-ref %build-inputs "linux-headers") | |
508 | "/include") | |
5f456680 | 509 | |
fdaae613 | 510 | ;; This is the default for most architectures as of GNU libc 2.21, |
39ccbfad MW |
511 | ;; but we specify it explicitly for clarity and consistency. See |
512 | ;; "kernel-features.h" in the GNU libc for details. | |
513 | "--enable-kernel=2.6.32" | |
5f456680 | 514 | |
6e32f6c0 | 515 | ;; Use our Bash instead of /bin/sh. |
8cd8e97c | 516 | (string-append "BASH_SHELL=" |
6e32f6c0 | 517 | (assoc-ref %build-inputs "bash") |
8cd8e97c LC |
518 | "/bin/bash") |
519 | ||
520 | ;; XXX: Work around "undefined reference to `__stack_chk_guard'". | |
521 | "libc_cv_ssp=no") | |
6e32f6c0 | 522 | |
7cdeac02 | 523 | #:tests? #f ; XXX |
57f65bcc LC |
524 | #:phases (modify-phases %standard-phases |
525 | (add-before | |
526 | 'configure 'pre-configure | |
527 | (lambda* (#:key inputs native-inputs outputs | |
528 | #:allow-other-keys) | |
529 | (let* ((out (assoc-ref outputs "out")) | |
530 | (bin (string-append out "/bin")) | |
531 | ;; FIXME: Normally we would look it up only in INPUTS | |
532 | ;; but cross-base uses it as a native input. | |
533 | (bash (or (assoc-ref inputs "static-bash") | |
534 | (assoc-ref native-inputs "static-bash")))) | |
535 | ;; Use `pwd', not `/bin/pwd'. | |
536 | (substitute* "configure" | |
537 | (("/bin/pwd") "pwd")) | |
538 | ||
539 | ;; Install the rpc data base file under `$out/etc/rpc'. | |
540 | ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ]; | |
541 | (substitute* "sunrpc/Makefile" | |
542 | (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) | |
543 | (string-append out "/etc/rpc" suffix "\n")) | |
544 | (("^install-others =.*$") | |
545 | (string-append "install-others = " out "/etc/rpc\n"))) | |
546 | ||
547 | (substitute* "Makeconfig" | |
548 | ;; According to | |
549 | ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>, | |
550 | ;; linking against libgcc_s is not needed with GCC | |
551 | ;; 4.7.1. | |
552 | ((" -lgcc_s") "")) | |
553 | ||
554 | ;; Have `system' use that Bash. | |
555 | (substitute* "sysdeps/posix/system.c" | |
556 | (("#define[[:blank:]]+SHELL_PATH.*$") | |
557 | (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" | |
558 | bash))) | |
559 | ||
560 | ;; Same for `popen'. | |
561 | (substitute* "libio/iopopen.c" | |
562 | (("/bin/sh") | |
563 | (string-append bash "/bin/bash"))) | |
564 | ||
d56f8d5e LC |
565 | ;; Same for the shell used by the 'exec' functions for |
566 | ;; scripts that lack a shebang. | |
567 | (substitute* (find-files "." "^paths\\.h$") | |
568 | (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$") | |
569 | (string-append "#define _PATH_BSHELL \"" | |
570 | bash "/bin/bash\"\n"))) | |
571 | ||
57f65bcc LC |
572 | ;; Make sure we don't retain a reference to the |
573 | ;; bootstrap Perl. | |
574 | (substitute* "malloc/mtrace.pl" | |
575 | (("^#!.*") | |
576 | ;; The shebang can be omitted, because there's the | |
577 | ;; "bilingual" eval/exec magic at the top of the file. | |
578 | "") | |
579 | (("exec @PERL@") | |
580 | "exec perl")))))))) | |
7f614e49 | 581 | |
90d891fc | 582 | (inputs `(("static-bash" ,static-bash))) |
8fd6487e | 583 | |
6162b95d LC |
584 | ;; To build the manual, we need Texinfo and Perl. Gettext is needed to |
585 | ;; install the message catalogs, with 'msgfmt'. | |
8fd6487e | 586 | (native-inputs `(("texinfo" ,texinfo) |
6162b95d LC |
587 | ("perl" ,perl) |
588 | ("gettext" ,gnu-gettext))) | |
8fd6487e | 589 | |
d6718df4 LC |
590 | (native-search-paths |
591 | ;; Search path for packages that provide locale data. This is useful | |
592 | ;; primarily in build environments. | |
593 | (list (search-path-specification | |
594 | (variable "LOCPATH") | |
8a00b930 | 595 | (files '("lib/locale"))))) |
d6718df4 | 596 | |
d45122f5 LC |
597 | (synopsis "The GNU C Library") |
598 | (description | |
7cdeac02 LC |
599 | "Any Unix-like operating system needs a C library: the library which |
600 | defines the \"system calls\" and other basic facilities such as open, malloc, | |
601 | printf, exit... | |
602 | ||
603 | The GNU C library is used as the C library in the GNU system and most systems | |
604 | with the Linux kernel.") | |
4a44e743 | 605 | (license lgpl2.0+) |
7cdeac02 LC |
606 | (home-page "http://www.gnu.org/software/libc/"))) |
607 | ||
aee6180c LC |
608 | (define-public glibc-locales |
609 | (package | |
610 | (inherit glibc) | |
611 | (name "glibc-locales") | |
612 | (source (origin (inherit (package-source glibc)) | |
613 | (patches (cons (search-patch "glibc-locales.patch") | |
614 | (origin-patches (package-source glibc)))))) | |
615 | (synopsis "All the locales supported by the GNU C Library") | |
616 | (description | |
617 | "This package provides all the locales supported by the GNU C Library, | |
618 | more than 400 in total. To use them set the 'LOCPATH' environment variable to | |
619 | the 'share/locale' sub-directory of this package.") | |
620 | (outputs '("out")) ;110+ MiB | |
605217be | 621 | (native-search-paths '()) |
aee6180c LC |
622 | (arguments |
623 | (let ((args `(#:tests? #f #:strip-binaries? #f | |
624 | ,@(package-arguments glibc)))) | |
625 | (substitute-keyword-arguments args | |
626 | ((#:phases phases) | |
627 | `(alist-replace | |
628 | 'build | |
629 | (lambda* (#:key outputs #:allow-other-keys) | |
630 | (let ((out (assoc-ref outputs "out"))) | |
631 | ;; Delete $out/bin, which contains 'bash'. | |
632 | (delete-file-recursively (string-append out "/bin"))) | |
633 | ||
634 | (zero? (system* "make" "localedata/install-locales" | |
635 | "-j" (number->string (parallel-job-count))))) | |
636 | (alist-delete 'install ,phases))) | |
637 | ((#:configure-flags flags) | |
638 | `(append ,flags | |
b9e02a71 | 639 | ;; Use $(libdir)/locale as is the case by default. |
aee6180c LC |
640 | (list (string-append "libc_cv_localedir=" |
641 | (assoc-ref %outputs "out") | |
b9e02a71 | 642 | "/lib/locale"))))))))) |
aee6180c | 643 | |
c9505f3f LC |
644 | (define-public glibc-utf8-locales |
645 | (package | |
646 | (name "glibc-utf8-locales") | |
647 | (version (package-version glibc)) | |
648 | (source #f) | |
649 | (build-system trivial-build-system) | |
650 | (arguments | |
651 | '(#:modules ((guix build utils)) | |
652 | #:builder (begin | |
653 | (use-modules (srfi srfi-1) | |
654 | (guix build utils)) | |
655 | ||
656 | (let* ((libc (assoc-ref %build-inputs "glibc")) | |
657 | (gzip (assoc-ref %build-inputs "gzip")) | |
658 | (out (assoc-ref %outputs "out")) | |
659 | (localedir (string-append out "/lib/locale"))) | |
660 | ;; 'localedef' needs 'gzip'. | |
661 | (setenv "PATH" (string-append libc "/bin:" gzip "/bin")) | |
662 | ||
663 | (mkdir-p localedir) | |
664 | (every (lambda (locale) | |
665 | (zero? (system* "localedef" "--no-archive" | |
666 | "--prefix" localedir "-i" locale | |
667 | "-f" "UTF-8" | |
668 | (string-append localedir "/" | |
669 | locale | |
670 | ".UTF-8")))) | |
671 | ||
672 | ;; These are the locales commonly used for | |
673 | ;; tests---e.g., in Guile's i18n tests. | |
674 | '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR")))))) | |
675 | (inputs `(("glibc" ,glibc) | |
676 | ("gzip" ,gzip))) | |
677 | (synopsis "Small sample of UTF-8 locales") | |
678 | (description | |
679 | "This package provides a small sample of UTF-8 locales mostly useful in | |
680 | test environments.") | |
681 | (home-page (package-home-page glibc)) | |
682 | (license (package-license glibc)))) | |
aee6180c | 683 | |
ce0614dd LC |
684 | (define-public which |
685 | (package | |
686 | (name "which") | |
70ca2e94 | 687 | (version "2.21") |
ce0614dd LC |
688 | (source (origin |
689 | (method url-fetch) | |
690 | (uri (string-append "mirror://gnu/which/which-" | |
691 | version ".tar.gz")) | |
692 | (sha256 | |
693 | (base32 | |
70ca2e94 | 694 | "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl")))) |
ce0614dd LC |
695 | (build-system gnu-build-system) |
696 | (home-page "https://gnu.org/software/which/") | |
697 | (synopsis "Find full path of shell commands") | |
698 | (description | |
699 | "The which program finds the location of executables in PATH, with a | |
700 | variety of options. It is an alternative to the shell \"type\" built-in | |
701 | command.") | |
702 | (license gpl3+))) ; some files are under GPLv2+ | |
703 | ||
e789d9a8 LC |
704 | (define-public tzdata |
705 | (package | |
706 | (name "tzdata") | |
d8d6d096 | 707 | (version "2015c") |
e789d9a8 LC |
708 | (source (origin |
709 | (method url-fetch) | |
710 | (uri (string-append | |
711 | "http://www.iana.org/time-zones/repository/releases/tzdata" | |
712 | version ".tar.gz")) | |
713 | (sha256 | |
714 | (base32 | |
d8d6d096 | 715 | "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6")))) |
e789d9a8 LC |
716 | (build-system gnu-build-system) |
717 | (arguments | |
718 | '(#:tests? #f | |
719 | #:make-flags (let ((out (assoc-ref %outputs "out")) | |
720 | (tmp (getenv "TMPDIR"))) | |
721 | (list (string-append "TOPDIR=" out) | |
722 | (string-append "TZDIR=" out "/share/zoneinfo") | |
723 | ||
724 | ;; Discard zic, dump, and tzselect, already | |
725 | ;; provided by glibc. | |
726 | (string-append "ETCDIR=" tmp "/etc") | |
727 | ||
728 | ;; Likewise for the C library routines. | |
729 | (string-append "LIBDIR=" tmp "/lib") | |
730 | (string-append "MANDIR=" tmp "/man") | |
731 | ||
732 | "AWK=awk" | |
733 | "CC=gcc")) | |
734 | #:modules ((guix build utils) | |
735 | (guix build gnu-build-system) | |
736 | (srfi srfi-1)) | |
737 | #:phases | |
738 | (alist-replace | |
739 | 'unpack | |
c94d01ba LC |
740 | (lambda* (#:key source inputs #:allow-other-keys) |
741 | (and (zero? (system* "tar" "xvf" source)) | |
e789d9a8 LC |
742 | (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode"))))) |
743 | (alist-cons-after | |
744 | 'install 'post-install | |
745 | (lambda* (#:key outputs #:allow-other-keys) | |
746 | ;; Move data in the right place. | |
747 | (let ((out (assoc-ref outputs "out"))) | |
748 | (copy-recursively (string-append out "/share/zoneinfo-posix") | |
749 | (string-append out "/share/zoneinfo/posix")) | |
750 | (copy-recursively (string-append out "/share/zoneinfo-leaps") | |
751 | (string-append out "/share/zoneinfo/right")) | |
752 | (delete-file-recursively (string-append out "/share/zoneinfo-posix")) | |
753 | (delete-file-recursively (string-append out "/share/zoneinfo-leaps")))) | |
754 | (alist-delete 'configure %standard-phases))))) | |
755 | (inputs `(("tzcode" ,(origin | |
756 | (method url-fetch) | |
757 | (uri (string-append | |
758 | "http://www.iana.org/time-zones/repository/releases/tzcode" | |
759 | version ".tar.gz")) | |
760 | (sha256 | |
761 | (base32 | |
d8d6d096 | 762 | "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz")))))) |
e789d9a8 LC |
763 | (home-page "http://www.iana.org/time-zones") |
764 | (synopsis "Database of current and historical time zones") | |
765 | (description "The Time Zone Database (often called tz or zoneinfo) | |
766 | contains code and data that represent the history of local time for many | |
35b9e423 | 767 | representative locations around the globe. It is updated periodically to |
e789d9a8 LC |
768 | reflect changes made by political bodies to time zone boundaries, UTC offsets, |
769 | and daylight-saving rules.") | |
770 | (license public-domain))) | |
771 | ||
bdb36958 LC |
772 | (define-public (canonical-package package) |
773 | ;; Avoid circular dependency by lazily resolving 'commencement'. | |
774 | (let* ((iface (resolve-interface '(gnu packages commencement))) | |
775 | (proc (module-ref iface 'canonical-package))) | |
776 | (proc package))) | |
571aa6cd | 777 | |
1722d680 | 778 | ;;; base.scm ends here |