7f2bed3ab7b07cbf608bbe78b3b6da0ec313f1fc
[jackhill/guix/guix.git] / distro / packages / m4.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU 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 ;;; GNU 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (distro packages m4)
20 #:use-module (guix licenses)
21 #:use-module (distro)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix utils)
25 #:use-module (guix build-system gnu))
26
27 (define-public m4
28 (package
29 (name "m4")
30 (version "1.4.16")
31 (source (origin
32 (method url-fetch)
33 (uri (string-append "mirror://gnu/m4/m4-"
34 version ".tar.bz2"))
35 (sha256
36 (base32
37 "035r7ma272j2cwni2961jp22k6bn3n9xwn3b3qbcn2yrvlghql22"))))
38 (build-system gnu-build-system)
39 (arguments (case-lambda
40 ((system)
41 ;; XXX: Disable tests on those platforms with know issues.
42 `(#:tests? ,(not (member system
43 '("x86_64-darwin"
44 "i686-cygwin"
45 "i686-sunos")))
46 #:patches (list (assoc-ref %build-inputs "patch/s_isdir")
47 (assoc-ref %build-inputs
48 "patch/readlink-EINVAL")
49 (assoc-ref %build-inputs "patch/gets"))
50 #:phases (alist-cons-before
51 'check 'pre-check
52 (lambda* (#:key inputs #:allow-other-keys)
53 ;; Fix references to /bin/sh.
54 (let ((bash (assoc-ref inputs "bash")))
55 (for-each patch-shebang
56 (find-files "tests" "\\.sh$"))
57 (substitute* (find-files "tests"
58 "posix_spawn")
59 (("/bin/sh")
60 (format #f "~a/bin/bash" bash)))))
61 %standard-phases)))
62 ((system cross-system)
63 `(#:patches (list (assoc-ref %build-inputs "patch/s_isdir")
64 (assoc-ref %build-inputs
65 "patch/readlink-EINVAL")
66 (assoc-ref %build-inputs "patch/gets"))))))
67 (inputs `(("patch/s_isdir" ,(search-patch "m4-s_isdir.patch"))
68 ("patch/readlink-EINVAL"
69 ,(search-patch "m4-readlink-EINVAL.patch"))
70 ("patch/gets" ,(search-patch "m4-gets-undeclared.patch"))))
71 (synopsis "GNU M4, a macro processor")
72 (description
73 "GNU M4 is an implementation of the traditional Unix macro processor. It
74 is mostly SVR4 compatible although it has some extensions (for example,
75 handling more than 9 positional parameters to macros). GNU M4 also has
76 built-in functions for including files, running shell commands, doing
77 arithmetic, etc.
78
79 GNU M4 is a macro processor in the sense that it copies its input to the
80 output expanding macros as it goes. Macros are either builtin or
81 user-defined and can take any number of arguments. Besides just doing macro
82 expansion, m4 has builtin functions for including named files, running UNIX
83 commands, doing integer arithmetic, manipulating text in various ways,
84 recursion etc... m4 can be used either as a front-end to a compiler or as a
85 macro processor in its own right.")
86 (license gpl3+)
87 (home-page "http://www.gnu.org/software/m4/")))