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> |
f2dc5f5b | 6 | ;;; Copyright © 2016, 2017, 2020 Efraim Flashner <efraim@flashner.co.il> |
9ad3d679 | 7 | ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net> |
03d8505f | 8 | ;;; Copyright © 2016 doncatnip <gnopap@gmail.com> |
7c97a063 | 9 | ;;; Copyright © 2016, 2017, 2019 Clément Lassieur <clement@lassieur.org> |
35cdc267 | 10 | ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org> |
5327fbb3 | 11 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
ce577655 | 12 | ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com> |
1c58aa6f | 13 | ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr> |
712e6e68 CR |
14 | ;;; |
15 | ;;; This file is part of GNU Guix. | |
16 | ;;; | |
17 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
18 | ;;; under the terms of the GNU General Public License as published by | |
19 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
20 | ;;; your option) any later version. | |
21 | ;;; | |
22 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
23 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | ;;; GNU General Public License for more details. | |
26 | ;;; | |
27 | ;;; You should have received a copy of the GNU General Public License | |
28 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
29 | ||
30 | (define-module (gnu packages lua) | |
572e433f | 31 | #:use-module ((guix licenses) #:prefix license:) |
712e6e68 CR |
32 | #:use-module (guix packages) |
33 | #:use-module (guix download) | |
ce577655 | 34 | #:use-module (guix git-download) |
35cdc267 | 35 | #:use-module (guix utils) |
712e6e68 | 36 | #:use-module (guix build-system gnu) |
ce577655 | 37 | #:use-module (guix build-system cmake) |
1fd4b99e | 38 | #:use-module (guix build-system trivial) |
712e6e68 | 39 | #:use-module (gnu packages) |
fd07a6a6 | 40 | #:use-module (gnu packages readline) |
d62dc2ae | 41 | #:use-module (gnu packages tls) |
03d8505f | 42 | #:use-module (gnu packages xml) |
43 | #:use-module (gnu packages glib) | |
9ad3d679 | 44 | #:use-module (gnu packages libevent) |
03d8505f | 45 | #:use-module (gnu packages libffi) |
46 | #:use-module (gnu packages pkg-config) | |
47 | #:use-module (gnu packages xorg) | |
48 | #:use-module (gnu packages gtk)) | |
712e6e68 CR |
49 | |
50 | (define-public lua | |
51 | (package | |
52 | (name "lua") | |
6094a65e | 53 | (version "5.3.5") |
712e6e68 CR |
54 | (source (origin |
55 | (method url-fetch) | |
6dbf1fec | 56 | (uri (string-append "https://www.lua.org/ftp/lua-" |
712e6e68 CR |
57 | version ".tar.gz")) |
58 | (sha256 | |
6094a65e | 59 | (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc")) |
fc1adab1 | 60 | (patches (search-patches "lua-pkgconfig.patch" |
6dbf1fec | 61 | "lua-liblua-so.patch")))) |
712e6e68 | 62 | (build-system gnu-build-system) |
b3546174 | 63 | (inputs `(("readline" ,readline))) |
712e6e68 CR |
64 | (arguments |
65 | '(#:modules ((guix build gnu-build-system) | |
07cbe28e RW |
66 | (guix build utils) |
67 | (srfi srfi-1)) | |
712e6e68 | 68 | #:test-target "test" |
07cbe28e | 69 | #:make-flags |
c0d47cad | 70 | '("MYCFLAGS=-fPIC -DLUA_DL_DLOPEN" |
07cbe28e | 71 | "linux") |
a4349e7a EF |
72 | #:phases |
73 | (modify-phases %standard-phases | |
74 | (delete 'configure) | |
a4349e7a EF |
75 | (replace 'install |
76 | (lambda* (#:key outputs #:allow-other-keys) | |
77 | (let ((out (assoc-ref outputs "out"))) | |
ffa95cf3 MW |
78 | (invoke "make" "install" |
79 | (string-append "INSTALL_TOP=" out) | |
80 | (string-append "INSTALL_MAN=" out | |
81 | "/share/man/man1")))))))) | |
6dbf1fec | 82 | (home-page "https://www.lua.org/") |
9e771e3b | 83 | (synopsis "Embeddable scripting language") |
712e6e68 CR |
84 | (description |
85 | "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua | |
86 | combines simple procedural syntax with powerful data description constructs | |
35b9e423 | 87 | based on associative arrays and extensible semantics. Lua is dynamically typed, |
712e6e68 CR |
88 | runs by interpreting bytecode for a register-based virtual machine, and has |
89 | automatic memory management with incremental garbage collection, making it ideal | |
90 | for configuration, scripting, and rapid prototyping.") | |
572e433f | 91 | (license license:x11))) |
924cd631 | 92 | |
6dbf1fec MB |
93 | (define-public lua-5.2 |
94 | (package (inherit lua) | |
95 | (version "5.2.4") | |
96 | (source | |
97 | (origin | |
98 | (method url-fetch) | |
99 | (uri (string-append "https://www.lua.org/ftp/lua-" | |
100 | version ".tar.gz")) | |
101 | (sha256 | |
102 | (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr")) | |
103 | (patches (search-patches "lua-pkgconfig.patch" | |
104 | "lua-liblua-so.patch")))))) | |
105 | ||
01d3f19b AE |
106 | (define-public lua-5.1 |
107 | (package (inherit lua) | |
108 | (version "5.1.5") | |
109 | (source (origin | |
110 | (method url-fetch) | |
6dbf1fec | 111 | (uri (string-append "https://www.lua.org/ftp/lua-" |
01d3f19b AE |
112 | version ".tar.gz")) |
113 | (sha256 | |
c361d075 | 114 | (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16")) |
32fddd8e | 115 | (patches (search-patches "lua51-liblua-so.patch" |
a287fafe DM |
116 | "lua-CVE-2014-5461.patch" |
117 | "lua51-pkgconfig.patch")))))) | |
01d3f19b | 118 | |
924cd631 RG |
119 | (define-public luajit |
120 | (package | |
121 | (name "luajit") | |
906f1b48 | 122 | (version "2.1.0-beta3") |
924cd631 RG |
123 | (source (origin |
124 | (method url-fetch) | |
125 | (uri (string-append "http://luajit.org/download/LuaJIT-" | |
126 | version ".tar.gz")) | |
127 | (sha256 | |
906f1b48 TGR |
128 | (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs")) |
129 | (patches (search-patches "luajit-no_ldconfig.patch")))) | |
924cd631 RG |
130 | (build-system gnu-build-system) |
131 | (arguments | |
a093bb69 TGR |
132 | `(#:tests? #f ; luajit is distributed without tests |
133 | #:phases | |
134 | (modify-phases %standard-phases | |
135 | (delete 'configure) ; no configure script | |
136 | (add-after 'install 'create-luajit-symlink | |
137 | (lambda* (#:key outputs #:allow-other-keys) | |
138 | (let* ((out (assoc-ref outputs "out")) | |
139 | (bin (string-append out "/bin"))) | |
140 | (with-directory-excursion bin | |
141 | (symlink ,(string-append name "-" version) | |
142 | ,name) | |
143 | #t))))) | |
144 | #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))))) | |
0386cdd3 | 145 | (home-page "https://www.luajit.org/") |
924cd631 RG |
146 | (synopsis "Just in time compiler for Lua programming language version 5.1") |
147 | (description | |
148 | "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua | |
149 | programming language. Lua is a powerful, dynamic and light-weight programming | |
150 | language. It may be embedded or used as a general-purpose, stand-alone | |
151 | language.") | |
572e433f | 152 | (license license:x11))) |
fd07a6a6 | 153 | |
7c97a063 | 154 | (define (make-lua-expat name lua) |
fd07a6a6 | 155 | (package |
7c97a063 | 156 | (name name) |
fd07a6a6 RW |
157 | (version "1.3.0") |
158 | (source (origin | |
159 | (method url-fetch) | |
160 | (uri (string-append "https://matthewwild.co.uk/projects/" | |
161 | "luaexpat/luaexpat-" version ".tar.gz")) | |
162 | (sha256 | |
163 | (base32 | |
164 | "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h")))) | |
165 | (build-system gnu-build-system) | |
166 | (arguments | |
167 | `(#:make-flags | |
7c97a063 CL |
168 | (let ((out (assoc-ref %outputs "out")) |
169 | (lua-version ,(version-major+minor (package-version lua)))) | |
fd07a6a6 | 170 | (list "CC=gcc" |
7c97a063 CL |
171 | (string-append "LUA_LDIR=" out "/share/lua/" lua-version) |
172 | (string-append "LUA_CDIR=" out "/lib/lua/" lua-version))) | |
fd07a6a6 RW |
173 | #:phases |
174 | (modify-phases %standard-phases | |
175 | (delete 'configure) | |
176 | (replace 'check | |
177 | (lambda _ | |
178 | (setenv "LUA_CPATH" "src/?.so;;") | |
179 | (setenv "LUA_PATH" "src/?.lua;;") | |
12a16602 MW |
180 | (invoke "lua" "tests/test.lua") |
181 | (invoke "lua" "tests/test-lom.lua")))))) | |
fd07a6a6 | 182 | (inputs |
7c97a063 | 183 | `(("lua" ,lua) |
fd07a6a6 RW |
184 | ("expat" ,expat))) |
185 | (home-page "http://matthewwild.co.uk/projects/luaexpat/") | |
186 | (synopsis "SAX XML parser based on the Expat library") | |
187 | (description "LuaExpat is a SAX XML parser based on the Expat library.") | |
188 | (license (package-license lua-5.1)))) | |
c21b8261 | 189 | |
7c97a063 CL |
190 | (define-public lua5.1-expat |
191 | (make-lua-expat "lua5.1-expat" lua-5.1)) | |
192 | ||
193 | (define-public lua5.2-expat | |
194 | (make-lua-expat "lua5.2-expat" lua-5.2)) | |
195 | ||
253aab77 | 196 | (define (make-lua-socket name lua) |
c21b8261 | 197 | (package |
253aab77 | 198 | (name name) |
50269c01 | 199 | (version "3.0-rc1") |
c21b8261 | 200 | (source (origin |
5545abec EF |
201 | (method git-fetch) |
202 | (uri (git-reference | |
203 | (url "https://github.com/diegonehab/luasocket") | |
204 | (commit (string-append "v" version)))) | |
205 | (file-name (git-file-name name version)) | |
c21b8261 RW |
206 | (sha256 |
207 | (base32 | |
5545abec | 208 | "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk")))) |
c21b8261 RW |
209 | (build-system gnu-build-system) |
210 | (arguments | |
211 | `(#:make-flags | |
253aab77 CL |
212 | (let ((out (assoc-ref %outputs "out")) |
213 | (lua-version ,(version-major+minor (package-version lua)))) | |
214 | (list (string-append "INSTALL_TOP=" out) | |
215 | (string-append "LUAV?=" lua-version))) | |
c21b8261 RW |
216 | #:phases |
217 | (modify-phases %standard-phases | |
218 | (delete 'configure) | |
219 | (replace 'check | |
220 | (lambda _ | |
221 | (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;")) | |
222 | (setenv "LUA_PATH" "src/?.lua;;") | |
223 | (when (zero? (primitive-fork)) | |
6e3fc9ba MW |
224 | (invoke "lua" "test/testsrvr.lua")) |
225 | (invoke "lua" "test/testclnt.lua")))))) | |
c21b8261 | 226 | (inputs |
253aab77 | 227 | `(("lua" ,lua))) |
c21b8261 RW |
228 | (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/") |
229 | (synopsis "Socket library for Lua") | |
230 | (description "LuaSocket is a Lua extension library that is composed by two | |
231 | parts: a C core that provides support for the TCP and UDP transport layers, | |
232 | and a set of Lua modules that add support for functionality commonly needed by | |
233 | applications that deal with the Internet. | |
234 | ||
235 | Among the supported modules, the most commonly used implement the | |
236 | SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading | |
237 | files) client protocols. These provide a very natural and generic interface | |
238 | to the functionality defined by each protocol. In addition, you will find | |
239 | that the MIME (common encodings), URL (anything you could possible want to do | |
240 | with one) and LTN12 (filters, sinks, sources and pumps) modules can be very | |
241 | handy.") | |
253aab77 CL |
242 | (license license:expat))) |
243 | ||
244 | (define-public lua5.1-socket | |
245 | (make-lua-socket "lua5.1-socket" lua-5.1)) | |
246 | ||
247 | (define-public lua5.2-socket | |
248 | (make-lua-socket "lua5.2-socket" lua-5.2)) | |
182de8fc | 249 | |
d9943257 | 250 | (define (make-lua-filesystem name lua) |
182de8fc | 251 | (package |
d9943257 | 252 | (name name) |
3095616b | 253 | (version "1.7.0.2") |
182de8fc | 254 | (source (origin |
f2dc5f5b EF |
255 | (method git-fetch) |
256 | (uri (git-reference | |
257 | (url "https://github.com/keplerproject/luafilesystem") | |
3095616b | 258 | (commit (string-append "v" |
f2dc5f5b EF |
259 | (string-join |
260 | (string-split version #\.) "_"))))) | |
261 | (file-name (git-file-name name version)) | |
182de8fc RW |
262 | (sha256 |
263 | (base32 | |
3095616b | 264 | "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi")))) |
182de8fc RW |
265 | (build-system gnu-build-system) |
266 | (arguments | |
267 | `(#:make-flags | |
d9943257 CL |
268 | (let ((out (assoc-ref %outputs "out")) |
269 | (lua-version ,(version-major+minor (package-version lua)))) | |
270 | (list (string-append "PREFIX=" out) | |
271 | (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version))) | |
182de8fc RW |
272 | #:test-target "test" |
273 | #:phases | |
274 | (modify-phases %standard-phases | |
275 | (delete 'configure)))) | |
276 | (inputs | |
d9943257 | 277 | `(("lua" ,lua))) |
182de8fc RW |
278 | (home-page "https://keplerproject.github.io/luafilesystem/index.html") |
279 | (synopsis "File system library for Lua") | |
280 | (description "LuaFileSystem is a Lua library developed to complement the | |
281 | set of functions related to file systems offered by the standard Lua | |
282 | distribution. LuaFileSystem offers a portable way to access the underlying | |
283 | directory structure and file attributes.") | |
284 | (license (package-license lua-5.1)))) | |
d62dc2ae | 285 | |
d9943257 CL |
286 | (define-public lua-filesystem |
287 | (make-lua-filesystem "lua-filesystem" lua)) | |
288 | ||
289 | (define-public lua5.1-filesystem | |
290 | (make-lua-filesystem "lua5.1-filesystem" lua-5.1)) | |
291 | ||
292 | (define-public lua5.2-filesystem | |
293 | (make-lua-filesystem "lua5.2-filesystem" lua-5.2)) | |
294 | ||
eb5b6c57 | 295 | (define (make-lua-sec name lua) |
d62dc2ae | 296 | (package |
eb5b6c57 | 297 | (name name) |
6298f327 | 298 | (version "0.9") |
d62dc2ae | 299 | (source (origin |
b63785ec EF |
300 | (method git-fetch) |
301 | (uri (git-reference | |
302 | (url "https://github.com/brunoos/luasec") | |
6298f327 | 303 | (commit (string-append "v" version)))) |
b63785ec | 304 | (file-name (git-file-name name version)) |
d62dc2ae RW |
305 | (sha256 |
306 | (base32 | |
6298f327 | 307 | "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl")))) |
d62dc2ae RW |
308 | (build-system gnu-build-system) |
309 | (arguments | |
310 | `(#:make-flags | |
eb5b6c57 CL |
311 | (let ((out (assoc-ref %outputs "out")) |
312 | (lua-version ,(version-major+minor (package-version lua)))) | |
d62dc2ae RW |
313 | (list "linux" |
314 | "CC=gcc" | |
315 | "LD=gcc" | |
eb5b6c57 CL |
316 | (string-append "LUAPATH=" out "/share/lua/" lua-version) |
317 | (string-append "LUACPATH=" out "/lib/lua/" lua-version))) | |
d62dc2ae RW |
318 | #:tests? #f ; no tests included |
319 | #:phases | |
320 | (modify-phases %standard-phases | |
321 | (delete 'configure)))) | |
322 | (inputs | |
eb5b6c57 | 323 | `(("lua" ,lua) |
d62dc2ae RW |
324 | ("openssl" ,openssl))) |
325 | (propagated-inputs | |
eb5b6c57 CL |
326 | `(("lua-socket" |
327 | ,(make-lua-socket | |
328 | (format #f "lua~a-socket" | |
329 | (version-major+minor (package-version lua))) lua)))) | |
d62dc2ae RW |
330 | (home-page "https://github.com/brunoos/luasec/wiki") |
331 | (synopsis "OpenSSL bindings for Lua") | |
332 | (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL | |
333 | communication. It takes an already established TCP connection and creates a | |
334 | secure session between the peers.") | |
eb5b6c57 CL |
335 | (license license:expat))) |
336 | ||
337 | (define-public lua5.1-sec | |
338 | (make-lua-sec "lua5.1-sec" lua-5.1)) | |
339 | ||
340 | (define-public lua5.2-sec | |
341 | (make-lua-sec "lua5.2-sec" lua-5.2)) | |
03d8505f | 342 | |
1fd4b99e NG |
343 | (define-public lua-penlight |
344 | (package | |
345 | (name "lua-penlight") | |
346 | (version "1.7.0") | |
347 | (source | |
348 | (origin | |
349 | (method git-fetch) | |
350 | (uri (git-reference | |
351 | (url "https://github.com/Tieske/Penlight.git") | |
352 | (commit version))) | |
353 | (file-name (git-file-name name version)) | |
354 | (sha256 | |
355 | (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl")))) | |
356 | (build-system trivial-build-system) | |
357 | (inputs | |
358 | `(("lua" ,lua))) | |
359 | (propagated-inputs | |
360 | `(("lua-filesystem" ,lua-filesystem))) | |
361 | (arguments | |
362 | `(#:modules ((guix build utils)) | |
363 | #:builder | |
364 | (begin | |
365 | (use-modules (guix build utils)) | |
366 | (let* ((source (assoc-ref %build-inputs "source")) | |
367 | (lua-version ,(version-major+minor (package-version lua))) | |
368 | (destination (string-append (assoc-ref %outputs "out") | |
369 | "/share/lua/" lua-version))) | |
370 | (mkdir-p destination) | |
371 | (with-directory-excursion source | |
372 | (copy-recursively "lua/" destination))) | |
373 | #t))) | |
374 | (home-page "http://tieske.github.io/Penlight/") | |
375 | (synopsis "Collection of general purpose libraries for the Lua language") | |
376 | (description "Penlight is a set of pure Lua libraries focusing on | |
377 | input data handling (such as reading configuration files), functional | |
378 | programming (such as map, reduce, placeholder expressions,etc), and OS | |
379 | path management. Much of the functionality is inspired by the Python | |
380 | standard libraries.") | |
381 | (license license:expat))) | |
382 | ||
4898e06a NG |
383 | (define-public lua-ldoc |
384 | (package | |
385 | (name "lua-ldoc") | |
386 | (version "1.4.6") | |
387 | (source | |
388 | (origin | |
389 | (method git-fetch) | |
390 | (uri (git-reference | |
391 | (url "https://github.com/stevedonovan/LDoc.git") | |
392 | (commit version))) | |
393 | (file-name (git-file-name name version)) | |
394 | (sha256 | |
395 | (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8")))) | |
396 | (build-system gnu-build-system) | |
397 | (inputs | |
398 | `(("lua" ,lua))) | |
399 | (propagated-inputs | |
400 | `(("lua-penlight" ,lua-penlight))) | |
401 | (arguments | |
402 | `(#:tests? #f ;tests must run after installation. | |
403 | #:phases | |
404 | (modify-phases %standard-phases | |
405 | (add-after 'unpack 'fix-installation-directory | |
406 | (lambda* (#:key outputs #:allow-other-keys) | |
407 | (let ((out (assoc-ref outputs "out")) | |
408 | (lua-version ,(version-major+minor (package-version lua)))) | |
409 | (substitute* "makefile" | |
410 | (("LUA=.*") "#\n") | |
411 | (("(LUA_PREFIX=).*" _ prefix) | |
412 | (string-append prefix out "\n")) | |
413 | (("(LUA_BINDIR=).*" _ prefix) | |
414 | (string-append prefix out "/bin\n")) | |
415 | (("(LUA_SHAREDIR=).*" _ prefix) | |
416 | (string-append prefix out "/share/lua/" lua-version "\n")))) | |
417 | #t)) | |
418 | (delete 'configure) | |
419 | (add-before 'install 'create-bin-directory | |
420 | (lambda* (#:key outputs #:allow-other-keys) | |
421 | (mkdir-p (string-append (assoc-ref outputs "out") "/bin")) | |
422 | #t))))) | |
423 | (home-page "http://stevedonovan.github.io/ldoc/") | |
424 | (synopsis "Lua documentation generator") | |
425 | (description | |
426 | "LDoc is a LuaDoc-compatible documentation generation system for | |
427 | Lua source code. It parses the declaration and documentation comments | |
428 | in a set of Lua source files and produces a set of XHTML pages | |
429 | describing the commented declarations and functions.") | |
430 | (license license:expat))) | |
431 | ||
1c58aa6f | 432 | (define (make-lua-lgi name lua) |
03d8505f | 433 | (package |
1c58aa6f | 434 | (name name) |
ad514303 | 435 | (version "0.9.2") |
03d8505f | 436 | (source |
1c58aa6f NG |
437 | (origin |
438 | (method git-fetch) | |
439 | (uri (git-reference | |
440 | (url "https://github.com/pavouk/lgi") | |
441 | (commit version))) | |
442 | (file-name (git-file-name name version)) | |
443 | (sha256 | |
444 | (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj")))) | |
03d8505f | 445 | (build-system gnu-build-system) |
446 | (arguments | |
1c58aa6f NG |
447 | `(#:make-flags |
448 | (list "CC=gcc" | |
449 | (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
03d8505f | 450 | #:phases |
451 | (modify-phases %standard-phases | |
1c58aa6f | 452 | (delete 'configure) ; no configure script |
03d8505f | 453 | (add-before 'build 'set-env |
454 | (lambda* (#:key inputs #:allow-other-keys) | |
1c58aa6f NG |
455 | ;; We need to load cairo dynamically. |
456 | (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib"))) | |
03d8505f | 457 | (setenv "LD_LIBRARY_PATH" cairo) |
458 | #t))) | |
459 | (add-before 'build 'set-lua-version | |
460 | (lambda _ | |
1c58aa6f | 461 | ;; Lua version and therefore install directories are hardcoded. |
03d8505f | 462 | (substitute* "./lgi/Makefile" |
1c58aa6f NG |
463 | (("LUA_VERSION=5.1") |
464 | (format #f | |
465 | "LUA_VERSION=~a" | |
466 | ,(version-major+minor (package-version lua))))) | |
03d8505f | 467 | #t)) |
468 | (add-before 'check 'skip-test-gtk | |
469 | (lambda _ | |
470 | ;; FIXME: Skip GTK tests: | |
471 | ;; gtk3 - can't get it to run with the xorg-server config below | |
472 | ;; and some non-gtk tests will also fail | |
473 | ;; gtk2 - lots of functions aren't implemented | |
474 | ;; We choose gtk2 as the lesser evil and simply skip the test. | |
475 | ;; Currently, awesome is the only package that uses lua-lgi but | |
476 | ;; it doesn't need or interact with GTK using lua-lgi. | |
477 | (substitute* "./tests/test.lua" | |
478 | (("'gtk.lua',") "-- 'gtk.lua',")) | |
479 | #t)) | |
480 | (add-before 'check 'start-xserver-instance | |
481 | (lambda* (#:key inputs #:allow-other-keys) | |
482 | ;; There must be a running X server during tests. | |
483 | (system (format #f "~a/bin/Xvfb :1 &" | |
484 | (assoc-ref inputs "xorg-server"))) | |
485 | (setenv "DISPLAY" ":1") | |
486 | #t))))) | |
1c58aa6f NG |
487 | (native-inputs |
488 | `(("dbus" ,dbus) ;tests use 'dbus-run-session' | |
489 | ("pkg-config" ,pkg-config))) | |
03d8505f | 490 | (inputs |
1c58aa6f | 491 | `(("cairo" ,cairo) |
03d8505f | 492 | ("glib" ,glib) |
1c58aa6f | 493 | ("gobject-introspection" ,gobject-introspection) |
c695fb76 | 494 | ("gtk" ,gtk+-2) |
03d8505f | 495 | ("libffi" ,libffi) |
1c58aa6f NG |
496 | ("lua" ,lua) |
497 | ("pango" ,pango) | |
c695fb76 | 498 | ("xorg-server" ,xorg-server))) |
03d8505f | 499 | (home-page "https://github.com/pavouk/lgi/") |
500 | (synopsis "Lua bridge to GObject based libraries") | |
501 | (description | |
1c58aa6f NG |
502 | "LGI is gobject-introspection based dynamic Lua binding to GObject based |
503 | libraries. It allows using GObject-based libraries directly from Lua. | |
03d8505f | 504 | Notable examples are GTK+, GStreamer and Webkit.") |
505 | (license license:expat))) | |
35cdc267 | 506 | |
1c58aa6f NG |
507 | (define-public lua-lgi |
508 | (make-lua-lgi "lua-lgi" lua)) | |
509 | ||
510 | (define-public lua5.1-lgi | |
511 | (make-lua-lgi "lua5.1-lgi" lua-5.1)) | |
512 | ||
513 | (define-public lua5.2-lgi | |
514 | (make-lua-lgi "lua5.2-lgi" lua-5.2)) | |
515 | ||
149b2c43 | 516 | (define (make-lua-lpeg name lua) |
35cdc267 | 517 | (package |
149b2c43 | 518 | (name name) |
e3545ffc | 519 | (version "1.0.2") |
35cdc267 JMSG |
520 | (source (origin |
521 | (method url-fetch) | |
522 | (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-" | |
523 | version ".tar.gz")) | |
524 | (sha256 | |
e3545ffc | 525 | (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8")))) |
35cdc267 JMSG |
526 | (build-system gnu-build-system) |
527 | (arguments | |
528 | `(#:phases | |
529 | (modify-phases %standard-phases | |
530 | (delete 'configure) | |
531 | ;; `make install` isn't available, so we have to do it manually | |
532 | (replace 'install | |
533 | (lambda* (#:key outputs #:allow-other-keys) | |
534 | (let ((out (assoc-ref outputs "out")) | |
535 | (lua-version ,(version-major+minor (package-version lua)))) | |
536 | (install-file "lpeg.so" | |
537 | (string-append out "/lib/lua/" lua-version)) | |
538 | (install-file "re.lua" | |
539 | (string-append out "/share/lua/" lua-version)) | |
540 | #t)))) | |
541 | #:test-target "test")) | |
c695fb76 | 542 | (inputs `(("lua" ,lua))) |
35cdc267 JMSG |
543 | (synopsis "Pattern-matching library for Lua") |
544 | (description | |
545 | "LPeg is a pattern-matching library for Lua, based on Parsing Expression | |
546 | Grammars (PEGs).") | |
547 | (home-page "http://www.inf.puc-rio.br/~roberto/lpeg") | |
548 | (license license:expat))) | |
cf9a788d | 549 | |
149b2c43 CL |
550 | (define-public lua-lpeg |
551 | (make-lua-lpeg "lua-lpeg" lua)) | |
552 | ||
01a0a0c4 H |
553 | (define-public lua5.1-lpeg |
554 | (make-lua-lpeg "lua5.1-lpeg" lua-5.1)) | |
555 | ||
d9ed1779 | 556 | (define-public lua5.2-lpeg |
149b2c43 | 557 | (make-lua-lpeg "lua5.2-lpeg" lua-5.2)) |
d9ed1779 | 558 | |
9ad3d679 RW |
559 | (define (make-lua-luv name lua) |
560 | (package | |
561 | (name name) | |
251ce98c | 562 | (version "1.32.0-0") |
9ad3d679 RW |
563 | (source (origin |
564 | ;; The release tarball includes the sources of libuv but does | |
565 | ;; not include the pkg-config files. | |
566 | (method git-fetch) | |
567 | (uri (git-reference | |
568 | (url "https://github.com/luvit/luv.git") | |
569 | (commit version))) | |
570 | (file-name (git-file-name name version)) | |
571 | (sha256 | |
572 | (base32 | |
251ce98c | 573 | "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh")))) |
9ad3d679 RW |
574 | (build-system cmake-build-system) |
575 | (arguments | |
5327fbb3 | 576 | `(#:tests? #f ; there are none |
9ad3d679 RW |
577 | #:configure-flags |
578 | '("-DWITH_LUA_ENGINE=Lua" | |
579 | "-DWITH_SHARED_LIBUV=On" | |
580 | "-DBUILD_MODULE=Off" | |
581 | "-DBUILD_SHARED_LIBS=On" | |
582 | "-DLUA_BUILD_TYPE=System") | |
583 | #:phases | |
584 | (modify-phases %standard-phases | |
585 | (add-after 'unpack 'copy-lua-compat | |
586 | (lambda* (#:key inputs #:allow-other-keys) | |
587 | (copy-recursively (assoc-ref inputs "lua-compat") | |
588 | "lua-compat") | |
589 | (setenv "CPATH" | |
590 | (string-append (getcwd) "/lua-compat:" | |
591 | (or (getenv "CPATH") ""))) | |
592 | #t))))) | |
593 | (inputs | |
594 | `(("lua" ,lua) | |
595 | ("libuv" ,libuv))) | |
596 | (native-inputs | |
597 | `(("lua-compat" | |
598 | ,(origin | |
599 | (method git-fetch) | |
600 | (uri (git-reference | |
601 | (url "https://github.com/keplerproject/lua-compat-5.3.git") | |
602 | (commit "daebe77a2f498817713df37f0bb316db1d82222f"))) | |
603 | (file-name "lua-compat-5.3-checkout") | |
604 | (sha256 | |
605 | (base32 | |
606 | "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz")))))) | |
607 | (home-page "https://github.com/luvit/luv/") | |
608 | (synopsis "Libuv bindings for Lua") | |
609 | (description | |
610 | "This library makes libuv available to Lua scripts.") | |
611 | (license license:asl2.0))) | |
612 | ||
613 | (define-public lua-luv | |
614 | (make-lua-luv "lua-luv" lua)) | |
615 | ||
616 | (define-public lua5.1-luv | |
617 | (make-lua-luv "lua5.1-luv" lua-5.1)) | |
618 | ||
619 | (define-public lua5.2-luv | |
620 | (make-lua-luv "lua5.2-luv" lua-5.2)) | |
621 | ||
cf9a788d | 622 | ;; Lua 5.3 is not supported. |
cb31a524 | 623 | (define (make-lua-bitop name lua) |
cf9a788d | 624 | (package |
cb31a524 | 625 | (name name) |
cf9a788d RW |
626 | (version "1.0.2") |
627 | (source (origin | |
628 | (method url-fetch) | |
629 | (uri (string-append "http://bitop.luajit.org/download/" | |
630 | "LuaBitOp-" version ".tar.gz")) | |
631 | (sha256 | |
632 | (base32 | |
633 | "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj")))) | |
634 | (build-system gnu-build-system) | |
635 | (arguments | |
636 | `(#:test-target "test" | |
637 | #:make-flags | |
638 | (list "INSTALL=install -pD" | |
639 | (string-append "INSTALLPATH=printf " | |
640 | (assoc-ref %outputs "out") | |
641 | "/lib/lua/" | |
cb31a524 | 642 | ,(version-major+minor (package-version lua)) |
cf9a788d RW |
643 | "/bit/bit.so")) |
644 | #:phases | |
645 | (modify-phases %standard-phases | |
646 | (delete 'configure)))) | |
c695fb76 | 647 | (inputs `(("lua" ,lua))) |
0386cdd3 | 648 | (home-page "https://bitop.luajit.org/index.html") |
cf9a788d RW |
649 | (synopsis "Bitwise operations on numbers for Lua") |
650 | (description | |
651 | "Lua BitOp is a C extension module for Lua which adds bitwise operations | |
652 | on numbers.") | |
653 | (license license:expat))) | |
cb31a524 CL |
654 | |
655 | (define-public lua5.2-bitop | |
656 | (make-lua-bitop "lua5.2-bitop" lua-5.2)) | |
657 | ||
658 | (define-public lua5.1-bitop | |
659 | (make-lua-bitop "lua5.1-bitop" lua-5.1)) | |
ce577655 FT |
660 | |
661 | (define-public selene | |
662 | (package | |
663 | (name "selene") | |
664 | (version "2017.08.25") | |
665 | (source (origin | |
666 | (method git-fetch) | |
667 | (uri (git-reference | |
668 | (url "https://github.com/jeremyong/Selene.git") | |
669 | ;; The release is quite old. | |
670 | (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9"))) | |
671 | (file-name "Selene") | |
672 | (sha256 | |
673 | (base32 | |
674 | "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508")))) | |
675 | (build-system cmake-build-system) | |
676 | (arguments | |
677 | `(#:configure-flags | |
678 | ;; lua pc file in CMakeLists.txt is lua5.3.pc | |
679 | '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1") | |
680 | #:test-target "all" | |
681 | #:phases | |
682 | ;; This is a header only library | |
683 | (modify-phases %standard-phases | |
684 | (delete 'build) | |
685 | (replace 'install | |
686 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
687 | (let* ((output (assoc-ref outputs "out")) | |
688 | (source (assoc-ref inputs "source")) | |
689 | (includedir (string-append output "/include"))) | |
690 | (copy-recursively | |
691 | (string-append source "/include") | |
692 | includedir)) | |
693 | #t)) | |
694 | ;; The path of test files are hard coded. | |
695 | (replace 'check | |
696 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
697 | (let* ((output (assoc-ref outputs "out")) | |
698 | (source (assoc-ref inputs "source")) | |
699 | (builddir (getcwd)) | |
700 | (testdir (string-append builddir "/test"))) | |
701 | (copy-recursively (string-append source "/test") testdir) | |
702 | (invoke "make") | |
703 | (mkdir-p "runner") | |
704 | (copy-file "./test_runner" "./runner/test_runner") | |
705 | (chdir "./runner") | |
706 | (invoke "./test_runner"))))))) | |
707 | (native-inputs | |
708 | `(("lua" ,lua) | |
709 | ("pkg-config" ,pkg-config))) | |
710 | (home-page "https://github.com/jeremyong/Selene") | |
711 | (synopsis "Lua C++11 bindings") | |
712 | (description | |
713 | "Selene is a simple C++11 header-only library enabling seamless | |
714 | interoperability between C++ and Lua programming language.") | |
715 | (license license:zlib))) |