projects/guix·blob python-team · refs

2405 lines · 99.2 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, 2026 Maxim Cournoyer <[email protected]>
26;;; Copyright © 2025 Zheng Junjie <[email protected]>
27;;; Copyright © 2025 Ashish SHUKLA <[email protected]>
28;;; Copyright © 2025 Aaron Boyd <[email protected]>
29;;; Copyright © 2026 Nguyễn Gia Phong <[email protected]>
30;;; Copyright © 2026 Edouard Klein <[email protected]>
31;;;
32;;; This file is part of GNU Guix.
33;;;
34;;; GNU Guix is free software; you can redistribute it and/or modify it
35;;; under the terms of the GNU General Public License as published by
36;;; the Free Software Foundation; either version 3 of the License, or (at
37;;; your option) any later version.
38;;;
39;;; GNU Guix is distributed in the hope that it will be useful, but
40;;; WITHOUT ANY WARRANTY; without even the implied warranty of
41;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42;;; GNU General Public License for more details.
43;;;
44;;; You should have received a copy of the GNU General Public License
45;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
46
47(define-module (gnu packages lua)
48 #:use-module ((guix licenses) #:prefix license:)
49 #:use-module (guix packages)
50 #:use-module (guix download)
51 #:use-module (guix git-download)
52 #:use-module (guix gexp)
53 #:use-module (guix hg-download)
54 #:use-module (guix utils)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system cmake)
57 #:use-module (guix build-system meson)
58 #:use-module (guix build-system trivial)
59 #:use-module (gnu packages)
60 #:use-module (gnu packages autotools)
61 #:use-module (gnu packages base)
62 #:use-module (gnu packages bash)
63 #:use-module (gnu packages boost)
64 #:use-module (gnu packages curl)
65 #:use-module (gnu packages build-tools)
66 #:use-module (gnu packages check)
67 #:use-module (gnu packages compression)
68 #:use-module (gnu packages dns)
69 #:use-module (gnu packages gcc)
70 #:use-module (gnu packages glib)
71 #:use-module (gnu packages gperf)
72 #:use-module (gnu packages gnupg)
73 #:use-module (gnu packages gtk)
74 #:use-module (gnu packages haskell-xyz)
75 #:use-module (gnu packages libedit)
76 #:use-module (gnu packages libevent)
77 #:use-module (gnu packages libffi)
78 #:use-module (gnu packages linux)
79 #:use-module (gnu packages m4)
80 #:use-module (gnu packages ncurses)
81 #:use-module (gnu packages pkg-config)
82 #:use-module (gnu packages pretty-print)
83 #:use-module (gnu packages rdf)
84 #:use-module (gnu packages compiler-tools)
85 #:use-module (gnu packages readline)
86 #:use-module (gnu packages rsync)
87 #:use-module (gnu packages ssh)
88 #:use-module (gnu packages sqlite)
89 #:use-module (gnu packages tls)
90 #:use-module (gnu packages version-control)
91 #:use-module (gnu packages vim)
92 #:use-module (gnu packages wget)
93 #:use-module (gnu packages xml)
94 #:use-module (gnu packages xorg)
95 #:use-module (ice-9 match)
96 #:use-module ((srfi srfi-1) #:hide (zip)))
97
98(define (lua-search-paths version)
99 (list (search-path-specification
100 (variable "GUIX_LUA_PATH")
101 (separator ";")
102 (files (list (string-append "share/lua/" version))))
103 (search-path-specification
104 (variable "GUIX_LUA_CPATH")
105 (separator ";")
106 (files (list (string-append "lib/lua/" version))))))
107
108(define-public lua-5.3
109 (package
110 (name "lua")
111 (version "5.3.5")
112 (source (origin
113 (method url-fetch)
114 (uri (string-append "https://www.lua.org/ftp/lua-"
115 version ".tar.gz"))
116 (sha256
117 (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
118 (patches (search-patches "lua-pkgconfig.patch"
119 "lua-liblua-so.patch"
120 "lua-5.x-search-path-helpers.patch"
121 "lua-5.3-search-paths.patch"))))
122 (build-system gnu-build-system)
123 (inputs (list readline))
124 (arguments
125 `(#:modules ((guix build gnu-build-system)
126 (guix build utils)
127 (srfi srfi-1))
128 #:test-target "test"
129 #:make-flags
130 (list "MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
131 (string-append "CC=" ,(cc-for-target))
132 (string-append "SYSLIBS=-L" (assoc-ref %build-inputs "readline")
133 "/lib")
134 "linux")
135 #:phases
136 (modify-phases %standard-phases
137 (delete 'configure)
138 (replace 'install
139 (lambda* (#:key outputs #:allow-other-keys)
140 (let ((out (assoc-ref outputs "out")))
141 (invoke "make" "install"
142 (string-append "INSTALL_TOP=" out)
143 (string-append "INSTALL_MAN=" out
144 "/share/man/man1"))))))))
145 (native-search-paths (lua-search-paths "5.3"))
146 (home-page "https://www.lua.org/")
147 (synopsis "Embeddable scripting language")
148 (description
149 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
150combines simple procedural syntax with powerful data description constructs
151based on associative arrays and extensible semantics. Lua is dynamically typed,
152runs by interpreting bytecode for a register-based virtual machine, and has
153automatic memory management with incremental garbage collection, making it ideal
154for configuration, scripting, and rapid prototyping.")
155 (license license:x11)))
156
157(define-public lua lua-5.3)
158
159(define-public lua-5.5
160 (package (inherit lua)
161 (version "5.5.0")
162 (source (origin
163 (method url-fetch)
164 (uri (string-append "https://www.lua.org/ftp/lua-"
165 version ".tar.gz"))
166 (sha256
167 (base32 "0gcbsr00difm2s82pflxg28zcnjka9048lncbfvwl1fhpcmw7k2p"))
168 ;; Note: Some lua-5.4 patches seem to apply without issues
169 (patches (search-patches "lua-5.4-pkgconfig.patch"
170 "lua-5.4-liblua-so.patch"
171 "lua-5.x-search-path-helpers.patch"
172 "lua-5.5-search-paths.patch"))))
173 (native-search-paths (lua-search-paths "5.5"))))
174
175(define-public lua-5.4
176 (package (inherit lua)
177 (version "5.4.8")
178 (arguments
179 (substitute-keyword-arguments arguments
180 ((#:make-flags flags)
181 (append (delete "linux" flags)
182 '("linux-readline")))))
183 (source (origin
184 (method url-fetch)
185 (uri (string-append "https://www.lua.org/ftp/lua-"
186 version ".tar.gz"))
187 (sha256
188 (base32 "1bi90r9nzmqhjwhr8ysffhmhq30wxxcpqwmbxr33wyaf2npds62g"))
189 (patches (search-patches "lua-5.4-pkgconfig.patch"
190 "lua-5.4-liblua-so.patch"
191 "lua-5.x-search-path-helpers.patch"
192 "lua-5.4-search-paths.patch"))))
193 (native-search-paths (lua-search-paths "5.4"))))
194
195
196(define-public lua-5.4-for-c++
197 (let ((lua-pkg lua-5.4))
198 (hidden-package
199 (package/inherit lua-pkg
200 (name (string-append (package-name lua-pkg) "-for-c++"))
201 (arguments
202 (substitute-keyword-arguments (package-arguments lua-pkg)
203 ((#:make-flags old-flags)
204 (map
205 (match-lambda
206 ((string-append "CC=" _)
207 `(string-append "CC=" ,(cxx-for-target)))
208 (else else))
209 old-flags))))))))
210
211(define-public lua-5.2
212 (package (inherit lua)
213 (version "5.2.4")
214 (source
215 (origin
216 (method url-fetch)
217 (uri (string-append "https://www.lua.org/ftp/lua-"
218 version ".tar.gz"))
219 (sha256
220 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
221 (patches (search-patches "lua-pkgconfig.patch"
222 "lua-liblua-so.patch"
223 "lua-5.x-search-path-helpers.patch"
224 "lua-5.2-search-paths.patch"))))
225 (native-search-paths (lua-search-paths "5.2"))))
226
227(define-public lua-5.1
228 (package (inherit lua)
229 (version "5.1.5")
230 (source (origin
231 (method url-fetch)
232 (uri (string-append "https://www.lua.org/ftp/lua-"
233 version ".tar.gz"))
234 (sha256
235 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
236 (patches (search-patches "lua51-liblua-so.patch"
237 "lua-CVE-2014-5461.patch"
238 "lua51-pkgconfig.patch"
239 "lua-5.x-search-path-helpers.patch"
240 "lua-5.1-search-paths.patch"))))
241 (native-search-paths (lua-search-paths "5.1"))))
242
243(define-public luajit
244 (let ((branch "v2.1")
245 (commit "04dca7911ea255f37be799c18d74c305b921c1a6"))
246 (package
247 (name "luajit")
248 (version (git-version branch "0" commit))
249 (source (origin
250 (method git-fetch)
251 (uri (git-reference
252 (url "https://luajit.org/git/luajit.git")
253 (commit commit)))
254 (file-name (git-file-name name version))
255 (sha256
256 (base32
257 "0srwk9nmiz8a93f70inq2597ff6xy203ckr4c0k7jcksdixymi9v"))
258 (patches (search-patches "lua-5.x-search-path-helpers.patch"
259 "luajit-search-paths.patch"))))
260 (build-system gnu-build-system)
261 (arguments
262 (list #:tests? #f ; luajit is distributed without tests
263 #:phases
264 #~(modify-phases %standard-phases
265 #$@(if (target-riscv64?)
266 #~((add-after 'unpack 'patch
267 (lambda _
268 (invoke
269 "patch" "--force" "-p1" "-i"
270 #$(local-file
271 (search-patch
272 "luajit-add-riscv64-support.patch"))))))
273 #~())
274 (delete 'configure)) ; no configure script
275 #:make-flags
276 #~(list #$@(let ((target (%current-target-system)))
277 (if target
278 ;; src/Makefile uses e.g. $(CROSS)$(CC),
279 ;; expecting a hyphen at the end of CROSS.
280 #~((string-append "CROSS=" #$target "-"))
281 #~()))
282 (string-append "PREFIX=" #$output))))
283 (native-search-paths
284 (list (search-path-specification
285 (variable "GUIX_LUA_PATH")
286 (separator ";")
287 (files (list "share/lua/5.1"
288 "share/luajit-2.1")))
289 (search-path-specification
290 (variable "GUIX_LUA_CPATH")
291 (separator ";")
292 (files (list "lib/lua/5.1")))))
293 (home-page "https://www.luajit.org/")
294 (synopsis
295 "Just in time compiler for Lua programming language version 5.1")
296 ;; On powerpc64le-linux, the build fails with an error: "No support for
297 ;; PowerPC 64 bit mode (yet)". See: https://issues.guix.gnu.org/49220
298 (supported-systems (fold delete %supported-systems
299 (list "powerpc64le-linux")))
300 (description
301 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
302programming language. Lua is a powerful, dynamic and light-weight programming
303language. It may be embedded or used as a general-purpose, stand-alone
304language.")
305 (license license:x11))))
306
307(define-public luajit-lua52-openresty
308 (package
309 (inherit luajit)
310 (name "luajit-lua52-openresty")
311 (version "2.1-20201229")
312 (source
313 (origin
314 (method git-fetch)
315 (uri (git-reference
316 (url "https://github.com/openresty/luajit2.git")
317 (commit (string-append "v" version))))
318 (file-name (git-file-name name version))
319 (sha256
320 (base32 "07haj27kbpbnkv836c2nd36h2xislrmri52w0zbpxvl68xk6g96p"))))
321 (arguments
322 `(#:tests? #f ;no test
323 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
324 #:phases
325 (modify-phases %standard-phases
326 (delete 'configure) ;no configure script
327 (add-after 'unpack 'enable-lua52-compat
328 (lambda _
329 (substitute* "src/Makefile"
330 (("#(XCFLAGS\\+= -DLUAJIT_ENABLE_LUA52COMPAT)" _ flag) flag))
331 #t)))))
332 (home-page "https://github.com/openresty/luajit2")
333 (synopsis "OpenResty's Branch of LuaJIT 2")
334 (description
335 "This is the official OpenResty branch of LuaJIT. It is not to be
336considered a fork, since changes are regularly synchronized from the upstream
337LuaJIT project. This package also enables the Lua 5.2 compat mode needed by
338some projects.")))
339
340(define-public luau
341 (package
342 (name "luau")
343 (version "0.724")
344 (source
345 (origin
346 (method git-fetch)
347 (uri (git-reference
348 (url "https://github.com/luau-lang/luau")
349 (commit version)))
350 (file-name (git-file-name name version))
351 (patches (search-patches "luau-use-system-isocline.patch"))
352 (sha256
353 (base32 "1r5kw7xk62qwv2gsc3yxc5rngcgc4d824y2h0k0713i34jn9zgnv"))
354 (modules '((guix build utils)))
355 (snippet
356 #~(begin
357 (delete-file "extern/doctest.h")
358 (delete-file-recursively "extern/isocline")
359 (substitute* (find-files "tests" "\\.(cpp|h)$")
360 (("#include \"doctest.h\"")
361 "#include <doctest/doctest.h>"))))))
362 (build-system cmake-build-system)
363 (outputs (list "out" "static"))
364 (arguments
365 (list
366 #:phases
367 #~(modify-phases %standard-phases
368 (replace 'check
369 (lambda* (#:key tests? #:allow-other-keys)
370 (when tests?
371 (invoke "./Luau.UnitTest")
372 (invoke "./Luau.Conformance")
373 (let ((cli-test (string-append (getcwd) "/Luau.CLI.Test")))
374 (with-directory-excursion "../source"
375 (invoke cli-test))))))
376 (replace 'install
377 (lambda _
378 (let ((bin (string-append #$output "/bin"))
379 (include (string-append #$output:static "/include"))
380 (lib (string-append #$output:static "/lib")))
381 (for-each (lambda (program)
382 (install-file program bin))
383 '("luau"
384 "luau-analyze"
385 "luau-ast"
386 "luau-bytecode"
387 "luau-compile"
388 "luau-reduce"))
389 (for-each (lambda (library)
390 (install-file library lib))
391 (find-files "." "^libLuau\\..*\\.a$"))
392 (for-each
393 (lambda (component)
394 (copy-recursively
395 (string-append "../source/" component "/include")
396 include))
397 '("Analysis"
398 "Ast"
399 "Bytecode"
400 "CLI"
401 "CodeGen"
402 "Common"
403 "Compiler"
404 "Config"
405 "Require"
406 "VM"))))))))
407 (native-inputs
408 (list doctest))
409 (inputs
410 (list isocline))
411 (home-page "https://luau.org/")
412 (synopsis "Fast, gradually typed embeddable scripting language")
413 (description
414 "Luau is a fast, small, safe, gradually typed embeddable scripting
415language derived from Lua. It provides a sandboxed interpreter, type checker,
416linter, compiler, bytecode tools, and libraries for embedding the language.
417The @code{static} output contains the component libraries and public headers.")
418 (license license:expat)))
419
420(define (make-lua-rewriter lua-package old-prefix new-prefix)
421 "Define a procedure that replaces lua inputs with LUA-PACKAGE. This only
422operates on packages with a name starting with OLD-PREFIX, which is rewritten to
423NEW-PREFIX."
424 (define (transform-name name)
425 (if (string-prefix? old-prefix name)
426 (string-append new-prefix
427 (substring name (string-length old-prefix)))
428 name))
429
430 (define (rewrite-input-labels inputs)
431 (map (lambda (input)
432 (match input
433 ((label (? package? package) outputs ...)
434 (cons* (transform-name label) package outputs))
435 (_
436 input)))
437 inputs))
438
439 (define (transform package)
440 (if (eq? package lua)
441 lua-package
442 (let* ((old-name (package-name package))
443 (new-name (transform-name old-name)))
444 (if (string= old-name new-name)
445 package
446 (package/inherit package
447 (location (package-location package))
448 (name new-name)
449 (source
450 (cond
451 ;; List of packages that shouldn't have their sources
452 ;; rewritten. Eventually we would like to remove this
453 ;; source rewriting, but we'll do so progressively to avoid
454 ;; the rebuilds.
455 ((member (package-name package) '("lua-lunitx"))
456 (package-source package))
457 ;; If we're using {git,hg}-fetch, then rewrite the file-name
458 ;; of the resulting package. This avoids causing rebuilds
459 ;; when migrating from the older method of defining Lua
460 ;; packages.
461 ((eq? (origin-method (package-source package)) git-fetch)
462 (origin
463 (inherit (package-source package))
464 (file-name (git-file-name name (package-version package)))))
465 ((eq? (origin-method (package-source package)) hg-fetch)
466 (origin
467 (inherit (package-source package))
468 (file-name (hg-file-name name (package-version package)))))
469 (else
470 (package-source package))))
471 ;; We also need to rewrite the input labels, otherwise the
472 ;; differences cause rebuilds.
473 (inputs (rewrite-input-labels (package-inputs package)))
474 (native-inputs (rewrite-input-labels (package-native-inputs package)))
475 (propagated-inputs (rewrite-input-labels (package-propagated-inputs package))))))))
476
477 (define (cut? package)
478 (or (eq? package lua)
479 (eq? package lua-package)))
480
481 (package-mapping transform cut?))
482
483(define package-with-lua-5.5 (make-lua-rewriter lua-5.5 "lua-" "lua5.5-"))
484(define package-with-lua-5.4 (make-lua-rewriter lua-5.4 "lua-" "lua5.4-"))
485(define package-with-lua-5.3 (make-lua-rewriter lua "lua-" "lua5.3-"))
486(define package-with-lua-5.2 (make-lua-rewriter lua-5.2 "lua-" "lua5.2-"))
487(define package-with-lua-5.1 (make-lua-rewriter lua-5.1 "lua-" "lua5.1-"))
488
489(define-syntax define-public-lua-variant
490 (syntax-rules (lua-5.5 lua-5.4 lua-5.3 lua-5.2 lua-5.1)
491 "Helper to define a single variant for PACKAGE, called NEW-PACKAGE, for the
492specified lua version. We explicitly match the lua package name as a symbol, so
493we can pick the rewriting function to rewrite package names appropriately."
494 ((_ package (lua-5.5 new-package))
495 (define-public new-package (package-with-lua-5.5 package)))
496 ((_ package (lua-5.4 new-package))
497 (define-public new-package (package-with-lua-5.4 package)))
498 ((_ package (lua-5.3 new-package))
499 (define-public new-package (package-with-lua-5.3 package)))
500 ((_ package (lua-5.2 new-package))
501 (define-public new-package (package-with-lua-5.2 package)))
502 ((_ package (lua-5.1 new-package))
503 (define-public new-package (package-with-lua-5.1 package)))))
504
505(define-syntax-rule (define-public-lua-variants package (lua-version new-package) ...)
506 "Define variants of PACKAGE for each LUA-VERSION, naming the corresponding
507package NEW-PACKAGE."
508 (begin (define-public-lua-variant package (lua-version new-package)) ...))
509
510(define-syntax-rule (this-lua-version)
511 "Return the major+minor version string of the current package's lua input."
512 (version-major+minor (package-version (or (this-package-input "lua")
513 (this-package-native-input "lua")))))
514
515(define-syntax-rule (this-lua-input name)
516 "Return the package input which matches NAME, after replacing any lua- prefix
517with the appropriate luaX.X- prefix for this package."
518 (this-package-input
519 (if (string-prefix? "lua-" name)
520 (string-append "lua" (this-lua-version) "-" (substring name 4))
521 name)))
522
523(define-public lua-expat
524 (package
525 (name "lua-expat")
526 (version "1.5.2")
527 (source
528 (origin
529 (method git-fetch)
530 (uri (git-reference
531 (url "https://github.com/lunarmodules/luaexpat")
532 (commit version)))
533 (file-name (git-file-name name version))
534 (sha256
535 (base32
536 "03wb1rr739qh9xvvi762kpiw5bs99m2plypq5caaan3qacm73rry"))))
537 (build-system gnu-build-system)
538 (arguments
539 (list
540 #:tests? #f ;tests require "busted"
541 #:make-flags
542 #~(let ((lua-version #$(this-lua-version)))
543 (list (string-append "CC=" #$(cc-for-target))
544 (string-append "LUA_LDIR=" #$output "/share/lua/" lua-version)
545 (string-append "LUA_CDIR=" #$output "/lib/lua/" lua-version)))
546 #:phases
547 #~(modify-phases %standard-phases
548 (delete 'configure))))
549 (inputs
550 (list lua expat))
551 (home-page "https://github.com/lunarmodules/luaexpat")
552 (synopsis "SAX XML parser based on the Expat library")
553 (description "LuaExpat is a SAX XML parser based on the Expat library.")
554 (license (package-license lua-5.1))))
555
556(define-public-lua-variants lua-expat
557 (lua-5.5 lua5.5-expat)
558 (lua-5.4 lua5.4-expat)
559 (lua-5.3 lua5.3-expat)
560 (lua-5.2 lua5.2-expat)
561 (lua-5.1 lua5.1-expat))
562
563(define-public lua-socket
564 ;; The 3.1.0 tag still has 3.0.0 in a bunch of places.
565 (let ((commit "de359ea4083ac6d944216229e4104dc36537c29c")
566 (revision "1"))
567 (package
568 (name "lua-socket")
569 (version (git-version "3.1.0" revision commit))
570 (source
571 (origin
572 (method git-fetch)
573 (uri
574 (git-reference
575 (url "https://github.com/lunarmodules/luasocket")
576 (commit commit)))
577 (file-name (git-file-name name version))
578 (sha256
579 (base32 "1bdcdad8fq2p193jcvsv59wm5mifb07alvrxm8qq31qmgs1q4mpw"))))
580 (build-system gnu-build-system)
581 (arguments
582 (list
583 #:make-flags
584 #~(list (string-append "INSTALL_TOP=" #$output)
585 (string-append "LUAV=" #$(this-lua-version))
586 "MYCFLAGS=-DLUASOCKET_DEBUG")
587 #:modules
588 (cons '(ice-9 threads) %default-gnu-modules)
589 #:phases
590 #~(modify-phases %standard-phases
591 (delete 'configure)
592 (delete 'check)
593 (add-after 'install 'install-unix
594 (lambda* (#:key make-flags #:allow-other-keys)
595 (apply invoke "make" "install-unix" make-flags)))
596 (add-after 'install-unix 'check
597 (lambda _
598 (setenv "GUIX_LUA_CPATH"
599 (string-append #$output "/lib/lua/" #$(this-lua-version)))
600 (setenv "GUIX_LUA_PATH"
601 (string-append #$output "/share/lua/" #$(this-lua-version)))
602 (with-directory-excursion "test"
603 (make-thread invoke "lua" "testsrvr.lua")
604 (make-thread invoke "lua" "utestsrvr.lua")
605 (for-each
606 (lambda (test)
607 (invoke "lua" (string-append test ".lua")))
608 '("hello" "stufftest" "excepttest" "test_bind"
609 "test_getaddrinfo" "ltn12test" "mimetest" "urltest"
610 "test_socket_error" "testclnt" "utestclnt"))))))))
611 (inputs (list lua))
612 (home-page "https://lunarmodules.github.io/luasocket")
613 (synopsis "Network support for the Lua language")
614 (description
615 "LuaSocket is a Lua extension library that is composed by two parts:
616a C core that provides support for the TCP and UDP transport layers,
617and a set of Lua modules that add support for functionality commonly needed by
618applications that deal with the Internet.
619
620Among the supported modules, the most commonly used implement the
621SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
622files) client protocols. These provide a very natural and generic interface
623to the functionality defined by each protocol. In addition, you will find
624that the MIME (common encodings), URL (anything you could possible want to do
625with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
626handy.")
627 (license (package-license lua-5.1)))))
628
629(define-public-lua-variants lua-socket
630 (lua-5.5 lua5.5-socket)
631 (lua-5.4 lua5.4-socket)
632 (lua-5.3 lua5.3-socket)
633 (lua-5.2 lua5.2-socket)
634 (lua-5.1 lua5.1-socket))
635
636(define-public lua-filesystem
637 (package
638 (name "lua-filesystem")
639 (version "1.9.0")
640 (source (origin
641 (method git-fetch)
642 (uri (git-reference
643 (url "https://github.com/keplerproject/luafilesystem")
644 (commit (string-append "v"
645 (string-join
646 (string-split version #\.) "_")))))
647 (file-name (git-file-name name version))
648 (sha256
649 (base32
650 "0vd1b9rnbjl24bbnk91jrkli81dc1b2kvpjlsx319azjmynlk0y6"))))
651 (build-system gnu-build-system)
652 (arguments
653 `(#:make-flags
654 (let ((out (assoc-ref %outputs "out"))
655 (lua-version ,(this-lua-version)))
656 (list (string-append "PREFIX=" out)
657 (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version)))
658 #:test-target "test"
659 #:phases
660 (modify-phases %standard-phases
661 (delete 'configure))))
662 (inputs
663 (list lua))
664 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
665 (synopsis "File system library for Lua")
666 (description "LuaFileSystem is a Lua library developed to complement the
667set of functions related to file systems offered by the standard Lua
668distribution. LuaFileSystem offers a portable way to access the underlying
669directory structure and file attributes.")
670 (license (package-license lua-5.1))))
671
672(define-public-lua-variants lua-filesystem
673 (lua-5.4 lua5.4-filesystem)
674 (lua-5.3 lua5.3-filesystem)
675 (lua-5.2 lua5.2-filesystem)
676 (lua-5.1 lua5.1-filesystem))
677
678(define-public lua-bee
679 ;; There are no releases; use the commit known to work with the packaged
680 ;; luamake.
681 (let ((commit "fe3feb2b62e8f0179dad5abb438ed4df39f675d4")
682 (revision "0"))
683 (package
684 (name "lua-bee")
685 (version (git-version "0.0.0" revision commit))
686 (source (origin
687 (method git-fetch)
688 (uri (git-reference
689 (url "https://github.com/actboy168/bee.lua/")
690 (commit commit)
691 ;; Requires a few git submodules such as the Lua
692 ;; sources to patch and a few source libraries.
693 (recursive? #t)))
694 (file-name (git-file-name name version))
695 (sha256
696 (base32
697 "1iv4cdkgcs123zw67ngq4jfbp7p7hkmj8zg2lbblipmm0hivhbd2"))))
698 (build-system gnu-build-system)
699 (arguments
700 (list
701 ;; TODO: Re-enable the tests after luamake can use a newer bee commit
702 ;; (see:
703 ;; <https://github.com/actboy168/bee.lua/commit/679c566f0f26bcf0c19e37066e678993122e1f34>).
704 #:tests? #f
705 #:phases
706 #~(modify-phases %standard-phases
707 (delete 'configure)
708 (replace 'build
709 (lambda* (#:key parallel-build? #:allow-other-keys)
710 (invoke "luamake"
711 "-EXE" "lua"
712 "-notest"
713 "-j" (if parallel-build?
714 (number->string (parallel-job-count))
715 "1")
716 "-v")))
717 (replace 'check
718 (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
719 (when tests?
720 (invoke "luamake"
721 "-EXE" "lua"
722 "-j" (if parallel-tests?
723 (number->string (parallel-job-count))
724 "1")
725 "test" "-v"))))
726 (replace 'install
727 (lambda _
728 (install-file "build/bin/lua"
729 (string-append #$output "/bin"))
730 (install-file "build/bin/bee.so"
731 (string-append #$output "/lib/")))))))
732 (native-inputs (list luamake))
733 (home-page "https://github.com/actboy168/bee.lua/")
734 (synopsis "Lua runtime with a few extra features")
735 (description "The Bee Lua runtime implements a few extra features
736such as:
737@itemize
738@item Deterministic tables traversal
739@item Enable @code{lua_assert} in debug mode
740@item Add error hook (for debugger)
741@item Add resume/yield hook (for debugger)
742@item Disable tail calls in debug mode (for debugger)
743@end itemize")
744 (license license:expat))))
745
746(define-public luamake
747 (package
748 (name "luamake")
749 (version "1.7")
750 (source (origin
751 (method git-fetch)
752 (uri (git-reference
753 (url "https://github.com/actboy168/luamake")
754 (commit (string-append "v" version))))
755 (file-name (git-file-name name version))
756 (sha256
757 (base32
758 "075sp8dpcb81kwrpp843f1y00kvaqan09np6spf6b72z5dhf6aiw"))))
759 (build-system gnu-build-system)
760 (arguments
761 (list
762 #:phases
763 #~(modify-phases %standard-phases
764 (add-after 'unpack 'copy-lua-bee-sources
765 (lambda* (#:key native-inputs inputs #:allow-other-keys)
766 (copy-recursively (dirname
767 (search-input-directory
768 (or native-inputs inputs) "bee"))
769 "bee.lua")))
770 (add-after 'unpack 'patch-commands
771 (lambda* (#:key inputs #:allow-other-keys)
772 (substitute* "scripts/action.lua"
773 (("\"ninja\"")
774 (format #f "~s" (search-input-file inputs "bin/ninja"))))))
775 (delete 'configure)
776 (replace 'build
777 (lambda* (#:key parallel-build? #:allow-other-keys)
778 (invoke "compile/build.sh" "-j"
779 (if parallel-build?
780 (number->string (parallel-job-count))
781 "1")
782 "notest" "-v")))
783 (replace 'check
784 (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
785 (when tests?
786 (invoke "compile/build.sh" "-j"
787 (if parallel-tests?
788 (number->string (parallel-job-count))
789 "1")
790 "test" "-v"))))
791 (replace 'install
792 (lambda _
793 (let ((bin (string-append #$output "/bin"))
794 (lib (string-append #$output "/lib/luamake")))
795 (install-file "luamake" lib)
796 (install-file "main.lua" lib)
797 (copy-recursively "scripts"
798 (string-append lib "/scripts"))
799 (copy-recursively "tools"
800 (string-append lib "/tools"))
801 (mkdir bin)
802 (symlink (string-append lib "/luamake")
803 (string-append bin "/luamake"))))))))
804 (native-inputs (list (package-source lua-bee)
805 ninja))
806 (inputs (list ninja))
807 (home-page "https://github.com/actboy168/luamake")
808 (synopsis "Make-inspired configuration and build system")
809 (description "Luamake is a platform independent configuration and
810build system that uses the standard Lua command-line interpreter.")
811 (license license:expat)))
812
813(define-public lua-language-server
814 (package
815 (name "lua-language-server")
816 (version "3.17.1")
817 (source (origin
818 (method git-fetch)
819 (uri (git-reference
820 (url "https://github.com/LuaLS/lua-language-server")
821 (commit version)
822 ;; There are quite a few bundled Lua libraries under the
823 ;; '3rd' and 'meta/3rd' directories; most are currently
824 ;; not packaged in Guix, and they all track exact
825 ;; commits, so it would be annoying to maintain them as
826 ;; separate origins (on top of having to patch the build
827 ;; system to unbundle them).
828 (recursive? #t)))
829 (file-name (git-file-name name version))
830 (sha256
831 (base32
832 "1fjhh02iph0mplqrgxfrdqfydrppksjsgw3lg6k8y5w6g24l3z1m"))))
833 (build-system gnu-build-system)
834 (arguments
835 (list
836 ;; The test suite currently fails with luamake apparently attempting to
837 ;; find the bee.so shared object (see:
838 ;; <https://github.com/LuaLS/lua-language-server/issues/3325>).
839 #:tests? #f
840 #:phases
841 #~(modify-phases %standard-phases
842 (delete 'configure)
843 (replace 'build
844 (lambda* (#:key parallel-build? #:allow-other-keys)
845 (invoke "luamake"
846 "-notest"
847 "-j" (if parallel-build?
848 (number->string (parallel-job-count))
849 "1")
850 "-v")))
851 (replace 'check
852 (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
853 (when tests?
854 (invoke "luamake"
855 "-j" (if parallel-tests?
856 (number->string (parallel-job-count))
857 "1")
858 "test" "-v"))))
859 (replace 'install
860 ;; This is inspired by the package definition in Slackware.
861 (lambda* (#:key inputs #:allow-other-keys)
862 (let* ((bin (string-append #$output "/bin"))
863 (lib (string-append #$output
864 "/libexec/lua-language-server"))
865 (lib/bin (string-append lib "/bin")))
866 ;; XXX: The binary expects some odd layout to find its resources,
867 ;; hence the bin subdirectory under libexec.
868 (mkdir-p lib)
869 (for-each (lambda (x)
870 (copy-recursively x (string-append lib "/" x)))
871 (list "bin"
872 "debugger.lua"
873 "locale"
874 "main.lua"
875 "meta"
876 "script"))
877 ;; Create a custom wrapper, adjusted to log elsewhere than in
878 ;; its read-only location under the store.
879 (mkdir bin)
880 (call-with-output-file (string-append bin "/lua-language-server")
881 (lambda (p)
882 (format p "#!~a
883exec ~a --logpath=\"/tmp/runtime-$USER/lua-language-server/log\" \
884--metapath=\"/tmp/runtime-$USER/lua-language-server/meta\" \"$@\""
885 (search-input-file inputs "bin/sh")
886 (string-append lib/bin
887 "/lua-language-server"))))
888 (chmod (string-append bin "/lua-language-server") #o755)))))))
889 (native-inputs (list luamake))
890 (inputs (list bash-minimal)) ;for the wrapper
891 (home-page "https://github.com/LuaLS/lua-language-server")
892 (synopsis "Lua language server")
893 (description "The Lua language server provides various language
894 features for Lua to make development easier and faster, including:
895@itemize
896@item Support for all recent versions of Lua, including LuaJIT
897@item Jump to definition
898@item Dynamic type checking
899@item Find references
900@item Diagnostics/Warnings
901@item Syntax checking
902@item Element renaming
903@item Hover to view details on variables, functions, and more
904@item Auto-completion
905@item Support for libraries
906@item Code formatting
907@item Spell checking
908@item Custom plugins
909@item Documentation generation
910@end itemize")
911 (license license:expat)))
912
913(define-public lua-ossl
914 (package
915 (name "lua-ossl")
916 (version "20220711")
917 (source (origin
918 (method git-fetch)
919 (uri (git-reference
920 (url "https://github.com/wahern/luaossl")
921 (commit (string-append "rel-" version))))
922 (file-name (git-file-name name version))
923 (sha256
924 (base32
925 "1a9pgmc6fbhgh1m9ksz9fq057yzz46npqgakcsy9vngg47xacfdb"))))
926 (build-system gnu-build-system)
927 (arguments
928 (list
929 #:make-flags
930 #~(let ((lua-api-version #$(this-lua-version)))
931 (list (string-append "CC=" #$(cc-for-target))
932 "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
933 (string-append "prefix=" #$output)
934 (string-append "LUA_APIS=" lua-api-version)))
935 #:phases
936 #~(modify-phases %standard-phases
937 (delete 'configure)
938 (delete 'check)
939 (add-after 'install 'check
940 (lambda _
941 (let ((lua-version #$(this-lua-version)))
942 (setenv "LUA_CPATH"
943 (string-append #$output "/lib/lua/" lua-version "/?.so;;"))
944 (setenv "LUA_PATH"
945 (string-append #$output "/share/lua/" lua-version "/?.lua;;"))
946 (with-directory-excursion "regress"
947 (for-each (lambda (f)
948 (unless (member f (list
949 ;; This test is for luajit only
950 "./104-interposition-discarded.lua"
951 ;; needs cqueues, which needs ossl
952 "./148-custom-extensions.lua"))
953 (invoke "lua" f)))
954 (find-files "." "^[0-9].*\\.lua$")))))))))
955 (inputs
956 (list lua openssl))
957 (home-page "https://25thandclement.com/~william/projects/luaossl.html")
958 (synopsis "OpenSSL bindings for Lua")
959 (description "The luaossl extension module for Lua provides comprehensive,
960low-level bindings to the OpenSSL library, including support for certificate
961and key management, key generation, signature verification, and deep bindings
962to the distinguished name, alternative name, and X.509v3 extension interfaces.
963It also binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG
964interfaces.")
965 (license license:expat)))
966
967(define-public-lua-variants lua-ossl
968 (lua-5.3 lua5.3-ossl)
969 (lua-5.2 lua5.2-ossl)
970 (lua-5.1 lua5.1-ossl))
971
972(define-public lua-sec
973 (package
974 (name "lua-sec")
975 (version "1.3.2")
976 (source (origin
977 (method git-fetch)
978 (uri (git-reference
979 (url "https://github.com/brunoos/luasec")
980 (commit (string-append "v" version))))
981 (file-name (git-file-name name version))
982 (sha256
983 (base32
984 "0rrdfbnkd8pgqwh3f0iyd5cxy7g1h0568a88m3sq1z7715js4yx3"))))
985 (build-system gnu-build-system)
986 (arguments
987 (list
988 #:tests? #f ;no tests
989 #:make-flags
990 #~(let* ((lua-api-version #$(this-lua-version))
991 (lua-path (string-append #$output "/share/lua/" lua-api-version))
992 (lua-cpath (string-append #$output "/lib/lua/" lua-api-version)))
993 (list "linux"
994 (string-append "CC=" #$(cc-for-target))
995 (string-append "LD=" #$(cc-for-target))
996 (string-append "LUAPATH=" lua-path)
997 (string-append "LUACPATH=" lua-cpath)))
998 #:phases #~(modify-phases %standard-phases
999 (delete 'configure))))
1000 (inputs (list lua openssl))
1001 (propagated-inputs (list lua-socket))
1002 (home-page "https://github.com/brunoos/luasec/wiki")
1003 (synopsis "OpenSSL bindings for Lua")
1004 (description
1005 "LuaSec is a binding for OpenSSL library to provide TLS/SSL communication.
1006It takes an already established TCP connection and creates a secure session
1007between the peers.")
1008 (license license:expat)))
1009
1010(define-public-lua-variants lua-sec
1011 (lua-5.5 lua5.5-sec)
1012 (lua-5.4 lua5.4-sec)
1013 (lua-5.3 lua5.3-sec)
1014 (lua-5.2 lua5.2-sec)
1015 (lua-5.1 lua5.1-sec))
1016
1017(define-public lua-cqueues
1018 (package
1019 (name "lua-cqueues")
1020 (version "20200726")
1021 (source (origin
1022 (method git-fetch)
1023 (uri (git-reference
1024 (url "https://github.com/wahern/cqueues")
1025 (commit (string-append "rel-" version))))
1026 (file-name (git-file-name name version))
1027 (sha256
1028 (base32
1029 "17gwqndlga6gnishgs6wk8cvgwzanddr42yikkg2xd4nanhcg8z9"))))
1030 (build-system gnu-build-system)
1031 (arguments
1032 (list
1033 #:modules '((guix build gnu-build-system)
1034 (guix build utils)
1035 (ice-9 string-fun))
1036 #:make-flags
1037 #~(let ((lua-api-version #$(this-lua-version)))
1038 (list (string-append "CC=" #$(cc-for-target))
1039 (string-append "LUA_APIS=" lua-api-version)))
1040 #:phases
1041 #~(modify-phases %standard-phases
1042 (delete 'configure)
1043 (delete 'check)
1044 (replace 'install
1045 (lambda* (#:key make-flags #:allow-other-keys)
1046 (apply invoke "make" "install"
1047 (append make-flags
1048 (list (string-append "DESTDIR=" #$output)
1049 "prefix=")))))
1050 (add-after 'install 'check
1051 (lambda* (#:key make-flags #:allow-other-keys)
1052 (let*
1053 ((lua-version #$(this-lua-version))
1054 (env-suffix (if (equal? lua-version "5.1")
1055 ""
1056 (string-append
1057 "_"
1058 (string-replace-substring lua-version "." "_"))))
1059
1060 (lua-cpath (lambda (p)
1061 (string-append p "/lib/lua/" lua-version "/?.so")))
1062 (lua-path (lambda (p)
1063 (string-append p "/share/lua/" lua-version "/?.lua"))))
1064 ;; The test suite sets Lua-version-specific search-path variables
1065 ;; when available so we must do the same, as these take
1066 ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
1067 (setenv (string-append "LUA_CPATH" env-suffix)
1068 (string-append
1069 (string-join (map lua-cpath (list #$output #$(this-lua-input "lua-ossl"))) ";")
1070 ";;"))
1071 (setenv (string-append "LUA_PATH" env-suffix)
1072 (string-append
1073 (string-join (map lua-path (list #$output #$(this-lua-input "lua-ossl"))) ";")
1074 ";;"))
1075
1076 ;; Skip regression tests we expect to fail
1077 (with-directory-excursion "regress"
1078 (for-each (lambda (f)
1079 (rename-file f (string-append f ".skip")))
1080 (append
1081 ;; Regression tests that require network
1082 ;; connectivity
1083 '("22-client-dtls.lua"
1084 "30-starttls-completion.lua"
1085 "62-noname.lua"
1086 "153-dns-resolvers.lua")
1087
1088 ;; Regression tests that require LuaJIT
1089 '("44-resolvers-gc.lua"
1090 "51-join-defunct-thread.lua"
1091 ;; These both need the ffi module.
1092 "73-starttls-buffering.lua"
1093 "87-alpn-disappears.lua")
1094
1095 ;; Regression tests that require Lua 5.3
1096 (if (not (equal? lua-version "5.3"))
1097 '("152-thread-integer-passing.lua")
1098 '()))))
1099
1100 (apply invoke "make" "check" make-flags)))))))
1101 (native-inputs
1102 (list m4))
1103 (inputs
1104 (list lua openssl))
1105 (propagated-inputs
1106 (list lua-ossl))
1107 (home-page "https://25thandclement.com/~william/projects/cqueues.html")
1108 (synopsis "Event loop for Lua using continuation queues")
1109 (description "The cqueues extension module for Lua implements an event loop
1110that operates through the yielding and resumption of coroutines. It is designed
1111to be non-intrusive, composable, and embeddable within existing applications.")
1112 (license license:expat)))
1113
1114(define-public-lua-variants lua-cqueues
1115 (lua-5.3 lua5.3-cqueues)
1116 (lua-5.2 lua5.2-cqueues)
1117 (lua-5.1 lua5.1-cqueues))
1118
1119(define-public lua-penlight
1120 (package
1121 (name "lua-penlight")
1122 (version "1.7.0")
1123 (source
1124 (origin
1125 (method git-fetch)
1126 (uri (git-reference
1127 (url "https://github.com/Tieske/Penlight")
1128 (commit version)))
1129 (file-name (git-file-name name version))
1130 (sha256
1131 (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
1132 (build-system trivial-build-system)
1133 (inputs
1134 (list lua))
1135 (propagated-inputs
1136 (list lua-filesystem))
1137 (arguments
1138 `(#:modules ((guix build utils))
1139 #:builder
1140 (begin
1141 (use-modules (guix build utils))
1142 (let* ((source (assoc-ref %build-inputs "source"))
1143 (lua-version ,(version-major+minor (package-version lua)))
1144 (destination (string-append (assoc-ref %outputs "out")
1145 "/share/lua/" lua-version)))
1146 (mkdir-p destination)
1147 (with-directory-excursion source
1148 (copy-recursively "lua/" destination)))
1149 #t)))
1150 (home-page "http://tieske.github.io/Penlight/")
1151 (synopsis "Collection of general purpose libraries for the Lua language")
1152 (description "Penlight is a set of pure Lua libraries focusing on
1153input data handling (such as reading configuration files), functional
1154programming (such as map, reduce, placeholder expressions,etc), and OS
1155path management. Much of the functionality is inspired by the Python
1156standard libraries.")
1157 (license license:expat)))
1158
1159(define-public lua-ldoc
1160 (package
1161 (name "lua-ldoc")
1162 (version "1.4.6")
1163 (source
1164 (origin
1165 (method git-fetch)
1166 (uri (git-reference
1167 (url "https://github.com/stevedonovan/LDoc")
1168 (commit version)))
1169 (file-name (git-file-name name version))
1170 (sha256
1171 (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
1172 (build-system gnu-build-system)
1173 (inputs
1174 (list lua))
1175 (propagated-inputs
1176 (list lua-penlight))
1177 (arguments
1178 `(#:tests? #f ;tests must run after installation.
1179 #:phases
1180 (modify-phases %standard-phases
1181 (add-after 'unpack 'fix-installation-directory
1182 (lambda* (#:key outputs #:allow-other-keys)
1183 (let ((out (assoc-ref outputs "out"))
1184 (lua-version ,(version-major+minor (package-version lua))))
1185 (substitute* "makefile"
1186 (("LUA=.*") "#\n")
1187 (("(LUA_PREFIX=).*" _ prefix)
1188 (string-append prefix out "\n"))
1189 (("(LUA_BINDIR=).*" _ prefix)
1190 (string-append prefix out "/bin\n"))
1191 (("(LUA_SHAREDIR=).*" _ prefix)
1192 (string-append prefix out "/share/lua/" lua-version "\n"))))
1193 #t))
1194 (delete 'configure)
1195 (add-before 'install 'create-bin-directory
1196 (lambda* (#:key outputs #:allow-other-keys)
1197 (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
1198 #t)))))
1199 (home-page "https://stevedonovan.github.io/ldoc/")
1200 (synopsis "Lua documentation generator")
1201 (description
1202 "LDoc is a LuaDoc-compatible documentation generation system for
1203Lua source code. It parses the declaration and documentation comments
1204in a set of Lua source files and produces a set of XHTML pages
1205describing the commented declarations and functions.")
1206 (license license:expat)))
1207
1208(define-public lua-lgi
1209 (package
1210 (name "lua-lgi")
1211 (version "0.9.2")
1212 (source
1213 (origin
1214 (method git-fetch)
1215 (uri (git-reference
1216 (url "https://github.com/pavouk/lgi")
1217 (commit version)))
1218 (file-name (git-file-name name version))
1219 (patches (search-patches "lua-lgi-fix-ref.patch"
1220 "lua-lgi-fix-pango.patch"))
1221 (sha256
1222 (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
1223 (build-system gnu-build-system)
1224 (arguments
1225 `(#:make-flags
1226 (list ,(string-append "CC=" (cc-for-target))
1227 (string-append "PREFIX=" (assoc-ref %outputs "out")))
1228 #:phases
1229 (modify-phases %standard-phases
1230 (delete 'configure) ; no configure script
1231 (add-before 'build 'set-env
1232 (lambda* (#:key inputs #:allow-other-keys)
1233 ;; We need to load cairo dynamically.
1234 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
1235 (setenv "LD_LIBRARY_PATH" cairo)
1236 #t)))
1237 (add-before 'build 'set-lua-version
1238 (lambda _
1239 ;; Lua version and therefore install directories are hardcoded.
1240 (substitute* "./lgi/Makefile"
1241 (("LUA_VERSION=5.1")
1242 (format #f
1243 "LUA_VERSION=~a"
1244 ,(this-lua-version))))
1245 #t))
1246 (add-before 'check 'skip-test-gtk
1247 (lambda _
1248 ;; FIXME: Skip GTK tests:
1249 ;; gtk3 - can't get it to run with the xorg-server config below
1250 ;; and some non-gtk tests will also fail
1251 ;; gtk2 - lots of functions aren't implemented
1252 ;; We choose gtk2 as the lesser evil and simply skip the test.
1253 ;; Currently, awesome is the only package that uses lua-lgi but
1254 ;; it doesn't need or interact with GTK using lua-lgi.
1255 (substitute* "./tests/test.lua"
1256 (("'gtk.lua',") "-- 'gtk.lua',"))
1257 #t))
1258 (add-before 'check 'start-xserver-instance
1259 (lambda* (#:key inputs #:allow-other-keys)
1260 ;; There must be a running X server during tests.
1261 (system (format #f "~a/bin/Xvfb :1 &"
1262 (assoc-ref inputs "xorg-server")))
1263 (setenv "DISPLAY" ":1")
1264 #t)))))
1265 (native-inputs
1266 (list dbus ;tests use 'dbus-run-session'
1267 pkg-config))
1268 (inputs
1269 `(("cairo" ,cairo)
1270 ("glib" ,glib)
1271 ("gobject-introspection" ,gobject-introspection)
1272 ("gtk" ,gtk+-2)
1273 ("libffi" ,libffi)
1274 ("lua" ,lua)
1275 ("pango" ,pango)
1276 ("xorg-server" ,xorg-server)))
1277 (home-page "https://github.com/pavouk/lgi/")
1278 (synopsis "Lua bridge to GObject based libraries")
1279 (description
1280 "LGI is gobject-introspection based dynamic Lua binding to GObject based
1281libraries. It allows using GObject-based libraries directly from Lua.
1282Notable examples are GTK+, GStreamer and Webkit.")
1283 (license license:expat)))
1284
1285(define-public-lua-variants lua-lgi
1286 (lua-5.3 lua5.3-lgi)
1287 (lua-5.2 lua5.2-lgi)
1288 (lua-5.1 lua5.1-lgi))
1289
1290(define-public lua-lpeg
1291 (package
1292 (name "lua-lpeg")
1293 (version "1.1.0")
1294 (source (origin
1295 (method url-fetch)
1296 (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
1297 version ".tar.gz"))
1298 (sha256
1299 (base32
1300 "0aimsjpcpkh3kk65f0pg1z2bp6d83rn4dg6pgbx1yv14s9kms5ab"))))
1301 (build-system gnu-build-system)
1302 (arguments
1303 `(#:phases
1304 (modify-phases %standard-phases
1305 (delete 'configure)
1306 ;; `make install` isn't available, so we have to do it manually
1307 (replace 'install
1308 (lambda* (#:key outputs #:allow-other-keys)
1309 (let ((out (assoc-ref outputs "out"))
1310 (lua-version ,(this-lua-version)))
1311 (install-file "lpeg.so"
1312 (string-append out "/lib/lua/" lua-version))
1313 (install-file "re.lua"
1314 (string-append out "/share/lua/" lua-version))
1315 #t))))
1316 #:test-target "test"))
1317 (inputs (list lua))
1318 (synopsis "Pattern-matching library for Lua")
1319 (description
1320 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
1321Grammars (PEGs).")
1322 (home-page "https://www.inf.puc-rio.br/~roberto/lpeg")
1323 (license license:expat)))
1324
1325(define-public-lua-variants lua-lpeg
1326 (lua-5.4 lua5.4-lpeg)
1327 (lua-5.3 lua5.3-lpeg)
1328 (lua-5.2 lua5.2-lpeg)
1329 (lua-5.1 lua5.1-lpeg))
1330
1331(define-public lua-luv
1332 (package
1333 (name "lua-luv")
1334 (version "1.52.1-0")
1335 (source (origin
1336 ;; The release tarball includes the sources of libuv but does
1337 ;; not include the pkg-config files.
1338 (method git-fetch)
1339 (uri (git-reference
1340 (url "https://github.com/luvit/luv")
1341 (commit version)))
1342 (file-name (git-file-name name version))
1343 (sha256
1344 (base32
1345 "109d1g4j8kfjixxnp70wb64wn6rhvpi9amcd71vs5f7398z8d0sr"))))
1346 (build-system cmake-build-system)
1347 (arguments
1348 (list #:tests? #f ; there are none
1349 #:configure-flags
1350 #~'("-DWITH_LUA_ENGINE=Lua"
1351 "-DWITH_SHARED_LIBUV=On"
1352 "-DBUILD_SHARED_LIBS=On"
1353 "-DLUA_BUILD_TYPE=System")
1354 #:phases
1355 #~(modify-phases %standard-phases
1356 (add-after 'unpack 'copy-lua-compat
1357 (lambda* _
1358 (copy-recursively #+(this-package-native-input "lua-compat")
1359 "lua-compat")
1360 (setenv "CPATH"
1361 (string-append (getcwd) "/lua-compat/c-api:"
1362 (or (getenv "CPATH") "")))
1363 #t)))))
1364 (inputs
1365 (list lua libuv-for-luv))
1366 (native-inputs
1367 `(("lua-compat"
1368 ,(origin
1369 (method git-fetch)
1370 (uri (git-reference
1371 (url "https://github.com/keplerproject/lua-compat-5.3")
1372 (commit "v0.10")))
1373 (file-name "lua-compat-5.3-checkout")
1374 (sha256
1375 (base32
1376 "1caxn228gx48g6kymp9w7kczgxcg0v0cd5ixsx8viybzkd60dcn4"))))))
1377 (home-page "https://github.com/luvit/luv/")
1378 (synopsis "Libuv bindings for Lua")
1379 (description
1380 "This library makes libuv available to Lua scripts.")
1381 (license license:asl2.0)))
1382
1383(define-public-lua-variants lua-luv
1384 (lua-5.5 lua5.5-luv)
1385 (lua-5.4 lua5.4-luv)
1386 (lua-5.3 lua5.3-luv)
1387 (lua-5.2 lua5.2-luv)
1388 (lua-5.1 lua5.1-luv))
1389
1390;; Lua 5.3 is not supported, so this package is not exported.
1391(define lua-bitop
1392 (package
1393 (name "lua-bitop")
1394 (version "1.0.2")
1395 (source (origin
1396 (method url-fetch)
1397 (uri (string-append "http://bitop.luajit.org/download/"
1398 "LuaBitOp-" version ".tar.gz"))
1399 (sha256
1400 (base32
1401 "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
1402 (build-system gnu-build-system)
1403 (arguments
1404 `(#:test-target "test"
1405 #:make-flags
1406 (list "INSTALL=install -pD"
1407 (string-append "INSTALLPATH=printf "
1408 (assoc-ref %outputs "out")
1409 "/lib/lua/"
1410 ,(this-lua-version)
1411 "/bit/bit.so"))
1412 #:phases
1413 (modify-phases %standard-phases
1414 (delete 'configure))))
1415 (inputs (list lua))
1416 (home-page "https://bitop.luajit.org/index.html")
1417 (synopsis "Bitwise operations on numbers for Lua")
1418 (description
1419 "Lua BitOp is a C extension module for Lua which adds bitwise operations
1420on numbers.")
1421 (license license:expat)))
1422
1423(define-public-lua-variants lua-bitop
1424 (lua-5.2 lua5.2-bitop)
1425 (lua-5.1 lua5.1-bitop))
1426
1427(define-public lua-djot
1428 (package
1429 (name "lua-djot")
1430 (version "0.2.1")
1431 (source
1432 (origin
1433 (method git-fetch)
1434 (uri (git-reference
1435 (url "https://github.com/jgm/djot.lua")
1436 (commit version)))
1437 (file-name (git-file-name name version))
1438 (sha256 (base32 "0kivx4yyj2zhj23d93h5rr0ab7gkazd3z7r7aqv1bgmigcw47pj2"))
1439 (modules '((guix build utils)))
1440 (snippet #~(begin
1441 (delete-file-recursively "clib")
1442 (delete-file-recursively "doc/api")
1443 (delete-file "doc/djot.1")))))
1444 (build-system gnu-build-system)
1445 (arguments
1446 (list
1447 #:phases
1448 #~(modify-phases %standard-phases
1449 (add-after 'unpack 'patch-makefile
1450 (lambda _
1451 (substitute* "Makefile"
1452 (("^all: .*") "all:\n"))))
1453 (delete 'configure)
1454 (replace 'check
1455 (lambda* (#:key tests? #:allow-other-keys)
1456 (when tests?
1457 (invoke "lua" "test.lua"))))
1458 (replace 'install
1459 (lambda _
1460 (let ((lua-path
1461 (string-append
1462 #$output
1463 "/share/lua/"
1464 #$(this-lua-version))))
1465 (install-file "djot.lua" lua-path)
1466 (copy-recursively "djot" (string-append lua-path "/djot"))))))))
1467 (native-inputs (list lua))
1468 (home-page "https://github.com/jgm/djot.lua")
1469 (synopsis "Lua parser for the djot light markup language")
1470 (description
1471 "This package provides a Lua parser for djot, a light markup syntax.
1472It can produce an AST, rendered HTML, or a stream of match tokens
1473that identify elements by source position, which could be used
1474for syntax highlighting or a linting tool.")
1475 (license license:expat)))
1476
1477(define-public-lua-variants lua-djot
1478 (lua-5.4 lua5.4-djot)
1479 (lua-5.3 lua5.3-djot)
1480 (lua-5.2 lua5.2-djot)
1481 (lua-5.1 lua5.1-djot))
1482
1483(define-public djot
1484 (package
1485 (inherit lua5.1-djot)
1486 (name "djot")
1487 (arguments
1488 (substitute-keyword-arguments (package-arguments lua5.1-djot)
1489 ((#:phases phases)
1490 #~(modify-phases #$phases
1491 (replace 'patch-makefile
1492 (lambda _
1493 (substitute* "Makefile"
1494 (("^all: .*") "all: doc/djot.1\n"))))
1495 (replace 'check
1496 (lambda* (#:key tests? #:allow-other-keys)
1497 (when tests?
1498 (invoke "luajit" "test.lua"))))
1499 (add-after 'install 'install-bin-and-man
1500 (lambda* (#:key inputs #:allow-other-keys)
1501 (let ((out-lua (string-append #$output "/share/lua/5.1"))
1502 (out-bin (string-append #$output "/bin/djot")))
1503 (copy-file "bin/main.lua" "bin/djot")
1504 (substitute* "bin/djot"
1505 (("^local djot = require" all)
1506 (string-append
1507 "#!"
1508 (search-input-file inputs "bin/luajit")
1509 "\n"
1510 all)))
1511 (install-file "bin/djot" (string-append #$output "/bin"))
1512 (chmod out-bin #o755)
1513 (wrap-program out-bin
1514 `("GUIX_LUA_PATH" ";" = (,out-lua))))
1515 (install-file "doc/djot.1"
1516 (string-append #$output "/share/man/man1"))))))))
1517 (native-inputs (list pandoc))
1518 (inputs (list luajit))))
1519
1520(define-public lua-readline
1521 (package
1522 (name "lua-readline")
1523 (version "3.3")
1524 (source
1525 (origin
1526 (method git-fetch)
1527 (uri (git-reference ;Peter Billam's Lua module monorepo
1528 (url "https://gitlab.com/peterbillam/pjb_lua.git")
1529 (commit "c558b912032cb81508f1f41fcd1fa417ba9ea4f3")))
1530 (file-name (git-file-name "pjb-lua" "2023.11.26"))
1531 (sha256 (base32 "00xwfyf7p6lvm51msv67sjxw3xkjydfr32dq4p0wfn0ig3xz8m63"))))
1532 (build-system gnu-build-system)
1533 (arguments
1534 (list
1535 #:tests? #f ;test_rl.lua is manual
1536 #:phases
1537 #~(let* ((lua-api-version #$(this-lua-version))
1538 (lua-cpath (string-append #$output "/lib/lua/" lua-api-version))
1539 (lua-path (string-append #$output "/share/lua/" lua-api-version))
1540 (shared-object "C-readline.so"))
1541 (modify-phases %standard-phases
1542 (add-after 'unpack 'change-dir
1543 (lambda _
1544 (chdir "readline-0.0")))
1545 (delete 'configure)
1546 (replace 'build
1547 (lambda _
1548 (invoke #$(cc-for-target) "-O2" "-fPIC" "C-readline.c"
1549 "-llua" "-lreadline" "-shared" "-o" shared-object)))
1550 (replace 'install
1551 (lambda _
1552 (install-file shared-object lua-cpath)
1553 (install-file "readline.lua" lua-path)))))))
1554 (inputs (list lua readline))
1555 (home-page "https://peterbillam.gitlab.io/pjb_lua/lua/readline.html")
1556 (synopsis "Simple Lua interface to the readline and history libraries")
1557 (description
1558 "This Lua module offers an interface to the GNU readline library.
1559
1560The function @code{readline()} is a wrapper, which invokes the GNU readline,
1561adds the line to the end of the history list, and then returns the line.
1562Usually you call @code{save_history()} before the program exits,
1563so that the history list is saved to the @code{histfile}.
1564
1565This Lua module can dialogue with the user on the controlling-terminal
1566of the process (typically @file{/dev/tty}) as returned by @code{ctermid()}.
1567It also support most of readline's alternative interface, namely
1568@code{handler_install}, @code{read_char} and @code{handler_remove},
1569and readline's custom completion.")
1570 (license license:expat)))
1571
1572(define-public-lua-variants lua-readline
1573 (lua-5.5 lua5.5-readline)
1574 (lua-5.4 lua5.4-readline)
1575 (lua-5.3 lua5.3-readline)
1576 (lua-5.2 lua5.2-readline)
1577 (lua-5.1 lua5.1-readline))
1578
1579(define-public lua-scintillua
1580 (package
1581 (name "lua-scintillua")
1582 (version "6.6")
1583 (source
1584 (origin
1585 (method git-fetch)
1586 (uri (git-reference
1587 (url "https://github.com/orbitalquark/scintillua")
1588 (commit (string-append "scintillua_" version))))
1589 (file-name (git-file-name name version))
1590 (sha256
1591 (base32 "121ilpy91wyprqp3la4xzbb60i2yp1xpnvjlahzgzg0vck48njm7"))))
1592 (build-system gnu-build-system)
1593 (arguments
1594 (list
1595 #:phases
1596 #~(let* ((lua-api-version #$(this-lua-version))
1597 (lua-cpath (string-append "/lib/lua/" lua-api-version))
1598 (lua-path (string-append "/share/lua/" lua-api-version))
1599 (scintillua (string-append #$output lua-path "/scintillua"))
1600 (lexers (string-append scintillua "/lexers")))
1601 (modify-phases %standard-phases
1602 (delete 'configure)
1603 (delete 'build)
1604 (delete 'check) ;move after install
1605 (replace 'install
1606 (lambda _
1607 (mkdir-p scintillua)
1608 (copy-recursively "lexers" lexers)
1609 (substitute* (string-append lexers "/lexer.lua")
1610 (("package\\.path")
1611 (string-append "('" lexers "/?.lua;' .. package.path)")))
1612 (with-output-to-file (string-append scintillua "/init.lua")
1613 (lambda ()
1614 (display
1615 "return require'scintillua.lexers.lexer'\n")))))
1616 (add-after 'install 'set-lua-path
1617 (lambda* (#:key inputs #:allow-other-keys)
1618 (let ((input-dirs (map cdr (alist-delete "source" inputs))))
1619 (setenv "GUIX_LUA_CPATH"
1620 (string-join
1621 (map (lambda (prefix)
1622 (string-append prefix lua-cpath))
1623 input-dirs)
1624 ";"))
1625 (setenv "GUIX_LUA_PATH"
1626 (string-join
1627 (map (lambda (prefix)
1628 (string-append prefix lua-path))
1629 (cons #$output input-dirs))
1630 ";")))))
1631 (add-after 'set-lua-path 'check
1632 (lambda _
1633 (substitute* "tests.lua"
1634 (("^package\\.path = .*") "")
1635 (("require\\('lexer'\\)") "require'scintillua'")
1636 (("'lexers'") (string-append "'" lexers "'"))
1637 (("test_lua51" all)
1638 (string-append "skip_" all)))
1639 (invoke "lua" "tests.lua")))))))
1640 (native-inputs (list lua))
1641 (propagated-inputs (list lua-lpeg lua-filesystem))
1642 (home-page "https://orbitalquark.github.io/scintillua/")
1643 (synopsis "Collection of LPeg lexer for source code")
1644 (description
1645 "This Lua library provides LPeg lexers for source code syntax
1646highlighting. It can either be used by itself or as a drop-in replacement
1647for Scintilla lexers.")
1648 (license license:expat)))
1649
1650(define-public-lua-variants lua-scintillua
1651 (lua-5.4 lua5.4-scintillua))
1652
1653(define-public lutok
1654 (package
1655 (name "lutok")
1656 (version "0.6.2")
1657 (source (origin
1658 (method git-fetch)
1659 (uri (git-reference
1660 (url "https://github.com/freebsd/lutok")
1661 (commit (string-append name "-" version))))
1662 (file-name (git-file-name name version))
1663 (sha256
1664 (base32
1665 "1hk8shp1vkxa09qxaafcfrgc9098cr75n5zc192bv8yjyvz0hvc3"))))
1666 (build-system gnu-build-system)
1667 ;; Disable the test suite to avoid a circular dependency on kyua.
1668 (arguments (list #:tests? #f))
1669 (native-inputs (list autoconf automake libtool pkg-config))
1670 (inputs (list atf))
1671 (propagated-inputs (list lua-5.4)) ;included in c_gate.hpp
1672 (home-page "https://github.com/freebsd/lutok")
1673 (synopsis "Lightweight C++ API for Lua")
1674 (description "Lutok is a lightweight C++ API library for Lua.
1675
1676Lutok provides thin C++ wrappers around the Lua C API to ease the interaction
1677between C++ and Lua. These wrappers make intensive use of @acronym{RAII,
1678Resource Acquisition is Initialization} to prevent resource leakage, expose
1679C++-friendly data types, report errors by means of exceptions and ensure that
1680the Lua stack is always left untouched in the face of errors. The library
1681also provides a small subset of miscellaneous utility functions built on top
1682of the wrappers.
1683
1684Lutok focuses on providing a clean and safe C++ interface; the drawback is
1685that it is not suitable for performance-critical environments. In order to
1686implement error-safe C++ wrappers on top of a Lua C binary library, Lutok adds
1687several layers or abstraction and error checking that go against the original
1688spirit of the Lua C API and thus degrade performance.")
1689 (license license:bsd-3)))
1690
1691(define-public selene
1692 (package
1693 (name "selene")
1694 (version "2017.08.25")
1695 (source (origin
1696 (method git-fetch)
1697 (uri (git-reference
1698 (url "https://github.com/jeremyong/Selene")
1699 ;; The release is quite old.
1700 (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
1701 (file-name "Selene")
1702 (sha256
1703 (base32
1704 "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
1705 (build-system cmake-build-system)
1706 (arguments
1707 `(#:configure-flags
1708 ;; lua pc file in CMakeLists.txt is lua5.3.pc
1709 '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
1710 #:phases
1711 ;; This is a header only library
1712 (modify-phases %standard-phases
1713 (delete 'build)
1714 (replace 'install
1715 (lambda* (#:key inputs outputs #:allow-other-keys)
1716 (let* ((output (assoc-ref outputs "out"))
1717 (source (assoc-ref inputs "source"))
1718 (includedir (string-append output "/include")))
1719 (copy-recursively
1720 (string-append source "/include")
1721 includedir))
1722 #t))
1723 ;; The path of test files are hard coded.
1724 (replace 'check
1725 (lambda* (#:key inputs outputs #:allow-other-keys)
1726 (let* ((output (assoc-ref outputs "out"))
1727 (source (assoc-ref inputs "source"))
1728 (builddir (getcwd))
1729 (testdir (string-append builddir "/test")))
1730 (copy-recursively (string-append source "/test") testdir)
1731 (invoke "make")
1732 (mkdir-p "runner")
1733 (copy-file "./test_runner" "./runner/test_runner")
1734 (chdir "./runner")
1735 (invoke "./test_runner")))))))
1736 (native-inputs
1737 (list lua pkg-config))
1738 (home-page "https://github.com/jeremyong/Selene")
1739 (synopsis "Lua C++11 bindings")
1740 (description
1741 "Selene is a simple C++11 header-only library enabling seamless
1742 interoperability between C++ and Lua programming language.")
1743 (license license:zlib)))
1744
1745(define-public lua-resty-core
1746 (package
1747 (name "lua-resty-core")
1748 (version "0.1.18")
1749 (source (origin
1750 (method git-fetch)
1751 (uri (git-reference
1752 (url "https://github.com/openresty/lua-resty-core")
1753 (commit (string-append "v" version))))
1754 (file-name (git-file-name name version))
1755 (sha256
1756 (base32
1757 "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
1758 (build-system trivial-build-system)
1759 (arguments
1760 `(#:modules ((guix build utils))
1761 #:builder
1762 (begin
1763 (use-modules (guix build utils))
1764 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1765 (package-lua-resty (lambda (input output)
1766 (mkdir-p (string-append output "/lib/lua"))
1767 (copy-recursively (string-append input "/lib/resty")
1768 (string-append output "/lib/lua/resty"))
1769 (copy-recursively (string-append input "/lib/ngx")
1770 (string-append output "/lib/ngx"))
1771 (symlink (string-append output "/lib/lua/resty")
1772 (string-append output "/lib/resty")))))
1773 (package-lua-resty (assoc-ref %build-inputs "source")
1774 (assoc-ref %outputs "out")))
1775 #t)))
1776 (home-page "https://github.com/openresty/lua-resty-core")
1777 (synopsis "Lua API for NGINX")
1778 (description "This package provides a FFI-based Lua API for
1779@code{ngx_http_lua_module} or @code{ngx_stream_lua_module}.")
1780 (license license:bsd-2)))
1781
1782(define-public lua-resty-lrucache
1783 (package
1784 (name "lua-resty-lrucache")
1785 (version "0.10")
1786 (source (origin
1787 (method git-fetch)
1788 (uri (git-reference
1789 (url "https://github.com/openresty/lua-resty-lrucache")
1790 (commit (string-append "v" version))))
1791 (file-name (git-file-name name version))
1792 (sha256
1793 (base32
1794 "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
1795 (build-system trivial-build-system)
1796 (arguments
1797 `(#:modules ((guix build utils))
1798 #:builder
1799 (begin
1800 (use-modules (guix build utils))
1801 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1802 (package-lua-resty (lambda (input output)
1803 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1804 (copy-recursively (string-append input "/lib/resty")
1805 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1806 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1807 (string-append output "/lib/resty")))))
1808 (package-lua-resty (assoc-ref %build-inputs "source")
1809 (assoc-ref %outputs "out")))
1810 #t)))
1811 (home-page "https://github.com/openresty/lua-resty-lrucache")
1812 (synopsis "Lua LRU cache based on the LuaJIT FFI")
1813 (description
1814 "This package provides Lua LRU cache based on the LuaJIT FFI.")
1815 (license license:bsd-2)))
1816
1817(define-public lua-resty-signal
1818 (package
1819 (name "lua-resty-signal")
1820 (version "0.02")
1821 (source (origin
1822 (method git-fetch)
1823 (uri (git-reference
1824 (url "https://github.com/openresty/lua-resty-signal")
1825 (commit (string-append "v" version))))
1826 (file-name (git-file-name name version))
1827 (sha256
1828 (base32
1829 "13y1pqn45y49mhqwywasfdsid46d0c33yi6mrnracbnmvyxz1cif"))))
1830 (build-system gnu-build-system)
1831 (arguments
1832 `(#:tests? #f ;TODO: Run the test suite.
1833 #:make-flags (list ,(string-append "CC=" (cc-for-target))
1834 (string-append "PREFIX=" %output))
1835 #:phases
1836 (modify-phases %standard-phases
1837 (delete 'configure)
1838 (add-after 'install 'install-lua
1839 (lambda* (#:key inputs outputs #:allow-other-keys)
1840 (use-modules (guix build utils))
1841 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1842 (package-lua-resty (lambda (input output)
1843 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1844 (copy-recursively (string-append input "/lib/resty")
1845 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1846 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1847 (string-append output "/lib/resty")))))
1848 (package-lua-resty (assoc-ref inputs "source")
1849 (assoc-ref outputs "out")))
1850 #t)))))
1851 (home-page "https://github.com/openresty/lua-resty-signal")
1852 (synopsis "Lua library for killing or sending signals to Linux processes")
1853 (description "This package provides Lua library for killing or sending
1854signals to Linux processes.")
1855 (license license:bsd-3)))
1856
1857(define-public lua-tablepool
1858 (package
1859 (name "lua-tablepool")
1860 (version "0.01")
1861 (source (origin
1862 (method git-fetch)
1863 (uri (git-reference
1864 (url "https://github.com/openresty/lua-tablepool")
1865 (commit (string-append "v" version))))
1866 (file-name (git-file-name name version))
1867 (sha256
1868 (base32
1869 "03yjj3w6znvj6843prg84m0lkrn49l901f9hj9bgy3cj9s0awl6y"))))
1870 (build-system trivial-build-system)
1871 (arguments
1872 `(#:modules ((guix build utils))
1873 #:builder
1874 (begin
1875 (use-modules (guix build utils))
1876 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1877 (package-lua-resty (lambda (input output)
1878 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1879 (copy-recursively (string-append input "/lib")
1880 (string-append output "/lib")))))
1881 (package-lua-resty (assoc-ref %build-inputs "source")
1882 (assoc-ref %outputs "out")))
1883 #t)))
1884 (home-page "https://github.com/openresty/lua-tablepool")
1885 (synopsis "Lua table recycling pools for LuaJIT")
1886 (description "This package provides Lua table recycling pools for LuaJIT.")
1887 (license license:bsd-2)))
1888
1889(define-public lua-resty-shell
1890 (package
1891 (name "lua-resty-shell")
1892 (version "0.03")
1893 (source (origin
1894 (method git-fetch)
1895 (uri (git-reference
1896 (url "https://github.com/openresty/lua-resty-shell")
1897 (commit (string-append "v" version))))
1898 (file-name (git-file-name name version))
1899 (sha256
1900 (base32
1901 "1s6g04ip4hr97r2pd8ry3alq063604s9a3l0hn9nsidh81ps4dp7"))))
1902 (build-system trivial-build-system)
1903 (arguments
1904 `(#:modules ((guix build utils))
1905 #:builder
1906 (begin
1907 (use-modules (guix build utils))
1908 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1909 (package-lua-resty (lambda (input output)
1910 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1911 (copy-recursively (string-append input "/lib/resty")
1912 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1913 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1914 (string-append output "/lib/resty")))))
1915 (package-lua-resty (assoc-ref %build-inputs "source")
1916 (assoc-ref %outputs "out")))
1917 #t)))
1918 (home-page "https://github.com/openresty/lua-resty-shell")
1919 (synopsis "Lua module for nonblocking system shell command executions")
1920 (description "This package provides Lua module for nonblocking system
1921shell command executions.")
1922 (license license:bsd-3)))
1923
1924(define-public luarocks
1925 (package
1926 (name "luarocks")
1927 (version "3.9.2")
1928 (home-page "https://luarocks.org/")
1929 (source (origin
1930 (method url-fetch)
1931 (uri (string-append "https://luarocks.org/releases/luarocks-"
1932 version ".tar.gz"))
1933 (sha256
1934 (base32
1935 "1nsfp7cwqcxa8vmkcqkgi5wc0iax0j3gbdfd183kw81cq3nf99mw"))))
1936 (build-system gnu-build-system)
1937 (arguments
1938 `(#:tests? #f ;upstream has no tests
1939 #:phases
1940 (modify-phases %standard-phases
1941 (add-before 'build 'patch-bin-sh
1942 (lambda* (#:key inputs #:allow-other-keys)
1943 (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
1944 "src/luarocks/core/sysdetect.lua")
1945 (("/bin/sh")
1946 (search-input-file inputs "/bin/sh")))))
1947 (replace 'configure
1948 (lambda* (#:key outputs #:allow-other-keys)
1949 (let ((out (assoc-ref outputs "out")))
1950 (invoke "./configure"
1951 (string-append "--prefix=" out)))))
1952 (add-after 'install 'patch-unzip
1953 (lambda* (#:key inputs outputs #:allow-other-keys)
1954 (substitute*
1955 (string-append
1956 (assoc-ref outputs "out") "/etc/luarocks/config-"
1957 ,(this-lua-version) ".lua") ;e.g. "5.2"
1958 (("variables = \\{")
1959 (string-append
1960 "variables = {\n"
1961 " AR = \"" (search-input-file inputs "/bin/ar") "\";\n"
1962 " BUNZIP2 = \"" (search-input-file inputs "/bin/bunzip2") "\";\n"
1963 " CC = \"" (search-input-file inputs "/bin/gcc") "\";\n"
1964 " CHMOD = \"" (search-input-file inputs "/bin/chmod") "\";\n"
1965 " CP = \"" (search-input-file inputs "/bin/cp") "\";\n"
1966 " CURL = \"" (search-input-file inputs "/bin/curl") "\";\n"
1967 " FIND = \"" (search-input-file inputs "/bin/find") "\";\n"
1968 " GIT = \"" (search-input-file inputs "/bin/git") "\";\n"
1969 " GPG = \"" (search-input-file inputs "/bin/gpg") "\";\n"
1970 " GUNZIP = \"" (search-input-file inputs "/bin/gunzip") "\";\n"
1971 " HG = \"" (search-input-file inputs "/bin/hg") "\";\n"
1972 " LD = \"" (search-input-file inputs "/bin/ld") "\";\n"
1973 " LS = \"" (search-input-file inputs "/bin/ls") "\";\n"
1974 " MAKE = \"" (search-input-file inputs "/bin/make") "\";\n"
1975 " MD5SUM = \"" (search-input-file inputs "/bin/md5sum") "\";\n"
1976 " MKDIR = \"" (search-input-file inputs "/bin/mkdir") "\";\n"
1977 " MKTEMP = \"" (search-input-file inputs "/bin/mktemp") "\";\n"
1978 " OPENSSL = \"" (search-input-file inputs "/bin/openssl") "\";\n"
1979 " PWD = \"" (search-input-file inputs "/bin/pwd") "\";\n"
1980 " RANLIB = \"" (search-input-file inputs "/bin/ranlib") "\";\n"
1981 " RM = \"" (search-input-file inputs "/bin/rm") "\";\n"
1982 " RMDIR = \"" (search-input-file inputs "/bin/rmdir") "\";\n"
1983 " RSYNC = \"" (search-input-file inputs "/bin/rsync") "\";\n"
1984 " SCP = \"" (search-input-file inputs "/bin/scp") "\";\n"
1985 " TAR = \"" (search-input-file inputs "/bin/tar") "\";\n"
1986 " TEST = \"" (search-input-file inputs "/bin/test") "\";\n"
1987 " TOUCH = \"" (search-input-file inputs "/bin/touch") "\";\n"
1988 " UNZIP = \"" (search-input-file inputs "/bin/unzip") " -n\";\n"
1989 " WGET = \"" (search-input-file inputs "/bin/wget") "\";\n"
1990 " ZIP = \"" (search-input-file inputs "/bin/zip") "\";"))))))))
1991 (inputs (list lua
1992 bash-minimal
1993 ;; Executables required by luarocks.
1994 binutils
1995 bzip2
1996 coreutils
1997 curl
1998 findutils
1999 gcc
2000 git
2001 gnupg
2002 gzip
2003 gnu-make
2004 mercurial
2005 openssh
2006 openssl
2007 rsync
2008 tar
2009 unzip
2010 wget
2011 zip))
2012 (native-inputs (list unzip))
2013 (synopsis "Package manager for Lua modules")
2014 (description
2015 "LuaRocks is the package manager for the Lua programming
2016language.
2017
2018It allows you to install Lua modules as self-contained packages called
2019@url{https://luarocks.org/en/Types_of_rocks, @emph{rocks}}, which also contain
2020version @url{https://luarocks.org/en/Dependencies, dependency} information.
2021This information can be used both during installation, so that when one rock
2022is requested all rocks it depends on are installed as well, and also
2023optionally at run time, so that when a module is required, the correct version
2024is loaded. LuaRocks supports both local and
2025@url{http://luarocks.org/en/Rocks_repositories, remote} repositories, and
2026multiple local rocks trees.")
2027 (license license:expat)))
2028
2029;; Luarocks doesn't use the usual "lua-" prefix, so it doesn't play nicely with
2030;; our standard rewriter. Make a custom one just for this case for now.
2031(define luarocks-5.2-rewriter
2032 (make-lua-rewriter lua-5.2 "luarocks" "lua5.2-luarocks"))
2033
2034(define-public lua5.2-luarocks
2035 (luarocks-5.2-rewriter luarocks))
2036
2037(define-public dkjson
2038 (package
2039 (name "dkjson")
2040 (version "2.8")
2041 (source
2042 (origin
2043 (method url-fetch)
2044 (uri (string-append "https://dkolf.de/dkjson-lua/dkjson-" version ".lua"))
2045 (sha256
2046 (base32 "0i3x9qzx2m25fpf1pd6j45imm1gpykpjxibbvfi9bcwgd1hg2fzb"))))
2047 (build-system trivial-build-system)
2048 (arguments
2049 (list
2050 #:modules '((guix build utils))
2051 #:builder
2052 #~(begin
2053 (use-modules (guix build utils))
2054 (let* ((luajit-major+minor
2055 #$(version-major+minor (package-version lua)))
2056 (lua-dir
2057 (string-append #$output "/share/lua/" luajit-major+minor)))
2058 (mkdir-p lua-dir)
2059 (copy-file #$source (string-append lua-dir "/dkjson.lua"))))))
2060 (inputs (list lua))
2061 (synopsis "JSON module for Lua")
2062 (description
2063 "dkjson is a lua module for processing json in lua. It can handle tasks
2064 like encoding or decoding JSON objects to and from lua tables.")
2065 (home-page "https://dkolf.de/dkjson-lua/")
2066 (license license:expat)))
2067
2068(define-public fennel
2069 (package
2070 (name "fennel")
2071 (version "1.6.1")
2072 (source (origin
2073 (method git-fetch)
2074 (uri (git-reference
2075 (url "https://git.sr.ht/~technomancy/fennel")
2076 (commit version)))
2077 (file-name (git-file-name name version))
2078 (sha256
2079 (base32
2080 "0n58410gmxfnmgggdw6ap12fa68z5s7f83487b2apim52a8wpd9h"))))
2081 (build-system gnu-build-system)
2082 (arguments
2083 (list #:make-flags #~(list (string-append "PREFIX=" #$output))
2084 #:test-target "test"
2085 #:phases #~(modify-phases %standard-phases
2086 (delete 'configure)
2087 (add-after 'build 'patch-fennel
2088 (lambda* (#:key inputs #:allow-other-keys)
2089 ;; Remove IRC CI build status reporting
2090 (delete-file "test/irc.lua")
2091 (substitute* "test/init.lua"
2092 ((",\\{hooks=\\{exit=dofile\\(\"test/irc.lua\"\\)\\}\\}")
2093 ""))
2094 (substitute* "fennel"
2095 (("/usr/bin/env .*lua")
2096 (search-input-file inputs "/bin/lua")))))
2097 (delete 'check)
2098 (add-after 'install 'wrap
2099 (lambda _
2100 (wrap-program (string-append #$output "/bin/fennel")
2101 `("GUIX_LUA_CPATH" ";" suffix
2102 (,(getenv "GUIX_LUA_CPATH")))
2103 `("GUIX_LUA_PATH" ";" suffix
2104 (,(getenv "GUIX_LUA_PATH"))))))
2105 (add-after 'wrap 'check
2106 (assoc-ref %standard-phases
2107 'check)))))
2108 (inputs (list lua lua-readline))
2109 (home-page "https://fennel-lang.org/")
2110 (synopsis "Lisp that compiles to Lua")
2111 (description
2112 "Fennel is a programming language that brings together the speed,
2113simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro
2114system.")
2115 (license license:expat)))
2116
2117(define-public antifennel
2118 (package
2119 (version "0.2.0")
2120 (name "antifennel")
2121 (source
2122 (origin
2123 (method git-fetch)
2124 (uri (git-reference
2125 (url "https://git.sr.ht/~technomancy/antifennel")
2126 (commit version)))
2127 (sha256
2128 (base32 "1hd9h17q31b3gg88c657zq4han4air2ag55rrakbmcpy6n8acsqc"))
2129 (file-name (git-file-name name version))))
2130 (build-system gnu-build-system)
2131 (inputs (list luajit))
2132 (arguments
2133 (list
2134 #:phases #~(modify-phases %standard-phases
2135 (delete 'configure)
2136 ;; Tests pass after the fix introduced by the commit
2137 ;; ecd2169fcad1fa6616fdf6e6a8569f5b866601e5
2138 (delete 'check)
2139 (replace 'install
2140 (lambda _
2141 (install-file "antifennel"
2142 (string-append #$output "/bin")))))))
2143 (home-page "https://git.sr.ht/~technomancy/antifennel")
2144 (synopsis "Turn Lua code into Fennel code")
2145 (description
2146 "This package provides a way to turn Lua code into Fennel code.
2147This compiler does the opposite of what the Fennel compiler does.")
2148 (license license:expat)))
2149
2150(define-public fnlfmt
2151 (package
2152 (name "fnlfmt")
2153 (version "0.3.0")
2154 (source (origin
2155 (method git-fetch)
2156 (uri (git-reference
2157 (url "https://git.sr.ht/~technomancy/fnlfmt")
2158 (commit version)))
2159 (file-name (git-file-name name version))
2160 (sha256
2161 (base32
2162 "06gzw7f20yw4192kymr4karxw3ia3apjnjqpm6vxph87c67d1fa3"))
2163 (modules '((guix build utils)))
2164 (snippet
2165 #~(begin
2166 ;; Use input fennel instead of bundled fennel.
2167 (delete-file "fennel")
2168 (delete-file "fennel.lua")
2169 (substitute* "Makefile"
2170 (("./fennel") "fennel"))))))
2171 (build-system gnu-build-system)
2172 (arguments
2173 `(#:modules ((guix build gnu-build-system)
2174 (guix build utils)
2175 (ice-9 match))
2176 #:test-target "test"
2177 #:phases
2178 (modify-phases %standard-phases
2179 (delete 'configure)
2180 (add-before 'build 'patch-makefile
2181 (lambda* (#:key native-inputs inputs #:allow-other-keys)
2182 (substitute* "Makefile"
2183 ;; Patch lua shebang that gets inserted to fnlfmt.
2184 (("/usr/bin/env lua")
2185 (search-input-file (or native-inputs inputs) "/bin/lua")))))
2186 (replace 'install
2187 ;; There is no install target; manually install the output file.
2188 (lambda* (#:key outputs #:allow-other-keys)
2189 (let* ((out (assoc-ref outputs "out"))
2190 (bin (string-append out "/bin")))
2191 (for-each (lambda (file)
2192 (install-file file bin))
2193 (find-files "." "fnlfmt")))))
2194 (add-after 'install 'wrap
2195 (lambda* (#:key outputs #:allow-other-keys)
2196 (let* ((fnlfmt (assoc-ref outputs "out")))
2197 (wrap-program (string-append fnlfmt "/bin/fnlfmt")
2198 `("GUIX_LUA_PATH" ";" suffix (,(getenv "GUIX_LUA_PATH"))))
2199 #t))))))
2200 (inputs (list bash-minimal))
2201 (native-inputs (list lua fennel))
2202 (home-page "https://git.sr.ht/~technomancy/fnlfmt")
2203 (synopsis "Automatic formatting of Fennel code")
2204 (description
2205 "Fnlfmt is a tool for automatically formatting Fennel code in a consistent
2206way, following established lisp conventions.")
2207 (license license:lgpl3+)))
2208
2209(define-public fennel-ls
2210 (package
2211 (name "fennel-ls")
2212 (version "0.2.4")
2213 (source
2214 (origin
2215 (method git-fetch)
2216 (uri (git-reference
2217 (url "https://git.sr.ht/~xerool/fennel-ls")
2218 (commit version)))
2219 (file-name (git-file-name name version))
2220 (sha256
2221 (base32 "1bi7dr0svnfldkl98fs1w5dd2ms1f8km5rg5ch8brl65z4pk12a4"))))
2222 (build-system gnu-build-system)
2223 (arguments
2224 (list
2225 #:make-flags #~(list "VENDOR=false")
2226 #:tests? #f ; tests require additional dependencies
2227 #:phases
2228 #~(let ((luajit-major+minor
2229 #$(version-major+minor (package-version lua))))
2230 (modify-phases %standard-phases
2231 (delete 'configure)
2232 (add-before 'build 'rm-vendored-deps
2233 (lambda _
2234 (delete-file-recursively "fennel")
2235 (delete-file-recursively "deps/")))
2236 (replace 'install
2237 (lambda _
2238 (install-file "fennel-ls"
2239 (string-append #$output "/bin"))))
2240 (add-after 'install 'wrap
2241 (lambda _
2242 (wrap-program (string-append #$output "/bin/fennel-ls")
2243 `("GUIX_LUA_PATH" ";" prefix (,(getenv "GUIX_LUA_PATH"))))))))))
2244 (inputs (list bash-minimal lua fennel pandoc dkjson))
2245 (synopsis "Language server for Fennel")
2246 (description
2247 "Fennel Language Server is a language server for the Fennel programming
2248 language.")
2249 (home-page "https://git.sr.ht/~xerool/fennel-ls")
2250 (license license:expat)))
2251
2252(define-public lua-lunitx
2253 (package
2254 (name "lua-lunitx")
2255 (version "0.8.2")
2256 (source (origin
2257 (method git-fetch)
2258 (uri (git-reference
2259 ;; Upstream repository name is "lunit", but it provides
2260 ;; both lunit and lunitx modules.
2261 (url "https://github.com/dcurrie/lunit")
2262 (commit version)))
2263 (file-name (git-file-name name version))
2264 (sha256
2265 (base32
2266 "0y9szbd2g8xk63s8781bjmw8sv3s5m6rnv47kh1sk21ml3mxi69y"))))
2267 (build-system trivial-build-system)
2268 (arguments
2269 (list
2270 #:modules '((guix build utils))
2271 #:builder
2272 #~(begin
2273 (use-modules (guix build utils))
2274 (let* ((lua (string-append #$(this-package-native-input "lua") "/bin/lua"))
2275 (lua-version #$(this-lua-version))
2276 (lua-dir (string-append #$output "/share/lua/" lua-version)))
2277 (when #$(not (%current-target-system))
2278 (with-directory-excursion (string-append #$source "/lua")
2279 (invoke lua "../test/selftest.lua")))
2280 (mkdir-p lua-dir)
2281 (copy-recursively (string-append #$source "/lua") lua-dir)))))
2282 (native-inputs (list lua))
2283 (home-page "https://github.com/dcurrie/lunit")
2284 (synopsis "Unit testing framework for Lua")
2285 (description "Lunit is a unit testing framework for Lua. It includes
2286lunitx extensions adding Lua 5.2 compatibility via @code{lunit.module} and
2287the @code{lunitx} module for running tests automatically at program exit.")
2288 (license license:expat)))
2289
2290(define-public-lua-variants lua-lunitx
2291 (lua-5.4 lua5.4-lunitx)
2292 (lua-5.3 lua5.3-lunitx)
2293 (lua-5.2 lua5.2-lunitx)
2294 (lua-5.1 lua5.1-lunitx))
2295
2296(define-public lua-lsqlite3
2297 (package
2298 (name "lua-lsqlite3")
2299 (version "0.9.6")
2300 (source (origin
2301 (method url-fetch)
2302 (uri "https://lua.sqlite.org/home/zip/lsqlite3_v096.zip")
2303 (file-name (string-append "lsqlite3-v" version ".zip"))
2304 (sha256
2305 (base32
2306 "10md6bfvbzflrhz4n75jr1ppmz86mwsip85llny23w2ld9iygipc"))))
2307 (build-system gnu-build-system)
2308 (arguments
2309 (list
2310 #:tests? (not (%current-target-system))
2311 #:phases
2312 #~(modify-phases %standard-phases
2313 (delete 'configure)
2314 (replace 'build
2315 (lambda _
2316 (invoke #$(cc-for-target) "-fPIC" "-shared" "-O2"
2317 "-o" "lsqlite3.so"
2318 "lsqlite3.c"
2319 "-llua" "-lsqlite3")))
2320 (replace 'install
2321 (lambda* (#:key outputs #:allow-other-keys)
2322 (let* ((out (assoc-ref outputs "out"))
2323 (lua-version #$(this-lua-version))
2324 (cmod-dir (string-append out "/lib/lua/" lua-version)))
2325 (install-file "lsqlite3.so" cmod-dir))))
2326 (delete 'check)
2327 (add-after 'install 'check
2328 (lambda* (#:key tests? outputs #:allow-other-keys)
2329 (when tests?
2330 ;; Built only for the upstream test suite (test-dyld.lua).
2331 (invoke #$(cc-for-target) "-fPIC" "-shared" "-O2"
2332 "-o" "extras/libsqlitefunctions.so"
2333 "extras/extension-functions.c"
2334 "-lsqlite3")
2335 ;; Only test the dynamic lsqlite3 module; lsqlite3complete
2336 ;; (SQLite amalgamation) is not built by this package.
2337 (invoke "lua" "test/tests-sqlite3.lua" "lsqlite3")
2338 (invoke "lua" "test/test.lua")
2339 (invoke "lua" "test/test-dyld.lua")))))))
2340 (native-inputs (list unzip lua-lunitx))
2341 (inputs (list lua sqlite))
2342 (home-page "https://lua.sqlite.org/")
2343 (synopsis "SQLite3 binding for Lua")
2344 (description "LuaSQLite3 is a thin wrapper around the public domain
2345SQLite3 database engine. It provides a complete binding to the SQLite3 C API
2346from within Lua programs.")
2347 (license license:expat)))
2348
2349(define-public-lua-variants lua-lsqlite3
2350 (lua-5.4 lua5.4-lsqlite3)
2351 (lua-5.3 lua5.3-lsqlite3)
2352 (lua-5.2 lua5.2-lsqlite3)
2353 (lua-5.1 lua5.1-lsqlite3))
2354
2355(define-public lua-unbound
2356 (package
2357 (name "lua-unbound")
2358 (version "1.1.0")
2359 (source
2360 (origin
2361 (method hg-fetch)
2362 (uri (hg-reference
2363 (url "https://hg.sr.ht/~zash/luaunbound")
2364 (changeset version)))
2365 (file-name (hg-file-name name version))
2366 (sha256
2367 (base32 "17q5n9h1hnlx00x4k3h93rwyy41gfpd42yyp13rqkhhkmimw6q2y"))))
2368 (build-system gnu-build-system)
2369 (arguments
2370 (list
2371 #:tests? #f ;no test
2372 #:make-flags
2373 #~(let ((lua-version #$(this-lua-version)))
2374 (list
2375 (string-append "CC=" #$(cc-for-target))
2376 (string-append "LUA_VERSION=" lua-version)
2377 (string-append "LUA_LIBDIR=/lib/lua/" lua-version)
2378 (string-append "MYLDFLAGS=-L"
2379 #$(this-package-input "unbound") "/lib")
2380 (string-append "DESTDIR=" #$output)))
2381 #:phases
2382 #~(modify-phases %standard-phases
2383 (delete 'configure))))
2384 (native-inputs (list pkg-config))
2385 (inputs (list lua unbound))
2386 (home-page "https://www.zash.se/luaunbound.html")
2387 (synopsis "Unbound binding for Lua")
2388 (description
2389 "This is a binding to libunbound for Lua, allowing both asynchronous
2390and DNSSEC-secured DNS lookups of arbitrary DNS record types.
2391
2392It was created because Prosody needs an asynchronous DNS library with support
2393for SRV records, and the ones found at the time did one or the other, or was
2394missing DNSSEC that allowed implementing DANE.
2395
2396It originated out of a need in the XMPP server software Prosody for an
2397async-capable resolver library supporting SRV records, as well as a desire to
2398experiment with DNSSEC and new DNS records.")
2399 (license license:expat)))
2400
2401(define-public-lua-variants lua-unbound
2402 (lua-5.5 lua5.5-unbound)
2403 (lua-5.4 lua5.4-unbound)
2404 (lua-5.3 lua5.3-unbound)
2405 (lua-5.2 lua5.2-unbound))