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