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