1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com>
4 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2016, 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
9 ;;; Copyright © 2016, 2017, 2019 Clément Lassieur <clement@lassieur.org>
10 ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
11 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
13 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
14 ;;; Copyright © 2020 Simon South <simon@simonsouth.net>
16 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
58 (uri (string-append "https://www.lua.org/ftp/lua-"
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)))
67 `(#:modules ((guix build gnu-build-system)
72 (list "MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
73 (string-append "CC=" ,(cc-for-target))
74 (string-append "SYSLIBS=-L" (assoc-ref %build-inputs "readline")
78 (modify-phases %standard-phases
81 (lambda* (#:key outputs #:allow-other-keys)
82 (let ((out (assoc-ref outputs "out")))
83 (invoke "make" "install"
84 (string-append "INSTALL_TOP=" out)
85 (string-append "INSTALL_MAN=" out
86 "/share/man/man1"))))))))
87 (home-page "https://www.lua.org/")
88 (synopsis "Embeddable scripting language")
90 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
91 combines simple procedural syntax with powerful data description constructs
92 based on associative arrays and extensible semantics. Lua is dynamically typed,
93 runs by interpreting bytecode for a register-based virtual machine, and has
94 automatic memory management with incremental garbage collection, making it ideal
95 for configuration, scripting, and rapid prototyping.")
96 (license license:x11)))
98 (define-public lua-5.2
99 (package (inherit lua)
104 (uri (string-append "https://www.lua.org/ftp/lua-"
107 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
108 (patches (search-patches "lua-pkgconfig.patch"
109 "lua-liblua-so.patch"))))))
111 (define-public lua-5.1
112 (package (inherit lua)
116 (uri (string-append "https://www.lua.org/ftp/lua-"
119 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
120 (patches (search-patches "lua51-liblua-so.patch"
121 "lua-CVE-2014-5461.patch"
122 "lua51-pkgconfig.patch"))))))
124 (define-public luajit
127 (version "2.1.0-beta3")
130 (uri (string-append "http://luajit.org/download/LuaJIT-"
133 (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"))
134 (patches (search-patches "luajit-no_ldconfig.patch"))))
135 (build-system gnu-build-system)
137 `(#:tests? #f ; luajit is distributed without tests
139 (modify-phases %standard-phases
140 (delete 'configure) ; no configure script
141 (add-after 'install 'create-luajit-symlink
142 (lambda* (#:key outputs #:allow-other-keys)
143 (let* ((out (assoc-ref outputs "out"))
144 (bin (string-append out "/bin")))
145 (with-directory-excursion bin
146 (symlink ,(string-append name "-" version)
149 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
150 (home-page "https://www.luajit.org/")
151 (synopsis "Just in time compiler for Lua programming language version 5.1")
153 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
154 programming language. Lua is a powerful, dynamic and light-weight programming
155 language. It may be embedded or used as a general-purpose, stand-alone
157 (license license:x11)))
159 (define (make-lua-expat name lua)
165 (uri (string-append "https://matthewwild.co.uk/projects/"
166 "luaexpat/luaexpat-" version ".tar.gz"))
169 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
170 (build-system gnu-build-system)
173 (let ((out (assoc-ref %outputs "out"))
174 (lua-version ,(version-major+minor (package-version lua))))
176 (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
177 (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
179 (modify-phases %standard-phases
183 (setenv "LUA_CPATH" "src/?.so;;")
184 (setenv "LUA_PATH" "src/?.lua;;")
185 (invoke "lua" "tests/test.lua")
186 (invoke "lua" "tests/test-lom.lua"))))))
190 (home-page "https://matthewwild.co.uk/projects/luaexpat/")
191 (synopsis "SAX XML parser based on the Expat library")
192 (description "LuaExpat is a SAX XML parser based on the Expat library.")
193 (license (package-license lua-5.1))))
195 (define-public lua5.1-expat
196 (make-lua-expat "lua5.1-expat" lua-5.1))
198 (define-public lua5.2-expat
199 (make-lua-expat "lua5.2-expat" lua-5.2))
201 (define (make-lua-socket name lua)
208 (url "https://github.com/diegonehab/luasocket")
209 (commit (string-append "v" version))))
210 (file-name (git-file-name name version))
213 "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
214 (build-system gnu-build-system)
217 (let ((out (assoc-ref %outputs "out"))
218 (lua-version ,(version-major+minor (package-version lua))))
219 (list (string-append "INSTALL_TOP=" out)
220 (string-append "LUAV?=" lua-version)))
222 (modify-phases %standard-phases
226 (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
227 (setenv "LUA_PATH" "src/?.lua;;")
228 (when (zero? (primitive-fork))
229 (invoke "lua" "test/testsrvr.lua"))
230 (invoke "lua" "test/testclnt.lua"))))))
233 (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
234 (synopsis "Socket library for Lua")
235 (description "LuaSocket is a Lua extension library that is composed by two
236 parts: a C core that provides support for the TCP and UDP transport layers,
237 and a set of Lua modules that add support for functionality commonly needed by
238 applications that deal with the Internet.
240 Among the supported modules, the most commonly used implement the
241 SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
242 files) client protocols. These provide a very natural and generic interface
243 to the functionality defined by each protocol. In addition, you will find
244 that the MIME (common encodings), URL (anything you could possible want to do
245 with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
247 (license license:expat)))
249 (define-public lua5.1-socket
250 (make-lua-socket "lua5.1-socket" lua-5.1))
252 (define-public lua5.2-socket
253 (make-lua-socket "lua5.2-socket" lua-5.2))
255 (define (make-lua-filesystem name lua)
262 (url "https://github.com/keplerproject/luafilesystem")
263 (commit (string-append "v"
265 (string-split version #\.) "_")))))
266 (file-name (git-file-name name version))
269 "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
270 (build-system gnu-build-system)
273 (let ((out (assoc-ref %outputs "out"))
274 (lua-version ,(version-major+minor (package-version lua))))
275 (list (string-append "PREFIX=" out)
276 (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version)))
279 (modify-phases %standard-phases
280 (delete 'configure))))
283 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
284 (synopsis "File system library for Lua")
285 (description "LuaFileSystem is a Lua library developed to complement the
286 set of functions related to file systems offered by the standard Lua
287 distribution. LuaFileSystem offers a portable way to access the underlying
288 directory structure and file attributes.")
289 (license (package-license lua-5.1))))
291 (define-public lua-filesystem
292 (make-lua-filesystem "lua-filesystem" lua))
294 (define-public lua5.1-filesystem
295 (make-lua-filesystem "lua5.1-filesystem" lua-5.1))
297 (define-public lua5.2-filesystem
298 (make-lua-filesystem "lua5.2-filesystem" lua-5.2))
300 (define (make-lua-ossl name lua)
306 (uri (string-append "https://25thandclement.com/~william/"
307 "projects/releases/luaossl-" version ".tgz"))
310 "10392bvd0lzyibipblgiss09zlqh3a5zgqg1b9lgbybpqb9cv2k3"))))
311 (build-system gnu-build-system)
314 (let ((out (assoc-ref %outputs "out"))
315 (lua-api-version ,(version-major+minor (package-version lua))))
317 "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
318 (string-append "prefix=" out)
319 (string-append "LUA_APIS=" lua-api-version)))
321 (modify-phases %standard-phases
324 (add-after 'install 'check
325 (lambda* (#:key outputs #:allow-other-keys)
326 (let ((out (assoc-ref outputs "out"))
327 (lua-version ,(version-major+minor (package-version lua))))
329 (string-append out "/lib/lua/" lua-version "/?.so;;"))
331 (string-append out "/share/lua/" lua-version "/?.lua;;"))
332 (with-directory-excursion "regress"
333 (for-each (lambda (f)
335 (find-files "." "^[0-9].*\\.lua$"))))
339 ("openssl" ,openssl)))
340 (home-page "https://25thandclement.com/~william/projects/luaossl.html")
341 (synopsis "OpenSSL bindings for Lua")
342 (description "The luaossl extension module for Lua provides comprehensive,
343 low-level bindings to the OpenSSL library, including support for certificate and
344 key management, key generation, signature verification, and deep bindings to the
345 distinguished name, alternative name, and X.509v3 extension interfaces. It also
346 binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG interfaces.")
347 (license license:expat)))
349 (define-public lua-ossl
350 (make-lua-ossl "lua-ossl" lua))
352 (define-public lua5.1-ossl
353 (make-lua-ossl "lua5.1-ossl" lua-5.1))
355 (define-public lua5.2-ossl
356 (make-lua-ossl "lua5.2-ossl" lua-5.2))
358 (define (make-lua-sec name lua)
365 (url "https://github.com/brunoos/luasec")
366 (commit (string-append "v" version))))
367 (file-name (git-file-name name version))
370 "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
371 (build-system gnu-build-system)
374 (let ((out (assoc-ref %outputs "out"))
375 (lua-version ,(version-major+minor (package-version lua))))
379 (string-append "LUAPATH=" out "/share/lua/" lua-version)
380 (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
381 #:tests? #f ; no tests included
383 (modify-phases %standard-phases
384 (delete 'configure))))
387 ("openssl" ,openssl)))
391 (format #f "lua~a-socket"
392 (version-major+minor (package-version lua))) lua))))
393 (home-page "https://github.com/brunoos/luasec/wiki")
394 (synopsis "OpenSSL bindings for Lua")
395 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
396 communication. It takes an already established TCP connection and creates a
397 secure session between the peers.")
398 (license license:expat)))
400 (define-public lua5.1-sec
401 (make-lua-sec "lua5.1-sec" lua-5.1))
403 (define-public lua5.2-sec
404 (make-lua-sec "lua5.2-sec" lua-5.2))
406 (define (make-lua-cqueues name lua lua-ossl)
412 (uri (string-append "https://25thandclement.com/~william/"
413 "projects/releases/cqueues-" version ".tgz"))
416 "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb"))))
417 (build-system gnu-build-system)
419 `(#:modules ((guix build gnu-build-system)
423 (let ((out (assoc-ref %outputs "out"))
424 (lua-api-version ,(version-major+minor (package-version lua))))
426 (string-append "LUA_APIS=" lua-api-version)))
428 (modify-phases %standard-phases
432 (lambda* (#:key make-flags outputs #:allow-other-keys)
433 (let ((out (assoc-ref outputs "out")))
434 (apply invoke "make" "install"
436 (list (string-append "DESTDIR=" out)
438 (add-after 'install 'check
439 (lambda* (#:key inputs outputs make-flags #:allow-other-keys)
441 ((lua-version ,(version-major+minor (package-version lua)))
442 (env-suffix (if (equal? lua-version "5.1")
446 (string-replace-substring lua-version "." "_"))))
448 (lua-ossl (assoc-ref inputs "lua-ossl"))
449 (out (assoc-ref outputs "out"))
451 (lua-cpath (lambda (p)
452 (string-append p "/lib/lua/" lua-version "/?.so")))
453 (lua-path (lambda (p)
454 (string-append p "/share/lua/" lua-version "/?.lua"))))
455 ;; The test suite sets Lua-version-specific search-path variables
456 ;; when available so we must do the same, as these take
457 ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
458 (setenv (string-append "LUA_CPATH" env-suffix)
460 (string-join (map lua-cpath (list out lua-ossl)) ";")
462 (setenv (string-append "LUA_PATH" env-suffix)
464 (string-join (map lua-path (list out lua-ossl)) ";")
467 ;; Skip regression tests we expect to fail
468 (with-directory-excursion "regress"
469 (for-each (lambda (f)
470 (rename-file f (string-append f ".skip")))
472 ;; Regression tests that require network
474 '("22-client-dtls.lua"
475 "30-starttls-completion.lua"
477 "153-dns-resolvers.lua")
479 ;; Regression tests that require LuaJIT
480 '("44-resolvers-gc.lua"
481 "51-join-defunct-thread.lua")
483 ;; Regression tests that require Lua 5.3
484 (if (not (equal? lua-version "5.3"))
485 '("152-thread-integer-passing.lua")
488 (apply invoke "make" "check" make-flags)))))))
493 ("openssl" ,openssl)))
495 `(("lua-ossl" ,lua-ossl)))
496 (home-page "https://25thandclement.com/~william/projects/cqueues.html")
497 (synopsis "Event loop for Lua using continuation queues")
498 (description "The cqueues extension module for Lua implements an event loop
499 that operates through the yielding and resumption of coroutines. It is designed
500 to be non-intrusive, composable, and embeddable within existing applications.")
501 (license license:expat)))
503 (define-public lua-cqueues
504 (make-lua-cqueues "lua-cqueues" lua lua-ossl))
506 (define-public lua5.1-cqueues
507 (make-lua-cqueues "lua5.1-cqueues" lua-5.1 lua5.1-ossl))
509 (define-public lua5.2-cqueues
510 (make-lua-cqueues "lua5.2-cqueues" lua-5.2 lua5.2-ossl))
512 (define-public lua-penlight
514 (name "lua-penlight")
520 (url "https://github.com/Tieske/Penlight")
522 (file-name (git-file-name name version))
524 (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
525 (build-system trivial-build-system)
529 `(("lua-filesystem" ,lua-filesystem)))
531 `(#:modules ((guix build utils))
534 (use-modules (guix build utils))
535 (let* ((source (assoc-ref %build-inputs "source"))
536 (lua-version ,(version-major+minor (package-version lua)))
537 (destination (string-append (assoc-ref %outputs "out")
538 "/share/lua/" lua-version)))
539 (mkdir-p destination)
540 (with-directory-excursion source
541 (copy-recursively "lua/" destination)))
543 (home-page "http://tieske.github.io/Penlight/")
544 (synopsis "Collection of general purpose libraries for the Lua language")
545 (description "Penlight is a set of pure Lua libraries focusing on
546 input data handling (such as reading configuration files), functional
547 programming (such as map, reduce, placeholder expressions,etc), and OS
548 path management. Much of the functionality is inspired by the Python
549 standard libraries.")
550 (license license:expat)))
552 (define-public lua-ldoc
560 (url "https://github.com/stevedonovan/LDoc")
562 (file-name (git-file-name name version))
564 (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
565 (build-system gnu-build-system)
569 `(("lua-penlight" ,lua-penlight)))
571 `(#:tests? #f ;tests must run after installation.
573 (modify-phases %standard-phases
574 (add-after 'unpack 'fix-installation-directory
575 (lambda* (#:key outputs #:allow-other-keys)
576 (let ((out (assoc-ref outputs "out"))
577 (lua-version ,(version-major+minor (package-version lua))))
578 (substitute* "makefile"
580 (("(LUA_PREFIX=).*" _ prefix)
581 (string-append prefix out "\n"))
582 (("(LUA_BINDIR=).*" _ prefix)
583 (string-append prefix out "/bin\n"))
584 (("(LUA_SHAREDIR=).*" _ prefix)
585 (string-append prefix out "/share/lua/" lua-version "\n"))))
588 (add-before 'install 'create-bin-directory
589 (lambda* (#:key outputs #:allow-other-keys)
590 (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
592 (home-page "http://stevedonovan.github.io/ldoc/")
593 (synopsis "Lua documentation generator")
595 "LDoc is a LuaDoc-compatible documentation generation system for
596 Lua source code. It parses the declaration and documentation comments
597 in a set of Lua source files and produces a set of XHTML pages
598 describing the commented declarations and functions.")
599 (license license:expat)))
601 (define (make-lua-lgi name lua)
609 (url "https://github.com/pavouk/lgi")
611 (file-name (git-file-name name version))
613 (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
614 (build-system gnu-build-system)
618 (string-append "PREFIX=" (assoc-ref %outputs "out")))
620 (modify-phases %standard-phases
621 (delete 'configure) ; no configure script
622 (add-before 'build 'set-env
623 (lambda* (#:key inputs #:allow-other-keys)
624 ;; We need to load cairo dynamically.
625 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
626 (setenv "LD_LIBRARY_PATH" cairo)
628 (add-before 'build 'set-lua-version
630 ;; Lua version and therefore install directories are hardcoded.
631 (substitute* "./lgi/Makefile"
635 ,(version-major+minor (package-version lua)))))
637 (add-before 'check 'skip-test-gtk
639 ;; FIXME: Skip GTK tests:
640 ;; gtk3 - can't get it to run with the xorg-server config below
641 ;; and some non-gtk tests will also fail
642 ;; gtk2 - lots of functions aren't implemented
643 ;; We choose gtk2 as the lesser evil and simply skip the test.
644 ;; Currently, awesome is the only package that uses lua-lgi but
645 ;; it doesn't need or interact with GTK using lua-lgi.
646 (substitute* "./tests/test.lua"
647 (("'gtk.lua',") "-- 'gtk.lua',"))
649 (add-before 'check 'start-xserver-instance
650 (lambda* (#:key inputs #:allow-other-keys)
651 ;; There must be a running X server during tests.
652 (system (format #f "~a/bin/Xvfb :1 &"
653 (assoc-ref inputs "xorg-server")))
654 (setenv "DISPLAY" ":1")
657 `(("dbus" ,dbus) ;tests use 'dbus-run-session'
658 ("pkg-config" ,pkg-config)))
662 ("gobject-introspection" ,gobject-introspection)
667 ("xorg-server" ,xorg-server)))
668 (home-page "https://github.com/pavouk/lgi/")
669 (synopsis "Lua bridge to GObject based libraries")
671 "LGI is gobject-introspection based dynamic Lua binding to GObject based
672 libraries. It allows using GObject-based libraries directly from Lua.
673 Notable examples are GTK+, GStreamer and Webkit.")
674 (license license:expat)))
676 (define-public lua-lgi
677 (make-lua-lgi "lua-lgi" lua))
679 (define-public lua5.1-lgi
680 (make-lua-lgi "lua5.1-lgi" lua-5.1))
682 (define-public lua5.2-lgi
683 (make-lua-lgi "lua5.2-lgi" lua-5.2))
685 (define (make-lua-lpeg name lua)
691 (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
694 (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
695 (build-system gnu-build-system)
698 (modify-phases %standard-phases
700 ;; `make install` isn't available, so we have to do it manually
702 (lambda* (#:key outputs #:allow-other-keys)
703 (let ((out (assoc-ref outputs "out"))
704 (lua-version ,(version-major+minor (package-version lua))))
705 (install-file "lpeg.so"
706 (string-append out "/lib/lua/" lua-version))
707 (install-file "re.lua"
708 (string-append out "/share/lua/" lua-version))
710 #:test-target "test"))
711 (inputs `(("lua" ,lua)))
712 (synopsis "Pattern-matching library for Lua")
714 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
716 (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
717 (license license:expat)))
719 (define-public lua-lpeg
720 (make-lua-lpeg "lua-lpeg" lua))
722 (define-public lua5.1-lpeg
723 (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
725 (define-public lua5.2-lpeg
726 (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
728 (define (make-lua-luv name lua)
733 ;; The release tarball includes the sources of libuv but does
734 ;; not include the pkg-config files.
737 (url "https://github.com/luvit/luv")
739 (file-name (git-file-name name version))
742 "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh"))))
743 (build-system cmake-build-system)
745 `(#:tests? #f ; there are none
747 '("-DWITH_LUA_ENGINE=Lua"
748 "-DWITH_SHARED_LIBUV=On"
750 "-DBUILD_SHARED_LIBS=On"
751 "-DLUA_BUILD_TYPE=System")
753 (modify-phases %standard-phases
754 (add-after 'unpack 'copy-lua-compat
755 (lambda* (#:key inputs #:allow-other-keys)
756 (copy-recursively (assoc-ref inputs "lua-compat")
759 (string-append (getcwd) "/lua-compat:"
760 (or (getenv "CPATH") "")))
770 (url "https://github.com/keplerproject/lua-compat-5.3")
771 (commit "daebe77a2f498817713df37f0bb316db1d82222f")))
772 (file-name "lua-compat-5.3-checkout")
775 "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz"))))))
776 (home-page "https://github.com/luvit/luv/")
777 (synopsis "Libuv bindings for Lua")
779 "This library makes libuv available to Lua scripts.")
780 (license license:asl2.0)))
782 (define-public lua-luv
783 (make-lua-luv "lua-luv" lua))
785 (define-public lua5.1-luv
786 (make-lua-luv "lua5.1-luv" lua-5.1))
788 (define-public lua5.2-luv
789 (make-lua-luv "lua5.2-luv" lua-5.2))
791 ;; Lua 5.3 is not supported.
792 (define (make-lua-bitop name lua)
798 (uri (string-append "http://bitop.luajit.org/download/"
799 "LuaBitOp-" version ".tar.gz"))
802 "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
803 (build-system gnu-build-system)
805 `(#:test-target "test"
807 (list "INSTALL=install -pD"
808 (string-append "INSTALLPATH=printf "
809 (assoc-ref %outputs "out")
811 ,(version-major+minor (package-version lua))
814 (modify-phases %standard-phases
815 (delete 'configure))))
816 (inputs `(("lua" ,lua)))
817 (home-page "https://bitop.luajit.org/index.html")
818 (synopsis "Bitwise operations on numbers for Lua")
820 "Lua BitOp is a C extension module for Lua which adds bitwise operations
822 (license license:expat)))
824 (define-public lua5.2-bitop
825 (make-lua-bitop "lua5.2-bitop" lua-5.2))
827 (define-public lua5.1-bitop
828 (make-lua-bitop "lua5.1-bitop" lua-5.1))
830 (define-public selene
833 (version "2017.08.25")
837 (url "https://github.com/jeremyong/Selene")
838 ;; The release is quite old.
839 (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
843 "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
844 (build-system cmake-build-system)
847 ;; lua pc file in CMakeLists.txt is lua5.3.pc
848 '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
851 ;; This is a header only library
852 (modify-phases %standard-phases
855 (lambda* (#:key inputs outputs #:allow-other-keys)
856 (let* ((output (assoc-ref outputs "out"))
857 (source (assoc-ref inputs "source"))
858 (includedir (string-append output "/include")))
860 (string-append source "/include")
863 ;; The path of test files are hard coded.
865 (lambda* (#:key inputs outputs #:allow-other-keys)
866 (let* ((output (assoc-ref outputs "out"))
867 (source (assoc-ref inputs "source"))
869 (testdir (string-append builddir "/test")))
870 (copy-recursively (string-append source "/test") testdir)
873 (copy-file "./test_runner" "./runner/test_runner")
875 (invoke "./test_runner")))))))
878 ("pkg-config" ,pkg-config)))
879 (home-page "https://github.com/jeremyong/Selene")
880 (synopsis "Lua C++11 bindings")
882 "Selene is a simple C++11 header-only library enabling seamless
883 interoperability between C++ and Lua programming language.")
884 (license license:zlib)))
886 (define-public lua-resty-core
888 (name "lua-resty-core")
893 (url "https://github.com/openresty/lua-resty-core")
894 (commit (string-append "v" version))))
895 (file-name (git-file-name name version))
898 "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
899 (build-system trivial-build-system)
901 `(#:modules ((guix build utils))
904 (use-modules (guix build utils))
905 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
906 (package-lua-resty (lambda (input output)
907 (mkdir-p (string-append output "/lib/lua"))
908 (copy-recursively (string-append input "/lib/resty")
909 (string-append output "/lib/lua/resty"))
910 (copy-recursively (string-append input "/lib/ngx")
911 (string-append output "/lib/ngx"))
912 (symlink (string-append output "/lib/lua/resty")
913 (string-append output "/lib/resty")))))
914 (package-lua-resty (assoc-ref %build-inputs "source")
915 (assoc-ref %outputs "out")))
917 (home-page "https://github.com/openresty/lua-resty-core")
918 (synopsis "Lua API for NGINX")
919 (description "This package provides a FFI-based Lua API for
920 @code{ngx_http_lua_module} or @code{ngx_stream_lua_module}.")
921 (license license:bsd-2)))
923 (define-public lua-resty-lrucache
925 (name "lua-resty-lrucache")
930 (url "https://github.com/openresty/lua-resty-lrucache")
931 (commit (string-append "v" version))))
932 (file-name (git-file-name name version))
935 "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
936 (build-system trivial-build-system)
938 `(#:modules ((guix build utils))
941 (use-modules (guix build utils))
942 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
943 (package-lua-resty (lambda (input output)
944 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
945 (copy-recursively (string-append input "/lib/resty")
946 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
947 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
948 (string-append output "/lib/resty")))))
949 (package-lua-resty (assoc-ref %build-inputs "source")
950 (assoc-ref %outputs "out")))
952 (home-page "https://github.com/openresty/lua-resty-lrucache")
953 (synopsis "Lua LRU cache based on the LuaJIT FFI")
955 "This package provides Lua LRU cache based on the LuaJIT FFI.")
956 (license license:bsd-2)))
958 (define-public lua-resty-signal
960 (name "lua-resty-signal")
965 (url "https://github.com/openresty/lua-resty-signal")
966 (commit (string-append "v" version))))
967 (file-name (git-file-name name version))
970 "13y1pqn45y49mhqwywasfdsid46d0c33yi6mrnracbnmvyxz1cif"))))
971 (build-system gnu-build-system)
973 `(#:tests? #f ;TODO: Run the test suite.
974 #:make-flags (list "CC=gcc"
975 (string-append "PREFIX=" %output))
977 (modify-phases %standard-phases
979 (add-after 'install 'install-lua
980 (lambda* (#:key inputs outputs #:allow-other-keys)
981 (use-modules (guix build utils))
982 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
983 (package-lua-resty (lambda (input output)
984 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
985 (copy-recursively (string-append input "/lib/resty")
986 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
987 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
988 (string-append output "/lib/resty")))))
989 (package-lua-resty (assoc-ref inputs "source")
990 (assoc-ref outputs "out")))
992 (home-page "https://github.com/openresty/lua-resty-signal")
993 (synopsis "Lua library for killing or sending signals to Linux processes")
994 (description "This package provides Lua library for killing or sending
995 signals to Linux processes.")
996 (license license:bsd-3)))
998 (define-public lua-tablepool
1000 (name "lua-tablepool")
1005 (url "https://github.com/openresty/lua-tablepool")
1006 (commit (string-append "v" version))))
1007 (file-name (git-file-name name version))
1010 "03yjj3w6znvj6843prg84m0lkrn49l901f9hj9bgy3cj9s0awl6y"))))
1011 (build-system trivial-build-system)
1013 `(#:modules ((guix build utils))
1016 (use-modules (guix build utils))
1017 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1018 (package-lua-resty (lambda (input output)
1019 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1020 (copy-recursively (string-append input "/lib")
1021 (string-append output "/lib")))))
1022 (package-lua-resty (assoc-ref %build-inputs "source")
1023 (assoc-ref %outputs "out")))
1025 (home-page "https://github.com/openresty/lua-tablepool")
1026 (synopsis "Lua table recycling pools for LuaJIT")
1027 (description "This package provides Lua table recycling pools for LuaJIT.")
1028 (license license:bsd-2)))
1030 (define-public lua-resty-shell
1032 (name "lua-resty-shell")
1037 (url "https://github.com/openresty/lua-resty-shell")
1038 (commit (string-append "v" version))))
1039 (file-name (git-file-name name version))
1042 "1s6g04ip4hr97r2pd8ry3alq063604s9a3l0hn9nsidh81ps4dp7"))))
1043 (build-system trivial-build-system)
1045 `(#:modules ((guix build utils))
1048 (use-modules (guix build utils))
1049 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1050 (package-lua-resty (lambda (input output)
1051 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1052 (copy-recursively (string-append input "/lib/resty")
1053 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1054 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1055 (string-append output "/lib/resty")))))
1056 (package-lua-resty (assoc-ref %build-inputs "source")
1057 (assoc-ref %outputs "out")))
1059 (home-page "https://github.com/openresty/lua-resty-shell")
1060 (synopsis "Lua module for nonblocking system shell command executions")
1061 (description "This package provides Lua module for nonblocking system
1062 shell command executions.")
1063 (license license:bsd-3)))