1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com>
4 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2016, 2017, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
9 ;;; Copyright © 2016, 2017, 2019 Clément Lassieur <clement@lassieur.org>
10 ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
11 ;;; Copyright © 2018, 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>
15 ;;; Copyright © 2020 Paul A. Patience <paul@apatience.com>
17 ;;; This file is part of GNU Guix.
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32 (define-module (gnu packages lua)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix utils)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system cmake)
40 #:use-module (guix build-system trivial)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages readline)
43 #:use-module (gnu packages m4)
44 #:use-module (gnu packages tls)
45 #:use-module (gnu packages xml)
46 #:use-module (gnu packages glib)
47 #:use-module (gnu packages libevent)
48 #:use-module (gnu packages libffi)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages xorg)
51 #:use-module (gnu packages gtk))
59 (uri (string-append "https://www.lua.org/ftp/lua-"
62 (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
63 (patches (search-patches "lua-pkgconfig.patch"
64 "lua-liblua-so.patch"))))
65 (build-system gnu-build-system)
66 (inputs `(("readline" ,readline)))
68 `(#:modules ((guix build gnu-build-system)
73 (list "MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
74 (string-append "CC=" ,(cc-for-target))
75 (string-append "SYSLIBS=-L" (assoc-ref %build-inputs "readline")
79 (modify-phases %standard-phases
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let ((out (assoc-ref outputs "out")))
84 (invoke "make" "install"
85 (string-append "INSTALL_TOP=" out)
86 (string-append "INSTALL_MAN=" out
87 "/share/man/man1"))))))))
88 (home-page "https://www.lua.org/")
89 (synopsis "Embeddable scripting language")
91 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
92 combines simple procedural syntax with powerful data description constructs
93 based on associative arrays and extensible semantics. Lua is dynamically typed,
94 runs by interpreting bytecode for a register-based virtual machine, and has
95 automatic memory management with incremental garbage collection, making it ideal
96 for configuration, scripting, and rapid prototyping.")
97 (license license:x11)))
99 (define-public lua-5.2
100 (package (inherit lua)
105 (uri (string-append "https://www.lua.org/ftp/lua-"
108 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
109 (patches (search-patches "lua-pkgconfig.patch"
110 "lua-liblua-so.patch"))))))
112 (define-public lua-5.1
113 (package (inherit lua)
117 (uri (string-append "https://www.lua.org/ftp/lua-"
120 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
121 (patches (search-patches "lua51-liblua-so.patch"
122 "lua-CVE-2014-5461.patch"
123 "lua51-pkgconfig.patch"))))))
125 (define-public luajit
128 (version "2.1.0-beta3")
131 (uri (string-append "http://luajit.org/download/LuaJIT-"
134 (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"))
135 (patches (search-patches "luajit-no_ldconfig.patch"))))
136 (build-system gnu-build-system)
138 `(#:tests? #f ; luajit is distributed without tests
140 (modify-phases %standard-phases
141 (delete 'configure) ; no configure script
142 (add-after 'install 'create-luajit-symlink
143 (lambda* (#:key outputs #:allow-other-keys)
144 (let* ((out (assoc-ref outputs "out"))
145 (bin (string-append out "/bin")))
146 (with-directory-excursion bin
147 (symlink ,(string-append name "-" version)
150 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
151 (home-page "https://www.luajit.org/")
152 (synopsis "Just in time compiler for Lua programming language version 5.1")
154 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
155 programming language. Lua is a powerful, dynamic and light-weight programming
156 language. It may be embedded or used as a general-purpose, stand-alone
158 (license license:x11)))
160 (define (make-lua-expat name lua)
166 (uri (string-append "https://matthewwild.co.uk/projects/"
167 "luaexpat/luaexpat-" version ".tar.gz"))
170 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
171 (build-system gnu-build-system)
174 (let ((out (assoc-ref %outputs "out"))
175 (lua-version ,(version-major+minor (package-version lua))))
177 (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
178 (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
180 (modify-phases %standard-phases
184 (setenv "LUA_CPATH" "src/?.so;;")
185 (setenv "LUA_PATH" "src/?.lua;;")
186 (invoke "lua" "tests/test.lua")
187 (invoke "lua" "tests/test-lom.lua"))))))
191 (home-page "https://matthewwild.co.uk/projects/luaexpat/")
192 (synopsis "SAX XML parser based on the Expat library")
193 (description "LuaExpat is a SAX XML parser based on the Expat library.")
194 (license (package-license lua-5.1))))
196 (define-public lua5.1-expat
197 (make-lua-expat "lua5.1-expat" lua-5.1))
199 (define-public lua5.2-expat
200 (make-lua-expat "lua5.2-expat" lua-5.2))
202 (define (make-lua-socket name lua)
209 (url "https://github.com/diegonehab/luasocket")
210 (commit (string-append "v" version))))
211 (file-name (git-file-name name version))
214 "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
215 (build-system gnu-build-system)
218 (let ((out (assoc-ref %outputs "out"))
219 (lua-version ,(version-major+minor (package-version lua))))
220 (list (string-append "INSTALL_TOP=" out)
221 (string-append "LUAV?=" lua-version)))
223 (modify-phases %standard-phases
227 (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
228 (setenv "LUA_PATH" "src/?.lua;;")
229 (when (zero? (primitive-fork))
230 (invoke "lua" "test/testsrvr.lua"))
231 (invoke "lua" "test/testclnt.lua"))))))
234 (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
235 (synopsis "Socket library for Lua")
236 (description "LuaSocket is a Lua extension library that is composed by two
237 parts: a C core that provides support for the TCP and UDP transport layers,
238 and a set of Lua modules that add support for functionality commonly needed by
239 applications that deal with the Internet.
241 Among the supported modules, the most commonly used implement the
242 SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
243 files) client protocols. These provide a very natural and generic interface
244 to the functionality defined by each protocol. In addition, you will find
245 that the MIME (common encodings), URL (anything you could possible want to do
246 with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
248 (license license:expat)))
250 (define-public lua5.1-socket
251 (make-lua-socket "lua5.1-socket" lua-5.1))
253 (define-public lua5.2-socket
254 (make-lua-socket "lua5.2-socket" lua-5.2))
256 (define (make-lua-filesystem name lua)
263 (url "https://github.com/keplerproject/luafilesystem")
264 (commit (string-append "v"
266 (string-split version #\.) "_")))))
267 (file-name (git-file-name name version))
270 "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
271 (build-system gnu-build-system)
274 (let ((out (assoc-ref %outputs "out"))
275 (lua-version ,(version-major+minor (package-version lua))))
276 (list (string-append "PREFIX=" out)
277 (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version)))
280 (modify-phases %standard-phases
281 (delete 'configure))))
284 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
285 (synopsis "File system library for Lua")
286 (description "LuaFileSystem is a Lua library developed to complement the
287 set of functions related to file systems offered by the standard Lua
288 distribution. LuaFileSystem offers a portable way to access the underlying
289 directory structure and file attributes.")
290 (license (package-license lua-5.1))))
292 (define-public lua-filesystem
293 (make-lua-filesystem "lua-filesystem" lua))
295 (define-public lua5.1-filesystem
296 (make-lua-filesystem "lua5.1-filesystem" lua-5.1))
298 (define-public lua5.2-filesystem
299 (make-lua-filesystem "lua5.2-filesystem" lua-5.2))
301 (define (make-lua-ossl name lua)
307 (uri (string-append "https://25thandclement.com/~william/"
308 "projects/releases/luaossl-" version ".tgz"))
311 "10392bvd0lzyibipblgiss09zlqh3a5zgqg1b9lgbybpqb9cv2k3"))))
312 (build-system gnu-build-system)
315 (let ((out (assoc-ref %outputs "out"))
316 (lua-api-version ,(version-major+minor (package-version lua))))
318 "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
319 (string-append "prefix=" out)
320 (string-append "LUA_APIS=" lua-api-version)))
322 (modify-phases %standard-phases
325 (add-after 'install 'check
326 (lambda* (#:key outputs #:allow-other-keys)
327 (let ((out (assoc-ref outputs "out"))
328 (lua-version ,(version-major+minor (package-version lua))))
330 (string-append out "/lib/lua/" lua-version "/?.so;;"))
332 (string-append out "/share/lua/" lua-version "/?.lua;;"))
333 (with-directory-excursion "regress"
334 (for-each (lambda (f)
336 (find-files "." "^[0-9].*\\.lua$"))))
340 ("openssl" ,openssl)))
341 (home-page "https://25thandclement.com/~william/projects/luaossl.html")
342 (synopsis "OpenSSL bindings for Lua")
343 (description "The luaossl extension module for Lua provides comprehensive,
344 low-level bindings to the OpenSSL library, including support for certificate and
345 key management, key generation, signature verification, and deep bindings to the
346 distinguished name, alternative name, and X.509v3 extension interfaces. It also
347 binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG interfaces.")
348 (license license:expat)))
350 (define-public lua-ossl
351 (make-lua-ossl "lua-ossl" lua))
353 (define-public lua5.1-ossl
354 (make-lua-ossl "lua5.1-ossl" lua-5.1))
356 (define-public lua5.2-ossl
357 (make-lua-ossl "lua5.2-ossl" lua-5.2))
359 (define (make-lua-sec name lua)
366 (url "https://github.com/brunoos/luasec")
367 (commit (string-append "v" version))))
368 (file-name (git-file-name name version))
371 "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
372 (build-system gnu-build-system)
375 (let ((out (assoc-ref %outputs "out"))
376 (lua-version ,(version-major+minor (package-version lua))))
380 (string-append "LUAPATH=" out "/share/lua/" lua-version)
381 (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
382 #:tests? #f ; no tests included
384 (modify-phases %standard-phases
385 (delete 'configure))))
388 ("openssl" ,openssl)))
392 (format #f "lua~a-socket"
393 (version-major+minor (package-version lua))) lua))))
394 (home-page "https://github.com/brunoos/luasec/wiki")
395 (synopsis "OpenSSL bindings for Lua")
396 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
397 communication. It takes an already established TCP connection and creates a
398 secure session between the peers.")
399 (license license:expat)))
401 (define-public lua5.1-sec
402 (make-lua-sec "lua5.1-sec" lua-5.1))
404 (define-public lua5.2-sec
405 (make-lua-sec "lua5.2-sec" lua-5.2))
407 (define (make-lua-cqueues name lua lua-ossl)
413 (uri (string-append "https://25thandclement.com/~william/"
414 "projects/releases/cqueues-" version ".tgz"))
417 "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb"))))
418 (build-system gnu-build-system)
420 `(#:modules ((guix build gnu-build-system)
424 (let ((out (assoc-ref %outputs "out"))
425 (lua-api-version ,(version-major+minor (package-version lua))))
427 (string-append "LUA_APIS=" lua-api-version)))
429 (modify-phases %standard-phases
433 (lambda* (#:key make-flags outputs #:allow-other-keys)
434 (let ((out (assoc-ref outputs "out")))
435 (apply invoke "make" "install"
437 (list (string-append "DESTDIR=" out)
439 (add-after 'install 'check
440 (lambda* (#:key inputs outputs make-flags #:allow-other-keys)
442 ((lua-version ,(version-major+minor (package-version lua)))
443 (env-suffix (if (equal? lua-version "5.1")
447 (string-replace-substring lua-version "." "_"))))
449 (lua-ossl (assoc-ref inputs "lua-ossl"))
450 (out (assoc-ref outputs "out"))
452 (lua-cpath (lambda (p)
453 (string-append p "/lib/lua/" lua-version "/?.so")))
454 (lua-path (lambda (p)
455 (string-append p "/share/lua/" lua-version "/?.lua"))))
456 ;; The test suite sets Lua-version-specific search-path variables
457 ;; when available so we must do the same, as these take
458 ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
459 (setenv (string-append "LUA_CPATH" env-suffix)
461 (string-join (map lua-cpath (list out lua-ossl)) ";")
463 (setenv (string-append "LUA_PATH" env-suffix)
465 (string-join (map lua-path (list out lua-ossl)) ";")
468 ;; Skip regression tests we expect to fail
469 (with-directory-excursion "regress"
470 (for-each (lambda (f)
471 (rename-file f (string-append f ".skip")))
473 ;; Regression tests that require network
475 '("22-client-dtls.lua"
476 "30-starttls-completion.lua"
478 "153-dns-resolvers.lua")
480 ;; Regression tests that require LuaJIT
481 '("44-resolvers-gc.lua"
482 "51-join-defunct-thread.lua")
484 ;; Regression tests that require Lua 5.3
485 (if (not (equal? lua-version "5.3"))
486 '("152-thread-integer-passing.lua")
489 (apply invoke "make" "check" make-flags)))))))
494 ("openssl" ,openssl)))
496 `(("lua-ossl" ,lua-ossl)))
497 (home-page "https://25thandclement.com/~william/projects/cqueues.html")
498 (synopsis "Event loop for Lua using continuation queues")
499 (description "The cqueues extension module for Lua implements an event loop
500 that operates through the yielding and resumption of coroutines. It is designed
501 to be non-intrusive, composable, and embeddable within existing applications.")
502 (license license:expat)))
504 (define-public lua-cqueues
505 (make-lua-cqueues "lua-cqueues" lua lua-ossl))
507 (define-public lua5.1-cqueues
508 (make-lua-cqueues "lua5.1-cqueues" lua-5.1 lua5.1-ossl))
510 (define-public lua5.2-cqueues
511 (make-lua-cqueues "lua5.2-cqueues" lua-5.2 lua5.2-ossl))
513 (define-public lua-penlight
515 (name "lua-penlight")
521 (url "https://github.com/Tieske/Penlight")
523 (file-name (git-file-name name version))
525 (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
526 (build-system trivial-build-system)
530 `(("lua-filesystem" ,lua-filesystem)))
532 `(#:modules ((guix build utils))
535 (use-modules (guix build utils))
536 (let* ((source (assoc-ref %build-inputs "source"))
537 (lua-version ,(version-major+minor (package-version lua)))
538 (destination (string-append (assoc-ref %outputs "out")
539 "/share/lua/" lua-version)))
540 (mkdir-p destination)
541 (with-directory-excursion source
542 (copy-recursively "lua/" destination)))
544 (home-page "http://tieske.github.io/Penlight/")
545 (synopsis "Collection of general purpose libraries for the Lua language")
546 (description "Penlight is a set of pure Lua libraries focusing on
547 input data handling (such as reading configuration files), functional
548 programming (such as map, reduce, placeholder expressions,etc), and OS
549 path management. Much of the functionality is inspired by the Python
550 standard libraries.")
551 (license license:expat)))
553 (define-public lua-ldoc
561 (url "https://github.com/stevedonovan/LDoc")
563 (file-name (git-file-name name version))
565 (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
566 (build-system gnu-build-system)
570 `(("lua-penlight" ,lua-penlight)))
572 `(#:tests? #f ;tests must run after installation.
574 (modify-phases %standard-phases
575 (add-after 'unpack 'fix-installation-directory
576 (lambda* (#:key outputs #:allow-other-keys)
577 (let ((out (assoc-ref outputs "out"))
578 (lua-version ,(version-major+minor (package-version lua))))
579 (substitute* "makefile"
581 (("(LUA_PREFIX=).*" _ prefix)
582 (string-append prefix out "\n"))
583 (("(LUA_BINDIR=).*" _ prefix)
584 (string-append prefix out "/bin\n"))
585 (("(LUA_SHAREDIR=).*" _ prefix)
586 (string-append prefix out "/share/lua/" lua-version "\n"))))
589 (add-before 'install 'create-bin-directory
590 (lambda* (#:key outputs #:allow-other-keys)
591 (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
593 (home-page "http://stevedonovan.github.io/ldoc/")
594 (synopsis "Lua documentation generator")
596 "LDoc is a LuaDoc-compatible documentation generation system for
597 Lua source code. It parses the declaration and documentation comments
598 in a set of Lua source files and produces a set of XHTML pages
599 describing the commented declarations and functions.")
600 (license license:expat)))
602 (define (make-lua-lgi name lua)
610 (url "https://github.com/pavouk/lgi")
612 (file-name (git-file-name name version))
614 (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
615 (build-system gnu-build-system)
619 (string-append "PREFIX=" (assoc-ref %outputs "out")))
621 (modify-phases %standard-phases
622 (delete 'configure) ; no configure script
623 (add-before 'build 'set-env
624 (lambda* (#:key inputs #:allow-other-keys)
625 ;; We need to load cairo dynamically.
626 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
627 (setenv "LD_LIBRARY_PATH" cairo)
629 (add-before 'build 'set-lua-version
631 ;; Lua version and therefore install directories are hardcoded.
632 (substitute* "./lgi/Makefile"
636 ,(version-major+minor (package-version lua)))))
638 (add-before 'check 'skip-test-gtk
640 ;; FIXME: Skip GTK tests:
641 ;; gtk3 - can't get it to run with the xorg-server config below
642 ;; and some non-gtk tests will also fail
643 ;; gtk2 - lots of functions aren't implemented
644 ;; We choose gtk2 as the lesser evil and simply skip the test.
645 ;; Currently, awesome is the only package that uses lua-lgi but
646 ;; it doesn't need or interact with GTK using lua-lgi.
647 (substitute* "./tests/test.lua"
648 (("'gtk.lua',") "-- 'gtk.lua',"))
650 (add-before 'check 'start-xserver-instance
651 (lambda* (#:key inputs #:allow-other-keys)
652 ;; There must be a running X server during tests.
653 (system (format #f "~a/bin/Xvfb :1 &"
654 (assoc-ref inputs "xorg-server")))
655 (setenv "DISPLAY" ":1")
658 `(("dbus" ,dbus) ;tests use 'dbus-run-session'
659 ("pkg-config" ,pkg-config)))
663 ("gobject-introspection" ,gobject-introspection)
668 ("xorg-server" ,xorg-server)))
669 (home-page "https://github.com/pavouk/lgi/")
670 (synopsis "Lua bridge to GObject based libraries")
672 "LGI is gobject-introspection based dynamic Lua binding to GObject based
673 libraries. It allows using GObject-based libraries directly from Lua.
674 Notable examples are GTK+, GStreamer and Webkit.")
675 (license license:expat)))
677 (define-public lua-lgi
678 (make-lua-lgi "lua-lgi" lua))
680 (define-public lua5.1-lgi
681 (make-lua-lgi "lua5.1-lgi" lua-5.1))
683 (define-public lua5.2-lgi
684 (make-lua-lgi "lua5.2-lgi" lua-5.2))
686 (define (make-lua-lpeg name lua)
692 (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
695 (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
696 (build-system gnu-build-system)
699 (modify-phases %standard-phases
701 ;; `make install` isn't available, so we have to do it manually
703 (lambda* (#:key outputs #:allow-other-keys)
704 (let ((out (assoc-ref outputs "out"))
705 (lua-version ,(version-major+minor (package-version lua))))
706 (install-file "lpeg.so"
707 (string-append out "/lib/lua/" lua-version))
708 (install-file "re.lua"
709 (string-append out "/share/lua/" lua-version))
711 #:test-target "test"))
712 (inputs `(("lua" ,lua)))
713 (synopsis "Pattern-matching library for Lua")
715 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
717 (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
718 (license license:expat)))
720 (define-public lua-lpeg
721 (make-lua-lpeg "lua-lpeg" lua))
723 (define-public lua5.1-lpeg
724 (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
726 (define-public lua5.2-lpeg
727 (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
729 (define (make-lua-luv name lua)
734 ;; The release tarball includes the sources of libuv but does
735 ;; not include the pkg-config files.
738 (url "https://github.com/luvit/luv")
740 (file-name (git-file-name name version))
743 "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh"))))
744 (build-system cmake-build-system)
746 `(#:tests? #f ; there are none
748 '("-DWITH_LUA_ENGINE=Lua"
749 "-DWITH_SHARED_LIBUV=On"
751 "-DBUILD_SHARED_LIBS=On"
752 "-DLUA_BUILD_TYPE=System")
754 (modify-phases %standard-phases
755 (add-after 'unpack 'copy-lua-compat
756 (lambda* (#:key inputs #:allow-other-keys)
757 (copy-recursively (assoc-ref inputs "lua-compat")
760 (string-append (getcwd) "/lua-compat:"
761 (or (getenv "CPATH") "")))
771 (url "https://github.com/keplerproject/lua-compat-5.3")
772 (commit "daebe77a2f498817713df37f0bb316db1d82222f")))
773 (file-name "lua-compat-5.3-checkout")
776 "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz"))))))
777 (home-page "https://github.com/luvit/luv/")
778 (synopsis "Libuv bindings for Lua")
780 "This library makes libuv available to Lua scripts.")
781 (license license:asl2.0)))
783 (define-public lua-luv
784 (make-lua-luv "lua-luv" lua))
786 (define-public lua5.1-luv
787 (make-lua-luv "lua5.1-luv" lua-5.1))
789 (define-public lua5.2-luv
790 (make-lua-luv "lua5.2-luv" lua-5.2))
792 ;; Lua 5.3 is not supported.
793 (define (make-lua-bitop name lua)
799 (uri (string-append "http://bitop.luajit.org/download/"
800 "LuaBitOp-" version ".tar.gz"))
803 "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
804 (build-system gnu-build-system)
806 `(#:test-target "test"
808 (list "INSTALL=install -pD"
809 (string-append "INSTALLPATH=printf "
810 (assoc-ref %outputs "out")
812 ,(version-major+minor (package-version lua))
815 (modify-phases %standard-phases
816 (delete 'configure))))
817 (inputs `(("lua" ,lua)))
818 (home-page "https://bitop.luajit.org/index.html")
819 (synopsis "Bitwise operations on numbers for Lua")
821 "Lua BitOp is a C extension module for Lua which adds bitwise operations
823 (license license:expat)))
825 (define-public lua5.2-bitop
826 (make-lua-bitop "lua5.2-bitop" lua-5.2))
828 (define-public lua5.1-bitop
829 (make-lua-bitop "lua5.1-bitop" lua-5.1))
831 (define-public selene
834 (version "2017.08.25")
838 (url "https://github.com/jeremyong/Selene")
839 ;; The release is quite old.
840 (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
844 "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
845 (build-system cmake-build-system)
848 ;; lua pc file in CMakeLists.txt is lua5.3.pc
849 '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
852 ;; This is a header only library
853 (modify-phases %standard-phases
856 (lambda* (#:key inputs outputs #:allow-other-keys)
857 (let* ((output (assoc-ref outputs "out"))
858 (source (assoc-ref inputs "source"))
859 (includedir (string-append output "/include")))
861 (string-append source "/include")
864 ;; The path of test files are hard coded.
866 (lambda* (#:key inputs outputs #:allow-other-keys)
867 (let* ((output (assoc-ref outputs "out"))
868 (source (assoc-ref inputs "source"))
870 (testdir (string-append builddir "/test")))
871 (copy-recursively (string-append source "/test") testdir)
874 (copy-file "./test_runner" "./runner/test_runner")
876 (invoke "./test_runner")))))))
879 ("pkg-config" ,pkg-config)))
880 (home-page "https://github.com/jeremyong/Selene")
881 (synopsis "Lua C++11 bindings")
883 "Selene is a simple C++11 header-only library enabling seamless
884 interoperability between C++ and Lua programming language.")
885 (license license:zlib)))
887 (define-public lua-resty-core
889 (name "lua-resty-core")
894 (url "https://github.com/openresty/lua-resty-core")
895 (commit (string-append "v" version))))
896 (file-name (git-file-name name version))
899 "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
900 (build-system trivial-build-system)
902 `(#:modules ((guix build utils))
905 (use-modules (guix build utils))
906 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
907 (package-lua-resty (lambda (input output)
908 (mkdir-p (string-append output "/lib/lua"))
909 (copy-recursively (string-append input "/lib/resty")
910 (string-append output "/lib/lua/resty"))
911 (copy-recursively (string-append input "/lib/ngx")
912 (string-append output "/lib/ngx"))
913 (symlink (string-append output "/lib/lua/resty")
914 (string-append output "/lib/resty")))))
915 (package-lua-resty (assoc-ref %build-inputs "source")
916 (assoc-ref %outputs "out")))
918 (home-page "https://github.com/openresty/lua-resty-core")
919 (synopsis "Lua API for NGINX")
920 (description "This package provides a FFI-based Lua API for
921 @code{ngx_http_lua_module} or @code{ngx_stream_lua_module}.")
922 (license license:bsd-2)))
924 (define-public lua-resty-lrucache
926 (name "lua-resty-lrucache")
931 (url "https://github.com/openresty/lua-resty-lrucache")
932 (commit (string-append "v" version))))
933 (file-name (git-file-name name version))
936 "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
937 (build-system trivial-build-system)
939 `(#:modules ((guix build utils))
942 (use-modules (guix build utils))
943 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
944 (package-lua-resty (lambda (input output)
945 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
946 (copy-recursively (string-append input "/lib/resty")
947 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
948 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
949 (string-append output "/lib/resty")))))
950 (package-lua-resty (assoc-ref %build-inputs "source")
951 (assoc-ref %outputs "out")))
953 (home-page "https://github.com/openresty/lua-resty-lrucache")
954 (synopsis "Lua LRU cache based on the LuaJIT FFI")
956 "This package provides Lua LRU cache based on the LuaJIT FFI.")
957 (license license:bsd-2)))
959 (define-public lua-resty-signal
961 (name "lua-resty-signal")
966 (url "https://github.com/openresty/lua-resty-signal")
967 (commit (string-append "v" version))))
968 (file-name (git-file-name name version))
971 "13y1pqn45y49mhqwywasfdsid46d0c33yi6mrnracbnmvyxz1cif"))))
972 (build-system gnu-build-system)
974 `(#:tests? #f ;TODO: Run the test suite.
975 #:make-flags (list "CC=gcc"
976 (string-append "PREFIX=" %output))
978 (modify-phases %standard-phases
980 (add-after 'install 'install-lua
981 (lambda* (#:key inputs outputs #:allow-other-keys)
982 (use-modules (guix build utils))
983 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
984 (package-lua-resty (lambda (input output)
985 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
986 (copy-recursively (string-append input "/lib/resty")
987 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
988 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
989 (string-append output "/lib/resty")))))
990 (package-lua-resty (assoc-ref inputs "source")
991 (assoc-ref outputs "out")))
993 (home-page "https://github.com/openresty/lua-resty-signal")
994 (synopsis "Lua library for killing or sending signals to Linux processes")
995 (description "This package provides Lua library for killing or sending
996 signals to Linux processes.")
997 (license license:bsd-3)))
999 (define-public lua-tablepool
1001 (name "lua-tablepool")
1006 (url "https://github.com/openresty/lua-tablepool")
1007 (commit (string-append "v" version))))
1008 (file-name (git-file-name name version))
1011 "03yjj3w6znvj6843prg84m0lkrn49l901f9hj9bgy3cj9s0awl6y"))))
1012 (build-system trivial-build-system)
1014 `(#:modules ((guix build utils))
1017 (use-modules (guix build utils))
1018 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1019 (package-lua-resty (lambda (input output)
1020 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1021 (copy-recursively (string-append input "/lib")
1022 (string-append output "/lib")))))
1023 (package-lua-resty (assoc-ref %build-inputs "source")
1024 (assoc-ref %outputs "out")))
1026 (home-page "https://github.com/openresty/lua-tablepool")
1027 (synopsis "Lua table recycling pools for LuaJIT")
1028 (description "This package provides Lua table recycling pools for LuaJIT.")
1029 (license license:bsd-2)))
1031 (define-public lua-resty-shell
1033 (name "lua-resty-shell")
1038 (url "https://github.com/openresty/lua-resty-shell")
1039 (commit (string-append "v" version))))
1040 (file-name (git-file-name name version))
1043 "1s6g04ip4hr97r2pd8ry3alq063604s9a3l0hn9nsidh81ps4dp7"))))
1044 (build-system trivial-build-system)
1046 `(#:modules ((guix build utils))
1049 (use-modules (guix build utils))
1050 (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
1051 (package-lua-resty (lambda (input output)
1052 (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
1053 (copy-recursively (string-append input "/lib/resty")
1054 (string-append output "/lib/lua/" luajit-major+minor "/resty"))
1055 (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
1056 (string-append output "/lib/resty")))))
1057 (package-lua-resty (assoc-ref %build-inputs "source")
1058 (assoc-ref %outputs "out")))
1060 (home-page "https://github.com/openresty/lua-resty-shell")
1061 (synopsis "Lua module for nonblocking system shell command executions")
1062 (description "This package provides Lua module for nonblocking system
1063 shell command executions.")
1064 (license license:bsd-3)))
1066 (define-public fennel
1073 (url "https://git.sr.ht/~technomancy/fennel")
1075 (file-name (git-file-name name version))
1078 "1jng33vmnk6mi37l3x2z0plng940jpj7kz1s493ki80z3mkaxjfg"))
1079 (modules '((guix build utils)))
1082 (delete-file "fennelview.lua") #t))))
1083 (build-system gnu-build-system)
1085 '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
1086 #:tests? #t ; even on cross-build
1087 #:test-target "test"
1089 (modify-phases %standard-phases
1091 (add-before 'build 'patch-lua-calls
1092 (lambda* (#:key inputs #:allow-other-keys)
1093 (let ((lua (string-append (assoc-ref inputs "lua") "/bin/lua")))
1095 (substitute* "old/launcher.lua"
1096 (("/usr/bin/env lua") lua))
1098 (add-after 'build 'patch-fennel
1099 (lambda* (#:key inputs #:allow-other-keys)
1100 (substitute* "fennel"
1101 (("/usr/bin/env .*lua")
1102 (string-append (assoc-ref inputs "lua") "/bin/lua")))
1105 (add-after 'install 'check
1106 (assoc-ref %standard-phases 'check))
1107 (add-after 'install 'install-manpage
1108 (lambda* (#:key outputs #:allow-other-keys)
1109 (install-file "fennel.1"
1110 (string-append (assoc-ref outputs "out")
1113 (inputs `(("lua" ,lua)))
1114 (home-page "https://fennel-lang.org/")
1115 (synopsis "Lisp that compiles to Lua")
1117 "Fennel is a programming language that brings together the speed,
1118 simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro
1120 (license license:expat)))