Commit | Line | Data |
---|---|---|
712e6e68 CR |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com> | |
924cd631 | 3 | ;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com> |
a2c03fb1 | 4 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
90f80bf2 | 5 | ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr> |
32fddd8e | 6 | ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> |
07cbe28e | 7 | ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> |
03d8505f | 8 | ;;; Copyright © 2016 doncatnip <gnopap@gmail.com> |
4a384221 | 9 | ;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org> |
35cdc267 | 10 | ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org> |
712e6e68 CR |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages lua) | |
572e433f | 28 | #:use-module ((guix licenses) #:prefix license:) |
712e6e68 CR |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
35cdc267 | 31 | #:use-module (guix utils) |
712e6e68 CR |
32 | #:use-module (guix build-system gnu) |
33 | #:use-module (gnu packages) | |
fd07a6a6 | 34 | #:use-module (gnu packages readline) |
d62dc2ae | 35 | #:use-module (gnu packages tls) |
03d8505f | 36 | #:use-module (gnu packages xml) |
37 | #:use-module (gnu packages glib) | |
38 | #:use-module (gnu packages libffi) | |
39 | #:use-module (gnu packages pkg-config) | |
40 | #:use-module (gnu packages xorg) | |
41 | #:use-module (gnu packages gtk)) | |
712e6e68 CR |
42 | |
43 | (define-public lua | |
44 | (package | |
45 | (name "lua") | |
6dbf1fec | 46 | (version "5.3.3") |
712e6e68 CR |
47 | (source (origin |
48 | (method url-fetch) | |
6dbf1fec | 49 | (uri (string-append "https://www.lua.org/ftp/lua-" |
712e6e68 CR |
50 | version ".tar.gz")) |
51 | (sha256 | |
6dbf1fec | 52 | (base32 "18mcfbbmjyp8f2l9yy7n6dzk066nq6man0kpwly4bppphilc04si")) |
fc1adab1 | 53 | (patches (search-patches "lua-pkgconfig.patch" |
6dbf1fec | 54 | "lua-liblua-so.patch")))) |
712e6e68 | 55 | (build-system gnu-build-system) |
b3546174 | 56 | (inputs `(("readline" ,readline))) |
712e6e68 CR |
57 | (arguments |
58 | '(#:modules ((guix build gnu-build-system) | |
07cbe28e RW |
59 | (guix build utils) |
60 | (srfi srfi-1)) | |
712e6e68 | 61 | #:test-target "test" |
07cbe28e | 62 | #:make-flags |
c0d47cad | 63 | '("MYCFLAGS=-fPIC -DLUA_DL_DLOPEN" |
07cbe28e | 64 | "linux") |
a4349e7a EF |
65 | #:phases |
66 | (modify-phases %standard-phases | |
67 | (delete 'configure) | |
a4349e7a EF |
68 | (replace 'install |
69 | (lambda* (#:key outputs #:allow-other-keys) | |
70 | (let ((out (assoc-ref outputs "out"))) | |
71 | (zero? (system* "make" "install" | |
72 | (string-append "INSTALL_TOP=" out) | |
73 | (string-append "INSTALL_MAN=" out | |
74 | "/share/man/man1"))))))))) | |
6dbf1fec | 75 | (home-page "https://www.lua.org/") |
9e771e3b | 76 | (synopsis "Embeddable scripting language") |
712e6e68 CR |
77 | (description |
78 | "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua | |
79 | combines simple procedural syntax with powerful data description constructs | |
35b9e423 | 80 | based on associative arrays and extensible semantics. Lua is dynamically typed, |
712e6e68 CR |
81 | runs by interpreting bytecode for a register-based virtual machine, and has |
82 | automatic memory management with incremental garbage collection, making it ideal | |
83 | for configuration, scripting, and rapid prototyping.") | |
572e433f | 84 | (license license:x11))) |
924cd631 | 85 | |
6dbf1fec MB |
86 | (define-public lua-5.2 |
87 | (package (inherit lua) | |
88 | (version "5.2.4") | |
89 | (source | |
90 | (origin | |
91 | (method url-fetch) | |
92 | (uri (string-append "https://www.lua.org/ftp/lua-" | |
93 | version ".tar.gz")) | |
94 | (sha256 | |
95 | (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr")) | |
96 | (patches (search-patches "lua-pkgconfig.patch" | |
97 | "lua-liblua-so.patch")))))) | |
98 | ||
01d3f19b AE |
99 | (define-public lua-5.1 |
100 | (package (inherit lua) | |
101 | (version "5.1.5") | |
102 | (source (origin | |
103 | (method url-fetch) | |
6dbf1fec | 104 | (uri (string-append "https://www.lua.org/ftp/lua-" |
01d3f19b AE |
105 | version ".tar.gz")) |
106 | (sha256 | |
c361d075 | 107 | (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16")) |
32fddd8e | 108 | (patches (search-patches "lua51-liblua-so.patch" |
a287fafe DM |
109 | "lua-CVE-2014-5461.patch" |
110 | "lua51-pkgconfig.patch")))))) | |
01d3f19b | 111 | |
924cd631 RG |
112 | (define-public luajit |
113 | (package | |
114 | (name "luajit") | |
89deaf16 | 115 | (version "2.0.4") |
924cd631 RG |
116 | (source (origin |
117 | (method url-fetch) | |
118 | (uri (string-append "http://luajit.org/download/LuaJIT-" | |
119 | version ".tar.gz")) | |
120 | (sha256 | |
89deaf16 | 121 | (base32 "0zc0y7p6nx1c0pp4nhgbdgjljpfxsb5kgwp4ysz22l1p2bms83v2")) |
fc1adab1 AK |
122 | (patches (search-patches "luajit-symlinks.patch" |
123 | "luajit-no_ldconfig.patch")))) | |
924cd631 RG |
124 | (build-system gnu-build-system) |
125 | (arguments | |
126 | '(#:tests? #f ;luajit is distributed without tests | |
127 | #:phases (alist-delete 'configure %standard-phases) | |
128 | #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))))) | |
129 | (home-page "http://www.luajit.org/") | |
130 | (synopsis "Just in time compiler for Lua programming language version 5.1") | |
131 | (description | |
132 | "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua | |
133 | programming language. Lua is a powerful, dynamic and light-weight programming | |
134 | language. It may be embedded or used as a general-purpose, stand-alone | |
135 | language.") | |
572e433f | 136 | (license license:x11))) |
fd07a6a6 RW |
137 | |
138 | (define-public lua5.1-expat | |
139 | (package | |
140 | (name "lua5.1-expat") | |
141 | (version "1.3.0") | |
142 | (source (origin | |
143 | (method url-fetch) | |
144 | (uri (string-append "https://matthewwild.co.uk/projects/" | |
145 | "luaexpat/luaexpat-" version ".tar.gz")) | |
146 | (sha256 | |
147 | (base32 | |
148 | "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h")))) | |
149 | (build-system gnu-build-system) | |
150 | (arguments | |
151 | `(#:make-flags | |
152 | (let ((out (assoc-ref %outputs "out"))) | |
153 | (list "CC=gcc" | |
154 | (string-append "LUA_LDIR=" out "/share/lua/$(LUA_V)") | |
155 | (string-append "LUA_CDIR=" out "/lib/lua/$(LUA_V)"))) | |
156 | #:phases | |
157 | (modify-phases %standard-phases | |
158 | (delete 'configure) | |
159 | (replace 'check | |
160 | (lambda _ | |
161 | (setenv "LUA_CPATH" "src/?.so;;") | |
162 | (setenv "LUA_PATH" "src/?.lua;;") | |
163 | (and (zero? (system* "lua" "tests/test.lua")) | |
164 | (zero? (system* "lua" "tests/test-lom.lua")))))))) | |
165 | (inputs | |
166 | `(("lua" ,lua-5.1) | |
167 | ("expat" ,expat))) | |
168 | (home-page "http://matthewwild.co.uk/projects/luaexpat/") | |
169 | (synopsis "SAX XML parser based on the Expat library") | |
170 | (description "LuaExpat is a SAX XML parser based on the Expat library.") | |
171 | (license (package-license lua-5.1)))) | |
c21b8261 RW |
172 | |
173 | (define-public lua5.1-socket | |
174 | (package | |
175 | (name "lua5.1-socket") | |
176 | (version "2.0.2") | |
177 | (source (origin | |
178 | (method url-fetch) | |
179 | (uri (string-append "http://files.luaforge.net/releases/" | |
180 | "luasocket/luasocket/luasocket-" | |
181 | version "/luasocket-" version ".tar.gz")) | |
182 | (sha256 | |
183 | (base32 | |
184 | "19ichkbc4rxv00ggz8gyf29jibvc2wq9pqjik0ll326rrxswgnag")))) | |
185 | (build-system gnu-build-system) | |
186 | (arguments | |
187 | `(#:make-flags | |
188 | (let ((out (assoc-ref %outputs "out"))) | |
189 | (list (string-append "INSTALL_TOP_SHARE=" out "/share/lua/5.1") | |
190 | (string-append "INSTALL_TOP_LIB=" out "/lib/lua/5.1"))) | |
191 | #:phases | |
192 | (modify-phases %standard-phases | |
193 | (delete 'configure) | |
194 | (replace 'check | |
195 | (lambda _ | |
196 | (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;")) | |
197 | (setenv "LUA_PATH" "src/?.lua;;") | |
198 | (when (zero? (primitive-fork)) | |
199 | (system* "lua" "test/testsrvr.lua")) | |
200 | (zero? (system* "lua" "test/testclnt.lua"))))))) | |
201 | (inputs | |
202 | `(("lua" ,lua-5.1))) | |
203 | (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/") | |
204 | (synopsis "Socket library for Lua") | |
205 | (description "LuaSocket is a Lua extension library that is composed by two | |
206 | parts: a C core that provides support for the TCP and UDP transport layers, | |
207 | and a set of Lua modules that add support for functionality commonly needed by | |
208 | applications that deal with the Internet. | |
209 | ||
210 | Among the supported modules, the most commonly used implement the | |
211 | SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading | |
212 | files) client protocols. These provide a very natural and generic interface | |
213 | to the functionality defined by each protocol. In addition, you will find | |
214 | that the MIME (common encodings), URL (anything you could possible want to do | |
215 | with one) and LTN12 (filters, sinks, sources and pumps) modules can be very | |
216 | handy.") | |
217 | (license (package-license lua-5.1)))) | |
182de8fc RW |
218 | |
219 | (define-public lua5.1-filesystem | |
220 | (package | |
221 | (name "lua5.1-filesystem") | |
222 | (version "1.6.3") | |
223 | (source (origin | |
224 | (method url-fetch) | |
225 | (uri (string-append "https://github.com/keplerproject/" | |
226 | "luafilesystem/archive/v_" | |
227 | "1_6_3" ".tar.gz")) | |
228 | (file-name (string-append name "-" version ".tar.gz")) | |
229 | (sha256 | |
230 | (base32 | |
231 | "0s10ckxin0bysd6gaywqhxkpw3ybjhprr8m655b8cx3pxjwd49am")))) | |
232 | (build-system gnu-build-system) | |
233 | (arguments | |
234 | `(#:make-flags | |
235 | (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
236 | #:test-target "test" | |
237 | #:phases | |
238 | (modify-phases %standard-phases | |
239 | (delete 'configure)))) | |
240 | (inputs | |
241 | `(("lua" ,lua-5.1))) | |
242 | (home-page "https://keplerproject.github.io/luafilesystem/index.html") | |
243 | (synopsis "File system library for Lua") | |
244 | (description "LuaFileSystem is a Lua library developed to complement the | |
245 | set of functions related to file systems offered by the standard Lua | |
246 | distribution. LuaFileSystem offers a portable way to access the underlying | |
247 | directory structure and file attributes.") | |
248 | (license (package-license lua-5.1)))) | |
d62dc2ae RW |
249 | |
250 | (define-public lua5.1-sec | |
251 | (package | |
252 | (name "lua5.1-sec") | |
253 | (version "0.6") | |
254 | (source (origin | |
255 | (method url-fetch) | |
256 | (uri (string-append "https://github.com/brunoos/luasec/archive/" | |
257 | "luasec-" version ".tar.gz")) | |
258 | (sha256 | |
259 | (base32 | |
260 | "0pgd1anzznl4s0h16wg8dlw9mgdb9h52drlcki6sbf5y31fa7wyf")))) | |
261 | (build-system gnu-build-system) | |
262 | (arguments | |
263 | `(#:make-flags | |
264 | (let ((out (assoc-ref %outputs "out"))) | |
265 | (list "linux" | |
266 | "CC=gcc" | |
267 | "LD=gcc" | |
268 | (string-append "LUAPATH=" out "/share/lua/5.1") | |
269 | (string-append "LUACPATH=" out "/lib/lua/5.1"))) | |
270 | #:tests? #f ; no tests included | |
271 | #:phases | |
272 | (modify-phases %standard-phases | |
273 | (delete 'configure)))) | |
274 | (inputs | |
275 | `(("lua" ,lua-5.1) | |
276 | ("openssl" ,openssl))) | |
277 | (propagated-inputs | |
278 | `(("lua-socket" ,lua5.1-socket))) | |
279 | (home-page "https://github.com/brunoos/luasec/wiki") | |
280 | (synopsis "OpenSSL bindings for Lua") | |
281 | (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL | |
282 | communication. It takes an already established TCP connection and creates a | |
283 | secure session between the peers.") | |
284 | (license (package-license lua-5.1)))) | |
03d8505f | 285 | |
4a384221 CL |
286 | (define-public lua5.1-sec-0.5 |
287 | (package | |
288 | (inherit lua5.1-sec) | |
289 | (version "0.5.1") | |
290 | (source (origin | |
291 | (method url-fetch) | |
292 | (uri (string-append "https://github.com/brunoos/luasec/archive/" | |
293 | "luasec-" version ".tar.gz")) | |
294 | (sha256 | |
295 | (base32 | |
296 | "01llf5bcrjmqqy6m65avqkajz7h79rvkka6rd131kwr10n75yp3d")))))) | |
297 | ||
03d8505f | 298 | (define-public lua-lgi |
299 | (package | |
300 | (name "lua-lgi") | |
301 | (version "0.9.1") | |
302 | (source | |
303 | (origin | |
304 | (method url-fetch) | |
305 | (uri (string-append | |
306 | "https://github.com/pavouk/lgi/archive/" | |
307 | version ".tar.gz")) | |
308 | (file-name (string-append name "-" version ".tar.gz")) | |
309 | (sha256 | |
310 | (base32 | |
311 | "1fmgdl5y4ph3yc6ycg865s3vai1rjkyda61cgqxk6zd13hmznw0c")))) | |
312 | (build-system gnu-build-system) | |
313 | (arguments | |
314 | '(#:make-flags (list "CC=gcc" | |
315 | (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
316 | #:phases | |
317 | (modify-phases %standard-phases | |
318 | (delete 'configure) ; no configure script | |
319 | (add-before 'build 'set-env | |
320 | (lambda* (#:key inputs #:allow-other-keys) | |
321 | ;; we need to load cairo dynamically | |
322 | (let* ((cairo (string-append | |
323 | (assoc-ref inputs "cairo") "/lib" ))) | |
324 | (setenv "LD_LIBRARY_PATH" cairo) | |
325 | #t))) | |
326 | (add-before 'build 'set-lua-version | |
327 | (lambda _ | |
328 | ;; lua version and therefore install directories are hardcoded | |
329 | ;; FIXME: This breaks when we update lua to >=5.3 | |
330 | (substitute* "./lgi/Makefile" | |
331 | (("LUA_VERSION=5.1") "LUA_VERSION=5.2")) | |
332 | #t)) | |
333 | (add-before 'check 'skip-test-gtk | |
334 | (lambda _ | |
335 | ;; FIXME: Skip GTK tests: | |
336 | ;; gtk3 - can't get it to run with the xorg-server config below | |
337 | ;; and some non-gtk tests will also fail | |
338 | ;; gtk2 - lots of functions aren't implemented | |
339 | ;; We choose gtk2 as the lesser evil and simply skip the test. | |
340 | ;; Currently, awesome is the only package that uses lua-lgi but | |
341 | ;; it doesn't need or interact with GTK using lua-lgi. | |
342 | (substitute* "./tests/test.lua" | |
343 | (("'gtk.lua',") "-- 'gtk.lua',")) | |
344 | #t)) | |
345 | (add-before 'check 'start-xserver-instance | |
346 | (lambda* (#:key inputs #:allow-other-keys) | |
347 | ;; There must be a running X server during tests. | |
348 | (system (format #f "~a/bin/Xvfb :1 &" | |
349 | (assoc-ref inputs "xorg-server"))) | |
350 | (setenv "DISPLAY" ":1") | |
351 | #t))))) | |
352 | (inputs | |
353 | `(("gobject-introspection" ,gobject-introspection) | |
354 | ("glib" ,glib) | |
355 | ("pango", pango) | |
356 | ("gtk", gtk+-2) | |
357 | ("lua" ,lua) | |
358 | ("cairo" ,cairo) | |
359 | ("libffi" ,libffi) | |
360 | ("xorg-server", xorg-server))) | |
361 | (native-inputs | |
362 | `(("pkg-config" ,pkg-config))) | |
363 | (home-page "https://github.com/pavouk/lgi/") | |
364 | (synopsis "Lua bridge to GObject based libraries") | |
365 | (description | |
366 | "LGI is gobject-introspection based dynamic Lua binding to GObject | |
367 | based libraries. It allows using GObject-based libraries directly from Lua. | |
368 | Notable examples are GTK+, GStreamer and Webkit.") | |
369 | (license license:expat))) | |
35cdc267 JMSG |
370 | |
371 | (define-public lua-lpeg | |
372 | (package | |
373 | (name "lua-lpeg") | |
139c8f94 | 374 | (version "1.0.1") |
35cdc267 JMSG |
375 | (source (origin |
376 | (method url-fetch) | |
377 | (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-" | |
378 | version ".tar.gz")) | |
379 | (sha256 | |
139c8f94 | 380 | (base32 "0sq25z3r324a324ky73izgq9mbf66j2xvjp0fxf227rwxalzgnb2")))) |
35cdc267 JMSG |
381 | (build-system gnu-build-system) |
382 | (arguments | |
383 | `(#:phases | |
384 | (modify-phases %standard-phases | |
385 | (delete 'configure) | |
386 | ;; `make install` isn't available, so we have to do it manually | |
387 | (replace 'install | |
388 | (lambda* (#:key outputs #:allow-other-keys) | |
389 | (let ((out (assoc-ref outputs "out")) | |
390 | (lua-version ,(version-major+minor (package-version lua)))) | |
391 | (install-file "lpeg.so" | |
392 | (string-append out "/lib/lua/" lua-version)) | |
393 | (install-file "re.lua" | |
394 | (string-append out "/share/lua/" lua-version)) | |
395 | #t)))) | |
396 | #:test-target "test")) | |
397 | (inputs `(("lua", lua))) | |
398 | (synopsis "Pattern-matching library for Lua") | |
399 | (description | |
400 | "LPeg is a pattern-matching library for Lua, based on Parsing Expression | |
401 | Grammars (PEGs).") | |
402 | (home-page "http://www.inf.puc-rio.br/~roberto/lpeg") | |
403 | (license license:expat))) |