gnu: Add lua5.1-expat.
[jackhill/guix/guix.git] / gnu / packages / lua.scm
CommitLineData
712e6e68
CR
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
924cd631 3;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com>
a2c03fb1 4;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
90f80bf2 5;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
32fddd8e 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
07cbe28e 7;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
712e6e68
CR
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages lua)
572e433f 25 #:use-module ((guix licenses) #:prefix license:)
712e6e68
CR
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
fd07a6a6
RW
30 #:use-module (gnu packages readline)
31 #:use-module (gnu packages xml))
712e6e68
CR
32
33(define-public lua
34 (package
35 (name "lua")
2cb33ef8 36 (version "5.2.4")
712e6e68
CR
37 (source (origin
38 (method url-fetch)
39 (uri (string-append "http://www.lua.org/ftp/lua-"
40 version ".tar.gz"))
41 (sha256
2cb33ef8 42 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
fc1adab1
AK
43 (patches (search-patches "lua-pkgconfig.patch"
44 "lua52-liblua-so.patch"))))
712e6e68 45 (build-system gnu-build-system)
b3546174 46 (inputs `(("readline" ,readline)))
712e6e68
CR
47 (arguments
48 '(#:modules ((guix build gnu-build-system)
07cbe28e
RW
49 (guix build utils)
50 (srfi srfi-1))
712e6e68 51 #:test-target "test"
07cbe28e
RW
52 #:make-flags
53 '("CFLAGS=-fPIC -DLUA_DL_DLOPEN -DLUA_USE_POSIX"
54 "linux")
a4349e7a
EF
55 #:phases
56 (modify-phases %standard-phases
57 (delete 'configure)
a4349e7a
EF
58 (replace 'install
59 (lambda* (#:key outputs #:allow-other-keys)
60 (let ((out (assoc-ref outputs "out")))
61 (zero? (system* "make" "install"
62 (string-append "INSTALL_TOP=" out)
63 (string-append "INSTALL_MAN=" out
64 "/share/man/man1")))))))))
712e6e68 65 (home-page "http://www.lua.org/")
9e771e3b 66 (synopsis "Embeddable scripting language")
712e6e68
CR
67 (description
68 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
69combines simple procedural syntax with powerful data description constructs
35b9e423 70based on associative arrays and extensible semantics. Lua is dynamically typed,
712e6e68
CR
71runs by interpreting bytecode for a register-based virtual machine, and has
72automatic memory management with incremental garbage collection, making it ideal
73for configuration, scripting, and rapid prototyping.")
572e433f 74 (license license:x11)))
924cd631 75
01d3f19b
AE
76(define-public lua-5.1
77 (package (inherit lua)
78 (version "5.1.5")
79 (source (origin
80 (method url-fetch)
81 (uri (string-append "http://www.lua.org/ftp/lua-"
82 version ".tar.gz"))
83 (sha256
c361d075 84 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
32fddd8e
EF
85 (patches (search-patches "lua51-liblua-so.patch"
86 "lua-CVE-2014-5461.patch"))))))
01d3f19b 87
924cd631
RG
88(define-public luajit
89 (package
90 (name "luajit")
89deaf16 91 (version "2.0.4")
924cd631
RG
92 (source (origin
93 (method url-fetch)
94 (uri (string-append "http://luajit.org/download/LuaJIT-"
95 version ".tar.gz"))
96 (sha256
89deaf16 97 (base32 "0zc0y7p6nx1c0pp4nhgbdgjljpfxsb5kgwp4ysz22l1p2bms83v2"))
fc1adab1
AK
98 (patches (search-patches "luajit-symlinks.patch"
99 "luajit-no_ldconfig.patch"))))
924cd631
RG
100 (build-system gnu-build-system)
101 (arguments
102 '(#:tests? #f ;luajit is distributed without tests
103 #:phases (alist-delete 'configure %standard-phases)
104 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
105 (home-page "http://www.luajit.org/")
106 (synopsis "Just in time compiler for Lua programming language version 5.1")
107 (description
108 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
109programming language. Lua is a powerful, dynamic and light-weight programming
110language. It may be embedded or used as a general-purpose, stand-alone
111language.")
572e433f 112 (license license:x11)))
fd07a6a6
RW
113
114(define-public lua5.1-expat
115 (package
116 (name "lua5.1-expat")
117 (version "1.3.0")
118 (source (origin
119 (method url-fetch)
120 (uri (string-append "https://matthewwild.co.uk/projects/"
121 "luaexpat/luaexpat-" version ".tar.gz"))
122 (sha256
123 (base32
124 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
125 (build-system gnu-build-system)
126 (arguments
127 `(#:make-flags
128 (let ((out (assoc-ref %outputs "out")))
129 (list "CC=gcc"
130 (string-append "LUA_LDIR=" out "/share/lua/$(LUA_V)")
131 (string-append "LUA_CDIR=" out "/lib/lua/$(LUA_V)")))
132 #:phases
133 (modify-phases %standard-phases
134 (delete 'configure)
135 (replace 'check
136 (lambda _
137 (setenv "LUA_CPATH" "src/?.so;;")
138 (setenv "LUA_PATH" "src/?.lua;;")
139 (and (zero? (system* "lua" "tests/test.lua"))
140 (zero? (system* "lua" "tests/test-lom.lua"))))))))
141 (inputs
142 `(("lua" ,lua-5.1)
143 ("expat" ,expat)))
144 (home-page "http://matthewwild.co.uk/projects/luaexpat/")
145 (synopsis "SAX XML parser based on the Expat library")
146 (description "LuaExpat is a SAX XML parser based on the Expat library.")
147 (license (package-license lua-5.1))))