gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / gawk.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages gawk)
22 #:use-module (guix licenses)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages libsigsegv)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu))
29
30 (define-public gawk
31 (package
32 (name "gawk")
33 (version "5.0.1")
34 (source (origin
35 (method url-fetch)
36 (uri (string-append "mirror://gnu/gawk/gawk-" version
37 ".tar.xz"))
38 (sha256
39 (base32 "15570p7g2x54asvr2fsc56sxzmm08fbk4mzpcs5n92fp9vq8cklf"))))
40 (build-system gnu-build-system)
41 (arguments
42 `(#:phases (modify-phases %standard-phases
43 (add-before '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/sh")))
50
51 ;; When cross-compiling, remove dependencies on the
52 ;; `check-for-shared-lib-support' target, which tries
53 ;; to 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 #t)))
61
62 (add-before 'check 'adjust-test-infrastructure
63 (lambda _
64 ;; Remove dependency on 'more' (from util-linux), which
65 ;; would needlessly complicate bootstrapping.
66 (substitute* "test/Makefile"
67 (("\\| more") ""))
68
69 ;; Adjust the shebang in that file since it is then diff'd
70 ;; against the actual test output.
71 (substitute* "test/watchpoint1.ok"
72 (("#! /usr/bin/gawk")
73 (string-append "#!" (which "gawk"))))
74 #t)))))
75
76 (inputs `(("libsigsegv" ,libsigsegv)
77
78 ,@(if (%current-target-system)
79 `(("bash" ,bash))
80 '())))
81
82 (home-page "https://www.gnu.org/software/gawk/")
83 (synopsis "Text scanning and processing language")
84 (description
85 "Gawk is the GNU implementation of Awk, a specialized programming
86 language for the easy manipulation of formatted text, such as tables of data.
87 Gawk features many extensions beyond the traditional implementation,
88 including network access, sorting, and large libraries.")
89 (license gpl3+)))