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 |
2c1dea85 LC |
251 | ("gmp" ,gmp))) |
252 | (native-inputs | |
253 | ;; Perl is needed to run tests in native builds, and to run the bundled | |
7f31c71c LC |
254 | ;; copy of help2man. However, don't pass it when cross-compiling since |
255 | ;; that would lead it to try to run programs to get their '--help' output | |
256 | ;; for help2man. | |
257 | (if (%current-target-system) | |
258 | '() | |
259 | `(("perl" ,perl)))) | |
9bf62d9b | 260 | (outputs '("out" "debug")) |
2c957cd2 | 261 | (arguments |
8ba8aeb7 LC |
262 | `(#:parallel-build? #f ; help2man may be called too early |
263 | #:phases (alist-cons-before | |
264 | 'build 'patch-shell-references | |
265 | (lambda* (#:key inputs #:allow-other-keys) | |
266 | (let ((bash (assoc-ref inputs "bash"))) | |
b47b2b52 LC |
267 | ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so |
268 | ;; that tests pass, since /bin/sh isn't in the chroot. | |
269 | (setenv "SHELL" (which "sh")) | |
270 | ||
271 | (substitute* (find-files "gnulib-tests" "\\.c$") | |
8ba8aeb7 LC |
272 | (("/bin/sh") |
273 | (format #f "~a/bin/sh" bash))) | |
274 | (substitute* (find-files "tests" "\\.sh$") | |
275 | (("#!/bin/sh") | |
b47b2b52 | 276 | (format #f "#!~a/bin/sh" bash))))) |
56c092ce | 277 | %standard-phases))) |
f50d2669 | 278 | (synopsis "Core GNU utilities (file, text, shell)") |
d45122f5 | 279 | (description |
79c311b8 | 280 | "GNU Coreutils includes all of the basic command-line tools that are |
a22dc0c4 LC |
281 | expected in a POSIX system. These provide the basic file, shell and text |
282 | manipulation functions of the GNU system. Most of these tools offer extended | |
283 | functionality beyond that which is outlined in the POSIX standard.") | |
4a44e743 | 284 | (license gpl3+) |
2c957cd2 | 285 | (home-page "http://www.gnu.org/software/coreutils/"))) |
af5521ca | 286 | |
ab776865 LC |
287 | (define-public gnu-make |
288 | (package | |
289 | (name "make") | |
6178ae9c | 290 | (version "4.1") |
ab776865 | 291 | (source (origin |
87f5d366 | 292 | (method url-fetch) |
0db342a5 | 293 | (uri (string-append "mirror://gnu/make/make-" version |
ab776865 LC |
294 | ".tar.bz2")) |
295 | (sha256 | |
296 | (base32 | |
6178ae9c | 297 | "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb")) |
de80b504 | 298 | (patches (list (search-patch "make-impure-dirs.patch"))))) |
ab776865 | 299 | (build-system gnu-build-system) |
aa6b0d6b | 300 | (native-inputs `(("pkg-config", pkg-config))) ; to detect Guile |
ed41d48e | 301 | (inputs `(("guile" ,guile-2.0))) |
9bf62d9b | 302 | (outputs '("out" "debug")) |
ea8fbbf2 | 303 | (arguments |
de80b504 | 304 | '(#:phases (alist-cons-before |
ea8fbbf2 LC |
305 | 'build 'set-default-shell |
306 | (lambda* (#:key inputs #:allow-other-keys) | |
307 | ;; Change the default shell from /bin/sh. | |
308 | (let ((bash (assoc-ref inputs "bash"))) | |
309 | (substitute* "job.c" | |
6178ae9c MW |
310 | (("default_shell =.*$") |
311 | (format #f "default_shell = \"~a/bin/bash\";\n" | |
ea8fbbf2 LC |
312 | bash))))) |
313 | %standard-phases))) | |
f50d2669 | 314 | (synopsis "Remake files automatically") |
d45122f5 | 315 | (description |
a22dc0c4 LC |
316 | "Make is a program that is used to control the production of |
317 | executables or other files from their source files. The process is | |
318 | controlled from a Makefile, in which the developer specifies how each file is | |
319 | generated from its source. It has powerful dependency resolution and the | |
320 | ability to determine when files have to be regenerated after their sources | |
79c311b8 | 321 | change. GNU make offers many powerful extensions over the standard utility.") |
4a44e743 | 322 | (license gpl3+) |
ab776865 LC |
323 | (home-page "http://www.gnu.org/software/make/"))) |
324 | ||
8f6201a3 LC |
325 | (define-public binutils |
326 | (package | |
327 | (name "binutils") | |
f02c902c | 328 | (version "2.25.1") |
8f6201a3 | 329 | (source (origin |
87f5d366 | 330 | (method url-fetch) |
0db342a5 | 331 | (uri (string-append "mirror://gnu/binutils/binutils-" |
8f6201a3 LC |
332 | version ".tar.bz2")) |
333 | (sha256 | |
334 | (base32 | |
f02c902c | 335 | "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm")) |
2c1ceeac | 336 | (patches (list (search-patch "binutils-ld-new-dtags.patch") |
6c95f363 | 337 | (search-patch "binutils-loongson-workaround.patch"))))) |
8f6201a3 LC |
338 | (build-system gnu-build-system) |
339 | ||
340 | ;; TODO: Add dependency on zlib + those for Gold. | |
8f6201a3 | 341 | (arguments |
de80b504 | 342 | `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency |
01d45404 LC |
343 | ;; on GCC when bootstrapping. |
344 | "LDFLAGS=-static-libgcc" | |
8f6201a3 | 345 | |
01d45404 | 346 | ;; Don't search under /usr/lib & co. |
444c64b0 LC |
347 | "--with-lib-path=/no-ld-lib-path" |
348 | ||
349 | ;; Glibc 2.17 has a "comparison of unsigned | |
350 | ;; expression >= 0 is always true" in wchar.h. | |
6c95f363 LC |
351 | "--disable-werror" |
352 | ||
353 | ;; Install BFD. It ends up in a hidden directory, | |
354 | ;; but it's here. | |
cc0a1282 LC |
355 | "--enable-install-libbfd" |
356 | ||
357 | ;; Make sure 'ar' and 'ranlib' produce archives in a | |
358 | ;; deterministic fashion. | |
359 | "--enable-deterministic-archives"))) | |
8f6201a3 | 360 | |
f50d2669 | 361 | (synopsis "Binary utilities: bfd gas gprof ld") |
d45122f5 | 362 | (description |
a22dc0c4 | 363 | "GNU Binutils is a collection of tools for working with binary files. |
c5779c93 LC |
364 | Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler. |
365 | Other tools include programs to display binary profiling information, list | |
366 | the strings in a binary file, and utilities for working with archives. The | |
367 | \"bfd\" library for working with executable and object formats is also | |
368 | included.") | |
4a44e743 | 369 | (license gpl3+) |
8f6201a3 LC |
370 | (home-page "http://www.gnu.org/software/binutils/"))) |
371 | ||
4a740d0f LC |
372 | (define* (make-ld-wrapper name #:key binutils |
373 | (guile (canonical-package guile-2.0)) | |
374 | (bash (canonical-package bash)) target | |
8fdd4101 LC |
375 | (guile-for-build guile)) |
376 | "Return a package called NAME that contains a wrapper for the 'ld' program | |
4a740d0f LC |
377 | of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When |
378 | TARGET is not #f, make a wrapper for the cross-linker for TARGET, called | |
379 | 'TARGET-ld'. The wrapper uses GUILE and BASH." | |
8fdd4101 LC |
380 | (package |
381 | (name name) | |
382 | (version "0") | |
383 | (source #f) | |
384 | (build-system trivial-build-system) | |
385 | (inputs `(("binutils" ,binutils) | |
386 | ("guile" ,guile) | |
387 | ("bash" ,bash) | |
388 | ("wrapper" ,(search-path %load-path | |
c8bfa5b4 | 389 | "gnu/packages/ld-wrapper.in")))) |
8fdd4101 LC |
390 | (arguments |
391 | `(#:guile ,guile-for-build | |
392 | #:modules ((guix build utils)) | |
393 | #:builder (begin | |
394 | (use-modules (guix build utils) | |
395 | (system base compile)) | |
396 | ||
397 | (let* ((out (assoc-ref %outputs "out")) | |
398 | (bin (string-append out "/bin")) | |
4a740d0f LC |
399 | (ld ,(if target |
400 | `(string-append bin "/" ,target "-ld") | |
401 | '(string-append bin "/ld"))) | |
402 | (go (string-append ld ".go"))) | |
8fdd4101 LC |
403 | |
404 | (setvbuf (current-output-port) _IOLBF) | |
405 | (format #t "building ~s/bin/ld wrapper in ~s~%" | |
406 | (assoc-ref %build-inputs "binutils") | |
407 | out) | |
408 | ||
409 | (mkdir-p bin) | |
410 | (copy-file (assoc-ref %build-inputs "wrapper") ld) | |
411 | (substitute* ld | |
9bab6bea LC |
412 | (("@SELF@") |
413 | ld) | |
8fdd4101 LC |
414 | (("@GUILE@") |
415 | (string-append (assoc-ref %build-inputs "guile") | |
416 | "/bin/guile")) | |
417 | (("@BASH@") | |
418 | (string-append (assoc-ref %build-inputs "bash") | |
419 | "/bin/bash")) | |
420 | (("@LD@") | |
421 | (string-append (assoc-ref %build-inputs "binutils") | |
4a740d0f LC |
422 | ,(if target |
423 | (string-append "/bin/" | |
424 | target "-ld") | |
425 | "/bin/ld")))) | |
8fdd4101 LC |
426 | (chmod ld #o555) |
427 | (compile-file ld #:output-file go))))) | |
428 | (synopsis "The linker wrapper") | |
429 | (description | |
430 | "The linker wrapper (or 'ld-wrapper') wraps the linker to add any | |
431 | missing '-rpath' flags, and to detect any misuse of libraries outside of the | |
432 | store.") | |
433 | (home-page "http://www.gnu.org/software/guix/") | |
434 | (license gpl3+))) | |
435 | ||
436 | (export make-ld-wrapper) | |
437 | ||
7cdeac02 LC |
438 | (define-public glibc |
439 | (package | |
440 | (name "glibc") | |
fdaae613 | 441 | (version "2.21") |
7cdeac02 | 442 | (source (origin |
87f5d366 | 443 | (method url-fetch) |
0db342a5 | 444 | (uri (string-append "mirror://gnu/glibc/glibc-" |
7cdeac02 LC |
445 | version ".tar.xz")) |
446 | (sha256 | |
447 | (base32 | |
fdaae613 | 448 | "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf")) |
13990c73 LC |
449 | (snippet |
450 | ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is | |
451 | ;; required on LFS distros to avoid loading the distro's libc.so | |
452 | ;; instead of ours. | |
453 | '(substitute* "sysdeps/unix/sysv/linux/configure" | |
454 | (("use_ldconfig=yes") | |
455 | "use_ldconfig=no"))) | |
1faca892 | 456 | (modules '((guix build utils))) |
fdaae613 | 457 | (patches (list (search-patch "glibc-ldd-x86_64.patch"))))) |
7cdeac02 | 458 | (build-system gnu-build-system) |
0a3da5b7 LC |
459 | |
460 | ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc | |
461 | ;; users should automatically pull Linux headers as well. | |
124b1767 | 462 | (propagated-inputs `(("linux-headers" ,linux-libre-headers))) |
0a3da5b7 | 463 | |
97e11209 | 464 | (outputs '("out" "debug")) |
7f614e49 | 465 | |
7cdeac02 | 466 | (arguments |
8197c978 | 467 | `(#:out-of-source? #t |
211db2f6 LC |
468 | |
469 | ;; In version 2.21, there a race in the 'elf' directory, see | |
470 | ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>. | |
471 | #:parallel-build? #f | |
472 | ||
112da588 LC |
473 | ;; The libraries have an empty RUNPATH, but some, such as the versioned |
474 | ;; libraries (libdl-2.21.so, etc.) have ld.so marked as NEEDED. Since | |
475 | ;; these libraries are always going to be found anyway, just skip | |
476 | ;; RUNPATH checks. | |
477 | #:validate-runpath? #f | |
478 | ||
7cdeac02 LC |
479 | #:configure-flags |
480 | (list "--enable-add-ons" | |
481 | "--sysconfdir=/etc" | |
7f614e49 | 482 | |
97e11209 LC |
483 | ;; Installing a locale archive with all the locales is to |
484 | ;; expensive (~100 MiB), so we rely on users to install the | |
485 | ;; locales they really want. | |
486 | ;; | |
487 | ;; Set the default locale path. In practice, $LOCPATH may be | |
488 | ;; defined to point whatever locales users want. However, setuid | |
489 | ;; binaries don't honor $LOCPATH, so they'll instead look into | |
490 | ;; $libc_cv_localedir; we choose /run/current-system/locale, with | |
491 | ;; the idea that it is going to be populated by the sysadmin. | |
492 | ;; | |
7f614e49 LC |
493 | ;; `--localedir' is not honored, so work around it. |
494 | ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>. | |
97e11209 | 495 | (string-append "libc_cv_localedir=/run/current-system/locale") |
7f614e49 | 496 | |
7cdeac02 LC |
497 | (string-append "--with-headers=" |
498 | (assoc-ref %build-inputs "linux-headers") | |
499 | "/include") | |
5f456680 | 500 | |
fdaae613 | 501 | ;; This is the default for most architectures as of GNU libc 2.21, |
39ccbfad MW |
502 | ;; but we specify it explicitly for clarity and consistency. See |
503 | ;; "kernel-features.h" in the GNU libc for details. | |
504 | "--enable-kernel=2.6.32" | |
5f456680 | 505 | |
6e32f6c0 | 506 | ;; Use our Bash instead of /bin/sh. |
8cd8e97c | 507 | (string-append "BASH_SHELL=" |
6e32f6c0 | 508 | (assoc-ref %build-inputs "bash") |
8cd8e97c LC |
509 | "/bin/bash") |
510 | ||
511 | ;; XXX: Work around "undefined reference to `__stack_chk_guard'". | |
512 | "libc_cv_ssp=no") | |
6e32f6c0 | 513 | |
7cdeac02 LC |
514 | #:tests? #f ; XXX |
515 | #:phases (alist-cons-before | |
516 | 'configure 'pre-configure | |
6170834d LC |
517 | (lambda* (#:key inputs native-inputs outputs |
518 | #:allow-other-keys) | |
6e32f6c0 LC |
519 | (let* ((out (assoc-ref outputs "out")) |
520 | (bin (string-append out "/bin"))) | |
7cdeac02 LC |
521 | ;; Use `pwd', not `/bin/pwd'. |
522 | (substitute* "configure" | |
0a3da5b7 | 523 | (("/bin/pwd") "pwd")) |
7cdeac02 LC |
524 | |
525 | ;; Install the rpc data base file under `$out/etc/rpc'. | |
8197c978 | 526 | ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ]; |
7cdeac02 LC |
527 | (substitute* "sunrpc/Makefile" |
528 | (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) | |
529 | (string-append out "/etc/rpc" suffix "\n")) | |
530 | (("^install-others =.*$") | |
321b0996 LC |
531 | (string-append "install-others = " out "/etc/rpc\n"))) |
532 | ||
533 | (substitute* "Makeconfig" | |
534 | ;; According to | |
535 | ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>, | |
536 | ;; linking against libgcc_s is not needed with GCC | |
537 | ;; 4.7.1. | |
6e32f6c0 LC |
538 | ((" -lgcc_s") "")) |
539 | ||
46866fad LC |
540 | ;; Copy a statically-linked Bash in the output, with |
541 | ;; no references to other store paths. | |
6170834d LC |
542 | ;; FIXME: Normally we would look it up only in INPUTS but |
543 | ;; cross-base uses it as a native input. | |
6e32f6c0 | 544 | (mkdir-p bin) |
6170834d LC |
545 | (copy-file (string-append (or (assoc-ref inputs |
546 | "static-bash") | |
547 | (assoc-ref native-inputs | |
548 | "static-bash")) | |
46866fad | 549 | "/bin/bash") |
6e32f6c0 | 550 | (string-append bin "/bash")) |
46866fad | 551 | (remove-store-references (string-append bin "/bash")) |
6e32f6c0 LC |
552 | (chmod (string-append bin "/bash") #o555) |
553 | ||
46866fad LC |
554 | ;; Keep a symlink, for `patch-shebang' resolution. |
555 | (with-directory-excursion bin | |
556 | (symlink "bash" "sh")) | |
557 | ||
6e32f6c0 LC |
558 | ;; Have `system' use that Bash. |
559 | (substitute* "sysdeps/posix/system.c" | |
560 | (("#define[[:blank:]]+SHELL_PATH.*$") | |
561 | (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" | |
562 | out))) | |
563 | ||
564 | ;; Same for `popen'. | |
565 | (substitute* "libio/iopopen.c" | |
566 | (("/bin/sh") | |
2ed6aa9e LC |
567 | (string-append out "/bin/bash"))) |
568 | ||
569 | ;; Make sure we don't retain a reference to the | |
570 | ;; bootstrap Perl. | |
571 | (substitute* "malloc/mtrace.pl" | |
572 | (("^#!.*") | |
573 | ;; The shebang can be omitted, because there's the | |
574 | ;; "bilingual" eval/exec magic at the top of the file. | |
575 | "") | |
576 | (("exec @PERL@") | |
577 | "exec perl")))) | |
97e11209 | 578 | %standard-phases))) |
7f614e49 | 579 | |
de80b504 | 580 | (inputs `(("static-bash" ,(static-package bash-light)))) |
8fd6487e | 581 | |
6162b95d LC |
582 | ;; To build the manual, we need Texinfo and Perl. Gettext is needed to |
583 | ;; install the message catalogs, with 'msgfmt'. | |
8fd6487e | 584 | (native-inputs `(("texinfo" ,texinfo) |
6162b95d LC |
585 | ("perl" ,perl) |
586 | ("gettext" ,gnu-gettext))) | |
8fd6487e | 587 | |
d6718df4 LC |
588 | (native-search-paths |
589 | ;; Search path for packages that provide locale data. This is useful | |
590 | ;; primarily in build environments. | |
591 | (list (search-path-specification | |
592 | (variable "LOCPATH") | |
8a00b930 | 593 | (files '("lib/locale"))))) |
d6718df4 | 594 | |
d45122f5 LC |
595 | (synopsis "The GNU C Library") |
596 | (description | |
7cdeac02 LC |
597 | "Any Unix-like operating system needs a C library: the library which |
598 | defines the \"system calls\" and other basic facilities such as open, malloc, | |
599 | printf, exit... | |
600 | ||
601 | The GNU C library is used as the C library in the GNU system and most systems | |
602 | with the Linux kernel.") | |
4a44e743 | 603 | (license lgpl2.0+) |
7cdeac02 LC |
604 | (home-page "http://www.gnu.org/software/libc/"))) |
605 | ||
aee6180c LC |
606 | (define-public glibc-locales |
607 | (package | |
608 | (inherit glibc) | |
609 | (name "glibc-locales") | |
610 | (source (origin (inherit (package-source glibc)) | |
611 | (patches (cons (search-patch "glibc-locales.patch") | |
612 | (origin-patches (package-source glibc)))))) | |
613 | (synopsis "All the locales supported by the GNU C Library") | |
614 | (description | |
615 | "This package provides all the locales supported by the GNU C Library, | |
616 | more than 400 in total. To use them set the 'LOCPATH' environment variable to | |
617 | the 'share/locale' sub-directory of this package.") | |
618 | (outputs '("out")) ;110+ MiB | |
605217be | 619 | (native-search-paths '()) |
aee6180c LC |
620 | (arguments |
621 | (let ((args `(#:tests? #f #:strip-binaries? #f | |
622 | ,@(package-arguments glibc)))) | |
623 | (substitute-keyword-arguments args | |
624 | ((#:phases phases) | |
625 | `(alist-replace | |
626 | 'build | |
627 | (lambda* (#:key outputs #:allow-other-keys) | |
628 | (let ((out (assoc-ref outputs "out"))) | |
629 | ;; Delete $out/bin, which contains 'bash'. | |
630 | (delete-file-recursively (string-append out "/bin"))) | |
631 | ||
632 | (zero? (system* "make" "localedata/install-locales" | |
633 | "-j" (number->string (parallel-job-count))))) | |
634 | (alist-delete 'install ,phases))) | |
635 | ((#:configure-flags flags) | |
636 | `(append ,flags | |
b9e02a71 | 637 | ;; Use $(libdir)/locale as is the case by default. |
aee6180c LC |
638 | (list (string-append "libc_cv_localedir=" |
639 | (assoc-ref %outputs "out") | |
b9e02a71 | 640 | "/lib/locale"))))))))) |
aee6180c | 641 | |
c9505f3f LC |
642 | (define-public glibc-utf8-locales |
643 | (package | |
644 | (name "glibc-utf8-locales") | |
645 | (version (package-version glibc)) | |
646 | (source #f) | |
647 | (build-system trivial-build-system) | |
648 | (arguments | |
649 | '(#:modules ((guix build utils)) | |
650 | #:builder (begin | |
651 | (use-modules (srfi srfi-1) | |
652 | (guix build utils)) | |
653 | ||
654 | (let* ((libc (assoc-ref %build-inputs "glibc")) | |
655 | (gzip (assoc-ref %build-inputs "gzip")) | |
656 | (out (assoc-ref %outputs "out")) | |
657 | (localedir (string-append out "/lib/locale"))) | |
658 | ;; 'localedef' needs 'gzip'. | |
659 | (setenv "PATH" (string-append libc "/bin:" gzip "/bin")) | |
660 | ||
661 | (mkdir-p localedir) | |
662 | (every (lambda (locale) | |
663 | (zero? (system* "localedef" "--no-archive" | |
664 | "--prefix" localedir "-i" locale | |
665 | "-f" "UTF-8" | |
666 | (string-append localedir "/" | |
667 | locale | |
668 | ".UTF-8")))) | |
669 | ||
670 | ;; These are the locales commonly used for | |
671 | ;; tests---e.g., in Guile's i18n tests. | |
672 | '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR")))))) | |
673 | (inputs `(("glibc" ,glibc) | |
674 | ("gzip" ,gzip))) | |
675 | (synopsis "Small sample of UTF-8 locales") | |
676 | (description | |
677 | "This package provides a small sample of UTF-8 locales mostly useful in | |
678 | test environments.") | |
679 | (home-page (package-home-page glibc)) | |
680 | (license (package-license glibc)))) | |
aee6180c | 681 | |
ce0614dd LC |
682 | (define-public which |
683 | (package | |
684 | (name "which") | |
70ca2e94 | 685 | (version "2.21") |
ce0614dd LC |
686 | (source (origin |
687 | (method url-fetch) | |
688 | (uri (string-append "mirror://gnu/which/which-" | |
689 | version ".tar.gz")) | |
690 | (sha256 | |
691 | (base32 | |
70ca2e94 | 692 | "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl")))) |
ce0614dd LC |
693 | (build-system gnu-build-system) |
694 | (home-page "https://gnu.org/software/which/") | |
695 | (synopsis "Find full path of shell commands") | |
696 | (description | |
697 | "The which program finds the location of executables in PATH, with a | |
698 | variety of options. It is an alternative to the shell \"type\" built-in | |
699 | command.") | |
700 | (license gpl3+))) ; some files are under GPLv2+ | |
701 | ||
e789d9a8 LC |
702 | (define-public tzdata |
703 | (package | |
704 | (name "tzdata") | |
d8d6d096 | 705 | (version "2015c") |
e789d9a8 LC |
706 | (source (origin |
707 | (method url-fetch) | |
708 | (uri (string-append | |
709 | "http://www.iana.org/time-zones/repository/releases/tzdata" | |
710 | version ".tar.gz")) | |
711 | (sha256 | |
712 | (base32 | |
d8d6d096 | 713 | "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6")))) |
e789d9a8 LC |
714 | (build-system gnu-build-system) |
715 | (arguments | |
716 | '(#:tests? #f | |
717 | #:make-flags (let ((out (assoc-ref %outputs "out")) | |
718 | (tmp (getenv "TMPDIR"))) | |
719 | (list (string-append "TOPDIR=" out) | |
720 | (string-append "TZDIR=" out "/share/zoneinfo") | |
721 | ||
722 | ;; Discard zic, dump, and tzselect, already | |
723 | ;; provided by glibc. | |
724 | (string-append "ETCDIR=" tmp "/etc") | |
725 | ||
726 | ;; Likewise for the C library routines. | |
727 | (string-append "LIBDIR=" tmp "/lib") | |
728 | (string-append "MANDIR=" tmp "/man") | |
729 | ||
730 | "AWK=awk" | |
731 | "CC=gcc")) | |
732 | #:modules ((guix build utils) | |
733 | (guix build gnu-build-system) | |
734 | (srfi srfi-1)) | |
735 | #:phases | |
736 | (alist-replace | |
737 | 'unpack | |
c94d01ba LC |
738 | (lambda* (#:key source inputs #:allow-other-keys) |
739 | (and (zero? (system* "tar" "xvf" source)) | |
e789d9a8 LC |
740 | (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode"))))) |
741 | (alist-cons-after | |
742 | 'install 'post-install | |
743 | (lambda* (#:key outputs #:allow-other-keys) | |
744 | ;; Move data in the right place. | |
745 | (let ((out (assoc-ref outputs "out"))) | |
746 | (copy-recursively (string-append out "/share/zoneinfo-posix") | |
747 | (string-append out "/share/zoneinfo/posix")) | |
748 | (copy-recursively (string-append out "/share/zoneinfo-leaps") | |
749 | (string-append out "/share/zoneinfo/right")) | |
750 | (delete-file-recursively (string-append out "/share/zoneinfo-posix")) | |
751 | (delete-file-recursively (string-append out "/share/zoneinfo-leaps")))) | |
752 | (alist-delete 'configure %standard-phases))))) | |
753 | (inputs `(("tzcode" ,(origin | |
754 | (method url-fetch) | |
755 | (uri (string-append | |
756 | "http://www.iana.org/time-zones/repository/releases/tzcode" | |
757 | version ".tar.gz")) | |
758 | (sha256 | |
759 | (base32 | |
d8d6d096 | 760 | "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz")))))) |
e789d9a8 LC |
761 | (home-page "http://www.iana.org/time-zones") |
762 | (synopsis "Database of current and historical time zones") | |
763 | (description "The Time Zone Database (often called tz or zoneinfo) | |
764 | contains code and data that represent the history of local time for many | |
35b9e423 | 765 | representative locations around the globe. It is updated periodically to |
e789d9a8 LC |
766 | reflect changes made by political bodies to time zone boundaries, UTC offsets, |
767 | and daylight-saving rules.") | |
768 | (license public-domain))) | |
769 | ||
bdb36958 LC |
770 | (define-public (canonical-package package) |
771 | ;; Avoid circular dependency by lazily resolving 'commencement'. | |
772 | (let* ((iface (resolve-interface '(gnu packages commencement))) | |
773 | (proc (module-ref iface 'canonical-package))) | |
774 | (proc package))) | |
571aa6cd | 775 | |
1722d680 | 776 | ;;; base.scm ends here |