distro: Rename (distro ...) to (distro packages ...).
[jackhill/guix/guix.git] / distro / packages / base.scm
CommitLineData
e3ce5d70
LC
1;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
2;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
3;;;
4;;; This file is part of Guix.
5;;;
6;;; Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with Guix. If not, see <http://www.gnu.org/licenses/>.
18
1f455fdc 19(define-module (distro packages base)
800cdeef 20 #:use-module (distro)
e3ce5d70 21 #:use-module (guix packages)
457dd86d 22 #:use-module (guix ftp)
e3ce5d70
LC
23 #:use-module (guix http)
24 #:use-module (guix build-system gnu)
321b0996 25 #:use-module (guix build-system trivial)
60f984b2
LC
26 #:use-module (guix utils)
27 #:use-module (srfi srfi-1)
28 #:use-module (srfi srfi-26)
29 #:use-module (ice-9 match))
e3ce5d70
LC
30
31;;; Commentary:
32;;;
33;;; A Guix-based distribution.
34;;;
35;;; Code:
36
64fddd74
LC
37(define-public libsigsegv
38 (package
39 (name "libsigsegv")
40 (version "2.10")
90c68be8 41 (source (origin
64fddd74 42 (method http-fetch)
90c68be8
LC
43 (uri (string-append
44 "http://ftp.gnu.org/gnu/libsigsegv/libsigsegv-"
45 version ".tar.gz"))
64fddd74 46 (sha256
e4c245f8 47 (base32 "16hrs8k3nmc7a8jam5j1fpspd6sdpkamskvsdpcw6m29vnis8q44"))))
64fddd74 48 (build-system gnu-build-system)
888f72e9 49 (outputs '("out" "lib")) ; separate libdir from the rest
64fddd74
LC
50 (home-page "http://www.gnu.org/software/libsigsegv/")
51 (description "GNU libsigsegv, a library to handle page faults in user mode")
52 (long-description
53"GNU libsigsegv is a library for handling page faults in user mode. A page
54fault occurs when a program tries to access to a region of memory that is
55currently not available. Catching and handling a page fault is a useful
56technique for implementing pageable virtual memory, memory-mapped access to
57persistent databases, generational garbage collectors, stack overflow
58handlers, distributed shared memory, and more.")
59 (license "GPLv2+")))
60
61(define-public gawk
62 (package
63 (name "gawk")
64 (version "4.0.0")
90c68be8 65 (source (origin
64fddd74 66 (method http-fetch)
90c68be8
LC
67 (uri (string-append "http://ftp.gnu.org/gnu/gawk/gawk-" version
68 ".tar.bz2"))
64fddd74 69 (sha256
e4c245f8 70 (base32 "0sss7rhpvizi2a88h6giv0i7w5h07s2fxkw3s6n1hqvcnhrfgbb0"))))
64fddd74 71 (build-system gnu-build-system)
03671375
LC
72 (arguments (case-lambda
73 ((system)
74 (if (string=? system "i686-cygwin")
75 '(#:tests? #f) ; work around test failure on Cygwin
03f9609a 76 '(#:parallel-tests? #f))) ; test suite fails in parallel
03671375 77 ((system cross-system)
03f9609a 78 '(#:parallel-tests? #f))))
888f72e9
LC
79 (inputs `(("libsigsegv" ,libsigsegv) ; headers
80 ("libsigsegv/lib" ,libsigsegv "lib"))) ; library
64fddd74
LC
81 (home-page "http://www.gnu.org/software/gawk/")
82 (description "GNU implementation of the Awk programming language")
83 (long-description
84 "Many computer users need to manipulate text files: extract and then
85operate on data from parts of certain lines while discarding the rest, make
86changes in various text files wherever certain patterns appear, and so on.
87To write a program to do these things in a language such as C or Pascal is a
88time-consuming inconvenience that may take many lines of code. The job is
89easy with awk, especially the GNU implementation: Gawk.
90
91The awk utility interprets a special-purpose programming language that makes
92it possible to handle many data-reformatting jobs with just a few lines of
93code.")
94 (license "GPLv3+")))
95
e3ce5d70
LC
96(define-public hello
97 (package
98 (name "hello")
99 (version "2.8")
90c68be8 100 (source (origin
e3ce5d70 101 (method http-fetch)
90c68be8
LC
102 (uri (string-append "http://ftp.gnu.org/gnu/hello/hello-" version
103 ".tar.gz"))
e3ce5d70 104 (sha256
e4c245f8 105 (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))))
e3ce5d70
LC
106 (build-system gnu-build-system)
107 (arguments '(#:configure-flags
108 `("--disable-dependency-tracking"
109 ,(string-append "--with-gawk=" ; for illustration purposes
110 (assoc-ref %build-inputs "gawk")))))
64fddd74 111 (inputs `(("gawk" ,gawk)))
e3ce5d70
LC
112 (description "GNU Hello")
113 (long-description "Yeah...")
45753b65 114 (home-page "http://www.gnu.org/software/hello/")
e3ce5d70 115 (license "GPLv3+")))
d7672884 116
6794b278
LC
117(define-public grep
118 (package
119 (name "grep")
120 (version "2.14")
121 (source (origin
122 (method http-fetch)
123 (uri (string-append "http://ftp.gnu.org/gnu/grep/grep-"
124 version ".tar.xz"))
125 (sha256
126 (base32
127 "1qbjb1l7f9blckc5pqy8jlf6482hpx4awn2acmhyf5mv9wfq03p7"))))
128 (build-system gnu-build-system)
129 (description "GNU implementation of the Unix grep command")
130 (long-description
131 "The grep command searches one or more input files for lines containing a
132match to a specified pattern. By default, grep prints the matching
133lines.")
134 (license "GPLv3+")
135 (home-page "http://www.gnu.org/software/grep/")))
136
8dcad9aa
LC
137(define-public sed
138 (package
139 (name "sed")
140 (version "4.2.1")
141 (source (origin
142 (method http-fetch)
143 (uri (string-append "http://ftp.gnu.org/gnu/sed/sed-" version
144 ".tar.bz2"))
145 (sha256
146 (base32
147 "13wlsb4sf5d5a82xjhxqmdvrrn36rmw5f0pl9qyb9zkvldnb7hra"))))
148 (build-system gnu-build-system)
149 (description "GNU sed, a batch stream editor")
150 (long-description
151 "Sed (stream editor) isn't really a true text editor or text processor.
152Instead, it is used to filter text, i.e., it takes text input and performs
153some operation (or set of operations) on it and outputs the modified text.
154Sed is typically used for extracting part of a file using pattern matching or
155substituting multiple occurrences of a string within a file.")
156 (license "GPLv3+")
157 (home-page "http://www.gnu.org/software/sed/")))
158
85240322
LC
159(define-public tar
160 (package
161 (name "tar")
162 (version "1.26")
163 (source (origin
164 (method http-fetch)
165 (uri (string-append "http://ftp.gnu.org/gnu/tar/tar-"
166 version ".tar.bz2"))
167 (sha256
168 (base32
169 "0hbdkzmchq9ycr2x1pxqdcgdbaxksh8c6ac0jf75jajhcks6jlss"))))
170 (build-system gnu-build-system)
472894aa
LC
171 (inputs `(("patch/gets" ,(search-patch "tar-gets-undeclared.patch"))))
172 (arguments
173 `(#:patches (list (assoc-ref %build-inputs "patch/gets"))))
85240322
LC
174 (description "GNU implementation of the `tar' archiver")
175 (long-description
176 "The Tar program provides the ability to create tar archives, as well as
177various other kinds of manipulation. For example, you can use Tar on
178previously created archives to extract files, to store additional files, or
179to update or list files which were already stored.
180
181Initially, tar archives were used to store files conveniently on magnetic
182tape. The name \"Tar\" comes from this use; it stands for tape archiver.
183Despite the utility's name, Tar can direct its output to available devices,
184files, or other programs (using pipes), it can even access remote devices or
185files (as archives).")
186 (license "GPLv3+")
187 (home-page "http://www.gnu.org/software/tar/")))
188
b289e9f9
LC
189(define-public perl
190 ;; Yeah, Perl... It is required early in the bootstrap process by Linux.
191 (package
192 (name "perl")
193 (version "5.16.1")
194 (source (origin
195 (method http-fetch)
196 (uri (string-append "http://www.cpan.org/src/5.0/perl-"
197 version ".tar.gz"))
198 (sha256
199 (base32
200 "15qxzba3a50c9nik5ydgyfp62x7h9vxxn12yd1jgl93hb1wj96km"))))
201 (build-system gnu-build-system)
202 (arguments
203 (lambda (system)
204 `(#:tests? #f
205 #:patches (list (assoc-ref %build-inputs "patch/no-sys-dirs"))
206 #:phases
207 (alist-replace
208 'configure
209 (lambda* (#:key inputs outputs #:allow-other-keys)
210 (let ((out (assoc-ref outputs "out"))
211 (libc (assoc-ref inputs "libc"))
212 (pwd (search-path (search-path-as-string->list
213 (getenv "PATH"))
214 "pwd")))
215 ;; Use the right path for `pwd'.
216 (substitute* "dist/Cwd/Cwd.pm"
217 (("/bin/pwd") pwd))
218
219 (zero?
220 (system* "/bin/sh" "./Configure"
221 (string-append "-Dprefix=" out)
222 (string-append "-Dman1dir=" out "/share/man/man1")
223 (string-append "-Dman3dir=" out "/share/man/man3")
224 "-de" "-Dcc=gcc"
225 "-Uinstallusrbinperl"
226 "-Dinstallstyle=lib/perl5"
227 "-Duseshrplib"
228 (string-append "-Dlocincpth=" libc "/include")
229 (string-append "-Dloclibpth=" libc "/lib")))))
230 %standard-phases))))
231 (inputs `(("patch/no-sys-dirs" ,(search-patch "perl-no-sys-dirs.patch"))))
232 (description "Implementation of the Perl programming language")
233 (long-description
234 "Perl 5 is a highly capable, feature-rich programming language with over
23524 years of development.")
236 (home-page "http://www.perl.org/")
237 (license "GPLv1+"))) ; or "Artistic"
238
e0fb536a
LC
239(define-public gzip
240 (package
241 (name "gzip")
242 (version "1.5")
243 (source (origin
244 (method http-fetch)
245 (uri (string-append "http://ftp.gnu.org/gnu/gzip/gzip-"
246 version ".tar.gz"))
247 (sha256
248 (base32
249 "18rm80kar7n016g8bsyy1a3zk50i2826xdgs874yh64rzj7nxmdm"))))
250 (build-system gnu-build-system)
251 (description "Gzip, the GNU zip compression program")
252 (arguments
253 ;; FIXME: The test suite wants `less', and optionally Perl.
254 '(#:tests? #f))
255 (long-description
256 "gzip (GNU zip) is a popular data compression program written by Jean-loup
257Gailly for the GNU project. Mark Adler wrote the decompression part.
258
259We developed this program as a replacement for compress because of the Unisys
260and IBM patents covering the LZW algorithm used by compress. These patents
261made it impossible for us to use compress, and we needed a replacement. The
262superior compression ratio of gzip is just a bonus.")
263 (license "GPLv3+")
264 (home-page "http://www.gnu.org/software/gzip/")))
265
6818af7b
LC
266(define-public bzip2
267 (let ((fix-man-dir
268 ;; Move man pages to $out/share/.
269 '(lambda* (#:key outputs #:allow-other-keys)
270 (with-directory-excursion (assoc-ref outputs "out")
271 (mkdir "share")
272 (rename-file "man" "share"))))
273 (build-shared-lib
274 ;; Build a shared library.
275 '(lambda* (#:key inputs #:allow-other-keys)
276 (zero? (system* "make" "-f" "Makefile-libbz2_so"))))
277 (install-shared-lib
278 '(lambda* (#:key outputs #:allow-other-keys)
279 (let* ((out (assoc-ref outputs "out"))
280 (libdir (string-append out "/lib")))
281 ;; XXX: mv libbz2.so* $libdir
282 (file-system-fold (const #t)
283 (lambda (path stat result) ; leaf
284 (define base (basename path))
285 (when (string-prefix? "libbz2.so" base)
286 (format #t "installing `~a' to `~a'~%"
287 base libdir)
288 (copy-file path
289 (string-append libdir "/"
290 base))))
291 (const #t) ; down
292 (const #t) ; up
293 (const #t) ; skip
294 (lambda (path stat errno result)
295 (error "i/o error" path (strerror errno)))
296 #t
297 ".")))))
298 (package
299 (name "bzip2")
300 (version "1.0.6")
301 (source (origin
302 (method http-fetch)
303 (uri (string-append "http://www.bzip.org/" version "/bzip2-"
304 version ".tar.gz"))
305 (sha256
306 (base32
307 "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
308 (build-system gnu-build-system)
309 (arguments
310 `(#:modules ((guix build gnu-build-system)
311 (guix build utils)
312 (srfi srfi-1)
313 (ice-9 ftw))
314 #:phases
315 (alist-cons-before
316 'build 'build-shared-lib ,build-shared-lib
317 (alist-cons-after
318 'install 'fix-man-dir ,fix-man-dir
319 (alist-cons-after
320 'install 'install-shared-lib ,install-shared-lib
321 (alist-delete 'configure %standard-phases))))
322 #:make-flags (list (string-append "PREFIX="
323 (assoc-ref %outputs "out")))))
324 (description "high-quality data compression program")
325 (long-description
326 "bzip2 is a freely available, patent free (see below), high-quality data
327compressor. It typically compresses files to within 10% to 15% of the best
328available techniques (the PPM family of statistical compressors), whilst
329being around twice as fast at compression and six times faster at
330decompression.")
331 (license "BSD-style")
332 (home-page "http://www.bzip.org/"))))
333
24cf75b9
LC
334(define-public xz
335 (package
336 (name "xz")
337 (version "5.0.4")
338 (source (origin
339 (method http-fetch)
340 (uri (string-append "http://tukaani.org/xz/xz-" version
341 ".tar.gz"))
342 (sha256
343 (base32
344 "1dl35ca8fdss9z2d6y234gxh24ixq904xksizrjmjr5dimwhax6n"))))
345 (build-system gnu-build-system)
346 (description
347 "XZ, general-purpose data compression software, successor of LZMA")
348 (long-description
349 "XZ Utils is free general-purpose data compression software with high
350compression ratio. XZ Utils were written for POSIX-like systems, but also
351work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
352
353The core of the XZ Utils compression code is based on LZMA SDK, but it has
354been modified quite a lot to be suitable for XZ Utils. The primary
355compression algorithm is currently LZMA2, which is used inside the .xz
356container format. With typical files, XZ Utils create 30 % smaller output
357than gzip and 15 % smaller output than bzip2.")
358 (license '("GPLv2+" "LGPLv2.1+")) ; bits of both
359 (home-page "http://tukaani.org/xz/")))
360
fbeec3d9
LC
361(define-public patch
362 (package
363 (name "patch")
364 (version "2.6.1")
365 (source (origin
366 (method http-fetch)
367 (uri (string-append "http://ftp.gnu.org/gnu/patch/patch-"
368 version ".tar.xz"))
369 (sha256
370 (base32
371 "18012gxs9wc96izskp1q7bclrwns6rdmkn4jj31c8jbyfz6l5npq"))))
372 (build-system gnu-build-system)
373 (native-inputs '()) ; FIXME: needs `ed' for the tests
374 (arguments
375 (case-lambda
376 ((system) '(#:tests? #f))
377 ((system cross-system)
378 '(#:configure-flags '("ac_cv_func_strnlen_working=yes")))))
379 (description "GNU Patch, a program to apply differences to files")
380 (long-description
381 "GNU Patch takes a patch file containing a difference listing produced by
382the diff program and applies those differences to one or more original files,
383producing patched versions.")
384 (license "GPLv3+")
385 (home-page "http://savannah.gnu.org/projects/patch/")))
386
04a32ee5
LC
387(define-public diffutils
388 (package
389 (name "diffutils")
390 (version "3.2")
391 (source (origin
392 (method http-fetch)
393 (uri (string-append "http://ftp.gnu.org/gnu/diffutils/diffutils-"
394 version ".tar.xz"))
395 (sha256
396 (base32
397 "0jci0wv68025xd0s0rq4s5qxpx56dd9d730lka63qpzk1rfvfkxb"))))
398 (build-system gnu-build-system)
a5071b99
LC
399 (inputs `(("patch/gets"
400 ,(search-patch "diffutils-gets-undeclared.patch"))))
401 (arguments `(#:patches (list (assoc-ref %build-inputs "patch/gets"))))
04a32ee5
LC
402 (description "Programs to find differences among text files")
403 (long-description
404 "GNU Diffutils is a package of several programs related to finding
405differences between files.
406
407Computer users often find occasion to ask how two files differ. Perhaps one
408file is a newer version of the other file. Or maybe the two files started out
409as identical copies but were changed by different people.
410
411You can use the diff command to show differences between two files, or each
412corresponding file in two directories. diff outputs differences between files
413line by line in any of several formats, selectable by command line
414options. This set of differences is often called a ‘diff’ or ‘patch’. For
415files that are identical, diff normally produces no output; for
416binary (non-text) files, diff normally reports only that they are different.
417
418You can use the cmp command to show the offsets and line numbers where two
419files differ. cmp can also show all the characters that differ between the
420two files, side by side.
421
422You can use the diff3 command to show differences among three files. When two
423people have made independent changes to a common original, diff3 can report
424the differences between the original and the two changed versions, and can
425produce a merged file that contains both persons' changes together with
426warnings about conflicts.
427
428You can use the sdiff command to merge two files interactively.")
429 (license "GPLv3+")
430 (home-page "http://www.gnu.org/software/diffutils/")))
431
af5521ca
LC
432(define-public findutils
433 (package
434 (name "findutils")
435 (version "4.4.2")
436 (source (origin
437 (method http-fetch)
438 (uri (string-append "http://ftp.gnu.org/gnu/findutils/findutils-"
439 version ".tar.gz"))
440 (sha256
441 (base32
442 "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))))
443 (build-system gnu-build-system)
444 (native-inputs
445 `(("patch/absolute-paths"
800cdeef 446 ,(search-patch "findutils-absolute-paths.patch"))))
af5521ca
LC
447 (arguments
448 (case-lambda
449 ((system)
450 `(#:patches (list (assoc-ref %build-inputs "patch/absolute-paths"))))
451 ((system cross-system)
452 ;; Work around cross-compilation failure.
453 ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
454 `(#:configure-flags '("gl_cv_func_wcwidth_works=yes")
455 ,@(arguments cross-system)))))
456 (description "Basic directory searching utilities of the GNU operating
457system")
458 (long-description
459 "The GNU Find Utilities are the basic directory searching utilities of
460the GNU operating system. These programs are typically used in conjunction
461with other programs to provide modular and powerful directory search and file
462locating capabilities to other commands.
463
464The tools supplied with this package are:
465
466 * find - search for files in a directory hierarchy;
467 * locate - list files in databases that match a pattern;
468 * updatedb - update a file name database;
469 * xargs - build and execute command lines from standard input.
470")
471 (license "GPLv3+")
472 (home-page "http://www.gnu.org/software/findutils/")))
2c957cd2
LC
473
474(define-public coreutils
475 (package
476 (name "coreutils")
477 (version "8.19")
478 (source (origin
479 (method http-fetch)
480 (uri (string-append "http://ftp.gnu.org/gnu/coreutils/coreutils-"
481 version ".tar.xz"))
482 (sha256
483 (base32
484 "1rx9x3fp848w4nny7irdkcpkan9fcx24d99v5dkwgkyq7wc76f5d"))))
485 (build-system gnu-build-system)
486 (inputs `()) ; TODO: optional deps: SELinux, ACL, GMP
487 (arguments
dfae21c8 488 '(;; Perl is missing, and some tests are failing.
2c957cd2
LC
489 #:tests? #f))
490 (description
491 "The basic file, shell and text manipulation utilities of the GNU
492operating system")
493 (long-description
494 "The GNU Core Utilities are the basic file, shell and text manipulation
495utilities of the GNU operating system. These are the core utilities which
496are expected to exist on every operating system.")
497 (license "GPLv3+")
498 (home-page "http://www.gnu.org/software/coreutils/")))
af5521ca 499
4ac3df42
LC
500(define-public m4
501 (package
502 (name "m4")
503 (version "1.4.16")
504 (source (origin
505 (method http-fetch)
506 (uri (string-append "http://ftp.gnu.org/gnu/m4/m4-"
507 version ".tar.bz2"))
508 (sha256
509 (base32
510 "035r7ma272j2cwni2961jp22k6bn3n9xwn3b3qbcn2yrvlghql22"))))
511 (build-system gnu-build-system)
512 (arguments (case-lambda
513 ((system)
514 ;; XXX: Disable tests on those platforms with know issues.
515 `(#:tests? ,(not (member system
516 '("x86_64-darwin"
517 "i686-cygwin"
518 "i686-sunos")))
519 #:patches (list (assoc-ref %build-inputs "patch/s_isdir")
520 (assoc-ref %build-inputs
9dd036f3
LC
521 "patch/readlink-EINVAL")
522 (assoc-ref %build-inputs "patch/gets"))))
4ac3df42
LC
523 ((system cross-system)
524 `(#:patches (list (assoc-ref %build-inputs "patch/s_isdir")
525 (assoc-ref %build-inputs
9dd036f3
LC
526 "patch/readlink-EINVAL")
527 (assoc-ref %build-inputs "patch/gets"))))))
800cdeef 528 (inputs `(("patch/s_isdir" ,(search-patch "m4-s_isdir.patch"))
4ac3df42 529 ("patch/readlink-EINVAL"
9dd036f3
LC
530 ,(search-patch "m4-readlink-EINVAL.patch"))
531 ("patch/gets" ,(search-patch "m4-gets-undeclared.patch"))))
4ac3df42
LC
532 (description "GNU M4, a macro processor")
533 (long-description
534 "GNU M4 is an implementation of the traditional Unix macro processor. It
535is mostly SVR4 compatible although it has some extensions (for example,
536handling more than 9 positional parameters to macros). GNU M4 also has
537built-in functions for including files, running shell commands, doing
538arithmetic, etc.
539
540GNU M4 is a macro processor in the sense that it copies its input to the
541output expanding macros as it goes. Macros are either builtin or
542user-defined and can take any number of arguments. Besides just doing macro
543expansion, m4 has builtin functions for including named files, running UNIX
544commands, doing integer arithmetic, manipulating text in various ways,
545recursion etc... m4 can be used either as a front-end to a compiler or as a
546macro processor in its own right.")
547 (license "GPLv3+")
548 (home-page "http://www.gnu.org/software/m4/")))
549
ab776865
LC
550(define-public gnu-make
551 (package
552 (name "make")
553 (version "3.82")
554 (source (origin
555 (method http-fetch)
556 (uri (string-append "http://ftp.gnu.org/gnu/make/make-" version
557 ".tar.bz2"))
558 (sha256
559 (base32
560 "0ri98385hsd7li6rh4l5afcq92v8l2lgiaz85wgcfh4w2wzsghg2"))))
561 (build-system gnu-build-system)
562 (native-inputs
800cdeef 563 `(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch"))))
ab776865
LC
564 (arguments `(#:patches (list (assoc-ref %build-inputs
565 "patch/impure-dirs"))))
566 (description "GNU Make, a program controlling the generation of non-source
567files from sources")
568 (long-description
569 "Make is a tool which controls the generation of executables and other
570non-source files of a program from the program's source files.
571
572Make gets its knowledge of how to build your program from a file called the
573makefile, which lists each of the non-source files and how to compute it from
574other files. When you write a program, you should write a makefile for it, so
575that it is possible to use Make to build and install the program.")
576 (license "GPLv3+")
577 (home-page "http://www.gnu.org/software/make/")))
578
eb229e88
LC
579(define-public gmp
580 (package
581 (name "gmp")
582 (version "5.0.5")
583 (source (origin
584 (method http-fetch)
54ba617e 585 (uri (string-append "http://ftp.gnu.org/gnu/gmp/gmp-" version
eb229e88
LC
586 ".tar.bz2"))
587 (sha256
588 (base32
589 "1jfymbr90mpn0zw5sg001llqnvf2462y77vgjknrmfs1rjn8ln0z"))))
590 (build-system gnu-build-system)
591 (native-inputs `(("m4" ,m4)))
592 (arguments `(#:configure-flags
593 '(;; Build a "fat binary", with routines for several
594 ;; sub-architectures.
595 "--enable-fat"
596 "--enable-cxx")))
597 (description "GMP, the GNU multiple precision arithmetic library")
598 (long-description
599 "GMP is a free library for arbitrary precision arithmetic, operating on
600signed integers, rational numbers, and floating point numbers. There is no
601practical limit to the precision except the ones implied by the available
602memory in the machine GMP runs on. GMP has a rich set of functions, and the
603functions have a regular interface.
604
605The main target applications for GMP are cryptography applications and
606research, Internet security applications, algebra systems, computational
607algebra research, etc.
608
609GMP is carefully designed to be as fast as possible, both for small operands
610and for huge operands. The speed is achieved by using fullwords as the basic
611arithmetic type, by using fast algorithms, with highly optimised assembly
612code for the most common inner loops for a lot of CPUs, and by a general
613emphasis on speed.
614
615GMP is faster than any other bignum library. The advantage for GMP increases
616with the operand sizes for many operations, since GMP uses asymptotically
617faster algorithms.")
618 (license "LGPLv3+")
619 (home-page "http://gmplib.org/")))
620
040d1b2c
LC
621(define-public mpfr
622 (package
623 (name "mpfr")
624 (version "3.1.1")
625 (source (origin
626 (method http-fetch)
627 (uri (string-append "http://ftp.gnu.org/gnu/mpfr/mpfr-" version
628 ".tar.xz"))
629 (sha256 (base32
630 "0ym1ylcq803n52qrggxqmkz66gbn8ncc3ybawal31v5y5p1srma9"))))
631 (build-system gnu-build-system)
632 (inputs `(("gmp" ,gmp)))
633 (description "GNU MPFR, a library for multiple-precision floating-point
634arithmetic")
635 (long-description
636 "The GNU MPFR library is a C library for multiple-precision
637floating-point computations with correct rounding. MPFR is based on the GMP
638multiple-precision library.
639
640The main goal of MPFR is to provide a library for multiple-precision
641floating-point computation which is both efficient and has a well-defined
642semantics. It copies the good ideas from the ANSI/IEEE-754 standard for
643double-precision floating-point arithmetic (53-bit mantissa).")
644 (license "LGPLv3+")
645 (home-page "http://www.mpfr.org/")))
646
202851dd
LC
647(define-public mpc
648 (package
649 (name "mpc")
a08cdce7 650 (version "1.0")
202851dd
LC
651 (source (origin
652 (method http-fetch)
653 (uri (string-append
654 "http://www.multiprecision.org/mpc/download/mpc-"
655 version ".tar.gz"))
656 (sha256 (base32
a08cdce7 657 "00rxjmkpqnv6zzcyw9aa5w6rzaav32ys87km25zgfcv9i32km5cw"))))
202851dd
LC
658 (build-system gnu-build-system)
659 (inputs `(("gmp" ,gmp)
660 ("mpfr" ,mpfr)))
661 (description "GNU MPC, a library for multiprecision complex arithmetic
662with exact rounding")
663 (long-description
664 "GNU MPC is a C library for the arithmetic of complex numbers with
665arbitrarily high precision and correct rounding of the result. It is built
666upon and follows the same principles as GNU MPFR.")
667 (license "LGPLv3+")
668 (home-page "http://mpc.multiprecision.org/")))
669
8f6201a3
LC
670(define-public binutils
671 (package
672 (name "binutils")
673 (version "2.22")
674 (source (origin
675 (method http-fetch)
676 (uri (string-append "http://ftp.gnu.org/gnu/binutils/binutils-"
677 version ".tar.bz2"))
678 (sha256
679 (base32
680 "1a9w66v5dwvbnawshjwqcgz7km6kw6ihkzp6sswv9ycc3knzhykc"))))
681 (build-system gnu-build-system)
682
683 ;; TODO: Add dependency on zlib + those for Gold.
684 (native-inputs
685 `(("patch/new-dtags" ,(search-patch "binutils-ld-new-dtags.patch"))))
686 (arguments
687 `(#:patches (list (assoc-ref %build-inputs "patch/new-dtags"))
688
689 ;; Add `-static-libgcc' to not retain a dependency on GCC when
690 ;; bootstrapping.
691 #:configure-flags '("LDFLAGS=-static-libgcc")))
692
693 (description "GNU Binutils, tools for manipulating binaries (linker,
694assembler, etc.)")
695 (long-description
696 "The GNU Binutils are a collection of binary tools. The main ones are
697`ld' (the GNU linker) and `as' (the GNU assembler). They also include the
698BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
699 (license "GPLv3+")
700 (home-page "http://www.gnu.org/software/binutils/")))
701
321b0996
LC
702(define (glibc-dynamic-linker system)
703 "Return the name of Glibc's dynamic linker for SYSTEM."
704 (if (string=? system "x86_64-linux")
705 "ld-linux-x86-64.so.2"
706 (error "dynamic linker name not known for this system" system)))
707
81e57ec5
LC
708(define-public gcc-4.7
709 (let ((stripped? #t)) ; TODO: make this a parameter
710 (package
711 (name "gcc")
8ffae202 712 (version "4.7.2")
81e57ec5
LC
713 (source (origin
714 (method http-fetch)
715 (uri (string-append "http://ftp.gnu.org/gnu/gcc/gcc-"
716 version "/gcc-" version ".tar.bz2"))
717 (sha256
718 (base32
8ffae202 719 "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la"))))
81e57ec5 720 (build-system gnu-build-system)
dc0a9729 721 (inputs `(("gmp" ,gmp)
81e57ec5
LC
722 ("mpfr" ,mpfr)
723 ("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc.
724 (arguments
8197c978 725 `(#:out-of-source? #t
6e0874db 726 #:strip-binaries? ,stripped?
81e57ec5
LC
727 #:configure-flags
728 `("--enable-plugin"
729 "--enable-languages=c,c++"
730 "--disable-multilib"
321b0996
LC
731 ,(let ((libc (assoc-ref %build-inputs "libc")))
732 (if libc
733 (string-append "--with-native-system-header-dir=" libc
734 "/include")
735 "--without-headers")))
81e57ec5
LC
736 #:make-flags
737 (let ((libc (assoc-ref %build-inputs "libc")))
321b0996
LC
738 `(,@(if libc
739 (list (string-append "LDFLAGS_FOR_BUILD="
740 "-L" libc "/lib "
741 "-Wl,-dynamic-linker "
742 "-Wl," libc
743 "/lib/ld-linux-x86-64.so.2"))
744 '())
81e57ec5
LC
745 ,(string-append "BOOT_CFLAGS=-O2 "
746 ,(if stripped? "-g0" "-g"))))
dc4e0257 747
81e57ec5
LC
748 #:tests? #f
749 #:phases
750 (alist-cons-before
751 'configure 'pre-configure
f1f100b2
LC
752 (lambda* (#:key inputs outputs #:allow-other-keys)
753 (let ((out (assoc-ref outputs "out"))
754 (libc (assoc-ref inputs "libc")))
321b0996
LC
755 (when libc
756 ;; The following is not performed for `--without-headers'
757 ;; cross-compiler builds.
758
759 ;; Fix the dynamic linker's file name.
760 (substitute* "gcc/config/i386/linux64.h"
761 (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
762 (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
763 suffix
764 (string-append libc "/lib/ld-linux-x86-64.so.2"))))
765
766 ;; Tell where to find libstdc++, libc, and `?crt*.o', except
767 ;; `crt{begin,end}.o', which come with GCC.
dc8907d8 768
321b0996
LC
769 ;; XXX: For crt*.o, use `STANDARD_STARTFILE_PREFIX' instead? See
770 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/gcc-pass1.html>.
771 (substitute* ("gcc/config/gnu-user.h"
772 "gcc/config/i386/gnu-user.h"
773 "gcc/config/i386/gnu-user64.h")
774 (("#define LIB_SPEC (.*)$" _ suffix)
dc0a9729 775 (format #f "#define LIB_SPEC \"-L~a/lib -rpath=~a/lib \
82dc2b9a 776-rpath=~a/lib64 -rpath=~a/lib \" ~a~%"
dc0a9729 777 libc libc out out suffix))
321b0996
LC
778 (("([^ ]*)crt([^\\.])\\.o" _ prefix suffix)
779 (string-append libc "/lib/" prefix "crt" suffix ".o"))))
181df118
LC
780
781 ;; Don't retain a dependency on the build-time sed.
782 (substitute* "fixincludes/fixincl.x"
783 (("static char const sed_cmd_z\\[\\] =.*;")
784 "static char const sed_cmd_z[] = \"sed\";"))))
785
a436d201
LC
786 (alist-cons-after
787 'configure 'post-configure
788 (lambda _
789 ;; Don't store configure flags, to avoid retaining references to
790 ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
791 (substitute* "Makefile"
792 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
793 "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
794 (alist-replace 'install
795 (lambda* (#:key outputs #:allow-other-keys)
796 (zero?
797 (system* "make"
798 ,(if stripped?
799 "install-strip"
800 "install"))))
801 %standard-phases)))))
81e57ec5
LC
802
803 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
804 (description "The GNU Compiler Collection")
805 (long-description
806 "The GNU Compiler Collection includes compiler front ends for C, C++,
807Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as
808libraries for these languages (libstdc++, libgcj, libgomp,...).
809
810GCC development is a part of the GNU Project, aiming to improve the compiler
811used in the GNU system including the GNU/Linux variant.")
812 (license "GPLv3+")
813 (home-page "http://gcc.gnu.org/"))))
814
1788a456
LC
815(define-public ncurses
816 (let ((post-install-phase
817 '(lambda* (#:key outputs #:allow-other-keys)
818 (let ((out (assoc-ref outputs "out")))
819 ;; When building a wide-character (Unicode) build, create backward
820 ;; compatibility links from the the "normal" libraries to the
821 ;; wide-character libraries (e.g. libncurses.so to libncursesw.so).
822 (with-directory-excursion (string-append out "/lib")
823 (for-each (lambda (lib)
824 (define libw.a
825 (string-append "lib" lib "w.a"))
826 (define lib.a
827 (string-append "lib" lib ".a"))
828 (define libw.so.x
829 (string-append "lib" lib "w.so.5"))
830 (define lib.so.x
831 (string-append "lib" lib ".so.5"))
832 (define lib.so
833 (string-append "lib" lib ".so"))
834
835 (when (file-exists? libw.a)
836 (format #t "creating symlinks for `lib~a'~%" lib)
837 (symlink libw.a lib.a)
838 (symlink libw.so.x lib.so.x)
839 (false-if-exception (delete-file lib.so))
840 (call-with-output-file lib.so
841 (lambda (p)
842 (format p "INPUT (-l~aw)~%" lib)))))
843 '("curses" "ncurses" "form" "panel" "menu")))))))
844 (package
845 (name "ncurses")
846 (version "5.9")
847 (source (origin
848 (method http-fetch)
849 (uri (string-append "http://ftp.gnu.org/gnu/ncurses/ncurses-"
850 version ".tar.gz"))
851 (sha256
852 (base32
853 "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"))))
854 (build-system gnu-build-system)
855 (arguments
856 (case-lambda
857 ((system)
858 `(#:configure-flags
859 `("--with-shared" "--without-debug" "--enable-widec"
860
861 ;; By default headers land in an `ncursesw' subdir, which is not
862 ;; what users expect.
863 ,(string-append "--includedir=" (assoc-ref %outputs "out")
864 "/include")
865
866 ;; C++ bindings fail to build on
867 ;; `i386-pc-solaris2.11' with GCC 3.4.3:
868 ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
869 ,,@(if (string=? system "i686-solaris")
870 '("--without-cxx-binding")
871 '()))
872 #:tests? #f ; no "check" target
873 #:phases (alist-cons-after 'install 'post-install
874 ,post-install-phase
875 %standard-phases)))
876 ((system cross-system)
877 (arguments cross-system))))
878 (self-native-input? #t)
879 (description
880 "GNU Ncurses, a free software emulation of curses in SVR4 and more")
881 (long-description
882 "The Ncurses (new curses) library is a free software emulation of curses
883in System V Release 4.0, and more. It uses Terminfo format, supports pads
884and color and multiple highlights and forms characters and function-key
885mapping, and has all the other SYSV-curses enhancements over BSD Curses.
886
887The ncurses code was developed under GNU/Linux. It has been in use for some
888time with OpenBSD as the system curses library, and on FreeBSD and NetBSD as
889an external package. It should port easily to any ANSI/POSIX-conforming
890UNIX. It has even been ported to OS/2 Warp!")
891 (license "X11")
892 (home-page "http://www.gnu.org/software/ncurses/"))))
893
2282ec3a
LC
894(define-public readline
895 (package
896 (name "readline")
897 (version "6.2")
898 (source (origin
899 (method http-fetch)
900 (uri (string-append "http://ftp.gnu.org/gnu/readline/readline-"
901 version ".tar.gz"))
902 (sha256
903 (base32
904 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))))
905 (build-system gnu-build-system)
1788a456 906 (propagated-inputs `(("ncurses" ,ncurses)))
2282ec3a 907 (inputs `(("patch/link-ncurses"
800cdeef 908 ,(search-patch "readline-link-ncurses.patch"))))
2282ec3a
LC
909 (arguments `(#:patches (list (assoc-ref %build-inputs
910 "patch/link-ncurses"))
ea52a52d
LC
911 #:patch-flags '("-p0")
912 #:configure-flags
913 (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
914 (assoc-ref %build-inputs "ncurses")
915 "/lib"))))
2282ec3a
LC
916 (description "GNU Readline, a library for interactive line editing")
917 (long-description
918 "The GNU Readline library provides a set of functions for use by
919applications that allow users to edit command lines as they are typed in.
920Both Emacs and vi editing modes are available. The Readline library includes
921additional functions to maintain a list of previously-entered command lines,
922to recall and perhaps reedit those lines, and perform csh-like history
923expansion on previous commands.
924
925The history facilites are also placed into a separate library, the History
926library, as part of the build process. The History library may be used
927without Readline in applications which desire its capabilities.")
928 (license "GPLv3+")
929 (home-page "http://savannah.gnu.org/projects/readline/")))
930
9350da0d
LC
931(define-public bash
932 (let ((cppflags (string-join '("-DSYS_BASHRC='\"/etc/bashrc\"'"
933 "-DSYS_BASH_LOGOUT='\"/etc/bash_logout\"'"
934 "-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
935 "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
936 "-DNON_INTERACTIVE_LOGIN_SHELLS"
937 "-DSSH_SOURCE_BASHRC")
938 " ")))
939 (package
940 (name "bash")
941 (version "4.2")
942 (source (origin
943 (method http-fetch)
944 (uri (string-append
945 "http://ftp.gnu.org/gnu/bash/bash-" version ".tar.gz"))
946 (sha256
947 (base32
948 "1n5kbblp5ykbz5q8aq88lsif2z0gnvddg9babk33024wxiwi2ym2"))))
949 (build-system gnu-build-system)
ea52a52d
LC
950 (inputs `(("readline" ,readline)
951 ("ncurses" ,ncurses))) ; TODO: add texinfo
9350da0d 952 (arguments
ea52a52d
LC
953 `(#:configure-flags `("--with-installed-readline"
954 ,,(string-append "CPPFLAGS=" cppflags)
955 ,(string-append
956 "LDFLAGS=-Wl,-rpath -Wl,"
957 (assoc-ref %build-inputs "readline")
958 "/lib"
959 " -Wl,-rpath -Wl,"
960 (assoc-ref %build-inputs "ncurses")
961 "/lib"))
9350da0d
LC
962
963 ;; XXX: The tests have a lot of hard-coded paths, so disable them
964 ;; for now.
965 #:tests? #f
966
967 #:phases
968 (alist-cons-after 'install 'post-install
969 (lambda* (#:key outputs #:allow-other-keys)
970 ;; Add a `bash' -> `sh' link.
971 (let ((out (assoc-ref outputs "out")))
972 (with-directory-excursion
973 (string-append out "/bin")
974 (symlink "bash" "sh"))))
975 %standard-phases)))
976 (description "GNU Bourne-Again Shell")
977 (long-description
978 "Bash is the shell, or command language interpreter, that will appear in
979the GNU operating system. Bash is an sh-compatible shell that incorporates
980useful features from the Korn shell (ksh) and C shell (csh). It is intended
981to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It
982offers functional improvements over sh for both programming and interactive
983use. In addition, most sh scripts can be run by Bash without
984modification.")
985 (license "GPLv3+")
986 (home-page "http://www.gnu.org/software/bash/"))))
987
454fe58b
LC
988(define-public libtool
989 (package
990 (name "libtool")
991 (version "2.4.2")
992 (source (origin
993 (method http-fetch)
994 (uri (string-append "http://ftp.gnu.org/gnu/libtool/libtool-"
995 version ".tar.gz"))
996 (sha256
997 (base32
998 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))))
999 (build-system gnu-build-system)
1000 (native-inputs `(("m4" ,m4)
b289e9f9 1001 ("perl" ,perl)))
dc8907d8
LC
1002 (arguments
1003 ;; TODO: Use `TESTSUITEFLAGS=-jN' for tests.
1004 `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))))
1005 (inputs `(("patch/skip-tests"
1006 ,(search-patch "libtool-skip-tests.patch"))))
454fe58b
LC
1007 (description "GNU Libtool, a generic library support script")
1008 (long-description
1009 "GNU libtool is a generic library support script. Libtool hides the
1010complexity of using shared libraries behind a consistent, portable interface.
1011
1012To use libtool, add the new generic library building commands to your
1013Makefile, Makefile.in, or Makefile.am. See the documentation for
1014details.")
1015 (license "GPLv3+")
1016 (home-page "http://www.gnu.org/software/libtool/")))
1017
fd33c82c
LC
1018(define-public libunistring
1019 (package
1020 (name "libunistring")
1021 (version "0.9.3")
1022 (source (origin
1023 (method http-fetch)
1024 (uri (string-append
1025 "http://ftp.gnu.org/gnu/libunistring/libunistring-"
1026 version ".tar.gz"))
1027 (sha256
1028 (base32
1029 "18q620269xzpw39dwvr9zpilnl2dkw5z5kz3mxaadnpv4k3kw3b1"))))
1030 (propagated-inputs '()) ; FIXME: add libiconv when !glibc
1031 (build-system gnu-build-system)
1032 (description "GNU Libunistring, a Unicode string library")
1033 (long-description
1034 "This library provides functions for manipulating Unicode strings and for
1035manipulating C strings according to the Unicode standard.
1036
1037GNU libunistring is for you if your application involves non-trivial text
1038processing, such as upper/lower case conversions, line breaking, operations
1039on words, or more advanced analysis of text. Text provided by the user can,
1040in general, contain characters of all kinds of scripts. The text processing
1041functions provided by this library handle all scripts and all languages.
1042
1043libunistring is for you if your application already uses the ISO C / POSIX
1044<ctype.h>, <wctype.h> functions and the text it operates on is provided by
1045the user and can be in any language.
1046
1047libunistring is also for you if your application uses Unicode strings as
1048internal in-memory representation.")
1049 (home-page "http://www.gnu.org/software/libunistring/")
1050 (license "LGPLv3+")))
1051
38701758
LC
1052(define-public recutils
1053 (package
1054 (name "recutils")
1055 (version "1.5")
1056 (source (origin
1057 (method http-fetch)
1058 (uri (string-append "http://ftp.gnu.org/gnu/recutils/recutils-"
1059 version ".tar.gz"))
1060 (sha256
1061 (base32
1062 "1v2xzwwwhc5j5kmvg4sv6baxjpsfqh8ln7ilv4mgb1408rs7xmky"))))
1063 (build-system gnu-build-system)
1064 (inputs `(("curl" ,(nixpkgs-derivation* "curl"))
1065 ("emacs" ,(nixpkgs-derivation* "emacs"))
1066 ("check" ,(nixpkgs-derivation* "check"))
8bb9f66f
LC
1067 ("bc" ,(nixpkgs-derivation* "bc"))
1068 ("patch/gets"
1069 ,(search-patch "diffutils-gets-undeclared.patch"))))
1070 (arguments `(#:patches (list (assoc-ref %build-inputs "patch/gets"))))
38701758
LC
1071 (description "GNU recutils, tools and libraries to access human-editable,
1072text-based databases")
1073 (long-description
1074 "GNU recutils is a set of tools and libraries to access human-editable,
1075text-based databases called recfiles. The data is stored as a sequence of
1076records, each record containing an arbitrary number of named fields.")
1077 (license "GPLv3+")
1078 (home-page "http://www.gnu.org/software/recutils/")))
1079
d7672884
LC
1080(define-public guile-1.8
1081 (package
1082 (name "guile")
1083 (version "1.8.8")
1084 (source (origin
1085 (method http-fetch)
1086 (uri (string-append "http://ftp.gnu.org/gnu/guile/guile-" version
1087 ".tar.gz"))
1088 (sha256
1089 (base32
1090 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))))
1091 (build-system gnu-build-system)
10c87717 1092 (arguments '(#:configure-flags '("--disable-error-on-warning")
d7672884
LC
1093 #:patches (list (assoc-ref %build-inputs "patch/snarf"))
1094
1095 ;; Insert a phase before `configure' to patch things up.
1096 #:phases (alist-cons-before
1097 'configure
1098 'patch-loader-search-path
1099 (lambda* (#:key outputs #:allow-other-keys)
1100 ;; Add a call to `lt_dladdsearchdir' so that
1101 ;; `libguile-readline.so' & co. are in the
1102 ;; loader's search path.
10c87717 1103 (substitute* "libguile/dynl.c"
4fa697e9
LC
1104 (("lt_dlinit.*$" match)
1105 (format #f
1106 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
1107 match
1108 (assoc-ref outputs "out")))))
d7672884 1109 %standard-phases)))
800cdeef 1110 (inputs `(("patch/snarf" ,(search-patch "guile-1.8-cpp-4.5.patch"))
d7672884 1111 ("gawk" ,gawk)
2282ec3a 1112 ("readline" ,readline)))
6332da77
LC
1113
1114 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
1115 ;; propagated.
eb229e88 1116 (propagated-inputs `(("gmp" ,gmp)
454fe58b 1117 ("libtool" ,libtool)))
d7672884
LC
1118
1119 ;; When cross-compiling, a native version of Guile itself is needed.
1120 (self-native-input? #t)
1121
1122 (description "GNU Guile 1.8, an embeddable Scheme interpreter")
1123 (long-description
1124"GNU Guile 1.8 is an interpreter for the Scheme programming language,
1125packaged as a library that can be embedded into programs to make them
1126extensible. It supports many SRFIs.")
1127 (home-page "http://www.gnu.org/software/guile/")
1128 (license "LGPLv2+")))
1129
f66963df
LC
1130(define-public libffi
1131 (let ((post-install-phase
1132 ;; Install headers in the right place.
1133 '(lambda* (#:key outputs #:allow-other-keys)
1134 (define out (assoc-ref outputs "out"))
1135 (mkdir (string-append out "/include"))
1136 (with-directory-excursion
1137 (string-append out "/lib/libffi-3.0.9/include")
1138 (for-each (lambda (h)
1139 (format #t "moving `~a' to includedir~%" h)
1140 (rename-file h (string-append out "/include/" h)))
1141 (scandir "."
1142 (lambda (x)
1143 (not (member x '("." ".."))))))))))
1144 (package
1145 (name "libffi")
1146 (version "3.0.9")
1147 (source (origin
457dd86d
LC
1148 (method ftp-fetch)
1149 (uri
1150 (string-append "ftp://sourceware.org/pub/libffi/"
f66963df
LC
1151 name "-" version ".tar.gz"))
1152 (sha256
1153 (base32
1154 "0ln4jbpb6clcsdpb9niqk0frgx4k0xki96wiv067ig0q4cajb7aq"))))
1155 (build-system gnu-build-system)
1156 (arguments `(#:modules ((guix build utils) (guix build gnu-build-system)
1157 (ice-9 ftw) (srfi srfi-26))
1158 #:phases (alist-cons-after 'install 'post-install
1159 ,post-install-phase
1160 %standard-phases)))
1161 (description "libffi, a foreign function call interface library")
1162 (long-description
1163 "The libffi library provides a portable, high level programming interface
1164to various calling conventions. This allows a programmer to call any
1165function specified by a call interface description at run-time.
1166
1167FFI stands for Foreign Function Interface. A foreign function interface is
1168the popular name for the interface that allows code written in one language
1169to call code written in another language. The libffi library really only
1170provides the lowest, machine dependent layer of a fully featured foreign
1171function interface. A layer must exist above libffi that handles type
1172conversions for values passed between the two languages.")
1173 (home-page "http://sources.redhat.com/libffi/")
1174
1175 ;; See <http://github.com/atgreen/libffi/blob/master/LICENSE>.
1176 (license "free, non-copyleft"))))
1177
d5f0c7cc
LC
1178(define-public guile-2.0
1179 (package
1180 (name "guile")
1181 (version "2.0.6")
1182 (source (origin
1183 (method http-fetch)
1184 (uri (string-append "http://ftp.gnu.org/gnu/guile/guile-" version
1185 ".tar.xz"))
1186 (sha256
1187 (base32
1188 "000ng5qsq3cl1k35jvzvhwxj92wx4q87745n2fppkd4irh58vv5l"))))
1189 (build-system gnu-build-system)
60f984b2 1190 (native-inputs `(("pkgconfig" ,(nixpkgs-derivation* "pkgconfig"))))
f66963df 1191 (inputs `(("libffi" ,libffi)
2282ec3a 1192 ("readline" ,readline)))
d5f0c7cc 1193
466af8e8
LC
1194 (propagated-inputs
1195 `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
1196 ;; reads `-lltdl -lunistring', adding them here will add the needed
1197 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
1198 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
fd33c82c 1199 ("libunistring" ,libunistring)
454fe58b 1200 ("libtool" ,libtool)
466af8e8
LC
1201
1202 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
1203 ;; must be propagated.
ce5d658c 1204 ("bdw-gc" ,(nixpkgs-derivation* "boehmgc"))
eb229e88 1205 ("gmp" ,gmp)))
d5f0c7cc
LC
1206
1207 (self-native-input? #t)
1208
1209 (description "GNU Guile 2.0, an embeddable Scheme implementation")
1210 (long-description
1211"GNU Guile is an implementation of the Scheme programming language, with
1212support for many SRFIs, packaged for use in a wide variety of environments.
1213In addition to implementing the R5RS Scheme standard and a large subset of
1214R6RS, Guile includes a module system, full access to POSIX system calls,
1215networking support, multiple threads, dynamic linking, a foreign function
1216call interface, and powerful string processing.")
1217 (home-page "http://www.gnu.org/software/guile/")
1218 (license "LGPLv3+")))
1219
3db3913e
LC
1220(define-public linux-headers
1221 (let* ((version* "3.3.5")
1222 (build-phase
1223 '(lambda* (#:key outputs #:allow-other-keys)
1224 (setenv "ARCH" "x86_64") ; XXX
1225 (and (zero? (system* "make" "defconfig"))
1226 (zero? (system* "make" "mrproper" "headers_check")))))
1227 (install-phase
1228 `(lambda* (#:key outputs #:allow-other-keys)
1229 (let ((out (assoc-ref outputs "out")))
1230 (and (zero? (system* "make"
1231 (string-append "INSTALL_HDR_PATH=" out)
1232 "headers_install"))
1233 (mkdir (string-append out "/include/config"))
1234 (call-with-output-file
1235 (string-append out
1236 "/include/config/kernel.release")
1237 (lambda (p)
1238 (format p "~a-default~%" ,version*))))))))
1239 (package
1240 (name "linux-headers")
1241 (version version*)
1242 (source (origin ; TODO: use Linux-Libre
1243 (method http-fetch)
1244 (uri (string-append
1245 "http://www.kernel.org/pub/linux/kernel/v3.x/linux-"
1246 version ".tar.xz"))
1247 (sha256
1248 (base32
1249 "0i74jn47f6vs5kcvk8abvz3k08z32c9bbqw0sdjkdxwvr4jbczpv"))))
1250 (build-system gnu-build-system)
b289e9f9 1251 (native-inputs `(("perl" ,perl)))
3db3913e
LC
1252 (arguments
1253 `(#:modules ((guix build gnu-build-system)
1254 (guix build utils)
1255 (srfi srfi-1))
1256 #:phases (alist-replace
1257 'build ,build-phase
1258 (alist-replace
1259 'install ,install-phase
1260 (alist-delete 'configure %standard-phases)))
1261 #:tests? #f))
1262 (description "Linux kernel headers")
1263 (long-description "Headers of the Linux kernel.")
1264 (license "GPLv2")
1265 (home-page "http://kernel.org/"))))
1266
7cdeac02
LC
1267(define-public glibc
1268 (package
1269 (name "glibc")
1270 (version "2.16.0")
1271 (source (origin
1272 (method http-fetch)
1273 (uri (string-append "http://ftp.gnu.org/gnu/glibc/glibc-"
1274 version ".tar.xz"))
1275 (sha256
1276 (base32
1277 "092rdm49zh6l1pqkxbcpcaawgsgzxhpf1s7wf5wi5dvc5am3dp0y"))))
1278 (build-system gnu-build-system)
0a3da5b7
LC
1279
1280 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
1281 ;; users should automatically pull Linux headers as well.
1282 (propagated-inputs `(("linux-headers" ,linux-headers)))
1283
7cdeac02 1284 (arguments
8197c978 1285 `(#:out-of-source? #t
7cdeac02
LC
1286 #:configure-flags
1287 (list "--enable-add-ons"
1288 "--sysconfdir=/etc"
1289 "--localedir=/var/run/current-system/sw/lib/locale" ; XXX
1290 (string-append "--with-headers="
1291 (assoc-ref %build-inputs "linux-headers")
1292 "/include")
5f456680
LC
1293
1294 ;; The default is to assume a 2.4 Linux interface, but we'll
1295 ;; always use something newer. See "kernel-features.h" in the
1296 ;; GNU libc for details.
1297 "--enable-kernel=2.6.30"
1298
7cdeac02
LC
1299 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
1300 "libc_cv_ssp=no")
1301 #:tests? #f ; XXX
1302 #:phases (alist-cons-before
1303 'configure 'pre-configure
1304 (lambda* (#:key outputs #:allow-other-keys)
1305 (let ((out (assoc-ref outputs "out")))
1306 ;; Use `pwd', not `/bin/pwd'.
1307 (substitute* "configure"
0a3da5b7 1308 (("/bin/pwd") "pwd"))
7cdeac02
LC
1309
1310 ;; Install the rpc data base file under `$out/etc/rpc'.
8197c978 1311 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
7cdeac02
LC
1312 (substitute* "sunrpc/Makefile"
1313 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
1314 (string-append out "/etc/rpc" suffix "\n"))
1315 (("^install-others =.*$")
321b0996
LC
1316 (string-append "install-others = " out "/etc/rpc\n")))
1317
1318 (substitute* "Makeconfig"
1319 ;; According to
1320 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
1321 ;; linking against libgcc_s is not needed with GCC
1322 ;; 4.7.1.
1323 ((" -lgcc_s") ""))))
7cdeac02
LC
1324 %standard-phases)))
1325 (description "The GNU C Library")
1326 (long-description
1327 "Any Unix-like operating system needs a C library: the library which
1328defines the \"system calls\" and other basic facilities such as open, malloc,
1329printf, exit...
1330
1331The GNU C library is used as the C library in the GNU system and most systems
1332with the Linux kernel.")
1333 (license "LGPLv2+")
1334 (home-page "http://www.gnu.org/software/libc/")))
1335
60f984b2
LC
1336\f
1337;;;
1338;;; Bootstrap packages.
1339;;;
1340
1341(define %bootstrap-inputs
1342 (compile-time-value
1343 `(("libc" ,(nixpkgs-derivation "glibc"))
1344 ,@(map (lambda (name)
1345 (list name (nixpkgs-derivation name)))
3c0670e6 1346 '("gnutar" "gzip" "bzip2" "xz" "patch"
60f984b2 1347 "coreutils" "gnused" "gnugrep" "bash"
60f984b2 1348 "gawk" ; used by `config.status'
3c0670e6 1349 "gcc" "binutils")))))
5f805fdf
LC
1350
1351(define-syntax substitute-keyword-arguments
1352 (syntax-rules ()
1353 "Return a new list of arguments where the value for keyword arg KW is
1354replaced by EXP. EXP is evaluated in a context where VAR is boud to the
1355previous value of the keyword argument."
1356 ((_ original-args ((kw var) exp) ...)
1357 (let loop ((args original-args)
1358 (before '()))
1359 (match args
1360 ((kw var rest (... ...))
1361 (loop rest (cons* exp kw before)))
1362 ...
1363 ((x rest (... ...))
1364 (loop rest (cons x before)))
1365 (()
1366 (reverse before)))))))
60f984b2 1367
3c0670e6
LC
1368(define gnu-make-boot0
1369 (package (inherit gnu-make)
1370 (name "make-boot0")
1371 (location (source-properties->location (current-source-location)))
1372 (arguments `(#:implicit-inputs? #f
1373 #:tests? #f ; cannot run "make check"
1374 #:phases
1375 (alist-replace
1376 'build (lambda _
1377 (zero? (system* "./build.sh")))
1378 (alist-replace
1379 'install (lambda* (#:key outputs #:allow-other-keys)
1380 (let* ((out (assoc-ref outputs "out"))
1381 (bin (string-append out "/bin")))
1382 (mkdir out)
1383 (mkdir bin)
1384 (copy-file "make"
1385 (string-append bin "/make"))))
1386 %standard-phases))))
1387 (inputs %bootstrap-inputs)))
1388
1389(define diffutils-boot0
1390 (let ((p (package-with-explicit-inputs diffutils
1391 `(("make" ,gnu-make-boot0)
1392 ,@%bootstrap-inputs))))
1393 (package (inherit p)
1394 (location (source-properties->location (current-source-location)))
1395 (arguments `(#:tests? #f ; the test suite needs diffutils
1396 ,@(package-arguments p))))))
1397
1398(define findutils-boot0
1399 (package-with-explicit-inputs findutils
1400 `(("make" ,gnu-make-boot0)
1401 ("diffutils" ,diffutils-boot0) ; for tests
1402 ,@%bootstrap-inputs)
1403 (current-source-location)))
1404
1405
1406(define %boot0-inputs
1407 `(("make" ,gnu-make-boot0)
1408 ("diffutils" ,diffutils-boot0)
1409 ("findutils" ,findutils-boot0)
1410 ,@%bootstrap-inputs))
1411
321b0996
LC
1412(define* (nix-system->gnu-triplet system #:optional (vendor "unknown"))
1413 "Return an a guess of the GNU triplet corresponding to Nix system
1414identifier SYSTEM."
1415 (let* ((dash (string-index system #\-))
1416 (arch (substring system 0 dash))
1417 (os (substring system (+ 1 dash))))
1418 (string-append arch
1419 "-" vendor "-"
1420 (if (string=? os "linux")
1421 "linux-gnu"
1422 os))))
1423
1424(define boot-triplet
1425 ;; Return the triplet used to create the cross toolchain needed in the
1426 ;; first bootstrapping stage.
1427 (cut nix-system->gnu-triplet <> "guix"))
1428
1429;; Following Linux From Scratch, build a cross-toolchain in stage 0. That
1430;; toolchain actually targets the same OS and arch, but it has the advantage
1431;; of being independent of the libc and tools in %BOOTSTRAP-INPUTS, since
1432;; GCC-BOOT0 (below) is built without any reference to the target libc.
1433
1434(define binutils-boot0
1435 (package (inherit binutils)
1436 (name "binutils-cross-boot0")
1437 (arguments
1438 (lambda (system)
1439 `(#:implicit-inputs? #f
1440 ,@(substitute-keyword-arguments (package-arguments binutils)
1441 ((#:configure-flags cf)
1442 `(list ,(string-append "--target=" (boot-triplet system))))))))
1443 (inputs %boot0-inputs)))
1444
60f984b2
LC
1445(define gcc-boot0
1446 (package (inherit gcc-4.7)
321b0996 1447 (name "gcc-cross-boot0")
60f984b2 1448 (arguments
321b0996
LC
1449 (lambda (system)
1450 `(#:implicit-inputs? #f
1451 #:modules ((guix build gnu-build-system)
1452 (guix build utils)
1453 (ice-9 regex)
1454 (srfi srfi-1)
1455 (srfi srfi-26))
1456 ,@(substitute-keyword-arguments (package-arguments gcc-4.7)
1457 ((#:configure-flags flags)
1458 `(append (list ,(string-append "--target="
1459 (boot-triplet system))
1460
1461 ;; No libc yet.
1462 "--without-headers"
1463
1464 ;; Disable features not needed at this stage.
1465 "--disable-shared"
1466 "--enable-languages=c"
1467 "--disable-libmudflap"
1468 "--disable-libgomp"
1469 "--disable-libssp"
1470 "--disable-libquadmath"
1471 "--disable-decimal-float")
1472 (remove (cut string-match "--enable-languages.*" <>)
1473 ,flags)))
1474 ((#:phases phases)
5f805fdf 1475 `(alist-cons-after
321b0996 1476 'unpack 'unpack-gmp&co
5f805fdf 1477 (lambda* (#:key inputs #:allow-other-keys)
321b0996
LC
1478 (let ((gmp (assoc-ref %build-inputs "gmp-source"))
1479 (mpfr (assoc-ref %build-inputs "mpfr-source"))
1480 (mpc (assoc-ref %build-inputs "mpc-source")))
5f805fdf
LC
1481
1482 ;; To reduce the set of pre-built bootstrap inputs, build
1483 ;; GMP & co. from GCC.
1484 (for-each (lambda (source)
1485 (or (zero? (system* "tar" "xvf" source))
1486 (error "failed to unpack tarball"
1487 source)))
1488 (list gmp mpfr mpc))
1489
1490 ;; Create symlinks like `gmp' -> `gmp-5.0.5'.
1491 ,@(map (lambda (lib)
1492 `(symlink ,(package-full-name lib)
1493 ,(package-name lib)))
1494 (list gmp mpfr mpc))
1495
1496 ;; MPFR headers/lib are found under $(MPFR)/src, but
1497 ;; `configure' wrongfully tells MPC too look under
1498 ;; $(MPFR), so fix that.
1499 (substitute* "configure"
1500 (("extra_mpc_mpfr_configure_flags(.+)--with-mpfr-include=([^/]+)/mpfr(.*)--with-mpfr-lib=([^ ]+)/mpfr"
1501 _ equals include middle lib)
1502 (string-append "extra_mpc_mpfr_configure_flags" equals
1503 "--with-mpfr-include=" include
1504 "/mpfr/src" middle
1505 "--with-mpfr-lib=" lib
1506 "/mpfr/src"))
1507 (("gmpinc='-I([^ ]+)/mpfr -I([^ ]+)/mpfr" _ a b)
1508 (string-append "gmpinc='-I" a "/mpfr/src "
1509 "-I" b "/mpfr/src"))
1510 (("gmplibs='-L([^ ]+)/mpfr" _ a)
1511 (string-append "gmplibs='-L" a "/mpfr/src")))))
321b0996
LC
1512 (alist-cons-after
1513 'install 'symlink-libgcc_eh
1514 (lambda* (#:key outputs #:allow-other-keys)
1515 (let ((out (assoc-ref outputs "out")))
1516 ;; Glibc wants to link against libgcc_eh, so provide
1517 ;; it.
1518 (with-directory-excursion
1519 (string-append out "/lib/gcc/"
1520 ,(boot-triplet system)
1521 "/" ,(package-version gcc-4.7))
1522 (symlink "libgcc.a" "libgcc_eh.a"))))
1523 ,phases)))))))
1524
1525 (inputs `(("gmp-source" ,(package-source gmp))
5f805fdf
LC
1526 ("mpfr-source" ,(package-source mpfr))
1527 ("mpc-source" ,(package-source mpc))
321b0996 1528 ("binutils-cross" ,binutils-boot0)
60f984b2 1529
321b0996
LC
1530 ;; Call it differently so that the builder can check whether
1531 ;; the "libc" input is #f.
1532 ("libc-native" ,@(assoc-ref %boot0-inputs "libc"))
1533 ,@(alist-delete "libc" %boot0-inputs)))))
60f984b2
LC
1534
1535(define linux-headers-boot0
1536 (package (inherit linux-headers)
1537 (arguments `(#:implicit-inputs? #f
1538 ,@(package-arguments linux-headers)))
fb585745
LC
1539 (native-inputs
1540 (let ((perl (package-with-explicit-inputs perl
1541 %boot0-inputs
1542 (current-source-location))))
1543 `(("perl" ,perl)
1544 ,@%boot0-inputs)))))
60f984b2
LC
1545
1546(define %boot1-inputs
1547 ;; 2nd stage inputs.
1548 `(("gcc" ,gcc-boot0)
321b0996
LC
1549 ("binutils-cross" ,binutils-boot0)
1550
1551 ;; Keep "binutils" here because the cross-gcc invokes `as', not the
1552 ;; cross-`as'.
1553 ,@%boot0-inputs))
60f984b2
LC
1554
1555(define-public glibc-final
321b0996
LC
1556 ;; The final libc, "cross-built". If everything went well, the resulting
1557 ;; store path has no dependencies.
60f984b2
LC
1558 (package (inherit glibc)
1559 (arguments
321b0996
LC
1560 (lambda (system)
1561 `(#:implicit-inputs? #f
1562
1563 ;; Leave /bin/sh as the interpreter for `ldd', `sotruss', etc. to
1564 ;; avoid keeping a reference to the bootstrap Bash.
1565 #:patch-shebangs? #f
1566 ,@(substitute-keyword-arguments (package-arguments glibc)
1567 ((#:configure-flags flags)
1568 `(append (list ,(string-append "--host=" (boot-triplet system))
1569 ,(string-append "--build="
1570 (nix-system->gnu-triplet system))
1571 "BASH_SHELL=/bin/sh"
1572
1573 ;; cross-rpcgen fails to build, because it gets
1574 ;; built with the cross-compiler instead of the
1575 ;; native compiler. See also
1576 ;; <http://sourceware.org/ml/libc-alpha/2012-03/msg00325.html>.
1577 "--disable-obsolete-rpc")
1578 ,flags))))))
60f984b2 1579 (propagated-inputs `(("linux-headers" ,linux-headers-boot0)))
321b0996
LC
1580 (inputs `(;; A native GCC is needed to build `cross-rpcgen'.
1581 ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
1582 ,@%boot1-inputs))))
1583
1584(define gcc-boot0-wrapped
1585 ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
1586 ;; non-cross names.
1587 (package (inherit gcc-4.7)
1588 (name (string-append (package-name gcc-boot0) "-wrapped"))
1589 (build-system trivial-build-system)
1590 (arguments
1591 (lambda (system)
1592 `(#:modules ((guix build utils))
1593 #:builder (begin
1594 (use-modules (guix build utils))
1595
1596 (let* ((binutils (assoc-ref %build-inputs "binutils"))
1597 (gcc (assoc-ref %build-inputs "gcc"))
1598 (libc (assoc-ref %build-inputs "libc"))
1599 (out (assoc-ref %outputs "out"))
1600 (bindir (string-append out "/bin"))
1601 (triplet ,(boot-triplet system)))
1602 (mkdir out) (mkdir bindir)
1603 (with-directory-excursion bindir
1604 (for-each (lambda (tool)
1605 (symlink (string-append binutils "/bin/"
1606 triplet "-" tool)
1607 tool))
1608 '("ar" "ranlib"))
1609
1610 ;; GCC-BOOT0 is a libc-less cross-compiler, so it
1611 ;; needs to be told where to find the crt files and
1612 ;; the dynamic linker.
1613 (call-with-output-file "gcc"
1614 (lambda (p)
1615 (format p "#!/bin/sh
1616exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/lib/~a \"$@\"~%"
1617 gcc triplet
1618 libc libc
1619 ,(glibc-dynamic-linker system))))
1620
1621 (chmod "gcc" #o555)))))))
1622 (native-inputs
1623 `(("binutils" ,binutils-boot0)
1624 ("gcc" ,gcc-boot0)
1625 ("libc" ,glibc-final)))
1626 (inputs '())))
60f984b2
LC
1627
1628(define %boot2-inputs
1629 ;; 3rd stage inputs.
1630 `(("libc" ,glibc-final)
321b0996
LC
1631 ("gcc" ,gcc-boot0-wrapped)
1632 ,@(fold alist-delete %boot1-inputs '("libc" "gcc"))))
60f984b2 1633
321b0996
LC
1634(define binutils-final
1635 (package (inherit binutils)
60f984b2 1636 (arguments
321b0996
LC
1637 (lambda (system)
1638 `(#:implicit-inputs? #f
1639 ,@(package-arguments binutils))))
1640 (inputs %boot2-inputs)))
60f984b2 1641
321b0996
LC
1642(define-public gcc-final
1643 ;; The final GCC.
1644 (package (inherit gcc-boot0)
1645 (name "gcc")
60f984b2 1646 (arguments
321b0996
LC
1647 (lambda (system)
1648 `(#:implicit-inputs? #f
1649
1650 ;; Build again GMP & co. within GCC's build process, because it's hard
1651 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
1652 ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
1653 ,@(substitute-keyword-arguments ((package-arguments gcc-boot0) system)
1654 ((#:configure-flags boot-flags)
1655 (let loop ((args (package-arguments gcc-4.7)))
1656 (match args
1657 ((#:configure-flags normal-flags _ ...)
1658 normal-flags)
1659 ((_ rest ...)
1660 (loop rest)))))
1661 ((#:phases phases)
1662 `(alist-delete 'symlink-libgcc_eh ,phases))))))
1663
1664 (inputs `(("gmp-source" ,(package-source gmp))
1665 ("mpfr-source" ,(package-source mpfr))
1666 ("mpc-source" ,(package-source mpc))
1667 ("binutils" ,binutils-final)
60f984b2
LC
1668 ,@%boot2-inputs))))
1669
82dc2b9a
LC
1670(define ld-wrapper-boot3
1671 ;; A linker wrapper that uses the bootstrap Guile.
1672 (package
1673 (name "ld-wrapper-boot3")
1674 (version "0")
1675 (source #f)
1676 (build-system trivial-build-system)
1677 (inputs `(("binutils" ,binutils-final)
1678 ("guile" ,(nixpkgs-derivation* "guile"))
1f455fdc
LC
1679 ("wrapper" ,(search-path %load-path
1680 "distro/packages/ld-wrapper.scm"))))
82dc2b9a
LC
1681 (arguments
1682 `(#:modules ((guix build utils))
1683 #:builder (begin
1684 (use-modules (guix build utils)
1685 (system base compile))
1686
1687 (let* ((out (assoc-ref %outputs "out"))
1688 (bin (string-append out "/bin"))
1689 (ld (string-append bin "/ld"))
1690 (go (string-append bin "/ld.go")))
1691
1692 (setvbuf (current-output-port) _IOLBF)
1693 (format #t "building ~s/bin/ld wrapper in ~s~%"
1694 (assoc-ref %build-inputs "binutils")
1695 out)
1696
1697 (mkdir out) (mkdir bin)
1698 (copy-file (assoc-ref %build-inputs "wrapper") ld)
1699 (substitute* ld
1700 (("@GUILE@")
1701 (string-append (assoc-ref %build-inputs "guile")
1702 "/bin/guile"))
1703 (("@LD@")
1704 (string-append (assoc-ref %build-inputs "binutils")
1705 "/bin/ld")))
1706 (chmod ld #o555)
1707 (compile-file ld #:output-file go)))))
1708 (description "The linker wrapper")
1709 (long-description
1710 "The linker wrapper (or `ld-wrapper') wraps the linker to add any
1711missing `-rpath' flags, and to detect any misuse of libraries outside of the
1712store.")
1713 (home-page #f)
1714 (license "GPLv3+")))
1715
60f984b2
LC
1716(define %boot3-inputs
1717 ;; 4th stage inputs.
60f984b2 1718 `(("gcc" ,gcc-final)
82dc2b9a 1719 ("ld-wrapper" ,ld-wrapper-boot3)
321b0996 1720 ,@(alist-delete "gcc" %boot2-inputs)))
60f984b2 1721
82dc2b9a
LC
1722(define-public bash-final
1723 (package-with-explicit-inputs bash %boot3-inputs
1724 (current-source-location)))
1725
1726(define-public guile-final
1727 (package-with-explicit-inputs guile-2.0
1728 `(("bash" ,bash-final)
1729 ,@(alist-delete "bash" %boot3-inputs))
1730 (current-source-location)))
1731
1732(define-public ld-wrapper
1733 ;; The final `ld' wrapper, which uses the final Guile.
1734 (package (inherit ld-wrapper-boot3)
1735 (name "ld-wrapper")
1736 (inputs `(("guile" ,guile-final)
1737 ,@(alist-delete "guile" (package-inputs ld-wrapper-boot3))))))
1738
60f984b2
LC
1739(define-public %final-inputs
1740 ;; Final derivations used as implicit inputs by `gnu-build-system'.
dc8907d8
LC
1741 ;; FIXME: Build bash before the others, otherwise patch-shebangs uses it in
1742 ;; bzip2, for instance.
321b0996 1743 (let ((finalize (cut package-with-explicit-inputs <> %boot3-inputs
3c0670e6 1744 (current-source-location))))
60f984b2
LC
1745 `(,@(map (match-lambda
1746 ((name package)
1747 (list name (finalize package))))
1748 `(("tar" ,tar)
1749 ("gzip" ,gzip)
6818af7b 1750 ("bzip2" ,bzip2)
60f984b2
LC
1751 ("xz" ,xz)
1752 ("diffutils" ,diffutils)
1753 ("patch" ,patch)
1754 ("coreutils" ,coreutils)
1755 ("sed" ,sed)
1756 ("grep" ,grep)
60f984b2
LC
1757 ("findutils" ,findutils)
1758 ("gawk" ,gawk)
321b0996 1759 ("make" ,gnu-make)))
82dc2b9a
LC
1760 ("bash" ,bash-final)
1761 ("ld-wrapper" ,ld-wrapper)
321b0996 1762 ("binutils" ,binutils-final)
60f984b2 1763 ("gcc" ,gcc-final)
321b0996 1764 ("libc" ,glibc-final))))
60f984b2
LC
1765
1766\f
1767;;;
1768;;; Apps & libs --- TODO: move to separate module.
1769;;;
1770
d9d466dd
LC
1771(define (guile-reader guile)
1772 "Build Guile-Reader against GUILE, a package of some version of Guile 1.8
1773or 2.0."
1774 (package
1775 (name (string-append "guile-reader-for-guile-" (package-version guile)))
1776 (version "0.6")
1777 (source (origin
1778 (method http-fetch)
1779 (uri (string-append
1780 "http://download-mirror.savannah.gnu.org/releases/guile-reader/guile-reader-"
1781 version ".tar.gz"))
1782 (sha256
1783 (base32
1784 "1svlyk5pm4fsdp2g7n6qffdl6fdggxnlicj0jn9s4lxd63gzxy1n"))))
1785 (build-system gnu-build-system)
ce5d658c
LC
1786 (native-inputs `(("pkgconfig" ,(nixpkgs-derivation* "pkgconfig"))
1787 ("gperf" ,(nixpkgs-derivation* "gperf"))))
d9d466dd
LC
1788 (inputs `(("guile" ,guile)))
1789 (description "Guile-Reader, a simple framework for building readers for
1790GNU Guile")
1791 (long-description
1792"Guile-Reader is a simple framework for building readers for GNU Guile.
1793
1794The idea is to make it easy to build procedures that extend Guile’s read
1795procedure. Readers supporting various syntax variants can easily be written,
1796possibly by re-using existing “token readers” of a standard Scheme
1797readers. For example, it is used to implement Skribilo’s R5RS-derived
1798document syntax.
1799
1800Guile-Reader’s approach is similar to Common Lisp’s “read table”, but
1801hopefully more powerful and flexible (for instance, one may instantiate as
1802many readers as needed).")
1803 (home-page "http://www.nongnu.org/guile-reader/")
1804 (license "GPLv3+")))
1805
1806(define-public guile-reader/guile-1.8
1807 ;; Guile-Reader built against Guile 1.8.
1808 (guile-reader guile-1.8))
1809
1810(define-public guile-reader/guile-2.0
1811 ;; Guile-Reader built against Guile 2.0.
1812 (guile-reader guile-2.0))
1813
d7978f46
LC
1814(define-public lout
1815 ;; This one is a bit tricky, because it doesn't follow the GNU Build System
1816 ;; rules. Instead, it has a makefile that has to be patched to set the
1817 ;; prefix, etc., and it has no makefile rules to build its doc.
1818 (let ((configure-phase
1819 '(lambda* (#:key outputs #:allow-other-keys)
1820 (let ((out (assoc-ref outputs "out"))
1821 (doc (assoc-ref outputs "doc")))
1822 (substitute* "makefile"
1823 (("^PREFIX[[:blank:]]*=.*$")
1824 (string-append "PREFIX = " out "\n"))
1825 (("^LOUTLIBDIR[[:blank:]]*=.*$")
1826 (string-append "LOUTLIBDIR = " out "/lib/lout\n"))
1827 (("^LOUTDOCDIR[[:blank:]]*=.*$")
1828 (string-append "LOUTDOCDIR = " doc "/doc/lout\n"))
1829 (("^MANDIR[[:blank:]]*=.*$")
1830 (string-append "MANDIR = " out "/man\n")))
1831 (mkdir out)
1832 (mkdir (string-append out "/bin")) ; TODO: use `mkdir-p'
1833 (mkdir (string-append out "/lib"))
1834 (mkdir (string-append out "/man"))
1835 (mkdir doc)
1836 (mkdir (string-append doc "/doc"))
1837 (mkdir (string-append doc "/doc/lout")))))
1838 (install-man-phase
1839 '(lambda* (#:key outputs #:allow-other-keys)
1840 (zero? (system* "make" "installman"))))
1841 (doc-phase
1842 '(lambda* (#:key outputs #:allow-other-keys)
1843 (define out
1844 (assoc-ref outputs "doc"))
1845
1846 (setenv "PATH"
1847 (string-append (assoc-ref outputs "out")
1848 "/bin:" (getenv "PATH")))
1849 (chdir "doc")
1850 (every (lambda (doc)
1851 (format #t "doc: building `~a'...~%" doc)
1852 (with-directory-excursion doc
1853 (let ((file (string-append out "/doc/lout/"
1854 doc ".ps")))
1855 (and (or (file-exists? "outfile.ps")
1856 (zero? (system* "lout" "-r4" "-o"
1857 "outfile.ps" "all")))
1858 (begin
1859 (copy-file "outfile.ps" file)
1860 #t)
1861 (zero? (system* "ps2pdf"
1862 "-dPDFSETTINGS=/prepress"
1863 "-sPAPERSIZE=a4"
1864 file
1865 (string-append out "/doc/lout/"
1866 doc ".pdf")))))))
1867 '("design" "expert" "slides" "user")))))
1868 (package
1869 (name "lout")
1870 (version "3.39")
1871 (source (origin
1872 (method http-fetch)
1873 ;; FIXME: `http-get' doesn't follow redirects, hence the URL.
1874 (uri (string-append
1875 "http://download-mirror.savannah.gnu.org/releases/lout/lout-"
1876 version ".tar.gz"))
1877 (sha256
1878 (base32
1879 "12gkyqrn0kaa8xq7sc7v3wm407pz2fxg9ngc75aybhi5z825b9vq"))))
1880 (build-system gnu-build-system) ; actually, just a makefile
1881 (outputs '("out" "doc"))
ce5d658c 1882 (inputs `(("ghostscript" ,(nixpkgs-derivation* "ghostscript"))))
d7978f46
LC
1883 (arguments `(#:modules ((guix build utils)
1884 (guix build gnu-build-system)
1885 (srfi srfi-1)) ; we need SRFI-1
1886 #:tests? #f ; no "check" target
1887
1888 ;; Customize the build phases.
1889 #:phases (alist-replace
1890 'configure ,configure-phase
1891
1892 (alist-cons-after
1893 'install 'install-man-pages
1894 ,install-man-phase
1895
1896 (alist-cons-after
1897 'install 'install-doc
1898 ,doc-phase
1899 %standard-phases)))))
1900 (description "Lout, a document layout system similar in style to LaTeX")
1901 (long-description
1902"The Lout document formatting system is now reads a high-level description of
1903a document similar in style to LaTeX and produces a PostScript or plain text
1904output file.
1905
1906Lout offers an unprecedented range of advanced features, including optimal
1907paragraph and page breaking, automatic hyphenation, PostScript EPS file
1908inclusion and generation, equation formatting, tables, diagrams, rotation and
1909scaling, sorted indexes, bibliographic databases, running headers and
1910odd-even pages, automatic cross referencing, multilingual documents including
1911hyphenation (most European languages are supported), formatting of computer
1912programs, and much more, all ready to use. Furthermore, Lout is easily
1913extended with definitions which are very much easier to write than troff of
1914TeX macros because Lout is a high-level, purely functional language, the
1915outcome of an eight-year research project that went back to the
1916beginning.")
1917 (license "GPLv3+")
1918 (home-page "http://savannah.nongnu.org/projects/lout/"))))
1919
d7672884
LC
1920;;; Local Variables:
1921;;; eval: (put 'lambda* 'scheme-indent-function 1)
d7978f46
LC
1922;;; eval: (put 'substitute* 'scheme-indent-function 1)
1923;;; eval: (put 'with-directory-excursion 'scheme-indent-function 1)
60f984b2 1924;;; eval: (put 'package 'scheme-indent-function 1)
321b0996 1925;;; eval: (put 'substitute-keyword-arguments 'scheme-indent-function 1)
d7672884 1926;;; End: