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