Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / gawk.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages gawk)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages bash)
23 #:use-module (gnu packages libsigsegv)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu))
27
28 (define-public gawk
29 (package
30 (name "gawk")
31 (version "4.1.1")
32 (source (origin
33 (method url-fetch)
34 (uri (string-append "mirror://gnu/gawk/gawk-" version
35 ".tar.xz"))
36 (sha256
37 (base32 "1nz83vpss8xv7m475sv4qhhj40g74nvcw0y9kwq9ds8wzfmcdm7g"))))
38 (build-system gnu-build-system)
39 (arguments
40 `(#:parallel-tests? #f ; test suite fails in parallel
41
42 #:phases (alist-cons-before
43 'configure 'set-shell-file-name
44 (lambda* (#:key inputs #:allow-other-keys)
45 ;; Refer to the right shell.
46 (let ((bash (assoc-ref inputs "bash")))
47 (substitute* "io.c"
48 (("/bin/sh")
49 (string-append bash "/bin/bash")))
50
51 ;; When cross-compiling, remove dependencies on the
52 ;; `check-for-shared-lib-support' target, which tries to
53 ;; run the cross-built `gawk'.
54 ,@(if (%current-target-system)
55 '((substitute* "extension/Makefile.in"
56 (("^.*: check-for-shared-lib-support" match)
57 (string-append "### " match))))
58 '())
59
60 ;; XXX FIXME gawk 4.1.1 was bootstrapped with a prerelease
61 ;; libtool, which fails on MIPS in the absence of
62 ;; /usr/bin/file. As a temporary workaround, we patch
63 ;; the configure script to hardcode use of the little
64 ;; endian N32 ABI on MIPS.
65 ,@(if (equal? "mips64el-linux" (or (%current-target-system)
66 (%current-system)))
67 '((substitute* "extension/configure"
68 (("\\$emul") "elf32ltsmipn32")))
69 '())))
70 %standard-phases)))
71 (inputs `(("libsigsegv" ,libsigsegv)
72
73 ,@(if (%current-target-system)
74 `(("bash" ,bash))
75 '())))
76
77 (home-page "http://www.gnu.org/software/gawk/")
78 (synopsis "A text scanning and processing language")
79 (description
80 "Gawk is the GNU implementation of Awk, a specialized programming
81 language for the easy manipulation of formatted text, such as tables of data.
82 Gawk features many extensions beyond the traditional implementation,
83 including network access, sorting, and large libraries.")
84 (license gpl3+)))