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