Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / flex.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
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 flex)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages m4)
27 #:use-module (gnu packages man)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages indent)
30 #:use-module (srfi srfi-1))
31
32 (define-public flex
33 (package
34 (name "flex")
35 (version "2.6.4")
36 (source (origin
37 (method url-fetch)
38 (uri (string-append
39 "https://github.com/westes/flex"
40 "/releases/download/v" version "/"
41 "flex-" version ".tar.gz"))
42 (sha256
43 (base32
44 "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8"))))
45 (build-system gnu-build-system)
46 (inputs
47 (let ((bison-for-tests
48 ;; Work around an incompatibility with Bison 3.0:
49 ;; <http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00014.html>.
50 (package
51 (inherit bison)
52 (version "2.7.1")
53 (source (origin
54 (method url-fetch)
55 (uri (string-append
56 "mirror://gnu/bison/"
57 "bison-" version ".tar.xz"))
58 (sha256
59 (base32
60 "1yx7isx67sdmyijvihgyra1f59fwdz7sqriginvavfj5yb5ss2dl"))))
61
62 ;; Unlike Bison 3.0, this version did not need Flex for its
63 ;; tests, so it allows us to break the cycle.
64 (inputs (alist-delete "flex" (package-inputs bison))))))
65 `(("bison" ,bison-for-tests)
66 ("indent" ,indent))))
67 ;; m4 is not present in PATH when cross-building
68 (native-inputs
69 `(("help2man" ,help2man)
70 ("m4" ,m4)))
71 (propagated-inputs `(("m4" ,m4)))
72 (home-page "https://github.com/westes/flex")
73 (synopsis "Fast lexical analyser generator")
74 (description
75 "Flex is a tool for generating scanners. A scanner, sometimes
76 called a tokenizer, is a program which recognizes lexical patterns in
77 text. The flex program reads user-specified input files, or its standard
78 input if no file names are given, for a description of a scanner to
79 generate. The description is in the form of pairs of regular expressions
80 and C code, called rules. Flex generates a C source file named,
81 \"lex.yy.c\", which defines the function yylex(). The file \"lex.yy.c\"
82 can be compiled and linked to produce an executable. When the executable
83 is run, it analyzes its input for occurrences of text matching the
84 regular expressions for each rule. Whenever it finds a match, it
85 executes the corresponding C code.")
86 (license (non-copyleft "file://COPYING"
87 "See COPYING in the distribution."))))