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 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 '("MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
75 (modify-phases %standard-phases
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")
87 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
88 combines simple procedural syntax with powerful data description constructs
89 based on associative arrays and extensible semantics. Lua is dynamically typed,
90 runs by interpreting bytecode for a register-based virtual machine, and has
91 automatic memory management with incremental garbage collection, making it ideal
92 for configuration, scripting, and rapid prototyping.")
93 (license license:x11)))
95 (define-public lua-5.2
96 (package (inherit lua)
101 (uri (string-append "https://www.lua.org/ftp/lua-"
104 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
105 (patches (search-patches "lua-pkgconfig.patch"
106 "lua-liblua-so.patch"))))))
108 (define-public lua-5.1
109 (package (inherit lua)
113 (uri (string-append "https://www.lua.org/ftp/lua-"
116 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
117 (patches (search-patches "lua51-liblua-so.patch"
118 "lua-CVE-2014-5461.patch"
119 "lua51-pkgconfig.patch"))))))
121 (define-public luajit
124 (version "2.1.0-beta3")
127 (uri (string-append "http://luajit.org/download/LuaJIT-"
130 (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"))
131 (patches (search-patches "luajit-no_ldconfig.patch"))))
132 (build-system gnu-build-system)
134 `(#:tests? #f ; luajit is distributed without tests
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)
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")
150 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
151 programming language. Lua is a powerful, dynamic and light-weight programming
152 language. It may be embedded or used as a general-purpose, stand-alone
154 (license license:x11)))
156 (define (make-lua-expat name lua)
162 (uri (string-append "https://matthewwild.co.uk/projects/"
163 "luaexpat/luaexpat-" version ".tar.gz"))
166 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
167 (build-system gnu-build-system)
170 (let ((out (assoc-ref %outputs "out"))
171 (lua-version ,(version-major+minor (package-version lua))))
173 (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
174 (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
176 (modify-phases %standard-phases
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"))))))
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))))
192 (define-public lua5.1-expat
193 (make-lua-expat "lua5.1-expat" lua-5.1))
195 (define-public lua5.2-expat
196 (make-lua-expat "lua5.2-expat" lua-5.2))
198 (define (make-lua-socket name lua)
205 (url "https://github.com/diegonehab/luasocket")
206 (commit (string-append "v" version))))
207 (file-name (git-file-name name version))
210 "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
211 (build-system gnu-build-system)
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)))
219 (modify-phases %standard-phases
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"))))))
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
233 parts: a C core that provides support for the TCP and UDP transport layers,
234 and a set of Lua modules that add support for functionality commonly needed by
235 applications that deal with the Internet.
237 Among the supported modules, the most commonly used implement the
238 SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
239 files) client protocols. These provide a very natural and generic interface
240 to the functionality defined by each protocol. In addition, you will find
241 that the MIME (common encodings), URL (anything you could possible want to do
242 with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
244 (license license:expat)))
246 (define-public lua5.1-socket
247 (make-lua-socket "lua5.1-socket" lua-5.1))
249 (define-public lua5.2-socket
250 (make-lua-socket "lua5.2-socket" lua-5.2))
252 (define (make-lua-filesystem name lua)
259 (url "https://github.com/keplerproject/luafilesystem")
260 (commit (string-append "v"
262 (string-split version #\.) "_")))))
263 (file-name (git-file-name name version))
266 "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
267 (build-system gnu-build-system)
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)))
276 (modify-phases %standard-phases
277 (delete 'configure))))
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
283 set of functions related to file systems offered by the standard Lua
284 distribution. LuaFileSystem offers a portable way to access the underlying
285 directory structure and file attributes.")
286 (license (package-license lua-5.1))))
288 (define-public lua-filesystem
289 (make-lua-filesystem "lua-filesystem" lua))
291 (define-public lua5.1-filesystem
292 (make-lua-filesystem "lua5.1-filesystem" lua-5.1))
294 (define-public lua5.2-filesystem
295 (make-lua-filesystem "lua5.2-filesystem" lua-5.2))
297 (define (make-lua-ossl name lua)
303 (uri (string-append "https://25thandclement.com/~william/"
304 "projects/releases/luaossl-" version ".tgz"))
307 "10392bvd0lzyibipblgiss09zlqh3a5zgqg1b9lgbybpqb9cv2k3"))))
308 (build-system gnu-build-system)
311 (let ((out (assoc-ref %outputs "out"))
312 (lua-api-version ,(version-major+minor (package-version lua))))
314 "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
315 (string-append "DESTDIR=" out)
316 (string-append "LUA_APIS=" lua-api-version)
319 (modify-phases %standard-phases
322 (add-after 'install 'check
323 (lambda* (#:key outputs #:allow-other-keys)
324 (let ((out (assoc-ref outputs "out"))
325 (lua-version ,(version-major+minor (package-version lua))))
327 (string-append out "/lib/lua/" lua-version "/?.so;;"))
329 (string-append out "/share/lua/" lua-version "/?.lua;;"))
330 (with-directory-excursion "regress"
331 (for-each (lambda (f)
333 (find-files "." "^[0-9].*\\.lua$"))))
337 ("openssl" ,openssl)))
338 (home-page "https://25thandclement.com/~william/projects/luaossl.html")
339 (synopsis "OpenSSL bindings for Lua")
340 (description "The luaossl extension module for Lua provides comprehensive,
341 low-level bindings to the OpenSSL library, including support for certificate and
342 key management, key generation, signature verification, and deep bindings to the
343 distinguished name, alternative name, and X.509v3 extension interfaces. It also
344 binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG interfaces.")
345 (license license:expat)))
347 (define-public lua-ossl
348 (make-lua-ossl "lua-ossl" lua))
350 (define-public lua5.1-ossl
351 (make-lua-ossl "lua5.1-ossl" lua-5.1))
353 (define-public lua5.2-ossl
354 (make-lua-ossl "lua5.2-ossl" lua-5.2))
356 (define (make-lua-sec name lua)
363 (url "https://github.com/brunoos/luasec")
364 (commit (string-append "v" version))))
365 (file-name (git-file-name name version))
368 "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
369 (build-system gnu-build-system)
372 (let ((out (assoc-ref %outputs "out"))
373 (lua-version ,(version-major+minor (package-version lua))))
377 (string-append "LUAPATH=" out "/share/lua/" lua-version)
378 (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
379 #:tests? #f ; no tests included
381 (modify-phases %standard-phases
382 (delete 'configure))))
385 ("openssl" ,openssl)))
389 (format #f "lua~a-socket"
390 (version-major+minor (package-version lua))) lua))))
391 (home-page "https://github.com/brunoos/luasec/wiki")
392 (synopsis "OpenSSL bindings for Lua")
393 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
394 communication. It takes an already established TCP connection and creates a
395 secure session between the peers.")
396 (license license:expat)))
398 (define-public lua5.1-sec
399 (make-lua-sec "lua5.1-sec" lua-5.1))
401 (define-public lua5.2-sec
402 (make-lua-sec "lua5.2-sec" lua-5.2))
404 (define (make-lua-cqueues name lua lua-ossl)
410 (uri (string-append "https://25thandclement.com/~william/"
411 "projects/releases/cqueues-" version ".tgz"))
414 "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb"))))
415 (build-system gnu-build-system)
417 `(#:modules ((guix build gnu-build-system)
421 (let ((out (assoc-ref %outputs "out"))
422 (lua-api-version ,(version-major+minor (package-version lua))))
424 (string-append "LUA_APIS=" lua-api-version)))
426 (modify-phases %standard-phases
430 (lambda* (#:key make-flags outputs #:allow-other-keys)
431 (let ((out (assoc-ref outputs "out")))
432 (apply invoke "make" "install"
434 (list (string-append "DESTDIR=" out)
436 (add-after 'install 'check
437 (lambda* (#:key inputs outputs make-flags #:allow-other-keys)
439 ((lua-version ,(version-major+minor (package-version lua)))
440 (env-suffix (if (equal? lua-version "5.1")
444 (string-replace-substring lua-version "." "_"))))
446 (lua-ossl (assoc-ref inputs "lua-ossl"))
447 (out (assoc-ref outputs "out"))
449 (lua-cpath (lambda (p)
450 (string-append p "/lib/lua/" lua-version "/?.so")))
451 (lua-path (lambda (p)
452 (string-append p "/share/lua/" lua-version "/?.lua"))))
453 ;; The test suite sets Lua-version-specific search-path variables
454 ;; when available so we must do the same, as these take
455 ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
456 (setenv (string-append "LUA_CPATH" env-suffix)
458 (string-join (map lua-cpath (list out lua-ossl)) ";")
460 (setenv (string-append "LUA_PATH" env-suffix)
462 (string-join (map lua-path (list out lua-ossl)) ";")
465 ;; Skip regression tests we expect to fail
466 (with-directory-excursion "regress"
467 (for-each (lambda (f)
468 (rename-file f (string-append f ".skip")))
470 ;; Regression tests that require network
472 '("22-client-dtls.lua"
473 "30-starttls-completion.lua"
475 "153-dns-resolvers.lua")
477 ;; Regression tests that require LuaJIT
478 '("44-resolvers-gc.lua"
479 "51-join-defunct-thread.lua")
481 ;; Regression tests that require Lua 5.3
482 (if (not (equal? lua-version "5.3"))
483 '("152-thread-integer-passing.lua")
486 (apply invoke "make" "check" make-flags)))))))
491 ("openssl" ,openssl)))
493 `(("lua-ossl" ,lua-ossl)))
494 (home-page "https://25thandclement.com/~william/projects/cqueues.html")
495 (synopsis "Event loop for Lua using continuation queues")
496 (description "The cqueues extension module for Lua implements an event loop
497 that operates through the yielding and resumption of coroutines. It is designed
498 to be non-intrusive, composable, and embeddable within existing applications.")
499 (license license:expat)))
501 (define-public lua-cqueues
502 (make-lua-cqueues "lua-cqueues" lua lua-ossl))
504 (define-public lua5.1-cqueues
505 (make-lua-cqueues "lua5.1-cqueues" lua-5.1 lua5.1-ossl))
507 (define-public lua5.2-cqueues
508 (make-lua-cqueues "lua5.2-cqueues" lua-5.2 lua5.2-ossl))
510 (define-public lua-penlight
512 (name "lua-penlight")
518 (url "https://github.com/Tieske/Penlight")
520 (file-name (git-file-name name version))
522 (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
523 (build-system trivial-build-system)
527 `(("lua-filesystem" ,lua-filesystem)))
529 `(#:modules ((guix build utils))
532 (use-modules (guix build utils))
533 (let* ((source (assoc-ref %build-inputs "source"))
534 (lua-version ,(version-major+minor (package-version lua)))
535 (destination (string-append (assoc-ref %outputs "out")
536 "/share/lua/" lua-version)))
537 (mkdir-p destination)
538 (with-directory-excursion source
539 (copy-recursively "lua/" destination)))
541 (home-page "http://tieske.github.io/Penlight/")
542 (synopsis "Collection of general purpose libraries for the Lua language")
543 (description "Penlight is a set of pure Lua libraries focusing on
544 input data handling (such as reading configuration files), functional
545 programming (such as map, reduce, placeholder expressions,etc), and OS
546 path management. Much of the functionality is inspired by the Python
547 standard libraries.")
548 (license license:expat)))
550 (define-public lua-ldoc
558 (url "https://github.com/stevedonovan/LDoc")
560 (file-name (git-file-name name version))
562 (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
563 (build-system gnu-build-system)
567 `(("lua-penlight" ,lua-penlight)))
569 `(#:tests? #f ;tests must run after installation.
571 (modify-phases %standard-phases
572 (add-after 'unpack 'fix-installation-directory
573 (lambda* (#:key outputs #:allow-other-keys)
574 (let ((out (assoc-ref outputs "out"))
575 (lua-version ,(version-major+minor (package-version lua))))
576 (substitute* "makefile"
578 (("(LUA_PREFIX=).*" _ prefix)
579 (string-append prefix out "\n"))
580 (("(LUA_BINDIR=).*" _ prefix)
581 (string-append prefix out "/bin\n"))
582 (("(LUA_SHAREDIR=).*" _ prefix)
583 (string-append prefix out "/share/lua/" lua-version "\n"))))
586 (add-before 'install 'create-bin-directory
587 (lambda* (#:key outputs #:allow-other-keys)
588 (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
590 (home-page "http://stevedonovan.github.io/ldoc/")
591 (synopsis "Lua documentation generator")
593 "LDoc is a LuaDoc-compatible documentation generation system for
594 Lua source code. It parses the declaration and documentation comments
595 in a set of Lua source files and produces a set of XHTML pages
596 describing the commented declarations and functions.")
597 (license license:expat)))
599 (define (make-lua-lgi name lua)
607 (url "https://github.com/pavouk/lgi")
609 (file-name (git-file-name name version))
611 (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
612 (build-system gnu-build-system)
616 (string-append "PREFIX=" (assoc-ref %outputs "out")))
618 (modify-phases %standard-phases
619 (delete 'configure) ; no configure script
620 (add-before 'build 'set-env
621 (lambda* (#:key inputs #:allow-other-keys)
622 ;; We need to load cairo dynamically.
623 (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
624 (setenv "LD_LIBRARY_PATH" cairo)
626 (add-before 'build 'set-lua-version
628 ;; Lua version and therefore install directories are hardcoded.
629 (substitute* "./lgi/Makefile"
633 ,(version-major+minor (package-version lua)))))
635 (add-before 'check 'skip-test-gtk
637 ;; FIXME: Skip GTK tests:
638 ;; gtk3 - can't get it to run with the xorg-server config below
639 ;; and some non-gtk tests will also fail
640 ;; gtk2 - lots of functions aren't implemented
641 ;; We choose gtk2 as the lesser evil and simply skip the test.
642 ;; Currently, awesome is the only package that uses lua-lgi but
643 ;; it doesn't need or interact with GTK using lua-lgi.
644 (substitute* "./tests/test.lua"
645 (("'gtk.lua',") "-- 'gtk.lua',"))
647 (add-before 'check 'start-xserver-instance
648 (lambda* (#:key inputs #:allow-other-keys)
649 ;; There must be a running X server during tests.
650 (system (format #f "~a/bin/Xvfb :1 &"
651 (assoc-ref inputs "xorg-server")))
652 (setenv "DISPLAY" ":1")
655 `(("dbus" ,dbus) ;tests use 'dbus-run-session'
656 ("pkg-config" ,pkg-config)))
660 ("gobject-introspection" ,gobject-introspection)
665 ("xorg-server" ,xorg-server)))
666 (home-page "https://github.com/pavouk/lgi/")
667 (synopsis "Lua bridge to GObject based libraries")
669 "LGI is gobject-introspection based dynamic Lua binding to GObject based
670 libraries. It allows using GObject-based libraries directly from Lua.
671 Notable examples are GTK+, GStreamer and Webkit.")
672 (license license:expat)))
674 (define-public lua-lgi
675 (make-lua-lgi "lua-lgi" lua))
677 (define-public lua5.1-lgi
678 (make-lua-lgi "lua5.1-lgi" lua-5.1))
680 (define-public lua5.2-lgi
681 (make-lua-lgi "lua5.2-lgi" lua-5.2))
683 (define (make-lua-lpeg name lua)
689 (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
692 (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
693 (build-system gnu-build-system)
696 (modify-phases %standard-phases
698 ;; `make install` isn't available, so we have to do it manually
700 (lambda* (#:key outputs #:allow-other-keys)
701 (let ((out (assoc-ref outputs "out"))
702 (lua-version ,(version-major+minor (package-version lua))))
703 (install-file "lpeg.so"
704 (string-append out "/lib/lua/" lua-version))
705 (install-file "re.lua"
706 (string-append out "/share/lua/" lua-version))
708 #:test-target "test"))
709 (inputs `(("lua" ,lua)))
710 (synopsis "Pattern-matching library for Lua")
712 "LPeg is a pattern-matching library for Lua, based on Parsing Expression
714 (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
715 (license license:expat)))
717 (define-public lua-lpeg
718 (make-lua-lpeg "lua-lpeg" lua))
720 (define-public lua5.1-lpeg
721 (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
723 (define-public lua5.2-lpeg
724 (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
726 (define (make-lua-luv name lua)
731 ;; The release tarball includes the sources of libuv but does
732 ;; not include the pkg-config files.
735 (url "https://github.com/luvit/luv")
737 (file-name (git-file-name name version))
740 "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh"))))
741 (build-system cmake-build-system)
743 `(#:tests? #f ; there are none
745 '("-DWITH_LUA_ENGINE=Lua"
746 "-DWITH_SHARED_LIBUV=On"
748 "-DBUILD_SHARED_LIBS=On"
749 "-DLUA_BUILD_TYPE=System")
751 (modify-phases %standard-phases
752 (add-after 'unpack 'copy-lua-compat
753 (lambda* (#:key inputs #:allow-other-keys)
754 (copy-recursively (assoc-ref inputs "lua-compat")
757 (string-append (getcwd) "/lua-compat:"
758 (or (getenv "CPATH") "")))
768 (url "https://github.com/keplerproject/lua-compat-5.3")
769 (commit "daebe77a2f498817713df37f0bb316db1d82222f")))
770 (file-name "lua-compat-5.3-checkout")
773 "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz"))))))
774 (home-page "https://github.com/luvit/luv/")
775 (synopsis "Libuv bindings for Lua")
777 "This library makes libuv available to Lua scripts.")
778 (license license:asl2.0)))
780 (define-public lua-luv
781 (make-lua-luv "lua-luv" lua))
783 (define-public lua5.1-luv
784 (make-lua-luv "lua5.1-luv" lua-5.1))
786 (define-public lua5.2-luv
787 (make-lua-luv "lua5.2-luv" lua-5.2))
789 ;; Lua 5.3 is not supported.
790 (define (make-lua-bitop name lua)
796 (uri (string-append "http://bitop.luajit.org/download/"
797 "LuaBitOp-" version ".tar.gz"))
800 "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
801 (build-system gnu-build-system)
803 `(#:test-target "test"
805 (list "INSTALL=install -pD"
806 (string-append "INSTALLPATH=printf "
807 (assoc-ref %outputs "out")
809 ,(version-major+minor (package-version lua))
812 (modify-phases %standard-phases
813 (delete 'configure))))
814 (inputs `(("lua" ,lua)))
815 (home-page "https://bitop.luajit.org/index.html")
816 (synopsis "Bitwise operations on numbers for Lua")
818 "Lua BitOp is a C extension module for Lua which adds bitwise operations
820 (license license:expat)))
822 (define-public lua5.2-bitop
823 (make-lua-bitop "lua5.2-bitop" lua-5.2))
825 (define-public lua5.1-bitop
826 (make-lua-bitop "lua5.1-bitop" lua-5.1))
828 (define-public selene
831 (version "2017.08.25")
835 (url "https://github.com/jeremyong/Selene")
836 ;; The release is quite old.
837 (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
841 "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
842 (build-system cmake-build-system)
845 ;; lua pc file in CMakeLists.txt is lua5.3.pc
846 '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
849 ;; This is a header only library
850 (modify-phases %standard-phases
853 (lambda* (#:key inputs outputs #:allow-other-keys)
854 (let* ((output (assoc-ref outputs "out"))
855 (source (assoc-ref inputs "source"))
856 (includedir (string-append output "/include")))
858 (string-append source "/include")
861 ;; The path of test files are hard coded.
863 (lambda* (#:key inputs outputs #:allow-other-keys)
864 (let* ((output (assoc-ref outputs "out"))
865 (source (assoc-ref inputs "source"))
867 (testdir (string-append builddir "/test")))
868 (copy-recursively (string-append source "/test") testdir)
871 (copy-file "./test_runner" "./runner/test_runner")
873 (invoke "./test_runner")))))))
876 ("pkg-config" ,pkg-config)))
877 (home-page "https://github.com/jeremyong/Selene")
878 (synopsis "Lua C++11 bindings")
880 "Selene is a simple C++11 header-only library enabling seamless
881 interoperability between C++ and Lua programming language.")
882 (license license:zlib)))