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 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
9 ;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages lua)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages readline)
33 #:use-module (gnu packages tls)
34 #:use-module (gnu packages xml)
35 #:use-module (gnu packages glib)
36 #:use-module (gnu packages libffi)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages xorg)
39 #:use-module (gnu packages gtk))
47 (uri (string-append "https://www.lua.org/ftp/lua-"
50 (base32 "18mcfbbmjyp8f2l9yy7n6dzk066nq6man0kpwly4bppphilc04si"))
51 (patches (search-patches "lua-pkgconfig.patch"
52 "lua-liblua-so.patch"))))
53 (build-system gnu-build-system)
54 (inputs `(("readline" ,readline)))
56 '(#:modules ((guix build gnu-build-system)
61 '("MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
64 (modify-phases %standard-phases
67 (lambda* (#:key outputs #:allow-other-keys)
68 (let ((out (assoc-ref outputs "out")))
69 (zero? (system* "make" "install"
70 (string-append "INSTALL_TOP=" out)
71 (string-append "INSTALL_MAN=" out
72 "/share/man/man1")))))))))
73 (home-page "https://www.lua.org/")
74 (synopsis "Embeddable scripting language")
76 "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
77 combines simple procedural syntax with powerful data description constructs
78 based on associative arrays and extensible semantics. Lua is dynamically typed,
79 runs by interpreting bytecode for a register-based virtual machine, and has
80 automatic memory management with incremental garbage collection, making it ideal
81 for configuration, scripting, and rapid prototyping.")
82 (license license:x11)))
84 (define-public lua-5.2
85 (package (inherit lua)
90 (uri (string-append "https://www.lua.org/ftp/lua-"
93 (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
94 (patches (search-patches "lua-pkgconfig.patch"
95 "lua-liblua-so.patch"))))))
97 (define-public lua-5.1
98 (package (inherit lua)
102 (uri (string-append "https://www.lua.org/ftp/lua-"
105 (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
106 (patches (search-patches "lua51-liblua-so.patch"
107 "lua-CVE-2014-5461.patch"
108 "lua51-pkgconfig.patch"))))))
110 (define-public luajit
116 (uri (string-append "http://luajit.org/download/LuaJIT-"
119 (base32 "0zc0y7p6nx1c0pp4nhgbdgjljpfxsb5kgwp4ysz22l1p2bms83v2"))
120 (patches (search-patches "luajit-symlinks.patch"
121 "luajit-no_ldconfig.patch"))))
122 (build-system gnu-build-system)
124 '(#:tests? #f ;luajit is distributed without tests
125 #:phases (alist-delete 'configure %standard-phases)
126 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
127 (home-page "http://www.luajit.org/")
128 (synopsis "Just in time compiler for Lua programming language version 5.1")
130 "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
131 programming language. Lua is a powerful, dynamic and light-weight programming
132 language. It may be embedded or used as a general-purpose, stand-alone
134 (license license:x11)))
136 (define-public lua5.1-expat
138 (name "lua5.1-expat")
142 (uri (string-append "https://matthewwild.co.uk/projects/"
143 "luaexpat/luaexpat-" version ".tar.gz"))
146 "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
147 (build-system gnu-build-system)
150 (let ((out (assoc-ref %outputs "out")))
152 (string-append "LUA_LDIR=" out "/share/lua/$(LUA_V)")
153 (string-append "LUA_CDIR=" out "/lib/lua/$(LUA_V)")))
155 (modify-phases %standard-phases
159 (setenv "LUA_CPATH" "src/?.so;;")
160 (setenv "LUA_PATH" "src/?.lua;;")
161 (and (zero? (system* "lua" "tests/test.lua"))
162 (zero? (system* "lua" "tests/test-lom.lua"))))))))
166 (home-page "http://matthewwild.co.uk/projects/luaexpat/")
167 (synopsis "SAX XML parser based on the Expat library")
168 (description "LuaExpat is a SAX XML parser based on the Expat library.")
169 (license (package-license lua-5.1))))
171 (define-public lua5.1-socket
173 (name "lua5.1-socket")
177 (uri (string-append "http://files.luaforge.net/releases/"
178 "luasocket/luasocket/luasocket-"
179 version "/luasocket-" version ".tar.gz"))
182 "19ichkbc4rxv00ggz8gyf29jibvc2wq9pqjik0ll326rrxswgnag"))))
183 (build-system gnu-build-system)
186 (let ((out (assoc-ref %outputs "out")))
187 (list (string-append "INSTALL_TOP_SHARE=" out "/share/lua/5.1")
188 (string-append "INSTALL_TOP_LIB=" out "/lib/lua/5.1")))
190 (modify-phases %standard-phases
194 (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
195 (setenv "LUA_PATH" "src/?.lua;;")
196 (when (zero? (primitive-fork))
197 (system* "lua" "test/testsrvr.lua"))
198 (zero? (system* "lua" "test/testclnt.lua")))))))
201 (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
202 (synopsis "Socket library for Lua")
203 (description "LuaSocket is a Lua extension library that is composed by two
204 parts: a C core that provides support for the TCP and UDP transport layers,
205 and a set of Lua modules that add support for functionality commonly needed by
206 applications that deal with the Internet.
208 Among the supported modules, the most commonly used implement the
209 SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
210 files) client protocols. These provide a very natural and generic interface
211 to the functionality defined by each protocol. In addition, you will find
212 that the MIME (common encodings), URL (anything you could possible want to do
213 with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
215 (license (package-license lua-5.1))))
217 (define-public lua5.1-filesystem
219 (name "lua5.1-filesystem")
223 (uri (string-append "https://github.com/keplerproject/"
224 "luafilesystem/archive/v_"
226 (file-name (string-append name "-" version ".tar.gz"))
229 "0s10ckxin0bysd6gaywqhxkpw3ybjhprr8m655b8cx3pxjwd49am"))))
230 (build-system gnu-build-system)
233 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
236 (modify-phases %standard-phases
237 (delete 'configure))))
240 (home-page "https://keplerproject.github.io/luafilesystem/index.html")
241 (synopsis "File system library for Lua")
242 (description "LuaFileSystem is a Lua library developed to complement the
243 set of functions related to file systems offered by the standard Lua
244 distribution. LuaFileSystem offers a portable way to access the underlying
245 directory structure and file attributes.")
246 (license (package-license lua-5.1))))
248 (define-public lua5.1-sec
254 (uri (string-append "https://github.com/brunoos/luasec/archive/"
255 "luasec-" version ".tar.gz"))
258 "0pgd1anzznl4s0h16wg8dlw9mgdb9h52drlcki6sbf5y31fa7wyf"))))
259 (build-system gnu-build-system)
262 (let ((out (assoc-ref %outputs "out")))
266 (string-append "LUAPATH=" out "/share/lua/5.1")
267 (string-append "LUACPATH=" out "/lib/lua/5.1")))
268 #:tests? #f ; no tests included
270 (modify-phases %standard-phases
271 (delete 'configure))))
274 ("openssl" ,openssl)))
276 `(("lua-socket" ,lua5.1-socket)))
277 (home-page "https://github.com/brunoos/luasec/wiki")
278 (synopsis "OpenSSL bindings for Lua")
279 (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
280 communication. It takes an already established TCP connection and creates a
281 secure session between the peers.")
282 (license (package-license lua-5.1))))
284 (define-public lua5.1-sec-0.5
290 (uri (string-append "https://github.com/brunoos/luasec/archive/"
291 "luasec-" version ".tar.gz"))
294 "01llf5bcrjmqqy6m65avqkajz7h79rvkka6rd131kwr10n75yp3d"))))))
296 (define-public lua-lgi
304 "https://github.com/pavouk/lgi/archive/"
306 (file-name (string-append name "-" version ".tar.gz"))
309 "1fmgdl5y4ph3yc6ycg865s3vai1rjkyda61cgqxk6zd13hmznw0c"))))
310 (build-system gnu-build-system)
312 '(#:make-flags (list "CC=gcc"
313 (string-append "PREFIX=" (assoc-ref %outputs "out")))
315 (modify-phases %standard-phases
316 (delete 'configure) ; no configure script
317 (add-before 'build 'set-env
318 (lambda* (#:key inputs #:allow-other-keys)
319 ;; we need to load cairo dynamically
320 (let* ((cairo (string-append
321 (assoc-ref inputs "cairo") "/lib" )))
322 (setenv "LD_LIBRARY_PATH" cairo)
324 (add-before 'build 'set-lua-version
326 ;; lua version and therefore install directories are hardcoded
327 ;; FIXME: This breaks when we update lua to >=5.3
328 (substitute* "./lgi/Makefile"
329 (("LUA_VERSION=5.1") "LUA_VERSION=5.2"))
331 (add-before 'check 'skip-test-gtk
333 ;; FIXME: Skip GTK tests:
334 ;; gtk3 - can't get it to run with the xorg-server config below
335 ;; and some non-gtk tests will also fail
336 ;; gtk2 - lots of functions aren't implemented
337 ;; We choose gtk2 as the lesser evil and simply skip the test.
338 ;; Currently, awesome is the only package that uses lua-lgi but
339 ;; it doesn't need or interact with GTK using lua-lgi.
340 (substitute* "./tests/test.lua"
341 (("'gtk.lua',") "-- 'gtk.lua',"))
343 (add-before 'check 'start-xserver-instance
344 (lambda* (#:key inputs #:allow-other-keys)
345 ;; There must be a running X server during tests.
346 (system (format #f "~a/bin/Xvfb :1 &"
347 (assoc-ref inputs "xorg-server")))
348 (setenv "DISPLAY" ":1")
351 `(("gobject-introspection" ,gobject-introspection)
358 ("xorg-server", xorg-server)))
360 `(("pkg-config" ,pkg-config)))
361 (home-page "https://github.com/pavouk/lgi/")
362 (synopsis "Lua bridge to GObject based libraries")
364 "LGI is gobject-introspection based dynamic Lua binding to GObject
365 based libraries. It allows using GObject-based libraries directly from Lua.
366 Notable examples are GTK+, GStreamer and Webkit.")
367 (license license:expat)))