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