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