gnu: Add tintin++.
[jackhill/guix/guix.git] / gnu / packages / lua.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com>
4 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
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)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages readline)
31 #:use-module (gnu packages tls)
32 #:use-module (gnu packages xml))
33
34 (define-public lua
35 (package
36 (name "lua")
37 (version "5.2.4")
38 (source (origin
39 (method url-fetch)
40 (uri (string-append "http://www.lua.org/ftp/lua-"
41 version ".tar.gz"))
42 (sha256
43 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
44 (patches (search-patches "lua-pkgconfig.patch"
45 "lua52-liblua-so.patch"))))
46 (build-system gnu-build-system)
47 (inputs `(("readline" ,readline)))
48 (arguments
49 '(#:modules ((guix build gnu-build-system)
50 (guix build utils)
51 (srfi srfi-1))
52 #:test-target "test"
53 #:make-flags
54 '("CFLAGS=-fPIC -DLUA_DL_DLOPEN -DLUA_USE_POSIX"
55 "linux")
56 #:phases
57 (modify-phases %standard-phases
58 (delete 'configure)
59 (replace 'install
60 (lambda* (#:key outputs #:allow-other-keys)
61 (let ((out (assoc-ref outputs "out")))
62 (zero? (system* "make" "install"
63 (string-append "INSTALL_TOP=" out)
64 (string-append "INSTALL_MAN=" out
65 "/share/man/man1")))))))))
66 (home-page "http://www.lua.org/")
67 (synopsis "Embeddable scripting language")
68 (description
69 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
70 combines simple procedural syntax with powerful data description constructs
71 based on associative arrays and extensible semantics. Lua is dynamically typed,
72 runs by interpreting bytecode for a register-based virtual machine, and has
73 automatic memory management with incremental garbage collection, making it ideal
74 for configuration, scripting, and rapid prototyping.")
75 (license license:x11)))
76
77 (define-public lua-5.1
78 (package (inherit lua)
79 (version "5.1.5")
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "http://www.lua.org/ftp/lua-"
83 version ".tar.gz"))
84 (sha256
85 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
86 (patches (search-patches "lua51-liblua-so.patch"
87 "lua-CVE-2014-5461.patch"))))))
88
89 (define-public luajit
90 (package
91 (name "luajit")
92 (version "2.0.4")
93 (source (origin
94 (method url-fetch)
95 (uri (string-append "http://luajit.org/download/LuaJIT-"
96 version ".tar.gz"))
97 (sha256
98 (base32 "0zc0y7p6nx1c0pp4nhgbdgjljpfxsb5kgwp4ysz22l1p2bms83v2"))
99 (patches (search-patches "luajit-symlinks.patch"
100 "luajit-no_ldconfig.patch"))))
101 (build-system gnu-build-system)
102 (arguments
103 '(#:tests? #f ;luajit is distributed without tests
104 #:phases (alist-delete 'configure %standard-phases)
105 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
106 (home-page "http://www.luajit.org/")
107 (synopsis "Just in time compiler for Lua programming language version 5.1")
108 (description
109 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
110 programming language. Lua is a powerful, dynamic and light-weight programming
111 language. It may be embedded or used as a general-purpose, stand-alone
112 language.")
113 (license license:x11)))
114
115 (define-public lua5.1-expat
116 (package
117 (name "lua5.1-expat")
118 (version "1.3.0")
119 (source (origin
120 (method url-fetch)
121 (uri (string-append "https://matthewwild.co.uk/projects/"
122 "luaexpat/luaexpat-" version ".tar.gz"))
123 (sha256
124 (base32
125 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
126 (build-system gnu-build-system)
127 (arguments
128 `(#:make-flags
129 (let ((out (assoc-ref %outputs "out")))
130 (list "CC=gcc"
131 (string-append "LUA_LDIR=" out "/share/lua/$(LUA_V)")
132 (string-append "LUA_CDIR=" out "/lib/lua/$(LUA_V)")))
133 #:phases
134 (modify-phases %standard-phases
135 (delete 'configure)
136 (replace 'check
137 (lambda _
138 (setenv "LUA_CPATH" "src/?.so;;")
139 (setenv "LUA_PATH" "src/?.lua;;")
140 (and (zero? (system* "lua" "tests/test.lua"))
141 (zero? (system* "lua" "tests/test-lom.lua"))))))))
142 (inputs
143 `(("lua" ,lua-5.1)
144 ("expat" ,expat)))
145 (home-page "http://matthewwild.co.uk/projects/luaexpat/")
146 (synopsis "SAX XML parser based on the Expat library")
147 (description "LuaExpat is a SAX XML parser based on the Expat library.")
148 (license (package-license lua-5.1))))
149
150 (define-public lua5.1-socket
151 (package
152 (name "lua5.1-socket")
153 (version "2.0.2")
154 (source (origin
155 (method url-fetch)
156 (uri (string-append "http://files.luaforge.net/releases/"
157 "luasocket/luasocket/luasocket-"
158 version "/luasocket-" version ".tar.gz"))
159 (sha256
160 (base32
161 "19ichkbc4rxv00ggz8gyf29jibvc2wq9pqjik0ll326rrxswgnag"))))
162 (build-system gnu-build-system)
163 (arguments
164 `(#:make-flags
165 (let ((out (assoc-ref %outputs "out")))
166 (list (string-append "INSTALL_TOP_SHARE=" out "/share/lua/5.1")
167 (string-append "INSTALL_TOP_LIB=" out "/lib/lua/5.1")))
168 #:phases
169 (modify-phases %standard-phases
170 (delete 'configure)
171 (replace 'check
172 (lambda _
173 (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
174 (setenv "LUA_PATH" "src/?.lua;;")
175 (when (zero? (primitive-fork))
176 (system* "lua" "test/testsrvr.lua"))
177 (zero? (system* "lua" "test/testclnt.lua")))))))
178 (inputs
179 `(("lua" ,lua-5.1)))
180 (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
181 (synopsis "Socket library for Lua")
182 (description "LuaSocket is a Lua extension library that is composed by two
183 parts: a C core that provides support for the TCP and UDP transport layers,
184 and a set of Lua modules that add support for functionality commonly needed by
185 applications that deal with the Internet.
186
187 Among the supported modules, the most commonly used implement the
188 SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
189 files) client protocols. These provide a very natural and generic interface
190 to the functionality defined by each protocol. In addition, you will find
191 that the MIME (common encodings), URL (anything you could possible want to do
192 with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
193 handy.")
194 (license (package-license lua-5.1))))
195
196 (define-public lua5.1-filesystem
197 (package
198 (name "lua5.1-filesystem")
199 (version "1.6.3")
200 (source (origin
201 (method url-fetch)
202 (uri (string-append "https://github.com/keplerproject/"
203 "luafilesystem/archive/v_"
204 "1_6_3" ".tar.gz"))
205 (file-name (string-append name "-" version ".tar.gz"))
206 (sha256
207 (base32
208 "0s10ckxin0bysd6gaywqhxkpw3ybjhprr8m655b8cx3pxjwd49am"))))
209 (build-system gnu-build-system)
210 (arguments
211 `(#:make-flags
212 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
213 #:test-target "test"
214 #:phases
215 (modify-phases %standard-phases
216 (delete 'configure))))
217 (inputs
218 `(("lua" ,lua-5.1)))
219 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
220 (synopsis "File system library for Lua")
221 (description "LuaFileSystem is a Lua library developed to complement the
222 set of functions related to file systems offered by the standard Lua
223 distribution. LuaFileSystem offers a portable way to access the underlying
224 directory structure and file attributes.")
225 (license (package-license lua-5.1))))
226
227 (define-public lua5.1-sec
228 (package
229 (name "lua5.1-sec")
230 (version "0.6")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "https://github.com/brunoos/luasec/archive/"
234 "luasec-" version ".tar.gz"))
235 (sha256
236 (base32
237 "0pgd1anzznl4s0h16wg8dlw9mgdb9h52drlcki6sbf5y31fa7wyf"))))
238 (build-system gnu-build-system)
239 (arguments
240 `(#:make-flags
241 (let ((out (assoc-ref %outputs "out")))
242 (list "linux"
243 "CC=gcc"
244 "LD=gcc"
245 (string-append "LUAPATH=" out "/share/lua/5.1")
246 (string-append "LUACPATH=" out "/lib/lua/5.1")))
247 #:tests? #f ; no tests included
248 #:phases
249 (modify-phases %standard-phases
250 (delete 'configure))))
251 (inputs
252 `(("lua" ,lua-5.1)
253 ("openssl" ,openssl)))
254 (propagated-inputs
255 `(("lua-socket" ,lua5.1-socket)))
256 (home-page "https://github.com/brunoos/luasec/wiki")
257 (synopsis "OpenSSL bindings for Lua")
258 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
259 communication. It takes an already established TCP connection and creates a
260 secure session between the peers.")
261 (license (package-license lua-5.1))))