projects/guix·blob version-1.2.0 · refs

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