projects/guix·blob next-master · refs

1450 lines · 60.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Cyril Roelandt <[email protected]>
3;;; Copyright © 2014 Raimon Grau <[email protected]>
4;;; Copyright © 2014 Mark H Weaver <[email protected]>
5;;; Copyright © 2014 Andreas Enge <[email protected]>
6;;; Copyright © 2016, 2017, 2020-2022 Efraim Flashner <[email protected]>
7;;; Copyright © 2016, 2019, 2024 Ricardo Wurmus <[email protected]>
8;;; Copyright © 2016 doncatnip <[email protected]>
9;;; Copyright © 2016, 2017, 2019 Clément Lassieur <[email protected]>
10;;; Copyright © 2016 José Miguel Sánchez García <[email protected]>
11;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <[email protected]>
12;;; Copyright © 2018 Fis Trivial <[email protected]>
13;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
14;;; Copyright © 2020 Simon South <[email protected]>
15;;; Copyright © 2020 Paul A. Patience <[email protected]>
16;;; Copyright © 2021 Vinícius dos Santos Oliveira <[email protected]>
17;;; Copyright © 2021 Greg Hogan <[email protected]>
18;;; Copyright © 2022 Brandon Lucas <[email protected]>
19;;; Copyright © 2022 Luis Henrique Gomes Higino <[email protected]>
20;;; Copyright © 2022 Leo Nikkilä <[email protected]>
21;;; Copyright © 2023 Yovan Naumovski <[email protected]>
22;;; Copyright © 2023 Valter Nazianzeno <[email protected]>
23;;; Copyright © 2023 Timo Wilken <[email protected]>
24;;; Copyright © 2024 Jan Wielkiewicz <[email protected]>
25;;; Copyright © 2024 Maxim Cournoyer <[email protected]>
26;;; Copyright © 2025 Zheng Junjie <[email protected]>
27;;; Copyright © 2025 Ashish SHUKLA <[email protected]>
28;;;
29;;; This file is part of GNU Guix.
30;;;
31;;; GNU Guix is free software; you can redistribute it and/or modify it
32;;; under the terms of the GNU General Public License as published by
33;;; the Free Software Foundation; either version 3 of the License, or (at
34;;; your option) any later version.
35;;;
36;;; GNU Guix is distributed in the hope that it will be useful, but
37;;; WITHOUT ANY WARRANTY; without even the implied warranty of
38;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39;;; GNU General Public License for more details.
40;;;
41;;; You should have received a copy of the GNU General Public License
42;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
43
44(define-module (gnu packages lua)
45 #:use-module ((guix licenses) #:prefix license:)
46 #:use-module (guix packages)
47 #:use-module (guix download)
48 #:use-module (guix git-download)
49 #:use-module (guix gexp)
50 #:use-module (guix utils)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix build-system cmake)
53 #:use-module (guix build-system meson)
54 #:use-module (guix build-system trivial)
55 #:use-module (gnu packages)
56 #:use-module (gnu packages autotools)
57 #:use-module (gnu packages base)
58 #:use-module (gnu packages bash)
59 #:use-module (gnu packages boost)
60 #:use-module (gnu packages curl)
61 #:use-module (gnu packages build-tools)
62 #:use-module (gnu packages check)
63 #:use-module (gnu packages gcc)
64 #:use-module (gnu packages compression)
65 #:use-module (gnu packages gcc)
66 #:use-module (gnu packages glib)
67 #:use-module (gnu packages gperf)
68 #:use-module (gnu packages gnupg)
69 #:use-module (gnu packages gtk)
70 #:use-module (gnu packages libevent)
71 #:use-module (gnu packages libffi)
72 #:use-module (gnu packages linux)
73 #:use-module (gnu packages m4)
74 #:use-module (gnu packages ncurses)
75 #:use-module (gnu packages pkg-config)
76 #:use-module (gnu packages pretty-print)
77 #:use-module (gnu packages rdf)
78 #:use-module (gnu packages re2c)
79 #:use-module (gnu packages readline)
80 #:use-module (gnu packages rsync)
81 #:use-module (gnu packages ssh)
82 #:use-module (gnu packages tls)
83 #:use-module (gnu packages version-control)
84 #:use-module (gnu packages vim)
85 #:use-module (gnu packages wget)
86 #:use-module (gnu packages xml)
87 #:use-module (gnu packages xorg)
88 #:use-module ((srfi srfi-1) #:hide (zip)))
89
90(define-public lua
91 (package
92 (name "lua")
93 (version "5.3.5")
94 (source (origin
95 (method url-fetch)
96 (uri (string-append "https://www.lua.org/ftp/lua-"
97 version ".tar.gz"))
98 (sha256
99 (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
100 (patches (search-patches "lua-pkgconfig.patch"
101 "lua-liblua-so.patch"))))
102 (build-system gnu-build-system)
103 (inputs (list readline))
104 (arguments
105 `(#:modules ((guix build gnu-build-system)
106 (guix build utils)
107 (srfi srfi-1))
108 #:test-target "test"
109 #:make-flags
110 (list "MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
111 (string-append "CC=" ,(cc-for-target))
112 (string-append "SYSLIBS=-L" (assoc-ref %build-inputs "readline")
113 "/lib")
114 "linux")
115 #:phases
116 (modify-phases %standard-phases
117 (delete 'configure)
118 (replace 'install
119 (lambda* (#:key outputs #:allow-other-keys)
120 (let ((out (assoc-ref outputs "out")))
121 (invoke "make" "install"
122 (string-append "INSTALL_TOP=" out)
123 (string-append "INSTALL_MAN=" out
124 "/share/man/man1"))))))))
125 (home-page "https://www.lua.org/")
126 (synopsis "Embeddable scripting language")
127 (description
128 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
129combines simple procedural syntax with powerful data description constructs
130based on associative arrays and extensible semantics. Lua is dynamically typed,
131runs by interpreting bytecode for a register-based virtual machine, and has
132automatic memory management with incremental garbage collection, making it ideal
133for configuration, scripting, and rapid prototyping.")
134 (license license:x11)))
135
136(define-public lua-5.4
137 (package (inherit lua)
138 (version "5.4.8")
139 (arguments
140 (substitute-keyword-arguments (package-arguments lua)
141 ((#:make-flags flags)
142 (append (delete "linux" flags)
143 '("linux-readline")))))
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "https://www.lua.org/ftp/lua-"
147 version ".tar.gz"))
148 (sha256
149 (base32 "1bi90r9nzmqhjwhr8ysffhmhq30wxxcpqwmbxr33wyaf2npds62g"))
150 (patches (search-patches "lua-5.4-pkgconfig.patch"
151 "lua-5.4-liblua-so.patch"))))))
152
153(define-public lua-5.2
154 (package (inherit lua)
155 (version "5.2.4")
156 (source
157 (origin
158 (method url-fetch)
159 (uri (string-append "https://www.lua.org/ftp/lua-"
160 version ".tar.gz"))
161 (sha256
162 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
163 (patches (search-patches "lua-pkgconfig.patch"
164 "lua-liblua-so.patch"))))))
165
166(define-public lua-5.1
167 (package (inherit lua)
168 (version "5.1.5")
169 (source (origin
170 (method url-fetch)
171 (uri (string-append "https://www.lua.org/ftp/lua-"
172 version ".tar.gz"))
173 (sha256
174 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
175 (patches (search-patches "lua51-liblua-so.patch"
176 "lua-CVE-2014-5461.patch"
177 "lua51-pkgconfig.patch"))))))
178
179(define-public luajit
180 (let ((branch "v2.1")
181 (commit "04dca7911ea255f37be799c18d74c305b921c1a6"))
182 (package
183 (name "luajit")
184 (version (git-version branch "0" commit))
185 (source (origin
186 (method git-fetch)
187 (uri (git-reference
188 (url "https://luajit.org/git/luajit.git")
189 (commit commit)))
190 (file-name (git-file-name name version))
191 (sha256
192 (base32
193 "0srwk9nmiz8a93f70inq2597ff6xy203ckr4c0k7jcksdixymi9v"))))
194 (build-system gnu-build-system)
195 (arguments
196 (list #:tests? #f ; luajit is distributed without tests
197 #:phases
198 #~(modify-phases %standard-phases
199 #$@(if (target-riscv64?)
200 #~((add-after 'unpack 'patch
201 (lambda _
202 (invoke
203 "patch" "--force" "-p1" "-i"
204 #$(local-file
205 (search-patch
206 "luajit-add-riscv64-support.patch"))))))
207 #~())
208 (delete 'configure)) ; no configure script
209 #:make-flags #~(list (string-append "PREFIX="
210 (assoc-ref %outputs "out")))))
211 (home-page "https://www.luajit.org/")
212 (synopsis
213 "Just in time compiler for Lua programming language version 5.1")
214 ;; On powerpc64le-linux, the build fails with an error: "No support for
215 ;; PowerPC 64 bit mode (yet)". See: https://issues.guix.gnu.org/49220
216 (supported-systems (fold delete %supported-systems
217 (list "powerpc64le-linux")))
218 (description
219 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
220programming language. Lua is a powerful, dynamic and light-weight programming
221language. It may be embedded or used as a general-purpose, stand-alone
222language.")
223 (license license:x11))))
224
225(define-public luajit-lua52-openresty
226 (package
227 (inherit luajit)
228 (name "luajit-lua52-openresty")
229 (version "2.1-20201229")
230 (source
231 (origin
232 (method git-fetch)
233 (uri (git-reference
234 (url "https://github.com/openresty/luajit2.git")
235 (commit (string-append "v" version))))
236 (file-name (git-file-name name version))
237 (sha256
238 (base32 "07haj27kbpbnkv836c2nd36h2xislrmri52w0zbpxvl68xk6g96p"))))
239 (arguments
240 `(#:tests? #f ;no test
241 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
242 #:phases
243 (modify-phases %standard-phases
244 (delete 'configure) ;no configure script
245 (add-after 'unpack 'enable-lua52-compat
246 (lambda _
247 (substitute* "src/Makefile"
248 (("#(XCFLAGS\\+= -DLUAJIT_ENABLE_LUA52COMPAT)" _ flag) flag))
249 #t)))))
250 (home-page "https://github.com/openresty/luajit2")
251 (synopsis "OpenResty's Branch of LuaJIT 2")
252 (description
253 "This is the official OpenResty branch of LuaJIT. It is not to be
254considered a fork, since changes are regularly synchronized from the upstream
255LuaJIT project. This package also enables the Lua 5.2 compat mode needed by
256some projects.")))
257
258(define (make-lua-expat name lua)
259 (package
260 (name name)
261 (version "1.3.0")
262 (source (origin
263 (method url-fetch)
264 (uri (string-append "https://matthewwild.co.uk/projects/"
265 "luaexpat/luaexpat-" version ".tar.gz"))
266 (sha256
267 (base32
268 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
269 (build-system gnu-build-system)
270 (arguments
271 `(#:make-flags
272 (let ((out (assoc-ref %outputs "out"))
273 (lua-version ,(version-major+minor (package-version lua))))
274 (list ,(string-append "CC=" (cc-for-target))
275 (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
276 (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
277 #:phases
278 (modify-phases %standard-phases
279 (delete 'configure)
280 (replace 'check
281 (lambda _
282 (setenv "LUA_CPATH" "src/?.so;;")
283 (setenv "LUA_PATH" "src/?.lua;;")
284 (invoke "lua" "tests/test.lua")
285 (invoke "lua" "tests/test-lom.lua"))))))
286 (inputs
287 (list lua expat))
288 (home-page "https://matthewwild.co.uk/projects/luaexpat/")
289 (synopsis "SAX XML parser based on the Expat library")
290 (description "LuaExpat is a SAX XML parser based on the Expat library.")
291 (license (package-license lua-5.1))))
292
293(define-public lua5.1-expat
294 (make-lua-expat "lua5.1-expat" lua-5.1))
295
296(define-public lua5.2-expat
297 (make-lua-expat "lua5.2-expat" lua-5.2))
298
299(define (make-lua-socket name lua)
300 (package
301 (name name)
302 (version "3.0-rc1")
303 (source (origin
304 (method git-fetch)
305 (uri (git-reference
306 (url "https://github.com/diegonehab/luasocket")
307 (commit (string-append "v" version))))
308 (file-name (git-file-name name version))
309 (sha256
310 (base32
311 "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
312 (build-system gnu-build-system)
313 (arguments
314 `(#:make-flags
315 (let ((out (assoc-ref %outputs "out"))
316 (lua-version ,(version-major+minor (package-version lua))))
317 (list (string-append "INSTALL_TOP=" out)
318 (string-append "LUAV?=" lua-version)))
319 #:phases
320 (modify-phases %standard-phases
321 (delete 'configure)
322 (replace 'check
323 (lambda _
324 (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
325 (setenv "LUA_PATH" "src/?.lua;;")
326 (when (zero? (primitive-fork))
327 (invoke "lua" "test/testsrvr.lua"))
328 (invoke "lua" "test/testclnt.lua"))))))
329 (inputs
330 (list lua))
331 (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
332 (synopsis "Socket library for Lua")
333 (description "LuaSocket is a Lua extension library that is composed by two
334parts: a C core that provides support for the TCP and UDP transport layers,
335and a set of Lua modules that add support for functionality commonly needed by
336applications that deal with the Internet.
337
338Among the supported modules, the most commonly used implement the
339SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
340files) client protocols. These provide a very natural and generic interface
341to the functionality defined by each protocol. In addition, you will find
342that the MIME (common encodings), URL (anything you could possible want to do
343with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
344handy.")
345 (license license:expat)))
346
347(define-public lua5.1-socket
348 (make-lua-socket "lua5.1-socket" lua-5.1))
349
350(define-public lua5.2-socket
351 (make-lua-socket "lua5.2-socket" lua-5.2))
352
353(define (make-lua-filesystem name lua)
354 (package
355 (name name)
356 (version "1.7.0.2")
357 (source (origin
358 (method git-fetch)
359 (uri (git-reference
360 (url "https://github.com/keplerproject/luafilesystem")
361 (commit (string-append "v"
362 (string-join
363 (string-split version #\.) "_")))))
364 (file-name (git-file-name name version))
365 (sha256
366 (base32
367 "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
368 (build-system gnu-build-system)
369 (arguments
370 `(#:make-flags
371 (let ((out (assoc-ref %outputs "out"))
372 (lua-version ,(version-major+minor (package-version lua))))
373 (list (string-append "PREFIX=" out)
374 (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version)))
375 #:test-target "test"
376 #:phases
377 (modify-phases %standard-phases
378 (delete 'configure))))
379 (inputs
380 (list lua))
381 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
382 (synopsis "File system library for Lua")
383 (description "LuaFileSystem is a Lua library developed to complement the
384set of functions related to file systems offered by the standard Lua
385distribution. LuaFileSystem offers a portable way to access the underlying
386directory structure and file attributes.")
387 (license (package-license lua-5.1))))
388
389(define-public lua-filesystem
390 (make-lua-filesystem "lua-filesystem" lua))
391
392(define-public lua5.1-filesystem
393 (make-lua-filesystem "lua5.1-filesystem" lua-5.1))
394
395(define-public lua5.2-filesystem
396 (make-lua-filesystem "lua5.2-filesystem" lua-5.2))
397
398(define (make-lua-ossl name lua)
399 (package
400 (name name)
401 (version "20220711")
402 (source (origin
403 (method git-fetch)
404 (uri (git-reference
405 (url "https://github.com/wahern/luaossl")
406 (commit (string-append "rel-" version))))
407 (file-name (git-file-name name version))
408 (sha256
409 (base32
410 "1a9pgmc6fbhgh1m9ksz9fq057yzz46npqgakcsy9vngg47xacfdb"))))
411 (build-system gnu-build-system)
412 (arguments
413 (list
414 #:make-flags
415 #~(let ((lua-api-version #$(version-major+minor (package-version lua))))
416 (list (string-append "CC=" #$(cc-for-target))
417 "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
418 (string-append "prefix=" #$output)
419 (string-append "LUA_APIS=" lua-api-version)))
420 #:phases
421 #~(modify-phases %standard-phases
422 (delete 'configure)
423 (delete 'check)
424 (add-after 'install 'check
425 (lambda _
426 (let ((lua-version #$(version-major+minor (package-version lua))))
427 (setenv "LUA_CPATH"
428 (string-append #$output "/lib/lua/" lua-version "/?.so;;"))
429 (setenv "LUA_PATH"
430 (string-append #$output "/share/lua/" lua-version "/?.lua;;"))
431 (with-directory-excursion "regress"
432 (for-each (lambda (f)
433 (unless (member f (list
434 ;; This test is for luajit only
435 "./104-interposition-discarded.lua"
436 ;; needs cqueues, which needs ossl
437 "./148-custom-extensions.lua"))
438 (invoke "lua" f)))
439 (find-files "." "^[0-9].*\\.lua$")))))))))
440 (inputs
441 (list lua openssl))
442 (home-page "https://25thandclement.com/~william/projects/luaossl.html")
443 (synopsis "OpenSSL bindings for Lua")
444 (description "The luaossl extension module for Lua provides comprehensive,
445low-level bindings to the OpenSSL library, including support for certificate
446and key management, key generation, signature verification, and deep bindings
447to the distinguished name, alternative name, and X.509v3 extension interfaces.
448It also binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG
449interfaces.")
450 (license license:expat)))
451
452(define-public lua-ossl
453 (make-lua-ossl "lua-ossl" lua))
454
455(define-public lua5.1-ossl
456 (make-lua-ossl "lua5.1-ossl" lua-5.1))
457
458(define-public lua5.2-ossl
459 (make-lua-ossl "lua5.2-ossl" lua-5.2))
460
461(define (make-lua-sec name lua)
462 (package
463 (name name)
464 (version "0.9")
465 (source (origin
466 (method git-fetch)
467 (uri (git-reference
468 (url "https://github.com/brunoos/luasec")
469 (commit (string-append "v" version))))
470 (file-name (git-file-name name version))
471 (sha256
472 (base32
473 "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
474 (build-system gnu-build-system)
475 (arguments
476 `(#:make-flags
477 (let ((out (assoc-ref %outputs "out"))
478 (lua-version ,(version-major+minor (package-version lua))))
479 (list "linux"
480 ,(string-append "CC=" (cc-for-target))
481 "LD=gcc"
482 (string-append "LUAPATH=" out "/share/lua/" lua-version)
483 (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
484 #:tests? #f ; no tests included
485 #:phases
486 (modify-phases %standard-phases
487 (delete 'configure))))
488 (inputs
489 (list lua openssl))
490 (propagated-inputs
491 `(("lua-socket"
492 ,(make-lua-socket
493 (format #f "lua~a-socket"
494 (version-major+minor (package-version lua))) lua))))
495 (home-page "https://github.com/brunoos/luasec/wiki")
496 (synopsis "OpenSSL bindings for Lua")
497 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
498communication. It takes an already established TCP connection and creates a
499secure session between the peers.")
500 (license license:expat)))
501
502(define-public lua5.1-sec
503 (make-lua-sec "lua5.1-sec" lua-5.1))
504
505(define-public lua5.2-sec
506 (make-lua-sec "lua5.2-sec" lua-5.2))
507
508(define (make-lua-cqueues name lua lua-ossl)
509 (package
510 (name name)
511 (version "20200726")
512 (source (origin
513 (method git-fetch)
514 (uri (git-reference
515 (url "https://github.com/wahern/cqueues")
516 (commit (string-append "rel-" version))))
517 (file-name (git-file-name name version))
518 (sha256
519 (base32
520 "17gwqndlga6gnishgs6wk8cvgwzanddr42yikkg2xd4nanhcg8z9"))))
521 (build-system gnu-build-system)
522 (arguments
523 (list
524 #:modules '((guix build gnu-build-system)
525 (guix build utils)
526 (ice-9 string-fun))
527 #:make-flags
528 #~(let ((lua-api-version #$(version-major+minor (package-version lua))))
529 (list (string-append "CC=" #$(cc-for-target))
530 (string-append "LUA_APIS=" lua-api-version)))
531 #:phases
532 #~(modify-phases %standard-phases
533 (delete 'configure)
534 (delete 'check)
535 (replace 'install
536 (lambda* (#:key make-flags #:allow-other-keys)
537 (apply invoke "make" "install"
538 (append make-flags
539 (list (string-append "DESTDIR=" #$output)
540 "prefix=")))))
541 (add-after 'install 'check
542 (lambda* (#:key make-flags #:allow-other-keys)
543 (let*
544 ((lua-version #$(version-major+minor (package-version lua)))
545 (env-suffix (if (equal? lua-version "5.1")
546 ""
547 (string-append
548 "_"
549 (string-replace-substring lua-version "." "_"))))
550
551 (lua-cpath (lambda (p)
552 (string-append p "/lib/lua/" lua-version "/?.so")))
553 (lua-path (lambda (p)
554 (string-append p "/share/lua/" lua-version "/?.lua"))))
555 ;; The test suite sets Lua-version-specific search-path variables
556 ;; when available so we must do the same, as these take
557 ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
558 (setenv (string-append "LUA_CPATH" env-suffix)
559 (string-append
560 (string-join (map lua-cpath (list #$output #$lua-ossl)) ";")
561 ";;"))
562 (setenv (string-append "LUA_PATH" env-suffix)
563 (string-append
564 (string-join (map lua-path (list #$output #$lua-ossl)) ";")
565 ";;"))
566
567 ;; Skip regression tests we expect to fail
568 (with-directory-excursion "regress"
569 (for-each (lambda (f)
570 (rename-file f (string-append f ".skip")))
571 (append
572 ;; Regression tests that require network
573 ;; connectivity
574 '("22-client-dtls.lua"
575 "30-starttls-completion.lua"
576 "62-noname.lua"
577 "153-dns-resolvers.lua")
578
579 ;; Regression tests that require LuaJIT
580 '("44-resolvers-gc.lua"
581 "51-join-defunct-thread.lua"
582 ;; These both need the ffi module.
583 "73-starttls-buffering.lua"
584 "87-alpn-disappears.lua")
585
586 ;; Regression tests that require Lua 5.3
587 (if (not (equal? lua-version "5.3"))
588 '("152-thread-integer-passing.lua")
589 '()))))
590
591 (apply invoke "make" "check" make-flags)))))))
592 (native-inputs
593 (list m4))
594 (inputs
595 (list lua openssl))
596 (propagated-inputs
597 (list lua-ossl))
598 (home-page "https://25thandclement.com/~william/projects/cqueues.html")
599 (synopsis "Event loop for Lua using continuation queues")
600 (description "The cqueues extension module for Lua implements an event loop
601that operates through the yielding and resumption of coroutines. It is designed
602to be non-intrusive, composable, and embeddable within existing applications.")
603 (license license:expat)))
604
605(define-public lua-cqueues
606 (make-lua-cqueues "lua-cqueues" lua lua-ossl))
607
608(define-public lua5.1-cqueues
609 (make-lua-cqueues "lua5.1-cqueues" lua-5.1 lua5.1-ossl))
610
611(define-public lua5.2-cqueues
612 (make-lua-cqueues "lua5.2-cqueues" lua-5.2 lua5.2-ossl))
613
614(define-public lua-penlight
615 (package
616 (name "lua-penlight")
617 (version "1.7.0")
618 (source
619 (origin
620 (method git-fetch)
621 (uri (git-reference
622 (url "https://github.com/Tieske/Penlight")
623 (commit version)))
624 (file-name (git-file-name name version))
625 (sha256
626 (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
627 (build-system trivial-build-system)
628 (inputs
629 (list lua))
630 (propagated-inputs
631 (list lua-filesystem))
632 (arguments
633 `(#:modules ((guix build utils))
634 #:builder
635 (begin
636 (use-modules (guix build utils))
637 (let* ((source (assoc-ref %build-inputs "source"))
638 (lua-version ,(version-major+minor (package-version lua)))
639 (destination (string-append (assoc-ref %outputs "out")
640 "/share/lua/" lua-version)))
641 (mkdir-p destination)
642 (with-directory-excursion source
643 (copy-recursively "lua/" destination)))
644 #t)))
645 (home-page "http://tieske.github.io/Penlight/")
646 (synopsis "Collection of general purpose libraries for the Lua language")
647 (description "Penlight is a set of pure Lua libraries focusing on
648input data handling (such as reading configuration files), functional
649programming (such as map, reduce, placeholder expressions,etc), and OS
650path management. Much of the functionality is inspired by the Python
651standard libraries.")
652 (license license:expat)))
653
654(define-public lua-ldoc
655 (package
656 (name "lua-ldoc")
657 (version "1.4.6")
658 (source
659 (origin
660 (method git-fetch)
661 (uri (git-reference
662 (url "https://github.com/stevedonovan/LDoc")
663 (commit version)))
664 (file-name (git-file-name name version))
665 (sha256
666 (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
667 (build-system gnu-build-system)
668 (inputs
669 (list lua))
670 (propagated-inputs
671 (list lua-penlight))
672 (arguments
673 `(#:tests? #f ;tests must run after installation.
674 #:phases
675 (modify-phases %standard-phases
676 (add-after 'unpack 'fix-installation-directory
677 (lambda* (#:key outputs #:allow-other-keys)
678 (let ((out (assoc-ref outputs "out"))
679 (lua-version ,(version-major+minor (package-version lua))))
680 (substitute* "makefile"
681 (("LUA=.*") "#\n")
682 (("(LUA_PREFIX=).*" _ prefix)
683 (string-append prefix out "\n"))
684 (("(LUA_BINDIR=).*" _ prefix)
685 (string-append prefix out "/bin\n"))
686 (("(LUA_SHAREDIR=).*" _ prefix)
687 (string-append prefix out "/share/lua/" lua-version "\n"))))
688 #t))
689 (delete 'configure)
690 (add-before 'install 'create-bin-directory
691 (lambda* (#:key outputs #:allow-other-keys)
692 (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
693 #t)))))
694 (home-page "https://stevedonovan.github.io/ldoc/")
695 (synopsis "Lua documentation generator")
696 (description
697 "LDoc is a LuaDoc-compatible documentation generation system for
698Lua source code. It parses the declaration and documentation comments
699in a set of Lua source files and produces a set of XHTML pages
700describing the commented declarations and functions.")
701 (license license:expat)))
702
703(define (make-lua-lgi name lua)
704 (package
705 (name name)
706 (version "0.9.2")
707 (source
708 (origin
709 (method git-fetch)
710 (uri (git-reference
711 (url "https://github.com/pavouk/lgi")
712 (commit version)))
713 (file-name (git-file-name name version))
714 (sha256
715 (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
716 (build-system gnu-build-system)
717 (arguments
718 `(#:make-flags
719 (list ,(string-append "CC=" (cc-for-target))
720 (string-append "PREFIX=" (assoc-ref %outputs "out")))
721 #:phases
722 (modify-phases %standard-phases
723 (delete 'configure) ; no configure script
724 (add-before 'build 'set-env
725 (lambda* (#:key inputs #:allow-other-keys)
726 ;; We need to load cairo dynamically.
727 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
728 (setenv "LD_LIBRARY_PATH" cairo)
729 #t)))
730 (add-before 'build 'set-lua-version
731 (lambda _
732 ;; Lua version and therefore install directories are hardcoded.
733 (substitute* "./lgi/Makefile"
734 (("LUA_VERSION=5.1")
735 (format #f
736 "LUA_VERSION=~a"
737 ,(version-major+minor (package-version lua)))))
738 #t))
739 (add-before 'check 'skip-test-gtk
740 (lambda _
741 ;; FIXME: Skip GTK tests:
742 ;; gtk3 - can't get it to run with the xorg-server config below
743 ;; and some non-gtk tests will also fail
744 ;; gtk2 - lots of functions aren't implemented
745 ;; We choose gtk2 as the lesser evil and simply skip the test.
746 ;; Currently, awesome is the only package that uses lua-lgi but
747 ;; it doesn't need or interact with GTK using lua-lgi.
748 (substitute* "./tests/test.lua"
749 (("'gtk.lua',") "-- 'gtk.lua',"))
750 #t))
751 (add-before 'check 'start-xserver-instance
752 (lambda* (#:key inputs #:allow-other-keys)
753 ;; There must be a running X server during tests.
754 (system (format #f "~a/bin/Xvfb :1 &"
755 (assoc-ref inputs "xorg-server")))
756 (setenv "DISPLAY" ":1")
757 #t)))))
758 (native-inputs
759 (list dbus ;tests use 'dbus-run-session'
760 pkg-config))
761 (inputs
762 `(("cairo" ,cairo)
763 ("glib" ,glib)
764 ("gobject-introspection" ,gobject-introspection)
765 ("gtk" ,gtk+-2)
766 ("libffi" ,libffi)
767 ("lua" ,lua)
768 ("pango" ,pango)
769 ("xorg-server" ,xorg-server)))
770 (home-page "https://github.com/pavouk/lgi/")
771 (synopsis "Lua bridge to GObject based libraries")
772 (description
773 "LGI is gobject-introspection based dynamic Lua binding to GObject based
774libraries. It allows using GObject-based libraries directly from Lua.
775Notable examples are GTK+, GStreamer and Webkit.")
776 (license license:expat)))
777
778(define-public lua-lgi
779 (make-lua-lgi "lua-lgi" lua))
780
781(define-public lua5.1-lgi
782 (make-lua-lgi "lua5.1-lgi" lua-5.1))
783
784(define-public lua5.2-lgi
785 (make-lua-lgi "lua5.2-lgi" lua-5.2))
786
787(define (make-lua-lpeg name lua)
788 (package
789 (name name)
790 (version "1.0.2")
791 (source (origin
792 (method url-fetch)
793 (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
794 version ".tar.gz"))
795 (sha256
796 (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
797 (build-system gnu-build-system)
798 (arguments
799 `(#:phases
800 (modify-phases %standard-phases
801 (delete 'configure)
802 ;; `make install` isn't available, so we have to do it manually
803 (replace 'install
804 (lambda* (#:key outputs #:allow-other-keys)
805 (let ((out (assoc-ref outputs "out"))
806 (lua-version ,(version-major+minor (package-version lua))))
807 (install-file "lpeg.so"
808 (string-append out "/lib/lua/" lua-version))
809 (install-file "re.lua"
810 (string-append out "/share/lua/" lua-version))
811 #t))))
812 #:test-target "test"))
813 (inputs (list lua))
814 (synopsis "Pattern-matching library for Lua")
815 (description
816 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
817Grammars (PEGs).")
818 (home-page "https://www.inf.puc-rio.br/~roberto/lpeg")
819 (license license:expat)))
820
821(define-public lua-lpeg
822 (make-lua-lpeg "lua-lpeg" lua))
823
824(define-public lua5.1-lpeg
825 (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
826
827(define-public lua5.2-lpeg
828 (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
829
830(define (make-lua-luv name lua)
831 (package
832 (name name)
833 (version "1.43.0-0")
834 (source (origin
835 ;; The release tarball includes the sources of libuv but does
836 ;; not include the pkg-config files.
837 (method git-fetch)
838 (uri (git-reference
839 (url "https://github.com/luvit/luv")
840 (commit version)))
841 (file-name (git-file-name name version))
842 (sha256
843 (base32
844 "1yzi4bm845vl84wyv2qw4z1n1v285lgwm681swmp84brfy2s7czp"))))
845 (build-system cmake-build-system)
846 (arguments
847 (list #:tests? #f ; there are none
848 #:configure-flags
849 #~'("-DWITH_LUA_ENGINE=Lua"
850 "-DWITH_SHARED_LIBUV=On"
851 "-DBUILD_MODULE=Off"
852 "-DBUILD_SHARED_LIBS=On"
853 "-DLUA_BUILD_TYPE=System")
854 #:phases
855 #~(modify-phases %standard-phases
856 (add-after 'unpack 'copy-lua-compat
857 (lambda* _
858 (copy-recursively #+(this-package-native-input "lua-compat")
859 "lua-compat")
860 (setenv "CPATH"
861 (string-append (getcwd) "/lua-compat/c-api:"
862 (or (getenv "CPATH") "")))
863 #t)))))
864 (inputs
865 (list lua libuv-for-luv))
866 (native-inputs
867 `(("lua-compat"
868 ,(origin
869 (method git-fetch)
870 (uri (git-reference
871 (url "https://github.com/keplerproject/lua-compat-5.3")
872 (commit "v0.10")))
873 (file-name "lua-compat-5.3-checkout")
874 (sha256
875 (base32
876 "1caxn228gx48g6kymp9w7kczgxcg0v0cd5ixsx8viybzkd60dcn4"))))))
877 (home-page "https://github.com/luvit/luv/")
878 (synopsis "Libuv bindings for Lua")
879 (description
880 "This library makes libuv available to Lua scripts.")
881 (license license:asl2.0)))
882
883(define-public lua-luv
884 (make-lua-luv "lua-luv" lua))
885
886(define-public lua5.1-luv
887 (make-lua-luv "lua5.1-luv" lua-5.1))
888
889(define-public lua5.2-luv
890 (make-lua-luv "lua5.2-luv" lua-5.2))
891
892;; Lua 5.3 is not supported.
893(define (make-lua-bitop name lua)
894 (package
895 (name name)
896 (version "1.0.2")
897 (source (origin
898 (method url-fetch)
899 (uri (string-append "http://bitop.luajit.org/download/"
900 "LuaBitOp-" version ".tar.gz"))
901 (sha256
902 (base32
903 "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
904 (build-system gnu-build-system)
905 (arguments
906 `(#:test-target "test"
907 #:make-flags
908 (list "INSTALL=install -pD"
909 (string-append "INSTALLPATH=printf "
910 (assoc-ref %outputs "out")
911 "/lib/lua/"
912 ,(version-major+minor (package-version lua))
913 "/bit/bit.so"))
914 #:phases
915 (modify-phases %standard-phases
916 (delete 'configure))))
917 (inputs (list lua))
918 (home-page "https://bitop.luajit.org/index.html")
919 (synopsis "Bitwise operations on numbers for Lua")
920 (description
921 "Lua BitOp is a C extension module for Lua which adds bitwise operations
922on numbers.")
923 (license license:expat)))
924
925(define-public lua5.2-bitop
926 (make-lua-bitop "lua5.2-bitop" lua-5.2))
927
928(define-public lua5.1-bitop
929 (make-lua-bitop "lua5.1-bitop" lua-5.1))
930
931(define-public lutok
932 (package
933 (name "lutok")
934 (version "0.6.2")
935 (source (origin
936 (method git-fetch)
937 (uri (git-reference
938 (url "https://github.com/freebsd/lutok")
939 (commit (string-append name "-" version))))
940 (file-name (git-file-name name version))
941 (sha256
942 (base32
943 "1hk8shp1vkxa09qxaafcfrgc9098cr75n5zc192bv8yjyvz0hvc3"))))
944 (build-system gnu-build-system)
945 ;; Disable the test suite to avoid a circular dependency on kyua.
946 (arguments (list #:tests? #f))
947 (native-inputs (list autoconf automake libtool pkg-config))
948 (inputs (list atf))
949 (propagated-inputs (list lua-5.4)) ;included in c_gate.hpp
950 (home-page "https://github.com/freebsd/lutok")
951 (synopsis "Lightweight C++ API for Lua")
952 (description "Lutok is a lightweight C++ API library for Lua.
953
954Lutok provides thin C++ wrappers around the Lua C API to ease the interaction
955between C++ and Lua. These wrappers make intensive use of @acronym{RAII,
956Resource Acquisition is Initialization} to prevent resource leakage, expose
957C++-friendly data types, report errors by means of exceptions and ensure that
958the Lua stack is always left untouched in the face of errors. The library
959also provides a small subset of miscellaneous utility functions built on top
960of the wrappers.
961
962Lutok focuses on providing a clean and safe C++ interface; the drawback is
963that it is not suitable for performance-critical environments. In order to
964implement error-safe C++ wrappers on top of a Lua C binary library, Lutok adds
965several layers or abstraction and error checking that go against the original
966spirit of the Lua C API and thus degrade performance.")
967 (license license:bsd-3)))
968
969(define-public selene
970 (package
971 (name "selene")
972 (version "2017.08.25")
973 (source (origin
974 (method git-fetch)
975 (uri (git-reference
976 (url "https://github.com/jeremyong/Selene")
977 ;; The release is quite old.
978 (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
979 (file-name "Selene")
980 (sha256
981 (base32
982 "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
983 (build-system cmake-build-system)
984 (arguments
985 `(#:configure-flags
986 ;; lua pc file in CMakeLists.txt is lua5.3.pc
987 '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
988 #:phases
989 ;; This is a header only library
990 (modify-phases %standard-phases
991 (delete 'build)
992 (replace 'install
993 (lambda* (#:key inputs outputs #:allow-other-keys)
994 (let* ((output (assoc-ref outputs "out"))
995 (source (assoc-ref inputs "source"))
996 (includedir (string-append output "/include")))
997 (copy-recursively
998 (string-append source "/include")
999 includedir))
1000 #t))
1001 ;; The path of test files are hard coded.
1002 (replace 'check
1003 (lambda* (#:key inputs outputs #:allow-other-keys)
1004 (let* ((output (assoc-ref outputs "out"))
1005 (source (assoc-ref inputs "source"))
1006 (builddir (getcwd))
1007 (testdir (string-append builddir "/test")))
1008 (copy-recursively (string-append source "/test") testdir)
1009 (invoke "make")
1010 (mkdir-p "runner")
1011 (copy-file "./test_runner" "./runner/test_runner")
1012 (chdir "./runner")
1013 (invoke "./test_runner")))))))
1014 (native-inputs
1015 (list lua pkg-config))
1016 (home-page "https://github.com/jeremyong/Selene")
1017 (synopsis "Lua C++11 bindings")
1018 (description
1019 "Selene is a simple C++11 header-only library enabling seamless
1020 interoperability between C++ and Lua programming language.")
1021 (license license:zlib)))
1022
1023(define-public lua-resty-core
1024 (package
1025 (name "lua-resty-core")
1026 (version "0.1.18")
1027 (source (origin
1028 (method git-fetch)
1029 (uri (git-reference
1030 (url "https://github.com/openresty/lua-resty-core")
1031 (commit (string-append "v" version))))
1032 (file-name (git-file-name name version))
1033 (sha256
1034 (base32
1035 "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
1036 (build-system trivial-build-system)
1037 (arguments
1038 `(#:modules ((guix build utils))
1039 #:builder
1040 (begin
1041 (use-modules (guix build utils))
1042 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1043 (package-lua-resty (lambda (input output)
1044 (mkdir-p (string-append output "/lib/lua"))
1045 (copy-recursively (string-append input "/lib/resty")
1046 (string-append output "/lib/lua/resty"))
1047 (copy-recursively (string-append input "/lib/ngx")
1048 (string-append output "/lib/ngx"))
1049 (symlink (string-append output "/lib/lua/resty")
1050 (string-append output "/lib/resty")))))
1051 (package-lua-resty (assoc-ref %build-inputs "source")
1052 (assoc-ref %outputs "out")))
1053 #t)))
1054 (home-page "https://github.com/openresty/lua-resty-core")
1055 (synopsis "Lua API for NGINX")
1056 (description "This package provides a FFI-based Lua API for
1057@code{ngx_http_lua_module} or @code{ngx_stream_lua_module}.")
1058 (license license:bsd-2)))
1059
1060(define-public lua-resty-lrucache
1061 (package
1062 (name "lua-resty-lrucache")
1063 (version "0.10")
1064 (source (origin
1065 (method git-fetch)
1066 (uri (git-reference
1067 (url "https://github.com/openresty/lua-resty-lrucache")
1068 (commit (string-append "v" version))))
1069 (file-name (git-file-name name version))
1070 (sha256
1071 (base32
1072 "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
1073 (build-system trivial-build-system)
1074 (arguments
1075 `(#:modules ((guix build utils))
1076 #:builder
1077 (begin
1078 (use-modules (guix build utils))
1079 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1080 (package-lua-resty (lambda (input output)
1081 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1082 (copy-recursively (string-append input "/lib/resty")
1083 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1084 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1085 (string-append output "/lib/resty")))))
1086 (package-lua-resty (assoc-ref %build-inputs "source")
1087 (assoc-ref %outputs "out")))
1088 #t)))
1089 (home-page "https://github.com/openresty/lua-resty-lrucache")
1090 (synopsis "Lua LRU cache based on the LuaJIT FFI")
1091 (description
1092 "This package provides Lua LRU cache based on the LuaJIT FFI.")
1093 (license license:bsd-2)))
1094
1095(define-public lua-resty-signal
1096 (package
1097 (name "lua-resty-signal")
1098 (version "0.02")
1099 (source (origin
1100 (method git-fetch)
1101 (uri (git-reference
1102 (url "https://github.com/openresty/lua-resty-signal")
1103 (commit (string-append "v" version))))
1104 (file-name (git-file-name name version))
1105 (sha256
1106 (base32
1107 "13y1pqn45y49mhqwywasfdsid46d0c33yi6mrnracbnmvyxz1cif"))))
1108 (build-system gnu-build-system)
1109 (arguments
1110 `(#:tests? #f ;TODO: Run the test suite.
1111 #:make-flags (list ,(string-append "CC=" (cc-for-target))
1112 (string-append "PREFIX=" %output))
1113 #:phases
1114 (modify-phases %standard-phases
1115 (delete 'configure)
1116 (add-after 'install 'install-lua
1117 (lambda* (#:key inputs outputs #:allow-other-keys)
1118 (use-modules (guix build utils))
1119 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1120 (package-lua-resty (lambda (input output)
1121 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1122 (copy-recursively (string-append input "/lib/resty")
1123 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1124 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1125 (string-append output "/lib/resty")))))
1126 (package-lua-resty (assoc-ref inputs "source")
1127 (assoc-ref outputs "out")))
1128 #t)))))
1129 (home-page "https://github.com/openresty/lua-resty-signal")
1130 (synopsis "Lua library for killing or sending signals to Linux processes")
1131 (description "This package provides Lua library for killing or sending
1132signals to Linux processes.")
1133 (license license:bsd-3)))
1134
1135(define-public lua-tablepool
1136 (package
1137 (name "lua-tablepool")
1138 (version "0.01")
1139 (source (origin
1140 (method git-fetch)
1141 (uri (git-reference
1142 (url "https://github.com/openresty/lua-tablepool")
1143 (commit (string-append "v" version))))
1144 (file-name (git-file-name name version))
1145 (sha256
1146 (base32
1147 "03yjj3w6znvj6843prg84m0lkrn49l901f9hj9bgy3cj9s0awl6y"))))
1148 (build-system trivial-build-system)
1149 (arguments
1150 `(#:modules ((guix build utils))
1151 #:builder
1152 (begin
1153 (use-modules (guix build utils))
1154 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1155 (package-lua-resty (lambda (input output)
1156 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1157 (copy-recursively (string-append input "/lib")
1158 (string-append output "/lib")))))
1159 (package-lua-resty (assoc-ref %build-inputs "source")
1160 (assoc-ref %outputs "out")))
1161 #t)))
1162 (home-page "https://github.com/openresty/lua-tablepool")
1163 (synopsis "Lua table recycling pools for LuaJIT")
1164 (description "This package provides Lua table recycling pools for LuaJIT.")
1165 (license license:bsd-2)))
1166
1167(define-public lua-resty-shell
1168 (package
1169 (name "lua-resty-shell")
1170 (version "0.03")
1171 (source (origin
1172 (method git-fetch)
1173 (uri (git-reference
1174 (url "https://github.com/openresty/lua-resty-shell")
1175 (commit (string-append "v" version))))
1176 (file-name (git-file-name name version))
1177 (sha256
1178 (base32
1179 "1s6g04ip4hr97r2pd8ry3alq063604s9a3l0hn9nsidh81ps4dp7"))))
1180 (build-system trivial-build-system)
1181 (arguments
1182 `(#:modules ((guix build utils))
1183 #:builder
1184 (begin
1185 (use-modules (guix build utils))
1186 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1187 (package-lua-resty (lambda (input output)
1188 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1189 (copy-recursively (string-append input "/lib/resty")
1190 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1191 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1192 (string-append output "/lib/resty")))))
1193 (package-lua-resty (assoc-ref %build-inputs "source")
1194 (assoc-ref %outputs "out")))
1195 #t)))
1196 (home-page "https://github.com/openresty/lua-resty-shell")
1197 (synopsis "Lua module for nonblocking system shell command executions")
1198 (description "This package provides Lua module for nonblocking system
1199shell command executions.")
1200 (license license:bsd-3)))
1201
1202(define-public (make-luarocks name lua)
1203 (package
1204 (name name)
1205 (version "3.9.2")
1206 (home-page "https://luarocks.org/")
1207 (source (origin
1208 (method url-fetch)
1209 (uri (string-append "https://luarocks.org/releases/luarocks-"
1210 version ".tar.gz"))
1211 (sha256
1212 (base32
1213 "1nsfp7cwqcxa8vmkcqkgi5wc0iax0j3gbdfd183kw81cq3nf99mw"))))
1214 (build-system gnu-build-system)
1215 (arguments
1216 `(#:tests? #f ;upstream has no tests
1217 #:phases
1218 (modify-phases %standard-phases
1219 (add-before 'build 'patch-bin-sh
1220 (lambda* (#:key inputs #:allow-other-keys)
1221 (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
1222 "src/luarocks/core/sysdetect.lua")
1223 (("/bin/sh")
1224 (search-input-file inputs "/bin/sh")))))
1225 (replace 'configure
1226 (lambda* (#:key outputs #:allow-other-keys)
1227 (let ((out (assoc-ref outputs "out")))
1228 (invoke "./configure"
1229 (string-append "--prefix=" out)))))
1230 (add-after 'install 'patch-unzip
1231 (lambda* (#:key inputs outputs #:allow-other-keys)
1232 (substitute*
1233 (string-append
1234 (assoc-ref outputs "out") "/etc/luarocks/config-"
1235 ,(substring (package-version lua) 0 3) ".lua") ;e.g. "5.2"
1236 (("variables = \\{")
1237 (string-append
1238 "variables = {\n"
1239 " AR = \"" (search-input-file inputs "/bin/ar") "\";\n"
1240 " BUNZIP2 = \"" (search-input-file inputs "/bin/bunzip2") "\";\n"
1241 " CC = \"" (search-input-file inputs "/bin/gcc") "\";\n"
1242 " CHMOD = \"" (search-input-file inputs "/bin/chmod") "\";\n"
1243 " CP = \"" (search-input-file inputs "/bin/cp") "\";\n"
1244 " CURL = \"" (search-input-file inputs "/bin/curl") "\";\n"
1245 " FIND = \"" (search-input-file inputs "/bin/find") "\";\n"
1246 " GIT = \"" (search-input-file inputs "/bin/git") "\";\n"
1247 " GPG = \"" (search-input-file inputs "/bin/gpg") "\";\n"
1248 " GUNZIP = \"" (search-input-file inputs "/bin/gunzip") "\";\n"
1249 " HG = \"" (search-input-file inputs "/bin/hg") "\";\n"
1250 " LD = \"" (search-input-file inputs "/bin/ld") "\";\n"
1251 " LS = \"" (search-input-file inputs "/bin/ls") "\";\n"
1252 " MAKE = \"" (search-input-file inputs "/bin/make") "\";\n"
1253 " MD5SUM = \"" (search-input-file inputs "/bin/md5sum") "\";\n"
1254 " MKDIR = \"" (search-input-file inputs "/bin/mkdir") "\";\n"
1255 " MKTEMP = \"" (search-input-file inputs "/bin/mktemp") "\";\n"
1256 " OPENSSL = \"" (search-input-file inputs "/bin/openssl") "\";\n"
1257 " PWD = \"" (search-input-file inputs "/bin/pwd") "\";\n"
1258 " RANLIB = \"" (search-input-file inputs "/bin/ranlib") "\";\n"
1259 " RM = \"" (search-input-file inputs "/bin/rm") "\";\n"
1260 " RMDIR = \"" (search-input-file inputs "/bin/rmdir") "\";\n"
1261 " RSYNC = \"" (search-input-file inputs "/bin/rsync") "\";\n"
1262 " SCP = \"" (search-input-file inputs "/bin/scp") "\";\n"
1263 " TAR = \"" (search-input-file inputs "/bin/tar") "\";\n"
1264 " TEST = \"" (search-input-file inputs "/bin/test") "\";\n"
1265 " TOUCH = \"" (search-input-file inputs "/bin/touch") "\";\n"
1266 " UNZIP = \"" (search-input-file inputs "/bin/unzip") " -n\";\n"
1267 " WGET = \"" (search-input-file inputs "/bin/wget") "\";\n"
1268 " ZIP = \"" (search-input-file inputs "/bin/zip") "\";"))))))))
1269 (inputs (list lua
1270 bash-minimal
1271 ;; Executables required by luarocks.
1272 binutils
1273 bzip2
1274 coreutils
1275 curl
1276 findutils
1277 gcc
1278 git
1279 gnupg
1280 gzip
1281 gnu-make
1282 mercurial
1283 openssh
1284 openssl
1285 rsync
1286 tar
1287 unzip
1288 wget
1289 zip))
1290 (native-inputs (list unzip))
1291 (synopsis "Package manager for Lua modules")
1292 (description
1293 "LuaRocks is the package manager for the Lua programming
1294language.
1295
1296It allows you to install Lua modules as self-contained packages called
1297@url{https://luarocks.org/en/Types_of_rocks, @emph{rocks}}, which also contain
1298version @url{https://luarocks.org/en/Dependencies, dependency} information.
1299This information can be used both during installation, so that when one rock
1300is requested all rocks it depends on are installed as well, and also
1301optionally at run time, so that when a module is required, the correct version
1302is loaded. LuaRocks supports both local and
1303@url{http://luarocks.org/en/Rocks_repositories, remote} repositories, and
1304multiple local rocks trees.")
1305 (license license:expat)))
1306
1307(define-public lua5.2-luarocks
1308 (make-luarocks "lua5.2-luarocks" lua-5.2))
1309
1310(define-public luarocks
1311 (make-luarocks "luarocks" lua))
1312
1313(define-public fennel
1314 (package
1315 (name "fennel")
1316 (version "1.6.0")
1317 (source (origin
1318 (method git-fetch)
1319 (uri (git-reference
1320 (url "https://git.sr.ht/~technomancy/fennel")
1321 (commit version)))
1322 (file-name (git-file-name name version))
1323 (sha256
1324 (base32
1325 "09gky2w8z83qqv0n9vx8jqsfldni14kjr6l7y5k44lq5i30i0fsv"))))
1326 (build-system gnu-build-system)
1327 (arguments
1328 (list #:make-flags #~(list (string-append "PREFIX="
1329 (assoc-ref %outputs "out")))
1330 #:test-target "test"
1331 #:phases #~(modify-phases %standard-phases
1332 (delete 'configure)
1333 (add-after 'build 'patch-fennel
1334 (lambda* (#:key inputs #:allow-other-keys)
1335 ;; Remove IRC CI build status reporting
1336 (delete-file "test/irc.lua")
1337 (substitute* "test/init.lua"
1338 ((",\\{hooks=\\{exit=dofile\\(\"test/irc.lua\"\\)\\}\\}")
1339 ""))
1340 (substitute* "fennel"
1341 (("/usr/bin/env .*lua")
1342 (search-input-file inputs "/bin/lua")))))
1343 (delete 'check)
1344 (add-after 'install 'check
1345 (assoc-ref %standard-phases
1346 'check)))))
1347 (inputs (list lua))
1348 (home-page "https://fennel-lang.org/")
1349 (synopsis "Lisp that compiles to Lua")
1350 (description
1351 "Fennel is a programming language that brings together the speed,
1352simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro
1353system.")
1354 (license license:expat)))
1355
1356(define-public antifennel
1357 (package
1358 (version "0.2.0")
1359 (name "antifennel")
1360 (source
1361 (origin
1362 (method git-fetch)
1363 (uri (git-reference
1364 (url "https://git.sr.ht/~technomancy/antifennel")
1365 (commit version)))
1366 (sha256
1367 (base32 "1hd9h17q31b3gg88c657zq4han4air2ag55rrakbmcpy6n8acsqc"))
1368 (file-name (git-file-name name version))))
1369 (build-system gnu-build-system)
1370 (inputs (list luajit))
1371 (arguments
1372 (list
1373 #:phases #~(modify-phases %standard-phases
1374 (delete 'configure)
1375 ;; Tests pass after the fix introduced by the commit
1376 ;; ecd2169fcad1fa6616fdf6e6a8569f5b866601e5
1377 (delete 'check)
1378 (replace 'install
1379 (lambda _
1380 (install-file "antifennel"
1381 (string-append #$output "/bin")))))))
1382 (home-page "https://git.sr.ht/~technomancy/antifennel")
1383 (synopsis "Turn Lua code into Fennel code")
1384 (description
1385 "This package provides a way to turn Lua code into Fennel code.
1386This compiler does the opposite of what the Fennel compiler does.")
1387 (license license:expat)))
1388
1389(define-public fnlfmt
1390 (package
1391 (name "fnlfmt")
1392 (version "0.3.0")
1393 (source (origin
1394 (method git-fetch)
1395 (uri (git-reference
1396 (url "https://git.sr.ht/~technomancy/fnlfmt")
1397 (commit version)))
1398 (file-name (git-file-name name version))
1399 (sha256
1400 (base32
1401 "06gzw7f20yw4192kymr4karxw3ia3apjnjqpm6vxph87c67d1fa3"))
1402 (modules '((guix build utils)))
1403 (snippet
1404 #~(begin
1405 ;; Use input fennel instead of bundled fennel.
1406 (delete-file "fennel")
1407 (delete-file "fennel.lua")
1408 (substitute* "Makefile"
1409 (("./fennel") "fennel"))))))
1410 (build-system gnu-build-system)
1411 (arguments
1412 `(#:modules ((guix build gnu-build-system)
1413 (guix build utils)
1414 (ice-9 match))
1415 #:test-target "test"
1416 #:phases
1417 (modify-phases %standard-phases
1418 (delete 'configure)
1419 (add-before 'build 'patch-makefile
1420 (lambda* (#:key native-inputs inputs #:allow-other-keys)
1421 (substitute* "Makefile"
1422 ;; Patch lua shebang that gets inserted to fnlfmt.
1423 (("/usr/bin/env lua")
1424 (search-input-file (or native-inputs inputs) "/bin/lua")))))
1425 (replace 'install
1426 ;; There is no install target; manually install the output file.
1427 (lambda* (#:key outputs #:allow-other-keys)
1428 (let* ((out (assoc-ref outputs "out"))
1429 (bin (string-append out "/bin")))
1430 (for-each (lambda (file)
1431 (install-file file bin))
1432 (find-files "." "fnlfmt")))))
1433 (add-after 'install 'wrap
1434 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
1435 (let* ((all-inputs (or native-inputs inputs))
1436 (fnlfmt (assoc-ref outputs "out"))
1437 (lua-version ,(version-major+minor (package-version lua)))
1438 (fennel (assoc-ref all-inputs "fennel")))
1439 (wrap-program (string-append fnlfmt "/bin/fnlfmt")
1440 `("LUA_PATH" ";" suffix
1441 (,(format #f "~a/share/lua/~a/?.lua" fennel lua-version))))
1442 #t))))))
1443 (inputs (list bash-minimal))
1444 (native-inputs (list lua fennel))
1445 (home-page "https://git.sr.ht/~technomancy/fnlfmt")
1446 (synopsis "Automatic formatting of Fennel code")
1447 (description
1448 "Fnlfmt is a tool for automatically formatting Fennel code in a consistent
1449way, following established lisp conventions.")
1450 (license license:lgpl3+)))