gnu: libdvdcss: Update to 1.4.3.
[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>
d49b0331 6;;; Copyright © 2016, 2017, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
9ad3d679 7;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
03d8505f 8;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
7c97a063 9;;; Copyright © 2016, 2017, 2019 Clément Lassieur <clement@lassieur.org>
35cdc267 10;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
4f4c1ec8 11;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
ce577655 12;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
1c58aa6f 13;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
31be8fc8 14;;; Copyright © 2020 Simon South <simon@simonsouth.net>
0190c9b2 15;;; Copyright © 2020 Paul A. Patience <paul@apatience.com>
f4ac7571 16;;; Copyright © 2021 Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
712e6e68
CR
17;;;
18;;; This file is part of GNU Guix.
19;;;
20;;; GNU Guix is free software; you can redistribute it and/or modify it
21;;; under the terms of the GNU General Public License as published by
22;;; the Free Software Foundation; either version 3 of the License, or (at
23;;; your option) any later version.
24;;;
25;;; GNU Guix is distributed in the hope that it will be useful, but
26;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28;;; GNU General Public License for more details.
29;;;
30;;; You should have received a copy of the GNU General Public License
31;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33(define-module (gnu packages lua)
572e433f 34 #:use-module ((guix licenses) #:prefix license:)
712e6e68
CR
35 #:use-module (guix packages)
36 #:use-module (guix download)
ce577655 37 #:use-module (guix git-download)
35cdc267 38 #:use-module (guix utils)
712e6e68 39 #:use-module (guix build-system gnu)
ce577655 40 #:use-module (guix build-system cmake)
f4ac7571 41 #:use-module (guix build-system meson)
1fd4b99e 42 #:use-module (guix build-system trivial)
712e6e68 43 #:use-module (gnu packages)
f4f677f2 44 #:use-module (gnu packages boost)
f4ac7571 45 #:use-module (gnu packages build-tools)
f4f677f2 46 #:use-module (gnu packages gcc)
03d8505f 47 #:use-module (gnu packages glib)
f4f677f2 48 #:use-module (gnu packages gtk)
9ad3d679 49 #:use-module (gnu packages libevent)
03d8505f 50 #:use-module (gnu packages libffi)
f4f677f2
EF
51 #:use-module (gnu packages m4)
52 #:use-module (gnu packages ncurses)
03d8505f 53 #:use-module (gnu packages pkg-config)
ff34334c 54 #:use-module (gnu packages pretty-print)
f4f677f2
EF
55 #:use-module (gnu packages re2c)
56 #:use-module (gnu packages readline)
f4ac7571 57 #:use-module (gnu packages tls)
f4ac7571 58 #:use-module (gnu packages vim)
f4f677f2
EF
59 #:use-module (gnu packages xml)
60 #:use-module (gnu packages xorg))
712e6e68
CR
61
62(define-public lua
63 (package
64 (name "lua")
6094a65e 65 (version "5.3.5")
712e6e68
CR
66 (source (origin
67 (method url-fetch)
6dbf1fec 68 (uri (string-append "https://www.lua.org/ftp/lua-"
712e6e68
CR
69 version ".tar.gz"))
70 (sha256
6094a65e 71 (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
fc1adab1 72 (patches (search-patches "lua-pkgconfig.patch"
6dbf1fec 73 "lua-liblua-so.patch"))))
712e6e68 74 (build-system gnu-build-system)
b3546174 75 (inputs `(("readline" ,readline)))
712e6e68 76 (arguments
50836eb7 77 `(#:modules ((guix build gnu-build-system)
07cbe28e
RW
78 (guix build utils)
79 (srfi srfi-1))
712e6e68 80 #:test-target "test"
07cbe28e 81 #:make-flags
50836eb7
EF
82 (list "MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
83 (string-append "CC=" ,(cc-for-target))
84 (string-append "SYSLIBS=-L" (assoc-ref %build-inputs "readline")
85 "/lib")
86 "linux")
a4349e7a
EF
87 #:phases
88 (modify-phases %standard-phases
89 (delete 'configure)
a4349e7a
EF
90 (replace 'install
91 (lambda* (#:key outputs #:allow-other-keys)
92 (let ((out (assoc-ref outputs "out")))
ffa95cf3
MW
93 (invoke "make" "install"
94 (string-append "INSTALL_TOP=" out)
95 (string-append "INSTALL_MAN=" out
96 "/share/man/man1"))))))))
6dbf1fec 97 (home-page "https://www.lua.org/")
9e771e3b 98 (synopsis "Embeddable scripting language")
712e6e68
CR
99 (description
100 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
101combines simple procedural syntax with powerful data description constructs
35b9e423 102based on associative arrays and extensible semantics. Lua is dynamically typed,
712e6e68
CR
103runs by interpreting bytecode for a register-based virtual machine, and has
104automatic memory management with incremental garbage collection, making it ideal
105for configuration, scripting, and rapid prototyping.")
572e433f 106 (license license:x11)))
924cd631 107
6dbf1fec
MB
108(define-public lua-5.2
109 (package (inherit lua)
110 (version "5.2.4")
111 (source
112 (origin
113 (method url-fetch)
114 (uri (string-append "https://www.lua.org/ftp/lua-"
115 version ".tar.gz"))
116 (sha256
117 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
118 (patches (search-patches "lua-pkgconfig.patch"
119 "lua-liblua-so.patch"))))))
120
01d3f19b
AE
121(define-public lua-5.1
122 (package (inherit lua)
123 (version "5.1.5")
124 (source (origin
125 (method url-fetch)
6dbf1fec 126 (uri (string-append "https://www.lua.org/ftp/lua-"
01d3f19b
AE
127 version ".tar.gz"))
128 (sha256
c361d075 129 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
32fddd8e 130 (patches (search-patches "lua51-liblua-so.patch"
a287fafe
DM
131 "lua-CVE-2014-5461.patch"
132 "lua51-pkgconfig.patch"))))))
01d3f19b 133
924cd631
RG
134(define-public luajit
135 (package
136 (name "luajit")
906f1b48 137 (version "2.1.0-beta3")
924cd631
RG
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "http://luajit.org/download/LuaJIT-"
141 version ".tar.gz"))
142 (sha256
906f1b48
TGR
143 (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"))
144 (patches (search-patches "luajit-no_ldconfig.patch"))))
924cd631
RG
145 (build-system gnu-build-system)
146 (arguments
a093bb69
TGR
147 `(#:tests? #f ; luajit is distributed without tests
148 #:phases
149 (modify-phases %standard-phases
150 (delete 'configure) ; no configure script
151 (add-after 'install 'create-luajit-symlink
152 (lambda* (#:key outputs #:allow-other-keys)
153 (let* ((out (assoc-ref outputs "out"))
154 (bin (string-append out "/bin")))
155 (with-directory-excursion bin
156 (symlink ,(string-append name "-" version)
157 ,name)
158 #t)))))
159 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
0386cdd3 160 (home-page "https://www.luajit.org/")
924cd631
RG
161 (synopsis "Just in time compiler for Lua programming language version 5.1")
162 (description
163 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
164programming language. Lua is a powerful, dynamic and light-weight programming
165language. It may be embedded or used as a general-purpose, stand-alone
166language.")
572e433f 167 (license license:x11)))
fd07a6a6 168
b35bbb26
VSO
169(define-public luajit-lua52-openresty
170 (package
171 (inherit luajit)
172 (name "luajit-lua52-openresty")
173 (version "2.1-20201229")
174 (source
175 (origin
176 (method git-fetch)
177 (uri (git-reference
178 (url "https://github.com/openresty/luajit2.git")
179 (commit (string-append "v" version))))
570c9c97 180 (file-name (git-file-name name version))
b35bbb26
VSO
181 (sha256
182 (base32 "07haj27kbpbnkv836c2nd36h2xislrmri52w0zbpxvl68xk6g96p"))))
183 (arguments
184 `(#:tests? #f ;no test
185 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
186 #:phases
187 (modify-phases %standard-phases
188 (delete 'configure) ;no configure script
189 (add-after 'unpack 'enable-lua52-compat
190 (lambda _
191 (substitute* "src/Makefile"
192 (("#(XCFLAGS\\+= -DLUAJIT_ENABLE_LUA52COMPAT)" _ flag) flag))
193 #t)))))
194 (home-page "https://github.com/openresty/luajit2")
195 (synopsis "OpenResty's Branch of LuaJIT 2")
196 (description
197 "This is the official OpenResty branch of LuaJIT. It is not to be
198considered a fork, since changes are regularly synchronized from the upstream
199LuaJIT project. This package also enables the Lua 5.2 compat mode needed by
200some projects.")))
201
7c97a063 202(define (make-lua-expat name lua)
fd07a6a6 203 (package
7c97a063 204 (name name)
fd07a6a6
RW
205 (version "1.3.0")
206 (source (origin
207 (method url-fetch)
208 (uri (string-append "https://matthewwild.co.uk/projects/"
209 "luaexpat/luaexpat-" version ".tar.gz"))
210 (sha256
211 (base32
212 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
213 (build-system gnu-build-system)
214 (arguments
215 `(#:make-flags
7c97a063
CL
216 (let ((out (assoc-ref %outputs "out"))
217 (lua-version ,(version-major+minor (package-version lua))))
fd07a6a6 218 (list "CC=gcc"
7c97a063
CL
219 (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
220 (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
fd07a6a6
RW
221 #:phases
222 (modify-phases %standard-phases
223 (delete 'configure)
224 (replace 'check
225 (lambda _
226 (setenv "LUA_CPATH" "src/?.so;;")
227 (setenv "LUA_PATH" "src/?.lua;;")
12a16602
MW
228 (invoke "lua" "tests/test.lua")
229 (invoke "lua" "tests/test-lom.lua"))))))
fd07a6a6 230 (inputs
7c97a063 231 `(("lua" ,lua)
fd07a6a6 232 ("expat" ,expat)))
aa033c8e 233 (home-page "https://matthewwild.co.uk/projects/luaexpat/")
fd07a6a6
RW
234 (synopsis "SAX XML parser based on the Expat library")
235 (description "LuaExpat is a SAX XML parser based on the Expat library.")
236 (license (package-license lua-5.1))))
c21b8261 237
7c97a063
CL
238(define-public lua5.1-expat
239 (make-lua-expat "lua5.1-expat" lua-5.1))
240
241(define-public lua5.2-expat
242 (make-lua-expat "lua5.2-expat" lua-5.2))
243
253aab77 244(define (make-lua-socket name lua)
c21b8261 245 (package
253aab77 246 (name name)
50269c01 247 (version "3.0-rc1")
c21b8261 248 (source (origin
5545abec
EF
249 (method git-fetch)
250 (uri (git-reference
251 (url "https://github.com/diegonehab/luasocket")
252 (commit (string-append "v" version))))
253 (file-name (git-file-name name version))
c21b8261
RW
254 (sha256
255 (base32
5545abec 256 "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
c21b8261
RW
257 (build-system gnu-build-system)
258 (arguments
259 `(#:make-flags
253aab77
CL
260 (let ((out (assoc-ref %outputs "out"))
261 (lua-version ,(version-major+minor (package-version lua))))
262 (list (string-append "INSTALL_TOP=" out)
263 (string-append "LUAV?=" lua-version)))
c21b8261
RW
264 #:phases
265 (modify-phases %standard-phases
266 (delete 'configure)
267 (replace 'check
268 (lambda _
269 (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
270 (setenv "LUA_PATH" "src/?.lua;;")
271 (when (zero? (primitive-fork))
6e3fc9ba
MW
272 (invoke "lua" "test/testsrvr.lua"))
273 (invoke "lua" "test/testclnt.lua"))))))
c21b8261 274 (inputs
253aab77 275 `(("lua" ,lua)))
c21b8261
RW
276 (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
277 (synopsis "Socket library for Lua")
278 (description "LuaSocket is a Lua extension library that is composed by two
279parts: a C core that provides support for the TCP and UDP transport layers,
280and a set of Lua modules that add support for functionality commonly needed by
281applications that deal with the Internet.
282
283Among the supported modules, the most commonly used implement the
284SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
285files) client protocols. These provide a very natural and generic interface
286to the functionality defined by each protocol. In addition, you will find
287that the MIME (common encodings), URL (anything you could possible want to do
288with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
289handy.")
253aab77
CL
290 (license license:expat)))
291
292(define-public lua5.1-socket
293 (make-lua-socket "lua5.1-socket" lua-5.1))
294
295(define-public lua5.2-socket
296 (make-lua-socket "lua5.2-socket" lua-5.2))
182de8fc 297
d9943257 298(define (make-lua-filesystem name lua)
182de8fc 299 (package
d9943257 300 (name name)
3095616b 301 (version "1.7.0.2")
182de8fc 302 (source (origin
f2dc5f5b
EF
303 (method git-fetch)
304 (uri (git-reference
305 (url "https://github.com/keplerproject/luafilesystem")
3095616b 306 (commit (string-append "v"
f2dc5f5b
EF
307 (string-join
308 (string-split version #\.) "_")))))
309 (file-name (git-file-name name version))
182de8fc
RW
310 (sha256
311 (base32
3095616b 312 "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
182de8fc
RW
313 (build-system gnu-build-system)
314 (arguments
315 `(#:make-flags
d9943257
CL
316 (let ((out (assoc-ref %outputs "out"))
317 (lua-version ,(version-major+minor (package-version lua))))
318 (list (string-append "PREFIX=" out)
319 (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version)))
182de8fc
RW
320 #:test-target "test"
321 #:phases
322 (modify-phases %standard-phases
323 (delete 'configure))))
324 (inputs
d9943257 325 `(("lua" ,lua)))
182de8fc
RW
326 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
327 (synopsis "File system library for Lua")
328 (description "LuaFileSystem is a Lua library developed to complement the
329set of functions related to file systems offered by the standard Lua
330distribution. LuaFileSystem offers a portable way to access the underlying
331directory structure and file attributes.")
332 (license (package-license lua-5.1))))
d62dc2ae 333
d9943257
CL
334(define-public lua-filesystem
335 (make-lua-filesystem "lua-filesystem" lua))
336
337(define-public lua5.1-filesystem
338 (make-lua-filesystem "lua5.1-filesystem" lua-5.1))
339
340(define-public lua5.2-filesystem
341 (make-lua-filesystem "lua5.2-filesystem" lua-5.2))
342
31be8fc8
SS
343(define (make-lua-ossl name lua)
344 (package
345 (name name)
346 (version "20170903")
347 (source (origin
348 (method url-fetch)
349 (uri (string-append "https://25thandclement.com/~william/"
350 "projects/releases/luaossl-" version ".tgz"))
351 (sha256
352 (base32
353 "10392bvd0lzyibipblgiss09zlqh3a5zgqg1b9lgbybpqb9cv2k3"))))
354 (build-system gnu-build-system)
355 (arguments
356 `(#:make-flags
357 (let ((out (assoc-ref %outputs "out"))
358 (lua-api-version ,(version-major+minor (package-version lua))))
359 (list "CC=gcc"
360 "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
88a09963
TGR
361 (string-append "prefix=" out)
362 (string-append "LUA_APIS=" lua-api-version)))
31be8fc8
SS
363 #:phases
364 (modify-phases %standard-phases
365 (delete 'configure)
366 (delete 'check)
367 (add-after 'install 'check
368 (lambda* (#:key outputs #:allow-other-keys)
369 (let ((out (assoc-ref outputs "out"))
370 (lua-version ,(version-major+minor (package-version lua))))
371 (setenv "LUA_CPATH"
372 (string-append out "/lib/lua/" lua-version "/?.so;;"))
373 (setenv "LUA_PATH"
374 (string-append out "/share/lua/" lua-version "/?.lua;;"))
375 (with-directory-excursion "regress"
376 (for-each (lambda (f)
377 (invoke "lua" f))
378 (find-files "." "^[0-9].*\\.lua$"))))
379 #t)))))
380 (inputs
381 `(("lua" ,lua)
382 ("openssl" ,openssl)))
383 (home-page "https://25thandclement.com/~william/projects/luaossl.html")
384 (synopsis "OpenSSL bindings for Lua")
385 (description "The luaossl extension module for Lua provides comprehensive,
386low-level bindings to the OpenSSL library, including support for certificate and
387key management, key generation, signature verification, and deep bindings to the
388distinguished name, alternative name, and X.509v3 extension interfaces. It also
389binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG interfaces.")
390 (license license:expat)))
391
392(define-public lua-ossl
393 (make-lua-ossl "lua-ossl" lua))
394
395(define-public lua5.1-ossl
396 (make-lua-ossl "lua5.1-ossl" lua-5.1))
397
398(define-public lua5.2-ossl
399 (make-lua-ossl "lua5.2-ossl" lua-5.2))
400
eb5b6c57 401(define (make-lua-sec name lua)
d62dc2ae 402 (package
eb5b6c57 403 (name name)
6298f327 404 (version "0.9")
d62dc2ae 405 (source (origin
b63785ec
EF
406 (method git-fetch)
407 (uri (git-reference
408 (url "https://github.com/brunoos/luasec")
6298f327 409 (commit (string-append "v" version))))
b63785ec 410 (file-name (git-file-name name version))
d62dc2ae
RW
411 (sha256
412 (base32
6298f327 413 "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
d62dc2ae
RW
414 (build-system gnu-build-system)
415 (arguments
416 `(#:make-flags
eb5b6c57
CL
417 (let ((out (assoc-ref %outputs "out"))
418 (lua-version ,(version-major+minor (package-version lua))))
d62dc2ae
RW
419 (list "linux"
420 "CC=gcc"
421 "LD=gcc"
eb5b6c57
CL
422 (string-append "LUAPATH=" out "/share/lua/" lua-version)
423 (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
d62dc2ae
RW
424 #:tests? #f ; no tests included
425 #:phases
426 (modify-phases %standard-phases
427 (delete 'configure))))
428 (inputs
eb5b6c57 429 `(("lua" ,lua)
d62dc2ae
RW
430 ("openssl" ,openssl)))
431 (propagated-inputs
eb5b6c57
CL
432 `(("lua-socket"
433 ,(make-lua-socket
434 (format #f "lua~a-socket"
435 (version-major+minor (package-version lua))) lua))))
d62dc2ae
RW
436 (home-page "https://github.com/brunoos/luasec/wiki")
437 (synopsis "OpenSSL bindings for Lua")
438 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
439communication. It takes an already established TCP connection and creates a
440secure session between the peers.")
eb5b6c57
CL
441 (license license:expat)))
442
443(define-public lua5.1-sec
444 (make-lua-sec "lua5.1-sec" lua-5.1))
445
446(define-public lua5.2-sec
447 (make-lua-sec "lua5.2-sec" lua-5.2))
03d8505f 448
7c54e226
SS
449(define (make-lua-cqueues name lua lua-ossl)
450 (package
451 (name name)
452 (version "20171014")
453 (source (origin
454 (method url-fetch)
455 (uri (string-append "https://25thandclement.com/~william/"
456 "projects/releases/cqueues-" version ".tgz"))
457 (sha256
458 (base32
459 "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb"))))
460 (build-system gnu-build-system)
461 (arguments
462 `(#:modules ((guix build gnu-build-system)
463 (guix build utils)
464 (ice-9 string-fun))
465 #:make-flags
466 (let ((out (assoc-ref %outputs "out"))
467 (lua-api-version ,(version-major+minor (package-version lua))))
468 (list "CC=gcc"
469 (string-append "LUA_APIS=" lua-api-version)))
470 #:phases
471 (modify-phases %standard-phases
472 (delete 'configure)
473 (delete 'check)
474 (replace 'install
475 (lambda* (#:key make-flags outputs #:allow-other-keys)
476 (let ((out (assoc-ref outputs "out")))
477 (apply invoke "make" "install"
478 (append make-flags
479 (list (string-append "DESTDIR=" out)
480 "prefix="))))))
481 (add-after 'install 'check
482 (lambda* (#:key inputs outputs make-flags #:allow-other-keys)
483 (let*
484 ((lua-version ,(version-major+minor (package-version lua)))
485 (env-suffix (if (equal? lua-version "5.1")
486 ""
487 (string-append
488 "_"
489 (string-replace-substring lua-version "." "_"))))
490
491 (lua-ossl (assoc-ref inputs "lua-ossl"))
492 (out (assoc-ref outputs "out"))
493
494 (lua-cpath (lambda (p)
495 (string-append p "/lib/lua/" lua-version "/?.so")))
496 (lua-path (lambda (p)
497 (string-append p "/share/lua/" lua-version "/?.lua"))))
498 ;; The test suite sets Lua-version-specific search-path variables
499 ;; when available so we must do the same, as these take
500 ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
501 (setenv (string-append "LUA_CPATH" env-suffix)
502 (string-append
503 (string-join (map lua-cpath (list out lua-ossl)) ";")
504 ";;"))
505 (setenv (string-append "LUA_PATH" env-suffix)
506 (string-append
507 (string-join (map lua-path (list out lua-ossl)) ";")
508 ";;"))
509
510 ;; Skip regression tests we expect to fail
511 (with-directory-excursion "regress"
512 (for-each (lambda (f)
513 (rename-file f (string-append f ".skip")))
514 (append
515 ;; Regression tests that require network
516 ;; connectivity
517 '("22-client-dtls.lua"
518 "30-starttls-completion.lua"
519 "62-noname.lua"
520 "153-dns-resolvers.lua")
521
522 ;; Regression tests that require LuaJIT
523 '("44-resolvers-gc.lua"
524 "51-join-defunct-thread.lua")
525
526 ;; Regression tests that require Lua 5.3
527 (if (not (equal? lua-version "5.3"))
528 '("152-thread-integer-passing.lua")
529 '()))))
530
531 (apply invoke "make" "check" make-flags)))))))
532 (native-inputs
533 `(("m4" ,m4)))
534 (inputs
535 `(("lua" ,lua)
536 ("openssl" ,openssl)))
537 (propagated-inputs
538 `(("lua-ossl" ,lua-ossl)))
539 (home-page "https://25thandclement.com/~william/projects/cqueues.html")
540 (synopsis "Event loop for Lua using continuation queues")
541 (description "The cqueues extension module for Lua implements an event loop
542that operates through the yielding and resumption of coroutines. It is designed
543to be non-intrusive, composable, and embeddable within existing applications.")
544 (license license:expat)))
545
546(define-public lua-cqueues
547 (make-lua-cqueues "lua-cqueues" lua lua-ossl))
548
549(define-public lua5.1-cqueues
550 (make-lua-cqueues "lua5.1-cqueues" lua-5.1 lua5.1-ossl))
551
552(define-public lua5.2-cqueues
553 (make-lua-cqueues "lua5.2-cqueues" lua-5.2 lua5.2-ossl))
554
1fd4b99e
NG
555(define-public lua-penlight
556 (package
557 (name "lua-penlight")
558 (version "1.7.0")
559 (source
560 (origin
561 (method git-fetch)
562 (uri (git-reference
b0e7b699 563 (url "https://github.com/Tieske/Penlight")
1fd4b99e
NG
564 (commit version)))
565 (file-name (git-file-name name version))
566 (sha256
567 (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
568 (build-system trivial-build-system)
569 (inputs
570 `(("lua" ,lua)))
571 (propagated-inputs
572 `(("lua-filesystem" ,lua-filesystem)))
573 (arguments
574 `(#:modules ((guix build utils))
575 #:builder
576 (begin
577 (use-modules (guix build utils))
578 (let* ((source (assoc-ref %build-inputs "source"))
579 (lua-version ,(version-major+minor (package-version lua)))
580 (destination (string-append (assoc-ref %outputs "out")
581 "/share/lua/" lua-version)))
582 (mkdir-p destination)
583 (with-directory-excursion source
584 (copy-recursively "lua/" destination)))
585 #t)))
586 (home-page "http://tieske.github.io/Penlight/")
587 (synopsis "Collection of general purpose libraries for the Lua language")
588 (description "Penlight is a set of pure Lua libraries focusing on
589input data handling (such as reading configuration files), functional
590programming (such as map, reduce, placeholder expressions,etc), and OS
591path management. Much of the functionality is inspired by the Python
592standard libraries.")
593 (license license:expat)))
594
4898e06a
NG
595(define-public lua-ldoc
596 (package
597 (name "lua-ldoc")
598 (version "1.4.6")
599 (source
600 (origin
601 (method git-fetch)
602 (uri (git-reference
b0e7b699 603 (url "https://github.com/stevedonovan/LDoc")
4898e06a
NG
604 (commit version)))
605 (file-name (git-file-name name version))
606 (sha256
607 (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
608 (build-system gnu-build-system)
609 (inputs
610 `(("lua" ,lua)))
611 (propagated-inputs
612 `(("lua-penlight" ,lua-penlight)))
613 (arguments
614 `(#:tests? #f ;tests must run after installation.
615 #:phases
616 (modify-phases %standard-phases
617 (add-after 'unpack 'fix-installation-directory
618 (lambda* (#:key outputs #:allow-other-keys)
619 (let ((out (assoc-ref outputs "out"))
620 (lua-version ,(version-major+minor (package-version lua))))
621 (substitute* "makefile"
622 (("LUA=.*") "#\n")
623 (("(LUA_PREFIX=).*" _ prefix)
624 (string-append prefix out "\n"))
625 (("(LUA_BINDIR=).*" _ prefix)
626 (string-append prefix out "/bin\n"))
627 (("(LUA_SHAREDIR=).*" _ prefix)
628 (string-append prefix out "/share/lua/" lua-version "\n"))))
629 #t))
630 (delete 'configure)
631 (add-before 'install 'create-bin-directory
632 (lambda* (#:key outputs #:allow-other-keys)
633 (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
634 #t)))))
635 (home-page "http://stevedonovan.github.io/ldoc/")
636 (synopsis "Lua documentation generator")
637 (description
638 "LDoc is a LuaDoc-compatible documentation generation system for
639Lua source code. It parses the declaration and documentation comments
640in a set of Lua source files and produces a set of XHTML pages
641describing the commented declarations and functions.")
642 (license license:expat)))
643
1c58aa6f 644(define (make-lua-lgi name lua)
03d8505f 645 (package
1c58aa6f 646 (name name)
ad514303 647 (version "0.9.2")
03d8505f 648 (source
1c58aa6f
NG
649 (origin
650 (method git-fetch)
651 (uri (git-reference
652 (url "https://github.com/pavouk/lgi")
653 (commit version)))
654 (file-name (git-file-name name version))
655 (sha256
656 (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
03d8505f 657 (build-system gnu-build-system)
658 (arguments
1c58aa6f
NG
659 `(#:make-flags
660 (list "CC=gcc"
661 (string-append "PREFIX=" (assoc-ref %outputs "out")))
03d8505f 662 #:phases
663 (modify-phases %standard-phases
1c58aa6f 664 (delete 'configure) ; no configure script
03d8505f 665 (add-before 'build 'set-env
666 (lambda* (#:key inputs #:allow-other-keys)
1c58aa6f
NG
667 ;; We need to load cairo dynamically.
668 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
03d8505f 669 (setenv "LD_LIBRARY_PATH" cairo)
670 #t)))
671 (add-before 'build 'set-lua-version
672 (lambda _
1c58aa6f 673 ;; Lua version and therefore install directories are hardcoded.
03d8505f 674 (substitute* "./lgi/Makefile"
1c58aa6f
NG
675 (("LUA_VERSION=5.1")
676 (format #f
677 "LUA_VERSION=~a"
678 ,(version-major+minor (package-version lua)))))
03d8505f 679 #t))
680 (add-before 'check 'skip-test-gtk
681 (lambda _
682 ;; FIXME: Skip GTK tests:
683 ;; gtk3 - can't get it to run with the xorg-server config below
684 ;; and some non-gtk tests will also fail
685 ;; gtk2 - lots of functions aren't implemented
686 ;; We choose gtk2 as the lesser evil and simply skip the test.
687 ;; Currently, awesome is the only package that uses lua-lgi but
688 ;; it doesn't need or interact with GTK using lua-lgi.
689 (substitute* "./tests/test.lua"
690 (("'gtk.lua',") "-- 'gtk.lua',"))
691 #t))
692 (add-before 'check 'start-xserver-instance
693 (lambda* (#:key inputs #:allow-other-keys)
694 ;; There must be a running X server during tests.
695 (system (format #f "~a/bin/Xvfb :1 &"
696 (assoc-ref inputs "xorg-server")))
697 (setenv "DISPLAY" ":1")
698 #t)))))
1c58aa6f
NG
699 (native-inputs
700 `(("dbus" ,dbus) ;tests use 'dbus-run-session'
701 ("pkg-config" ,pkg-config)))
03d8505f 702 (inputs
1c58aa6f 703 `(("cairo" ,cairo)
03d8505f 704 ("glib" ,glib)
1c58aa6f 705 ("gobject-introspection" ,gobject-introspection)
c695fb76 706 ("gtk" ,gtk+-2)
03d8505f 707 ("libffi" ,libffi)
1c58aa6f
NG
708 ("lua" ,lua)
709 ("pango" ,pango)
c695fb76 710 ("xorg-server" ,xorg-server)))
03d8505f 711 (home-page "https://github.com/pavouk/lgi/")
712 (synopsis "Lua bridge to GObject based libraries")
713 (description
1c58aa6f
NG
714 "LGI is gobject-introspection based dynamic Lua binding to GObject based
715libraries. It allows using GObject-based libraries directly from Lua.
03d8505f 716Notable examples are GTK+, GStreamer and Webkit.")
717 (license license:expat)))
35cdc267 718
1c58aa6f
NG
719(define-public lua-lgi
720 (make-lua-lgi "lua-lgi" lua))
721
722(define-public lua5.1-lgi
723 (make-lua-lgi "lua5.1-lgi" lua-5.1))
724
725(define-public lua5.2-lgi
726 (make-lua-lgi "lua5.2-lgi" lua-5.2))
727
149b2c43 728(define (make-lua-lpeg name lua)
35cdc267 729 (package
149b2c43 730 (name name)
e3545ffc 731 (version "1.0.2")
35cdc267
JMSG
732 (source (origin
733 (method url-fetch)
734 (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
735 version ".tar.gz"))
736 (sha256
e3545ffc 737 (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
35cdc267
JMSG
738 (build-system gnu-build-system)
739 (arguments
740 `(#:phases
741 (modify-phases %standard-phases
742 (delete 'configure)
743 ;; `make install` isn't available, so we have to do it manually
744 (replace 'install
745 (lambda* (#:key outputs #:allow-other-keys)
746 (let ((out (assoc-ref outputs "out"))
747 (lua-version ,(version-major+minor (package-version lua))))
748 (install-file "lpeg.so"
749 (string-append out "/lib/lua/" lua-version))
750 (install-file "re.lua"
751 (string-append out "/share/lua/" lua-version))
752 #t))))
753 #:test-target "test"))
c695fb76 754 (inputs `(("lua" ,lua)))
35cdc267
JMSG
755 (synopsis "Pattern-matching library for Lua")
756 (description
757 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
758Grammars (PEGs).")
759 (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
760 (license license:expat)))
cf9a788d 761
149b2c43
CL
762(define-public lua-lpeg
763 (make-lua-lpeg "lua-lpeg" lua))
764
01a0a0c4
H
765(define-public lua5.1-lpeg
766 (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
767
d9ed1779 768(define-public lua5.2-lpeg
149b2c43 769 (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
d9ed1779 770
9ad3d679
RW
771(define (make-lua-luv name lua)
772 (package
773 (name name)
251ce98c 774 (version "1.32.0-0")
9ad3d679
RW
775 (source (origin
776 ;; The release tarball includes the sources of libuv but does
777 ;; not include the pkg-config files.
778 (method git-fetch)
779 (uri (git-reference
b0e7b699 780 (url "https://github.com/luvit/luv")
9ad3d679
RW
781 (commit version)))
782 (file-name (git-file-name name version))
783 (sha256
784 (base32
251ce98c 785 "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh"))))
9ad3d679
RW
786 (build-system cmake-build-system)
787 (arguments
5327fbb3 788 `(#:tests? #f ; there are none
9ad3d679
RW
789 #:configure-flags
790 '("-DWITH_LUA_ENGINE=Lua"
791 "-DWITH_SHARED_LIBUV=On"
792 "-DBUILD_MODULE=Off"
793 "-DBUILD_SHARED_LIBS=On"
794 "-DLUA_BUILD_TYPE=System")
795 #:phases
796 (modify-phases %standard-phases
797 (add-after 'unpack 'copy-lua-compat
798 (lambda* (#:key inputs #:allow-other-keys)
799 (copy-recursively (assoc-ref inputs "lua-compat")
800 "lua-compat")
801 (setenv "CPATH"
802 (string-append (getcwd) "/lua-compat:"
803 (or (getenv "CPATH") "")))
804 #t)))))
805 (inputs
806 `(("lua" ,lua)
807 ("libuv" ,libuv)))
808 (native-inputs
809 `(("lua-compat"
810 ,(origin
811 (method git-fetch)
812 (uri (git-reference
b0e7b699 813 (url "https://github.com/keplerproject/lua-compat-5.3")
9ad3d679
RW
814 (commit "daebe77a2f498817713df37f0bb316db1d82222f")))
815 (file-name "lua-compat-5.3-checkout")
816 (sha256
817 (base32
818 "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz"))))))
819 (home-page "https://github.com/luvit/luv/")
820 (synopsis "Libuv bindings for Lua")
821 (description
822 "This library makes libuv available to Lua scripts.")
823 (license license:asl2.0)))
824
825(define-public lua-luv
826 (make-lua-luv "lua-luv" lua))
827
828(define-public lua5.1-luv
829 (make-lua-luv "lua5.1-luv" lua-5.1))
830
831(define-public lua5.2-luv
832 (make-lua-luv "lua5.2-luv" lua-5.2))
833
cf9a788d 834;; Lua 5.3 is not supported.
cb31a524 835(define (make-lua-bitop name lua)
cf9a788d 836 (package
cb31a524 837 (name name)
cf9a788d
RW
838 (version "1.0.2")
839 (source (origin
840 (method url-fetch)
841 (uri (string-append "http://bitop.luajit.org/download/"
842 "LuaBitOp-" version ".tar.gz"))
843 (sha256
844 (base32
845 "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
846 (build-system gnu-build-system)
847 (arguments
848 `(#:test-target "test"
849 #:make-flags
850 (list "INSTALL=install -pD"
851 (string-append "INSTALLPATH=printf "
852 (assoc-ref %outputs "out")
853 "/lib/lua/"
cb31a524 854 ,(version-major+minor (package-version lua))
cf9a788d
RW
855 "/bit/bit.so"))
856 #:phases
857 (modify-phases %standard-phases
858 (delete 'configure))))
c695fb76 859 (inputs `(("lua" ,lua)))
0386cdd3 860 (home-page "https://bitop.luajit.org/index.html")
cf9a788d
RW
861 (synopsis "Bitwise operations on numbers for Lua")
862 (description
863 "Lua BitOp is a C extension module for Lua which adds bitwise operations
864on numbers.")
865 (license license:expat)))
cb31a524
CL
866
867(define-public lua5.2-bitop
868 (make-lua-bitop "lua5.2-bitop" lua-5.2))
869
870(define-public lua5.1-bitop
871 (make-lua-bitop "lua5.1-bitop" lua-5.1))
ce577655
FT
872
873(define-public selene
874 (package
875 (name "selene")
876 (version "2017.08.25")
877 (source (origin
878 (method git-fetch)
879 (uri (git-reference
b0e7b699 880 (url "https://github.com/jeremyong/Selene")
ce577655
FT
881 ;; The release is quite old.
882 (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
883 (file-name "Selene")
884 (sha256
885 (base32
886 "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
887 (build-system cmake-build-system)
888 (arguments
889 `(#:configure-flags
890 ;; lua pc file in CMakeLists.txt is lua5.3.pc
891 '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
892 #:test-target "all"
893 #:phases
894 ;; This is a header only library
895 (modify-phases %standard-phases
896 (delete 'build)
897 (replace 'install
898 (lambda* (#:key inputs outputs #:allow-other-keys)
899 (let* ((output (assoc-ref outputs "out"))
900 (source (assoc-ref inputs "source"))
901 (includedir (string-append output "/include")))
902 (copy-recursively
903 (string-append source "/include")
904 includedir))
905 #t))
906 ;; The path of test files are hard coded.
907 (replace 'check
908 (lambda* (#:key inputs outputs #:allow-other-keys)
909 (let* ((output (assoc-ref outputs "out"))
910 (source (assoc-ref inputs "source"))
911 (builddir (getcwd))
912 (testdir (string-append builddir "/test")))
913 (copy-recursively (string-append source "/test") testdir)
914 (invoke "make")
915 (mkdir-p "runner")
916 (copy-file "./test_runner" "./runner/test_runner")
917 (chdir "./runner")
918 (invoke "./test_runner")))))))
919 (native-inputs
920 `(("lua" ,lua)
921 ("pkg-config" ,pkg-config)))
922 (home-page "https://github.com/jeremyong/Selene")
923 (synopsis "Lua C++11 bindings")
924 (description
925 "Selene is a simple C++11 header-only library enabling seamless
926 interoperability between C++ and Lua programming language.")
927 (license license:zlib)))
cb53c59d
OP
928
929(define-public lua-resty-core
930 (package
931 (name "lua-resty-core")
9c3a29e3 932 (version "0.1.18")
cb53c59d
OP
933 (source (origin
934 (method git-fetch)
935 (uri (git-reference
936 (url "https://github.com/openresty/lua-resty-core")
937 (commit (string-append "v" version))))
938 (file-name (git-file-name name version))
939 (sha256
940 (base32
9c3a29e3 941 "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
cb53c59d
OP
942 (build-system trivial-build-system)
943 (arguments
944 `(#:modules ((guix build utils))
945 #:builder
946 (begin
947 (use-modules (guix build utils))
948 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
949 (package-lua-resty (lambda (input output)
950 (mkdir-p (string-append output "/lib/lua"))
951 (copy-recursively (string-append input "/lib/resty")
952 (string-append output "/lib/lua/resty"))
953 (copy-recursively (string-append input "/lib/ngx")
954 (string-append output "/lib/ngx"))
955 (symlink (string-append output "/lib/lua/resty")
956 (string-append output "/lib/resty")))))
957 (package-lua-resty (assoc-ref %build-inputs "source")
958 (assoc-ref %outputs "out")))
959 #t)))
960 (home-page "https://github.com/openresty/lua-resty-core")
961 (synopsis "Lua API for NGINX")
962 (description "This package provides a FFI-based Lua API for
963@code{ngx_http_lua_module} or @code{ngx_stream_lua_module}.")
964 (license license:bsd-2)))
1263bd0d
OP
965
966(define-public lua-resty-lrucache
967 (package
968 (name "lua-resty-lrucache")
e0c34c1a 969 (version "0.10")
1263bd0d
OP
970 (source (origin
971 (method git-fetch)
972 (uri (git-reference
973 (url "https://github.com/openresty/lua-resty-lrucache")
974 (commit (string-append "v" version))))
975 (file-name (git-file-name name version))
976 (sha256
977 (base32
e0c34c1a 978 "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
1263bd0d
OP
979 (build-system trivial-build-system)
980 (arguments
981 `(#:modules ((guix build utils))
982 #:builder
983 (begin
984 (use-modules (guix build utils))
985 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
986 (package-lua-resty (lambda (input output)
987 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
988 (copy-recursively (string-append input "/lib/resty")
989 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
990 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
991 (string-append output "/lib/resty")))))
992 (package-lua-resty (assoc-ref %build-inputs "source")
993 (assoc-ref %outputs "out")))
994 #t)))
995 (home-page "https://github.com/openresty/lua-resty-lrucache")
996 (synopsis "Lua LRU cache based on the LuaJIT FFI")
997 (description
998 "This package provides Lua LRU cache based on the LuaJIT FFI.")
999 (license license:bsd-2)))
8688fd8f
OP
1000
1001(define-public lua-resty-signal
1002 (package
1003 (name "lua-resty-signal")
1004 (version "0.02")
1005 (source (origin
1006 (method git-fetch)
1007 (uri (git-reference
1008 (url "https://github.com/openresty/lua-resty-signal")
1009 (commit (string-append "v" version))))
1010 (file-name (git-file-name name version))
1011 (sha256
1012 (base32
1013 "13y1pqn45y49mhqwywasfdsid46d0c33yi6mrnracbnmvyxz1cif"))))
1014 (build-system gnu-build-system)
1015 (arguments
1016 `(#:tests? #f ;TODO: Run the test suite.
1017 #:make-flags (list "CC=gcc"
1018 (string-append "PREFIX=" %output))
1019 #:phases
1020 (modify-phases %standard-phases
1021 (delete 'configure)
1022 (add-after 'install 'install-lua
1023 (lambda* (#:key inputs outputs #:allow-other-keys)
1024 (use-modules (guix build utils))
1025 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1026 (package-lua-resty (lambda (input output)
1027 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1028 (copy-recursively (string-append input "/lib/resty")
1029 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1030 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1031 (string-append output "/lib/resty")))))
1032 (package-lua-resty (assoc-ref inputs "source")
1033 (assoc-ref outputs "out")))
1034 #t)))))
1035 (home-page "https://github.com/openresty/lua-resty-signal")
1036 (synopsis "Lua library for killing or sending signals to Linux processes")
1037 (description "This package provides Lua library for killing or sending
1038signals to Linux processes.")
1039 (license license:bsd-3)))
0100fd06
OP
1040
1041(define-public lua-tablepool
1042 (package
1043 (name "lua-tablepool")
1044 (version "0.01")
1045 (source (origin
1046 (method git-fetch)
1047 (uri (git-reference
1048 (url "https://github.com/openresty/lua-tablepool")
1049 (commit (string-append "v" version))))
1050 (file-name (git-file-name name version))
1051 (sha256
1052 (base32
1053 "03yjj3w6znvj6843prg84m0lkrn49l901f9hj9bgy3cj9s0awl6y"))))
1054 (build-system trivial-build-system)
1055 (arguments
1056 `(#:modules ((guix build utils))
1057 #:builder
1058 (begin
1059 (use-modules (guix build utils))
1060 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1061 (package-lua-resty (lambda (input output)
1062 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1063 (copy-recursively (string-append input "/lib")
1064 (string-append output "/lib")))))
1065 (package-lua-resty (assoc-ref %build-inputs "source")
1066 (assoc-ref %outputs "out")))
1067 #t)))
1068 (home-page "https://github.com/openresty/lua-tablepool")
1069 (synopsis "Lua table recycling pools for LuaJIT")
1070 (description "This package provides Lua table recycling pools for LuaJIT.")
1071 (license license:bsd-2)))
89c4122e
OP
1072
1073(define-public lua-resty-shell
1074 (package
1075 (name "lua-resty-shell")
1076 (version "0.03")
1077 (source (origin
1078 (method git-fetch)
1079 (uri (git-reference
1080 (url "https://github.com/openresty/lua-resty-shell")
1081 (commit (string-append "v" version))))
1082 (file-name (git-file-name name version))
1083 (sha256
1084 (base32
1085 "1s6g04ip4hr97r2pd8ry3alq063604s9a3l0hn9nsidh81ps4dp7"))))
1086 (build-system trivial-build-system)
1087 (arguments
1088 `(#:modules ((guix build utils))
1089 #:builder
1090 (begin
1091 (use-modules (guix build utils))
1092 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1093 (package-lua-resty (lambda (input output)
1094 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1095 (copy-recursively (string-append input "/lib/resty")
1096 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1097 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1098 (string-append output "/lib/resty")))))
1099 (package-lua-resty (assoc-ref %build-inputs "source")
1100 (assoc-ref %outputs "out")))
1101 #t)))
1102 (home-page "https://github.com/openresty/lua-resty-shell")
1103 (synopsis "Lua module for nonblocking system shell command executions")
1104 (description "This package provides Lua module for nonblocking system
1105shell command executions.")
1106 (license license:bsd-3)))
0190c9b2 1107
f4ac7571
VSO
1108(define-public emilua
1109 (package
1110 (name "emilua")
ff34334c 1111 (version "0.3.0")
f4ac7571
VSO
1112 (source (origin
1113 (method git-fetch)
1114 (uri (git-reference
1115 (url "https://gitlab.com/emilua/emilua.git")
1116 (commit (string-append "v" version))
ff34334c
VSO
1117 ;; Current version requires bundled CLI11, but at some future
1118 ;; release the one found in the system could be used
f4ac7571
VSO
1119 ;; instead. Current version also requires Trial.Protocol and
1120 ;; the HTTP lib developed as part of GSoC 2014 for Boost, but
1121 ;; these are dependencies unlikely to be "unbundled" in future
1122 ;; releases.
1123 (recursive? #t)))
25d409bf 1124 (file-name (git-file-name name version))
f4ac7571
VSO
1125 (sha256
1126 (base32
ff34334c 1127 "124fj73722c03znwdyqp1i0jygwv3s11f6s1j9rzym513qrf7fnd"))))
f4ac7571
VSO
1128 (build-system meson-build-system)
1129 (arguments
1130 `(#:meson ,meson-0.55
1131 ;; Tests are disabled for now due to an issue that affecs guix:
1132 ;; <https://gitlab.com/emilua/emilua/-/issues/22>
ff34334c
VSO
1133 #:configure-flags
1134 (list "-Denable_http=true"
1135 "-Denable_tests=false"
1136 "-Denable_manpages=false"
1137 "-Dversion_suffix=-guix1")))
f4ac7571
VSO
1138 (native-inputs
1139 `(("gcc" ,gcc-10) ; gcc-7 is too old for our C++17 needs
1140 ("luajit-lua52-openresty" ,luajit-lua52-openresty)
1141 ("pkg-config" ,pkg-config)
1142 ("re2c" ,re2c)
1143 ("xxd" ,xxd)))
1144 (inputs
1145 `(("boost" ,boost)
1146 ("boost-static" ,boost-static)
ff34334c 1147 ("fmt" ,fmt)
f4ac7571
VSO
1148 ;; LuaJIT has a 2GiB addressing limit[1] that has been fixed on OpenResty
1149 ;; fork. Emilua is severely affected by this limit, so the upstream package
1150 ;; is avoided. Emilua also depends on the -DLUAJIT_ENABLE_LUA52COMPAT
1151 ;; configure flag[2] for some features to work (e.g. __pairs on HTTP
1152 ;; headers).
1153 ;;
1154 ;; [1] <http://hacksoflife.blogspot.com/2012/12/integrating-luajit-with-x-plane-64-bit.html>
1155 ;; [2] <http://luajit.org/extensions.html#lua52>
1156 ("luajit-lua52-openresty" ,luajit-lua52-openresty)
1157 ("ncurses" ,ncurses)
1158 ("openssl" ,openssl)))
ff34334c
VSO
1159 (native-search-paths
1160 (list
1161 (search-path-specification
1162 (variable "EMILUA_PATH")
1163 (files
1164 (list (string-append "lib/emilua-" (version-major+minor version)))))))
f4ac7571
VSO
1165 (home-page "https://gitlab.com/emilua/emilua")
1166 (synopsis "Lua execution engine")
1167 (description
1168 "Emilua is a LuaJIT-based Lua execution engine that supports async IO,
1169fibers and actor-inspired threading. The experimental builtin HTTP module is
1170enabled.")
1171 (license license:boost1.0)))
1172
0190c9b2
PP
1173(define-public fennel
1174 (package
1175 (name "fennel")
4f4c1ec8 1176 (version "0.8.1")
0190c9b2
PP
1177 (source (origin
1178 (method git-fetch)
1179 (uri (git-reference
1180 (url "https://git.sr.ht/~technomancy/fennel")
1181 (commit version)))
1182 (file-name (git-file-name name version))
1183 (sha256
1184 (base32
4f4c1ec8 1185 "0n0xkgzlrwpppm5vbvn84mq418xhmyakk9hakdmjv1lk2dfdq2g7"))
0190c9b2
PP
1186 (modules '((guix build utils)))
1187 (snippet
1188 '(begin
1189 (delete-file "fennelview.lua") #t))))
1190 (build-system gnu-build-system)
1191 (arguments
1192 '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
3080a6e7 1193 #:tests? #t ; even on cross-build
0190c9b2
PP
1194 #:test-target "test"
1195 #:phases
1196 (modify-phases %standard-phases
1197 (delete 'configure)
209d94fa
EF
1198 (add-before 'build 'patch-lua-calls
1199 (lambda* (#:key inputs #:allow-other-keys)
1200 (let ((lua (string-append (assoc-ref inputs "lua") "/bin/lua")))
1201 (setenv "LUA" lua)
1202 (substitute* "old/launcher.lua"
1203 (("/usr/bin/env lua") lua))
1204 #t)))
0190c9b2 1205 (add-after 'build 'patch-fennel
209d94fa 1206 (lambda* (#:key inputs #:allow-other-keys)
0190c9b2 1207 (substitute* "fennel"
209d94fa
EF
1208 (("/usr/bin/env .*lua")
1209 (string-append (assoc-ref inputs "lua") "/bin/lua")))
d49b0331
EF
1210 #t))
1211 (delete 'check)
1212 (add-after 'install 'check
18a51252
EF
1213 (assoc-ref %standard-phases 'check))
1214 (add-after 'install 'install-manpage
1215 (lambda* (#:key outputs #:allow-other-keys)
1216 (install-file "fennel.1"
1217 (string-append (assoc-ref outputs "out")
1218 "/share/man/man1"))
1219 #t)))))
0190c9b2
PP
1220 (inputs `(("lua" ,lua)))
1221 (home-page "https://fennel-lang.org/")
547bd692 1222 (synopsis "Lisp that compiles to Lua")
0190c9b2
PP
1223 (description
1224 "Fennel is a programming language that brings together the speed,
1225simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro
1226system.")
1227 (license license:expat)))