gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / lua.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com>
4 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2016, 2017, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
9 ;;; Copyright © 2016, 2017, 2019 Clément Lassieur <clement@lassieur.org>
10 ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
11 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
13 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
14 ;;; Copyright © 2020 Simon South <simon@simonsouth.net>
15 ;;; Copyright © 2020 Paul A. Patience <paul@apatience.com>
16 ;;; Copyright © 2021 Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
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)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix utils)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system meson)
42 #:use-module (guix build-system trivial)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages build-tools)
46 #:use-module (gnu packages gcc)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gtk)
49 #:use-module (gnu packages libevent)
50 #:use-module (gnu packages libffi)
51 #:use-module (gnu packages m4)
52 #:use-module (gnu packages ncurses)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages pretty-print)
55 #:use-module (gnu packages re2c)
56 #:use-module (gnu packages readline)
57 #:use-module (gnu packages tls)
58 #:use-module (gnu packages vim)
59 #:use-module (gnu packages xml)
60 #:use-module (gnu packages xorg))
61
62 (define-public lua
63 (package
64 (name "lua")
65 (version "5.3.5")
66 (source (origin
67 (method url-fetch)
68 (uri (string-append "https://www.lua.org/ftp/lua-"
69 version ".tar.gz"))
70 (sha256
71 (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
72 (patches (search-patches "lua-pkgconfig.patch"
73 "lua-liblua-so.patch"))))
74 (build-system gnu-build-system)
75 (inputs `(("readline" ,readline)))
76 (arguments
77 `(#:modules ((guix build gnu-build-system)
78 (guix build utils)
79 (srfi srfi-1))
80 #:test-target "test"
81 #:make-flags
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")
87 #:phases
88 (modify-phases %standard-phases
89 (delete 'configure)
90 (replace 'install
91 (lambda* (#:key outputs #:allow-other-keys)
92 (let ((out (assoc-ref outputs "out")))
93 (invoke "make" "install"
94 (string-append "INSTALL_TOP=" out)
95 (string-append "INSTALL_MAN=" out
96 "/share/man/man1"))))))))
97 (home-page "https://www.lua.org/")
98 (synopsis "Embeddable scripting language")
99 (description
100 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
101 combines simple procedural syntax with powerful data description constructs
102 based on associative arrays and extensible semantics. Lua is dynamically typed,
103 runs by interpreting bytecode for a register-based virtual machine, and has
104 automatic memory management with incremental garbage collection, making it ideal
105 for configuration, scripting, and rapid prototyping.")
106 (license license:x11)))
107
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
121 (define-public lua-5.1
122 (package (inherit lua)
123 (version "5.1.5")
124 (source (origin
125 (method url-fetch)
126 (uri (string-append "https://www.lua.org/ftp/lua-"
127 version ".tar.gz"))
128 (sha256
129 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
130 (patches (search-patches "lua51-liblua-so.patch"
131 "lua-CVE-2014-5461.patch"
132 "lua51-pkgconfig.patch"))))))
133
134 (define-public luajit
135 (package
136 (name "luajit")
137 (version "2.1.0-beta3")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "http://luajit.org/download/LuaJIT-"
141 version ".tar.gz"))
142 (sha256
143 (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"))
144 (patches (search-patches "luajit-no_ldconfig.patch"))))
145 (build-system gnu-build-system)
146 (arguments
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")))))
160 (home-page "https://www.luajit.org/")
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
164 programming language. Lua is a powerful, dynamic and light-weight programming
165 language. It may be embedded or used as a general-purpose, stand-alone
166 language.")
167 (license license:x11)))
168
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))))
180 (file-name (git-file-name name version))
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
198 considered a fork, since changes are regularly synchronized from the upstream
199 LuaJIT project. This package also enables the Lua 5.2 compat mode needed by
200 some projects.")))
201
202 (define (make-lua-expat name lua)
203 (package
204 (name name)
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
216 (let ((out (assoc-ref %outputs "out"))
217 (lua-version ,(version-major+minor (package-version lua))))
218 (list "CC=gcc"
219 (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
220 (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
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;;")
228 (invoke "lua" "tests/test.lua")
229 (invoke "lua" "tests/test-lom.lua"))))))
230 (inputs
231 `(("lua" ,lua)
232 ("expat" ,expat)))
233 (home-page "https://matthewwild.co.uk/projects/luaexpat/")
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))))
237
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
244 (define (make-lua-socket name lua)
245 (package
246 (name name)
247 (version "3.0-rc1")
248 (source (origin
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))
254 (sha256
255 (base32
256 "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
257 (build-system gnu-build-system)
258 (arguments
259 `(#:make-flags
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)))
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))
272 (invoke "lua" "test/testsrvr.lua"))
273 (invoke "lua" "test/testclnt.lua"))))))
274 (inputs
275 `(("lua" ,lua)))
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
279 parts: a C core that provides support for the TCP and UDP transport layers,
280 and a set of Lua modules that add support for functionality commonly needed by
281 applications that deal with the Internet.
282
283 Among the supported modules, the most commonly used implement the
284 SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
285 files) client protocols. These provide a very natural and generic interface
286 to the functionality defined by each protocol. In addition, you will find
287 that the MIME (common encodings), URL (anything you could possible want to do
288 with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
289 handy.")
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))
297
298 (define (make-lua-filesystem name lua)
299 (package
300 (name name)
301 (version "1.7.0.2")
302 (source (origin
303 (method git-fetch)
304 (uri (git-reference
305 (url "https://github.com/keplerproject/luafilesystem")
306 (commit (string-append "v"
307 (string-join
308 (string-split version #\.) "_")))))
309 (file-name (git-file-name name version))
310 (sha256
311 (base32
312 "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
313 (build-system gnu-build-system)
314 (arguments
315 `(#:make-flags
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)))
320 #:test-target "test"
321 #:phases
322 (modify-phases %standard-phases
323 (delete 'configure))))
324 (inputs
325 `(("lua" ,lua)))
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
329 set of functions related to file systems offered by the standard Lua
330 distribution. LuaFileSystem offers a portable way to access the underlying
331 directory structure and file attributes.")
332 (license (package-license lua-5.1))))
333
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
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
361 (string-append "prefix=" out)
362 (string-append "LUA_APIS=" lua-api-version)))
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,
386 low-level bindings to the OpenSSL library, including support for certificate and
387 key management, key generation, signature verification, and deep bindings to the
388 distinguished name, alternative name, and X.509v3 extension interfaces. It also
389 binds 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
401 (define (make-lua-sec name lua)
402 (package
403 (name name)
404 (version "0.9")
405 (source (origin
406 (method git-fetch)
407 (uri (git-reference
408 (url "https://github.com/brunoos/luasec")
409 (commit (string-append "v" version))))
410 (file-name (git-file-name name version))
411 (sha256
412 (base32
413 "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
414 (build-system gnu-build-system)
415 (arguments
416 `(#:make-flags
417 (let ((out (assoc-ref %outputs "out"))
418 (lua-version ,(version-major+minor (package-version lua))))
419 (list "linux"
420 "CC=gcc"
421 "LD=gcc"
422 (string-append "LUAPATH=" out "/share/lua/" lua-version)
423 (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
424 #:tests? #f ; no tests included
425 #:phases
426 (modify-phases %standard-phases
427 (delete 'configure))))
428 (inputs
429 `(("lua" ,lua)
430 ("openssl" ,openssl)))
431 (propagated-inputs
432 `(("lua-socket"
433 ,(make-lua-socket
434 (format #f "lua~a-socket"
435 (version-major+minor (package-version lua))) lua))))
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
439 communication. It takes an already established TCP connection and creates a
440 secure session between the peers.")
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))
448
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
542 that operates through the yielding and resumption of coroutines. It is designed
543 to 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
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
563 (url "https://github.com/Tieske/Penlight")
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
589 input data handling (such as reading configuration files), functional
590 programming (such as map, reduce, placeholder expressions,etc), and OS
591 path management. Much of the functionality is inspired by the Python
592 standard libraries.")
593 (license license:expat)))
594
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
603 (url "https://github.com/stevedonovan/LDoc")
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
639 Lua source code. It parses the declaration and documentation comments
640 in a set of Lua source files and produces a set of XHTML pages
641 describing the commented declarations and functions.")
642 (license license:expat)))
643
644 (define (make-lua-lgi name lua)
645 (package
646 (name name)
647 (version "0.9.2")
648 (source
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"))))
657 (build-system gnu-build-system)
658 (arguments
659 `(#:make-flags
660 (list "CC=gcc"
661 (string-append "PREFIX=" (assoc-ref %outputs "out")))
662 #:phases
663 (modify-phases %standard-phases
664 (delete 'configure) ; no configure script
665 (add-before 'build 'set-env
666 (lambda* (#:key inputs #:allow-other-keys)
667 ;; We need to load cairo dynamically.
668 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
669 (setenv "LD_LIBRARY_PATH" cairo)
670 #t)))
671 (add-before 'build 'set-lua-version
672 (lambda _
673 ;; Lua version and therefore install directories are hardcoded.
674 (substitute* "./lgi/Makefile"
675 (("LUA_VERSION=5.1")
676 (format #f
677 "LUA_VERSION=~a"
678 ,(version-major+minor (package-version lua)))))
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)))))
699 (native-inputs
700 `(("dbus" ,dbus) ;tests use 'dbus-run-session'
701 ("pkg-config" ,pkg-config)))
702 (inputs
703 `(("cairo" ,cairo)
704 ("glib" ,glib)
705 ("gobject-introspection" ,gobject-introspection)
706 ("gtk" ,gtk+-2)
707 ("libffi" ,libffi)
708 ("lua" ,lua)
709 ("pango" ,pango)
710 ("xorg-server" ,xorg-server)))
711 (home-page "https://github.com/pavouk/lgi/")
712 (synopsis "Lua bridge to GObject based libraries")
713 (description
714 "LGI is gobject-introspection based dynamic Lua binding to GObject based
715 libraries. It allows using GObject-based libraries directly from Lua.
716 Notable examples are GTK+, GStreamer and Webkit.")
717 (license license:expat)))
718
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
728 (define (make-lua-lpeg name lua)
729 (package
730 (name name)
731 (version "1.0.2")
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
737 (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
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"))
754 (inputs `(("lua" ,lua)))
755 (synopsis "Pattern-matching library for Lua")
756 (description
757 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
758 Grammars (PEGs).")
759 (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
760 (license license:expat)))
761
762 (define-public lua-lpeg
763 (make-lua-lpeg "lua-lpeg" lua))
764
765 (define-public lua5.1-lpeg
766 (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
767
768 (define-public lua5.2-lpeg
769 (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
770
771 (define (make-lua-luv name lua)
772 (package
773 (name name)
774 (version "1.32.0-0")
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
780 (url "https://github.com/luvit/luv")
781 (commit version)))
782 (file-name (git-file-name name version))
783 (sha256
784 (base32
785 "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh"))))
786 (build-system cmake-build-system)
787 (arguments
788 `(#:tests? #f ; there are none
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
813 (url "https://github.com/keplerproject/lua-compat-5.3")
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
834 ;; Lua 5.3 is not supported.
835 (define (make-lua-bitop name lua)
836 (package
837 (name name)
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/"
854 ,(version-major+minor (package-version lua))
855 "/bit/bit.so"))
856 #:phases
857 (modify-phases %standard-phases
858 (delete 'configure))))
859 (inputs `(("lua" ,lua)))
860 (home-page "https://bitop.luajit.org/index.html")
861 (synopsis "Bitwise operations on numbers for Lua")
862 (description
863 "Lua BitOp is a C extension module for Lua which adds bitwise operations
864 on numbers.")
865 (license license:expat)))
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))
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
880 (url "https://github.com/jeremyong/Selene")
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)))
928
929 (define-public lua-resty-core
930 (package
931 (name "lua-resty-core")
932 (version "0.1.18")
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
941 "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
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)))
965
966 (define-public lua-resty-lrucache
967 (package
968 (name "lua-resty-lrucache")
969 (version "0.10")
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
978 "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
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)))
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
1038 signals to Linux processes.")
1039 (license license:bsd-3)))
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)))
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
1105 shell command executions.")
1106 (license license:bsd-3)))
1107
1108 (define-public emilua
1109 (package
1110 (name "emilua")
1111 (version "0.3.0")
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))
1117 ;; Current version requires bundled CLI11, but at some future
1118 ;; release the one found in the system could be used
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)))
1124 (file-name (git-file-name name version))
1125 (sha256
1126 (base32
1127 "124fj73722c03znwdyqp1i0jygwv3s11f6s1j9rzym513qrf7fnd"))))
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>
1133 #:configure-flags
1134 (list "-Denable_http=true"
1135 "-Denable_tests=false"
1136 "-Denable_manpages=false"
1137 "-Dversion_suffix=-guix1")))
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)
1147 ("fmt" ,fmt)
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)))
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)))))))
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,
1169 fibers and actor-inspired threading. The experimental builtin HTTP module is
1170 enabled.")
1171 (license license:boost1.0)))
1172
1173 (define-public fennel
1174 (package
1175 (name "fennel")
1176 (version "0.8.1")
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
1185 "0n0xkgzlrwpppm5vbvn84mq418xhmyakk9hakdmjv1lk2dfdq2g7"))
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")))
1193 #:tests? #t ; even on cross-build
1194 #:test-target "test"
1195 #:phases
1196 (modify-phases %standard-phases
1197 (delete 'configure)
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)))
1205 (add-after 'build 'patch-fennel
1206 (lambda* (#:key inputs #:allow-other-keys)
1207 (substitute* "fennel"
1208 (("/usr/bin/env .*lua")
1209 (string-append (assoc-ref inputs "lua") "/bin/lua")))
1210 #t))
1211 (delete 'check)
1212 (add-after 'install 'check
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)))))
1220 (inputs `(("lua" ,lua)))
1221 (home-page "https://fennel-lang.org/")
1222 (synopsis "Lisp that compiles to Lua")
1223 (description
1224 "Fennel is a programming language that brings together the speed,
1225 simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro
1226 system.")
1227 (license license:expat)))