Commit | Line | Data |
---|---|---|
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> |
864a9590 | 6 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
07cbe28e | 7 | ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> |
03d8505f | 8 | ;;; Copyright © 2016 doncatnip <gnopap@gmail.com> |
4a384221 | 9 | ;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org> |
35cdc267 | 10 | ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org> |
712e6e68 CR |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages lua) | |
572e433f | 28 | #:use-module ((guix licenses) #:prefix license:) |
712e6e68 CR |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
35cdc267 | 31 | #:use-module (guix utils) |
712e6e68 CR |
32 | #:use-module (guix build-system gnu) |
33 | #:use-module (gnu packages) | |
fd07a6a6 | 34 | #:use-module (gnu packages readline) |
d62dc2ae | 35 | #:use-module (gnu packages tls) |
03d8505f | 36 | #:use-module (gnu packages xml) |
37 | #:use-module (gnu packages glib) | |
38 | #:use-module (gnu packages libffi) | |
39 | #:use-module (gnu packages pkg-config) | |
40 | #:use-module (gnu packages xorg) | |
41 | #:use-module (gnu packages gtk)) | |
712e6e68 CR |
42 | |
43 | (define-public lua | |
44 | (package | |
45 | (name "lua") | |
233a0c94 | 46 | (version "5.3.4") |
712e6e68 CR |
47 | (source (origin |
48 | (method url-fetch) | |
6dbf1fec | 49 | (uri (string-append "https://www.lua.org/ftp/lua-" |
712e6e68 CR |
50 | version ".tar.gz")) |
51 | (sha256 | |
233a0c94 | 52 | (base32 "0320a8dg3aci4hxla380dx1ifkw8gj4gbw5c4dz41g1kh98sm0gn")) |
fc1adab1 | 53 | (patches (search-patches "lua-pkgconfig.patch" |
6dbf1fec | 54 | "lua-liblua-so.patch")))) |
712e6e68 | 55 | (build-system gnu-build-system) |
b3546174 | 56 | (inputs `(("readline" ,readline))) |
712e6e68 CR |
57 | (arguments |
58 | '(#:modules ((guix build gnu-build-system) | |
07cbe28e RW |
59 | (guix build utils) |
60 | (srfi srfi-1)) | |
712e6e68 | 61 | #:test-target "test" |
07cbe28e | 62 | #:make-flags |
c0d47cad | 63 | '("MYCFLAGS=-fPIC -DLUA_DL_DLOPEN" |
07cbe28e | 64 | "linux") |
a4349e7a EF |
65 | #:phases |
66 | (modify-phases %standard-phases | |
67 | (delete 'configure) | |
a4349e7a EF |
68 | (replace 'install |
69 | (lambda* (#:key outputs #:allow-other-keys) | |
70 | (let ((out (assoc-ref outputs "out"))) | |
71 | (zero? (system* "make" "install" | |
72 | (string-append "INSTALL_TOP=" out) | |
73 | (string-append "INSTALL_MAN=" out | |
74 | "/share/man/man1"))))))))) | |
6dbf1fec | 75 | (home-page "https://www.lua.org/") |
9e771e3b | 76 | (synopsis "Embeddable scripting language") |
712e6e68 CR |
77 | (description |
78 | "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua | |
79 | combines simple procedural syntax with powerful data description constructs | |
35b9e423 | 80 | based on associative arrays and extensible semantics. Lua is dynamically typed, |
712e6e68 CR |
81 | runs by interpreting bytecode for a register-based virtual machine, and has |
82 | automatic memory management with incremental garbage collection, making it ideal | |
83 | for configuration, scripting, and rapid prototyping.") | |
572e433f | 84 | (license license:x11))) |
924cd631 | 85 | |
6dbf1fec MB |
86 | (define-public lua-5.2 |
87 | (package (inherit lua) | |
88 | (version "5.2.4") | |
89 | (source | |
90 | (origin | |
91 | (method url-fetch) | |
92 | (uri (string-append "https://www.lua.org/ftp/lua-" | |
93 | version ".tar.gz")) | |
94 | (sha256 | |
95 | (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr")) | |
96 | (patches (search-patches "lua-pkgconfig.patch" | |
97 | "lua-liblua-so.patch")))))) | |
98 | ||
01d3f19b AE |
99 | (define-public lua-5.1 |
100 | (package (inherit lua) | |
101 | (version "5.1.5") | |
102 | (source (origin | |
103 | (method url-fetch) | |
6dbf1fec | 104 | (uri (string-append "https://www.lua.org/ftp/lua-" |
01d3f19b AE |
105 | version ".tar.gz")) |
106 | (sha256 | |
c361d075 | 107 | (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16")) |
32fddd8e | 108 | (patches (search-patches "lua51-liblua-so.patch" |
a287fafe DM |
109 | "lua-CVE-2014-5461.patch" |
110 | "lua51-pkgconfig.patch")))))) | |
01d3f19b | 111 | |
924cd631 RG |
112 | (define-public luajit |
113 | (package | |
114 | (name "luajit") | |
864a9590 | 115 | (version "2.1.0-beta2") |
924cd631 RG |
116 | (source (origin |
117 | (method url-fetch) | |
118 | (uri (string-append "http://luajit.org/download/LuaJIT-" | |
119 | version ".tar.gz")) | |
120 | (sha256 | |
864a9590 | 121 | (base32 "0iyghj1xjlmd9ywa4flf9yszynf3jhbp0yqb9b49k7ab0g528fbi")) |
fc1adab1 AK |
122 | (patches (search-patches "luajit-symlinks.patch" |
123 | "luajit-no_ldconfig.patch")))) | |
924cd631 RG |
124 | (build-system gnu-build-system) |
125 | (arguments | |
126 | '(#:tests? #f ;luajit is distributed without tests | |
127 | #:phases (alist-delete 'configure %standard-phases) | |
128 | #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))))) | |
129 | (home-page "http://www.luajit.org/") | |
130 | (synopsis "Just in time compiler for Lua programming language version 5.1") | |
131 | (description | |
132 | "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua | |
133 | programming language. Lua is a powerful, dynamic and light-weight programming | |
134 | language. It may be embedded or used as a general-purpose, stand-alone | |
135 | language.") | |
572e433f | 136 | (license license:x11))) |
fd07a6a6 RW |
137 | |
138 | (define-public lua5.1-expat | |
139 | (package | |
140 | (name "lua5.1-expat") | |
141 | (version "1.3.0") | |
142 | (source (origin | |
143 | (method url-fetch) | |
144 | (uri (string-append "https://matthewwild.co.uk/projects/" | |
145 | "luaexpat/luaexpat-" version ".tar.gz")) | |
146 | (sha256 | |
147 | (base32 | |
148 | "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h")))) | |
149 | (build-system gnu-build-system) | |
150 | (arguments | |
151 | `(#:make-flags | |
152 | (let ((out (assoc-ref %outputs "out"))) | |
153 | (list "CC=gcc" | |
154 | (string-append "LUA_LDIR=" out "/share/lua/$(LUA_V)") | |
155 | (string-append "LUA_CDIR=" out "/lib/lua/$(LUA_V)"))) | |
156 | #:phases | |
157 | (modify-phases %standard-phases | |
158 | (delete 'configure) | |
159 | (replace 'check | |
160 | (lambda _ | |
161 | (setenv "LUA_CPATH" "src/?.so;;") | |
162 | (setenv "LUA_PATH" "src/?.lua;;") | |
163 | (and (zero? (system* "lua" "tests/test.lua")) | |
164 | (zero? (system* "lua" "tests/test-lom.lua")))))))) | |
165 | (inputs | |
166 | `(("lua" ,lua-5.1) | |
167 | ("expat" ,expat))) | |
168 | (home-page "http://matthewwild.co.uk/projects/luaexpat/") | |
169 | (synopsis "SAX XML parser based on the Expat library") | |
170 | (description "LuaExpat is a SAX XML parser based on the Expat library.") | |
171 | (license (package-license lua-5.1)))) | |
c21b8261 RW |
172 | |
173 | (define-public lua5.1-socket | |
174 | (package | |
175 | (name "lua5.1-socket") | |
176 | (version "2.0.2") | |
177 | (source (origin | |
178 | (method url-fetch) | |
179 | (uri (string-append "http://files.luaforge.net/releases/" | |
180 | "luasocket/luasocket/luasocket-" | |
181 | version "/luasocket-" version ".tar.gz")) | |
182 | (sha256 | |
183 | (base32 | |
184 | "19ichkbc4rxv00ggz8gyf29jibvc2wq9pqjik0ll326rrxswgnag")))) | |
185 | (build-system gnu-build-system) | |
186 | (arguments | |
187 | `(#:make-flags | |
188 | (let ((out (assoc-ref %outputs "out"))) | |
189 | (list (string-append "INSTALL_TOP_SHARE=" out "/share/lua/5.1") | |
190 | (string-append "INSTALL_TOP_LIB=" out "/lib/lua/5.1"))) | |
191 | #:phases | |
192 | (modify-phases %standard-phases | |
193 | (delete 'configure) | |
194 | (replace 'check | |
195 | (lambda _ | |
196 | (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;")) | |
197 | (setenv "LUA_PATH" "src/?.lua;;") | |
198 | (when (zero? (primitive-fork)) | |
199 | (system* "lua" "test/testsrvr.lua")) | |
200 | (zero? (system* "lua" "test/testclnt.lua"))))))) | |
201 | (inputs | |
202 | `(("lua" ,lua-5.1))) | |
203 | (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/") | |
204 | (synopsis "Socket library for Lua") | |
205 | (description "LuaSocket is a Lua extension library that is composed by two | |
206 | parts: a C core that provides support for the TCP and UDP transport layers, | |
207 | and a set of Lua modules that add support for functionality commonly needed by | |
208 | applications that deal with the Internet. | |
209 | ||
210 | Among the supported modules, the most commonly used implement the | |
211 | SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading | |
212 | files) client protocols. These provide a very natural and generic interface | |
213 | to the functionality defined by each protocol. In addition, you will find | |
214 | that the MIME (common encodings), URL (anything you could possible want to do | |
215 | with one) and LTN12 (filters, sinks, sources and pumps) modules can be very | |
216 | handy.") | |
217 | (license (package-license lua-5.1)))) | |
182de8fc RW |
218 | |
219 | (define-public lua5.1-filesystem | |
220 | (package | |
221 | (name "lua5.1-filesystem") | |
222 | (version "1.6.3") | |
223 | (source (origin | |
224 | (method url-fetch) | |
225 | (uri (string-append "https://github.com/keplerproject/" | |
226 | "luafilesystem/archive/v_" | |
227 | "1_6_3" ".tar.gz")) | |
228 | (file-name (string-append name "-" version ".tar.gz")) | |
229 | (sha256 | |
230 | (base32 | |
231 | "0s10ckxin0bysd6gaywqhxkpw3ybjhprr8m655b8cx3pxjwd49am")))) | |
232 | (build-system gnu-build-system) | |
233 | (arguments | |
234 | `(#:make-flags | |
235 | (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
236 | #:test-target "test" | |
237 | #:phases | |
238 | (modify-phases %standard-phases | |
239 | (delete 'configure)))) | |
240 | (inputs | |
241 | `(("lua" ,lua-5.1))) | |
242 | (home-page "https://keplerproject.github.io/luafilesystem/index.html") | |
243 | (synopsis "File system library for Lua") | |
244 | (description "LuaFileSystem is a Lua library developed to complement the | |
245 | set of functions related to file systems offered by the standard Lua | |
246 | distribution. LuaFileSystem offers a portable way to access the underlying | |
247 | directory structure and file attributes.") | |
248 | (license (package-license lua-5.1)))) | |
d62dc2ae RW |
249 | |
250 | (define-public lua5.1-sec | |
251 | (package | |
252 | (name "lua5.1-sec") | |
253 | (version "0.6") | |
254 | (source (origin | |
255 | (method url-fetch) | |
256 | (uri (string-append "https://github.com/brunoos/luasec/archive/" | |
257 | "luasec-" version ".tar.gz")) | |
258 | (sha256 | |
259 | (base32 | |
260 | "0pgd1anzznl4s0h16wg8dlw9mgdb9h52drlcki6sbf5y31fa7wyf")))) | |
261 | (build-system gnu-build-system) | |
262 | (arguments | |
263 | `(#:make-flags | |
264 | (let ((out (assoc-ref %outputs "out"))) | |
265 | (list "linux" | |
266 | "CC=gcc" | |
267 | "LD=gcc" | |
268 | (string-append "LUAPATH=" out "/share/lua/5.1") | |
269 | (string-append "LUACPATH=" out "/lib/lua/5.1"))) | |
270 | #:tests? #f ; no tests included | |
271 | #:phases | |
272 | (modify-phases %standard-phases | |
273 | (delete 'configure)))) | |
274 | (inputs | |
275 | `(("lua" ,lua-5.1) | |
276 | ("openssl" ,openssl))) | |
277 | (propagated-inputs | |
278 | `(("lua-socket" ,lua5.1-socket))) | |
279 | (home-page "https://github.com/brunoos/luasec/wiki") | |
280 | (synopsis "OpenSSL bindings for Lua") | |
281 | (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL | |
282 | communication. It takes an already established TCP connection and creates a | |
283 | secure session between the peers.") | |
284 | (license (package-license lua-5.1)))) | |
03d8505f | 285 | |
286 | (define-public lua-lgi | |
287 | (package | |
288 | (name "lua-lgi") | |
289 | (version "0.9.1") | |
290 | (source | |
291 | (origin | |
292 | (method url-fetch) | |
293 | (uri (string-append | |
294 | "https://github.com/pavouk/lgi/archive/" | |
295 | version ".tar.gz")) | |
296 | (file-name (string-append name "-" version ".tar.gz")) | |
297 | (sha256 | |
298 | (base32 | |
299 | "1fmgdl5y4ph3yc6ycg865s3vai1rjkyda61cgqxk6zd13hmznw0c")))) | |
300 | (build-system gnu-build-system) | |
301 | (arguments | |
302 | '(#:make-flags (list "CC=gcc" | |
303 | (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
304 | #:phases | |
305 | (modify-phases %standard-phases | |
306 | (delete 'configure) ; no configure script | |
307 | (add-before 'build 'set-env | |
308 | (lambda* (#:key inputs #:allow-other-keys) | |
309 | ;; we need to load cairo dynamically | |
310 | (let* ((cairo (string-append | |
311 | (assoc-ref inputs "cairo") "/lib" ))) | |
312 | (setenv "LD_LIBRARY_PATH" cairo) | |
313 | #t))) | |
314 | (add-before 'build 'set-lua-version | |
315 | (lambda _ | |
316 | ;; lua version and therefore install directories are hardcoded | |
317 | ;; FIXME: This breaks when we update lua to >=5.3 | |
318 | (substitute* "./lgi/Makefile" | |
319 | (("LUA_VERSION=5.1") "LUA_VERSION=5.2")) | |
320 | #t)) | |
321 | (add-before 'check 'skip-test-gtk | |
322 | (lambda _ | |
323 | ;; FIXME: Skip GTK tests: | |
324 | ;; gtk3 - can't get it to run with the xorg-server config below | |
325 | ;; and some non-gtk tests will also fail | |
326 | ;; gtk2 - lots of functions aren't implemented | |
327 | ;; We choose gtk2 as the lesser evil and simply skip the test. | |
328 | ;; Currently, awesome is the only package that uses lua-lgi but | |
329 | ;; it doesn't need or interact with GTK using lua-lgi. | |
330 | (substitute* "./tests/test.lua" | |
331 | (("'gtk.lua',") "-- 'gtk.lua',")) | |
332 | #t)) | |
333 | (add-before 'check 'start-xserver-instance | |
334 | (lambda* (#:key inputs #:allow-other-keys) | |
335 | ;; There must be a running X server during tests. | |
336 | (system (format #f "~a/bin/Xvfb :1 &" | |
337 | (assoc-ref inputs "xorg-server"))) | |
338 | (setenv "DISPLAY" ":1") | |
339 | #t))))) | |
340 | (inputs | |
341 | `(("gobject-introspection" ,gobject-introspection) | |
342 | ("glib" ,glib) | |
343 | ("pango", pango) | |
344 | ("gtk", gtk+-2) | |
345 | ("lua" ,lua) | |
346 | ("cairo" ,cairo) | |
347 | ("libffi" ,libffi) | |
348 | ("xorg-server", xorg-server))) | |
349 | (native-inputs | |
350 | `(("pkg-config" ,pkg-config))) | |
351 | (home-page "https://github.com/pavouk/lgi/") | |
352 | (synopsis "Lua bridge to GObject based libraries") | |
353 | (description | |
354 | "LGI is gobject-introspection based dynamic Lua binding to GObject | |
355 | based libraries. It allows using GObject-based libraries directly from Lua. | |
356 | Notable examples are GTK+, GStreamer and Webkit.") | |
357 | (license license:expat))) | |
35cdc267 JMSG |
358 | |
359 | (define-public lua-lpeg | |
360 | (package | |
361 | (name "lua-lpeg") | |
139c8f94 | 362 | (version "1.0.1") |
35cdc267 JMSG |
363 | (source (origin |
364 | (method url-fetch) | |
365 | (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-" | |
366 | version ".tar.gz")) | |
367 | (sha256 | |
139c8f94 | 368 | (base32 "0sq25z3r324a324ky73izgq9mbf66j2xvjp0fxf227rwxalzgnb2")))) |
35cdc267 JMSG |
369 | (build-system gnu-build-system) |
370 | (arguments | |
371 | `(#:phases | |
372 | (modify-phases %standard-phases | |
373 | (delete 'configure) | |
374 | ;; `make install` isn't available, so we have to do it manually | |
375 | (replace 'install | |
376 | (lambda* (#:key outputs #:allow-other-keys) | |
377 | (let ((out (assoc-ref outputs "out")) | |
378 | (lua-version ,(version-major+minor (package-version lua)))) | |
379 | (install-file "lpeg.so" | |
380 | (string-append out "/lib/lua/" lua-version)) | |
381 | (install-file "re.lua" | |
382 | (string-append out "/share/lua/" lua-version)) | |
383 | #t)))) | |
384 | #:test-target "test")) | |
385 | (inputs `(("lua", lua))) | |
386 | (synopsis "Pattern-matching library for Lua") | |
387 | (description | |
388 | "LPeg is a pattern-matching library for Lua, based on Parsing Expression | |
389 | Grammars (PEGs).") | |
390 | (home-page "http://www.inf.puc-rio.br/~roberto/lpeg") | |
391 | (license license:expat))) | |
cf9a788d | 392 | |
d9ed1779 RW |
393 | (define-public lua5.2-lpeg |
394 | (package (inherit lua-lpeg) | |
395 | (name "lua5.2-lpeg") | |
396 | ;; XXX: The arguments field is almost an exact copy of the field in | |
397 | ;; "lua-lpeg", except for the version string, which was derived from "lua" | |
398 | ;; and now is taken from "lua-5.2". See this discussion for context: | |
399 | ;; http://lists.gnu.org/archive/html/guix-devel/2017-01/msg02048.html | |
400 | (arguments | |
401 | `(#:phases | |
402 | (modify-phases %standard-phases | |
403 | (delete 'configure) | |
404 | ;; `make install` isn't available, so we have to do it manually | |
405 | (replace 'install | |
406 | (lambda* (#:key outputs #:allow-other-keys) | |
407 | (let ((out (assoc-ref outputs "out")) | |
408 | (lua-version ,(version-major+minor (package-version lua-5.2)))) | |
409 | (install-file "lpeg.so" | |
410 | (string-append out "/lib/lua/" lua-version)) | |
411 | (install-file "re.lua" | |
412 | (string-append out "/share/lua/" lua-version)) | |
413 | #t)))) | |
414 | #:test-target "test")) | |
415 | (inputs `(("lua", lua-5.2))))) | |
416 | ||
cf9a788d RW |
417 | ;; Lua 5.3 is not supported. |
418 | (define-public lua5.2-bitop | |
419 | (package | |
420 | (name "lua5.2-bitop") | |
421 | (version "1.0.2") | |
422 | (source (origin | |
423 | (method url-fetch) | |
424 | (uri (string-append "http://bitop.luajit.org/download/" | |
425 | "LuaBitOp-" version ".tar.gz")) | |
426 | (sha256 | |
427 | (base32 | |
428 | "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj")))) | |
429 | (build-system gnu-build-system) | |
430 | (arguments | |
431 | `(#:test-target "test" | |
432 | #:make-flags | |
433 | (list "INSTALL=install -pD" | |
434 | (string-append "INSTALLPATH=printf " | |
435 | (assoc-ref %outputs "out") | |
436 | "/lib/lua/" | |
437 | ,(version-major+minor (package-version lua-5.2)) | |
438 | "/bit/bit.so")) | |
439 | #:phases | |
440 | (modify-phases %standard-phases | |
441 | (delete 'configure)))) | |
442 | (inputs `(("lua", lua-5.2))) | |
443 | (home-page "http://bitop.luajit.org/index.html") | |
444 | (synopsis "Bitwise operations on numbers for Lua") | |
445 | (description | |
446 | "Lua BitOp is a C extension module for Lua which adds bitwise operations | |
447 | on numbers.") | |
448 | (license license:expat))) |