lua.scm 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
  3. ;;; Copyright © 2014 Raimon Grau <raimonster@gmail.com>
  4. ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
  5. ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
  6. ;;; Copyright © 2016, 2017, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
  8. ;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
  9. ;;; Copyright © 2016, 2017, 2019 Clément Lassieur <clement@lassieur.org>
  10. ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
  11. ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  12. ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
  13. ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  14. ;;; Copyright © 2020 Simon South <simon@simonsouth.net>
  15. ;;; Copyright © 2020 Paul A. Patience <paul@apatience.com>
  16. ;;; Copyright © 2021 Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
  17. ;;;
  18. ;;; This file is part of GNU Guix.
  19. ;;;
  20. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  21. ;;; under the terms of the GNU General Public License as published by
  22. ;;; the Free Software Foundation; either version 3 of the License, or (at
  23. ;;; your option) any later version.
  24. ;;;
  25. ;;; GNU Guix is distributed in the hope that it will be useful, but
  26. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  27. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. ;;; GNU General Public License for more details.
  29. ;;;
  30. ;;; You should have received a copy of the GNU General Public License
  31. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  32. (define-module (gnu packages lua)
  33. #:use-module ((guix licenses) #:prefix license:)
  34. #:use-module (guix packages)
  35. #:use-module (guix download)
  36. #:use-module (guix git-download)
  37. #:use-module (guix utils)
  38. #:use-module (guix build-system gnu)
  39. #:use-module (guix build-system cmake)
  40. #:use-module (guix build-system meson)
  41. #:use-module (guix build-system trivial)
  42. #:use-module (gnu packages)
  43. #:use-module (gnu packages boost)
  44. #:use-module (gnu packages build-tools)
  45. #:use-module (gnu packages gcc)
  46. #:use-module (gnu packages glib)
  47. #:use-module (gnu packages gtk)
  48. #:use-module (gnu packages libevent)
  49. #:use-module (gnu packages libffi)
  50. #:use-module (gnu packages m4)
  51. #:use-module (gnu packages ncurses)
  52. #:use-module (gnu packages pkg-config)
  53. #:use-module (gnu packages pretty-print)
  54. #:use-module (gnu packages re2c)
  55. #:use-module (gnu packages readline)
  56. #:use-module (gnu packages tls)
  57. #:use-module (gnu packages vim)
  58. #:use-module (gnu packages xml)
  59. #:use-module (gnu packages xorg))
  60. (define-public lua
  61. (package
  62. (name "lua")
  63. (version "5.3.5")
  64. (source (origin
  65. (method url-fetch)
  66. (uri (string-append "https://www.lua.org/ftp/lua-"
  67. version ".tar.gz"))
  68. (sha256
  69. (base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
  70. (patches (search-patches "lua-pkgconfig.patch"
  71. "lua-liblua-so.patch"))))
  72. (build-system gnu-build-system)
  73. (inputs `(("readline" ,readline)))
  74. (arguments
  75. `(#:modules ((guix build gnu-build-system)
  76. (guix build utils)
  77. (srfi srfi-1))
  78. #:test-target "test"
  79. #:make-flags
  80. (list "MYCFLAGS=-fPIC -DLUA_DL_DLOPEN"
  81. (string-append "CC=" ,(cc-for-target))
  82. (string-append "SYSLIBS=-L" (assoc-ref %build-inputs "readline")
  83. "/lib")
  84. "linux")
  85. #:phases
  86. (modify-phases %standard-phases
  87. (delete 'configure)
  88. (replace 'install
  89. (lambda* (#:key outputs #:allow-other-keys)
  90. (let ((out (assoc-ref outputs "out")))
  91. (invoke "make" "install"
  92. (string-append "INSTALL_TOP=" out)
  93. (string-append "INSTALL_MAN=" out
  94. "/share/man/man1"))))))))
  95. (home-page "https://www.lua.org/")
  96. (synopsis "Embeddable scripting language")
  97. (description
  98. "Lua is a powerful, fast, lightweight, embeddable scripting language. Lua
  99. combines simple procedural syntax with powerful data description constructs
  100. based on associative arrays and extensible semantics. Lua is dynamically typed,
  101. runs by interpreting bytecode for a register-based virtual machine, and has
  102. automatic memory management with incremental garbage collection, making it ideal
  103. for configuration, scripting, and rapid prototyping.")
  104. (license license:x11)))
  105. (define-public lua-5.2
  106. (package (inherit lua)
  107. (version "5.2.4")
  108. (source
  109. (origin
  110. (method url-fetch)
  111. (uri (string-append "https://www.lua.org/ftp/lua-"
  112. version ".tar.gz"))
  113. (sha256
  114. (base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
  115. (patches (search-patches "lua-pkgconfig.patch"
  116. "lua-liblua-so.patch"))))))
  117. (define-public lua-5.1
  118. (package (inherit lua)
  119. (version "5.1.5")
  120. (source (origin
  121. (method url-fetch)
  122. (uri (string-append "https://www.lua.org/ftp/lua-"
  123. version ".tar.gz"))
  124. (sha256
  125. (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
  126. (patches (search-patches "lua51-liblua-so.patch"
  127. "lua-CVE-2014-5461.patch"
  128. "lua51-pkgconfig.patch"))))))
  129. (define-public luajit
  130. (package
  131. (name "luajit")
  132. (version "2.1.0-beta3")
  133. (source (origin
  134. (method url-fetch)
  135. (uri (string-append "http://luajit.org/download/LuaJIT-"
  136. version ".tar.gz"))
  137. (sha256
  138. (base32 "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"))
  139. (patches (search-patches "luajit-no_ldconfig.patch"))))
  140. (build-system gnu-build-system)
  141. (arguments
  142. `(#:tests? #f ; luajit is distributed without tests
  143. #:phases
  144. (modify-phases %standard-phases
  145. (delete 'configure) ; no configure script
  146. (add-after 'install 'create-luajit-symlink
  147. (lambda* (#:key outputs #:allow-other-keys)
  148. (let* ((out (assoc-ref outputs "out"))
  149. (bin (string-append out "/bin")))
  150. (with-directory-excursion bin
  151. (symlink ,(string-append name "-" version)
  152. ,name)
  153. #t)))))
  154. #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
  155. (home-page "https://www.luajit.org/")
  156. (synopsis "Just in time compiler for Lua programming language version 5.1")
  157. (description
  158. "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua
  159. programming language. Lua is a powerful, dynamic and light-weight programming
  160. language. It may be embedded or used as a general-purpose, stand-alone
  161. language.")
  162. (license license:x11)))
  163. (define-public luajit-lua52-openresty
  164. (package
  165. (inherit luajit)
  166. (name "luajit-lua52-openresty")
  167. (version "2.1-20201229")
  168. (source
  169. (origin
  170. (method git-fetch)
  171. (uri (git-reference
  172. (url "https://github.com/openresty/luajit2.git")
  173. (commit (string-append "v" version))))
  174. (file-name (git-file-name name version))
  175. (sha256
  176. (base32 "07haj27kbpbnkv836c2nd36h2xislrmri52w0zbpxvl68xk6g96p"))))
  177. (arguments
  178. `(#:tests? #f ;no test
  179. #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  180. #:phases
  181. (modify-phases %standard-phases
  182. (delete 'configure) ;no configure script
  183. (add-after 'unpack 'enable-lua52-compat
  184. (lambda _
  185. (substitute* "src/Makefile"
  186. (("#(XCFLAGS\\+= -DLUAJIT_ENABLE_LUA52COMPAT)" _ flag) flag))
  187. #t)))))
  188. (home-page "https://github.com/openresty/luajit2")
  189. (synopsis "OpenResty's Branch of LuaJIT 2")
  190. (description
  191. "This is the official OpenResty branch of LuaJIT. It is not to be
  192. considered a fork, since changes are regularly synchronized from the upstream
  193. LuaJIT project. This package also enables the Lua 5.2 compat mode needed by
  194. some projects.")))
  195. (define (make-lua-expat name lua)
  196. (package
  197. (name name)
  198. (version "1.3.0")
  199. (source (origin
  200. (method url-fetch)
  201. (uri (string-append "https://matthewwild.co.uk/projects/"
  202. "luaexpat/luaexpat-" version ".tar.gz"))
  203. (sha256
  204. (base32
  205. "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"))))
  206. (build-system gnu-build-system)
  207. (arguments
  208. `(#:make-flags
  209. (let ((out (assoc-ref %outputs "out"))
  210. (lua-version ,(version-major+minor (package-version lua))))
  211. (list ,(string-append "CC=" (cc-for-target))
  212. (string-append "LUA_LDIR=" out "/share/lua/" lua-version)
  213. (string-append "LUA_CDIR=" out "/lib/lua/" lua-version)))
  214. #:phases
  215. (modify-phases %standard-phases
  216. (delete 'configure)
  217. (replace 'check
  218. (lambda _
  219. (setenv "LUA_CPATH" "src/?.so;;")
  220. (setenv "LUA_PATH" "src/?.lua;;")
  221. (invoke "lua" "tests/test.lua")
  222. (invoke "lua" "tests/test-lom.lua"))))))
  223. (inputs
  224. `(("lua" ,lua)
  225. ("expat" ,expat)))
  226. (home-page "https://matthewwild.co.uk/projects/luaexpat/")
  227. (synopsis "SAX XML parser based on the Expat library")
  228. (description "LuaExpat is a SAX XML parser based on the Expat library.")
  229. (license (package-license lua-5.1))))
  230. (define-public lua5.1-expat
  231. (make-lua-expat "lua5.1-expat" lua-5.1))
  232. (define-public lua5.2-expat
  233. (make-lua-expat "lua5.2-expat" lua-5.2))
  234. (define (make-lua-socket name lua)
  235. (package
  236. (name name)
  237. (version "3.0-rc1")
  238. (source (origin
  239. (method git-fetch)
  240. (uri (git-reference
  241. (url "https://github.com/diegonehab/luasocket")
  242. (commit (string-append "v" version))))
  243. (file-name (git-file-name name version))
  244. (sha256
  245. (base32
  246. "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk"))))
  247. (build-system gnu-build-system)
  248. (arguments
  249. `(#:make-flags
  250. (let ((out (assoc-ref %outputs "out"))
  251. (lua-version ,(version-major+minor (package-version lua))))
  252. (list (string-append "INSTALL_TOP=" out)
  253. (string-append "LUAV?=" lua-version)))
  254. #:phases
  255. (modify-phases %standard-phases
  256. (delete 'configure)
  257. (replace 'check
  258. (lambda _
  259. (setenv "LUA_CPATH" (string-append "src/?.so." ,version ";;"))
  260. (setenv "LUA_PATH" "src/?.lua;;")
  261. (when (zero? (primitive-fork))
  262. (invoke "lua" "test/testsrvr.lua"))
  263. (invoke "lua" "test/testclnt.lua"))))))
  264. (inputs
  265. `(("lua" ,lua)))
  266. (home-page "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/")
  267. (synopsis "Socket library for Lua")
  268. (description "LuaSocket is a Lua extension library that is composed by two
  269. parts: a C core that provides support for the TCP and UDP transport layers,
  270. and a set of Lua modules that add support for functionality commonly needed by
  271. applications that deal with the Internet.
  272. Among the supported modules, the most commonly used implement the
  273. SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading
  274. files) client protocols. These provide a very natural and generic interface
  275. to the functionality defined by each protocol. In addition, you will find
  276. that the MIME (common encodings), URL (anything you could possible want to do
  277. with one) and LTN12 (filters, sinks, sources and pumps) modules can be very
  278. handy.")
  279. (license license:expat)))
  280. (define-public lua5.1-socket
  281. (make-lua-socket "lua5.1-socket" lua-5.1))
  282. (define-public lua5.2-socket
  283. (make-lua-socket "lua5.2-socket" lua-5.2))
  284. (define (make-lua-filesystem name lua)
  285. (package
  286. (name name)
  287. (version "1.7.0.2")
  288. (source (origin
  289. (method git-fetch)
  290. (uri (git-reference
  291. (url "https://github.com/keplerproject/luafilesystem")
  292. (commit (string-append "v"
  293. (string-join
  294. (string-split version #\.) "_")))))
  295. (file-name (git-file-name name version))
  296. (sha256
  297. (base32
  298. "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi"))))
  299. (build-system gnu-build-system)
  300. (arguments
  301. `(#:make-flags
  302. (let ((out (assoc-ref %outputs "out"))
  303. (lua-version ,(version-major+minor (package-version lua))))
  304. (list (string-append "PREFIX=" out)
  305. (string-append "LUA_LIBDIR=" out "/lib/lua/" lua-version)))
  306. #:test-target "test"
  307. #:phases
  308. (modify-phases %standard-phases
  309. (delete 'configure))))
  310. (inputs
  311. `(("lua" ,lua)))
  312. (home-page "https://keplerproject.github.io/luafilesystem/index.html")
  313. (synopsis "File system library for Lua")
  314. (description "LuaFileSystem is a Lua library developed to complement the
  315. set of functions related to file systems offered by the standard Lua
  316. distribution. LuaFileSystem offers a portable way to access the underlying
  317. directory structure and file attributes.")
  318. (license (package-license lua-5.1))))
  319. (define-public lua-filesystem
  320. (make-lua-filesystem "lua-filesystem" lua))
  321. (define-public lua5.1-filesystem
  322. (make-lua-filesystem "lua5.1-filesystem" lua-5.1))
  323. (define-public lua5.2-filesystem
  324. (make-lua-filesystem "lua5.2-filesystem" lua-5.2))
  325. (define (make-lua-ossl name lua)
  326. (package
  327. (name name)
  328. (version "20170903")
  329. (source (origin
  330. (method url-fetch)
  331. (uri (string-append "https://25thandclement.com/~william/"
  332. "projects/releases/luaossl-" version ".tgz"))
  333. (sha256
  334. (base32
  335. "10392bvd0lzyibipblgiss09zlqh3a5zgqg1b9lgbybpqb9cv2k3"))))
  336. (build-system gnu-build-system)
  337. (arguments
  338. `(#:make-flags
  339. (let ((out (assoc-ref %outputs "out"))
  340. (lua-api-version ,(version-major+minor (package-version lua))))
  341. (list ,(string-append "CC=" (cc-for-target))
  342. "CFLAGS='-D HAVE_SYS_SYSCTL_H=0'" ; sys/sysctl.h is deprecated
  343. (string-append "prefix=" out)
  344. (string-append "LUA_APIS=" lua-api-version)))
  345. #:phases
  346. (modify-phases %standard-phases
  347. (delete 'configure)
  348. (delete 'check)
  349. (add-after 'install 'check
  350. (lambda* (#:key outputs #:allow-other-keys)
  351. (let ((out (assoc-ref outputs "out"))
  352. (lua-version ,(version-major+minor (package-version lua))))
  353. (setenv "LUA_CPATH"
  354. (string-append out "/lib/lua/" lua-version "/?.so;;"))
  355. (setenv "LUA_PATH"
  356. (string-append out "/share/lua/" lua-version "/?.lua;;"))
  357. (with-directory-excursion "regress"
  358. (for-each (lambda (f)
  359. (invoke "lua" f))
  360. (find-files "." "^[0-9].*\\.lua$"))))
  361. #t)))))
  362. (inputs
  363. `(("lua" ,lua)
  364. ("openssl" ,openssl)))
  365. (home-page "https://25thandclement.com/~william/projects/luaossl.html")
  366. (synopsis "OpenSSL bindings for Lua")
  367. (description "The luaossl extension module for Lua provides comprehensive,
  368. low-level bindings to the OpenSSL library, including support for certificate and
  369. key management, key generation, signature verification, and deep bindings to the
  370. distinguished name, alternative name, and X.509v3 extension interfaces. It also
  371. binds OpenSSL's bignum, message digest, HMAC, cipher, and CSPRNG interfaces.")
  372. (license license:expat)))
  373. (define-public lua-ossl
  374. (make-lua-ossl "lua-ossl" lua))
  375. (define-public lua5.1-ossl
  376. (make-lua-ossl "lua5.1-ossl" lua-5.1))
  377. (define-public lua5.2-ossl
  378. (make-lua-ossl "lua5.2-ossl" lua-5.2))
  379. (define (make-lua-sec name lua)
  380. (package
  381. (name name)
  382. (version "0.9")
  383. (source (origin
  384. (method git-fetch)
  385. (uri (git-reference
  386. (url "https://github.com/brunoos/luasec")
  387. (commit (string-append "v" version))))
  388. (file-name (git-file-name name version))
  389. (sha256
  390. (base32
  391. "0ssncgkggyr8i3z6zbvgrgsqj2q8676rnsikhpfwnk9n7sx4gwbl"))))
  392. (build-system gnu-build-system)
  393. (arguments
  394. `(#:make-flags
  395. (let ((out (assoc-ref %outputs "out"))
  396. (lua-version ,(version-major+minor (package-version lua))))
  397. (list "linux"
  398. ,(string-append "CC=" (cc-for-target))
  399. "LD=gcc"
  400. (string-append "LUAPATH=" out "/share/lua/" lua-version)
  401. (string-append "LUACPATH=" out "/lib/lua/" lua-version)))
  402. #:tests? #f ; no tests included
  403. #:phases
  404. (modify-phases %standard-phases
  405. (delete 'configure))))
  406. (inputs
  407. `(("lua" ,lua)
  408. ("openssl" ,openssl)))
  409. (propagated-inputs
  410. `(("lua-socket"
  411. ,(make-lua-socket
  412. (format #f "lua~a-socket"
  413. (version-major+minor (package-version lua))) lua))))
  414. (home-page "https://github.com/brunoos/luasec/wiki")
  415. (synopsis "OpenSSL bindings for Lua")
  416. (description "LuaSec is a binding for OpenSSL library to provide TLS/SSL
  417. communication. It takes an already established TCP connection and creates a
  418. secure session between the peers.")
  419. (license license:expat)))
  420. (define-public lua5.1-sec
  421. (make-lua-sec "lua5.1-sec" lua-5.1))
  422. (define-public lua5.2-sec
  423. (make-lua-sec "lua5.2-sec" lua-5.2))
  424. (define (make-lua-cqueues name lua lua-ossl)
  425. (package
  426. (name name)
  427. (version "20171014")
  428. (source (origin
  429. (method url-fetch)
  430. (uri (string-append "https://25thandclement.com/~william/"
  431. "projects/releases/cqueues-" version ".tgz"))
  432. (sha256
  433. (base32
  434. "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb"))))
  435. (build-system gnu-build-system)
  436. (arguments
  437. `(#:modules ((guix build gnu-build-system)
  438. (guix build utils)
  439. (ice-9 string-fun))
  440. #:make-flags
  441. (let ((out (assoc-ref %outputs "out"))
  442. (lua-api-version ,(version-major+minor (package-version lua))))
  443. (list ,(string-append "CC=" (cc-for-target))
  444. (string-append "LUA_APIS=" lua-api-version)))
  445. #:phases
  446. (modify-phases %standard-phases
  447. (delete 'configure)
  448. (delete 'check)
  449. (replace 'install
  450. (lambda* (#:key make-flags outputs #:allow-other-keys)
  451. (let ((out (assoc-ref outputs "out")))
  452. (apply invoke "make" "install"
  453. (append make-flags
  454. (list (string-append "DESTDIR=" out)
  455. "prefix="))))))
  456. (add-after 'install 'check
  457. (lambda* (#:key inputs outputs make-flags #:allow-other-keys)
  458. (let*
  459. ((lua-version ,(version-major+minor (package-version lua)))
  460. (env-suffix (if (equal? lua-version "5.1")
  461. ""
  462. (string-append
  463. "_"
  464. (string-replace-substring lua-version "." "_"))))
  465. (lua-ossl (assoc-ref inputs "lua-ossl"))
  466. (out (assoc-ref outputs "out"))
  467. (lua-cpath (lambda (p)
  468. (string-append p "/lib/lua/" lua-version "/?.so")))
  469. (lua-path (lambda (p)
  470. (string-append p "/share/lua/" lua-version "/?.lua"))))
  471. ;; The test suite sets Lua-version-specific search-path variables
  472. ;; when available so we must do the same, as these take
  473. ;; precedence over the generic "LUA_CPATH" and "LUA_PATH"
  474. (setenv (string-append "LUA_CPATH" env-suffix)
  475. (string-append
  476. (string-join (map lua-cpath (list out lua-ossl)) ";")
  477. ";;"))
  478. (setenv (string-append "LUA_PATH" env-suffix)
  479. (string-append
  480. (string-join (map lua-path (list out lua-ossl)) ";")
  481. ";;"))
  482. ;; Skip regression tests we expect to fail
  483. (with-directory-excursion "regress"
  484. (for-each (lambda (f)
  485. (rename-file f (string-append f ".skip")))
  486. (append
  487. ;; Regression tests that require network
  488. ;; connectivity
  489. '("22-client-dtls.lua"
  490. "30-starttls-completion.lua"
  491. "62-noname.lua"
  492. "153-dns-resolvers.lua")
  493. ;; Regression tests that require LuaJIT
  494. '("44-resolvers-gc.lua"
  495. "51-join-defunct-thread.lua")
  496. ;; Regression tests that require Lua 5.3
  497. (if (not (equal? lua-version "5.3"))
  498. '("152-thread-integer-passing.lua")
  499. '()))))
  500. (apply invoke "make" "check" make-flags)))))))
  501. (native-inputs
  502. `(("m4" ,m4)))
  503. (inputs
  504. `(("lua" ,lua)
  505. ("openssl" ,openssl)))
  506. (propagated-inputs
  507. `(("lua-ossl" ,lua-ossl)))
  508. (home-page "https://25thandclement.com/~william/projects/cqueues.html")
  509. (synopsis "Event loop for Lua using continuation queues")
  510. (description "The cqueues extension module for Lua implements an event loop
  511. that operates through the yielding and resumption of coroutines. It is designed
  512. to be non-intrusive, composable, and embeddable within existing applications.")
  513. (license license:expat)))
  514. (define-public lua-cqueues
  515. (make-lua-cqueues "lua-cqueues" lua lua-ossl))
  516. (define-public lua5.1-cqueues
  517. (make-lua-cqueues "lua5.1-cqueues" lua-5.1 lua5.1-ossl))
  518. (define-public lua5.2-cqueues
  519. (make-lua-cqueues "lua5.2-cqueues" lua-5.2 lua5.2-ossl))
  520. (define-public lua-penlight
  521. (package
  522. (name "lua-penlight")
  523. (version "1.7.0")
  524. (source
  525. (origin
  526. (method git-fetch)
  527. (uri (git-reference
  528. (url "https://github.com/Tieske/Penlight")
  529. (commit version)))
  530. (file-name (git-file-name name version))
  531. (sha256
  532. (base32 "0qc2d1riyr4b5a0gnsmdw2lz5pw65s4ac60hc34w3mmk9l6yg6nl"))))
  533. (build-system trivial-build-system)
  534. (inputs
  535. `(("lua" ,lua)))
  536. (propagated-inputs
  537. `(("lua-filesystem" ,lua-filesystem)))
  538. (arguments
  539. `(#:modules ((guix build utils))
  540. #:builder
  541. (begin
  542. (use-modules (guix build utils))
  543. (let* ((source (assoc-ref %build-inputs "source"))
  544. (lua-version ,(version-major+minor (package-version lua)))
  545. (destination (string-append (assoc-ref %outputs "out")
  546. "/share/lua/" lua-version)))
  547. (mkdir-p destination)
  548. (with-directory-excursion source
  549. (copy-recursively "lua/" destination)))
  550. #t)))
  551. (home-page "http://tieske.github.io/Penlight/")
  552. (synopsis "Collection of general purpose libraries for the Lua language")
  553. (description "Penlight is a set of pure Lua libraries focusing on
  554. input data handling (such as reading configuration files), functional
  555. programming (such as map, reduce, placeholder expressions,etc), and OS
  556. path management. Much of the functionality is inspired by the Python
  557. standard libraries.")
  558. (license license:expat)))
  559. (define-public lua-ldoc
  560. (package
  561. (name "lua-ldoc")
  562. (version "1.4.6")
  563. (source
  564. (origin
  565. (method git-fetch)
  566. (uri (git-reference
  567. (url "https://github.com/stevedonovan/LDoc")
  568. (commit version)))
  569. (file-name (git-file-name name version))
  570. (sha256
  571. (base32 "1h0cf7bp4am54r0j8lhjs2l1c7q5vz74ba0jvw9qdbaqimls46g8"))))
  572. (build-system gnu-build-system)
  573. (inputs
  574. `(("lua" ,lua)))
  575. (propagated-inputs
  576. `(("lua-penlight" ,lua-penlight)))
  577. (arguments
  578. `(#:tests? #f ;tests must run after installation.
  579. #:phases
  580. (modify-phases %standard-phases
  581. (add-after 'unpack 'fix-installation-directory
  582. (lambda* (#:key outputs #:allow-other-keys)
  583. (let ((out (assoc-ref outputs "out"))
  584. (lua-version ,(version-major+minor (package-version lua))))
  585. (substitute* "makefile"
  586. (("LUA=.*") "#\n")
  587. (("(LUA_PREFIX=).*" _ prefix)
  588. (string-append prefix out "\n"))
  589. (("(LUA_BINDIR=).*" _ prefix)
  590. (string-append prefix out "/bin\n"))
  591. (("(LUA_SHAREDIR=).*" _ prefix)
  592. (string-append prefix out "/share/lua/" lua-version "\n"))))
  593. #t))
  594. (delete 'configure)
  595. (add-before 'install 'create-bin-directory
  596. (lambda* (#:key outputs #:allow-other-keys)
  597. (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))
  598. #t)))))
  599. (home-page "http://stevedonovan.github.io/ldoc/")
  600. (synopsis "Lua documentation generator")
  601. (description
  602. "LDoc is a LuaDoc-compatible documentation generation system for
  603. Lua source code. It parses the declaration and documentation comments
  604. in a set of Lua source files and produces a set of XHTML pages
  605. describing the commented declarations and functions.")
  606. (license license:expat)))
  607. (define (make-lua-lgi name lua)
  608. (package
  609. (name name)
  610. (version "0.9.2")
  611. (source
  612. (origin
  613. (method git-fetch)
  614. (uri (git-reference
  615. (url "https://github.com/pavouk/lgi")
  616. (commit version)))
  617. (file-name (git-file-name name version))
  618. (sha256
  619. (base32 "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj"))))
  620. (build-system gnu-build-system)
  621. (arguments
  622. `(#:make-flags
  623. (list ,(string-append "CC=" (cc-for-target))
  624. (string-append "PREFIX=" (assoc-ref %outputs "out")))
  625. #:phases
  626. (modify-phases %standard-phases
  627. (delete 'configure) ; no configure script
  628. (add-before 'build 'set-env
  629. (lambda* (#:key inputs #:allow-other-keys)
  630. ;; We need to load cairo dynamically.
  631. (let* ((cairo (string-append (assoc-ref inputs "cairo") "/lib")))
  632. (setenv "LD_LIBRARY_PATH" cairo)
  633. #t)))
  634. (add-before 'build 'set-lua-version
  635. (lambda _
  636. ;; Lua version and therefore install directories are hardcoded.
  637. (substitute* "./lgi/Makefile"
  638. (("LUA_VERSION=5.1")
  639. (format #f
  640. "LUA_VERSION=~a"
  641. ,(version-major+minor (package-version lua)))))
  642. #t))
  643. (add-before 'check 'skip-test-gtk
  644. (lambda _
  645. ;; FIXME: Skip GTK tests:
  646. ;; gtk3 - can't get it to run with the xorg-server config below
  647. ;; and some non-gtk tests will also fail
  648. ;; gtk2 - lots of functions aren't implemented
  649. ;; We choose gtk2 as the lesser evil and simply skip the test.
  650. ;; Currently, awesome is the only package that uses lua-lgi but
  651. ;; it doesn't need or interact with GTK using lua-lgi.
  652. (substitute* "./tests/test.lua"
  653. (("'gtk.lua',") "-- 'gtk.lua',"))
  654. #t))
  655. (add-before 'check 'start-xserver-instance
  656. (lambda* (#:key inputs #:allow-other-keys)
  657. ;; There must be a running X server during tests.
  658. (system (format #f "~a/bin/Xvfb :1 &"
  659. (assoc-ref inputs "xorg-server")))
  660. (setenv "DISPLAY" ":1")
  661. #t)))))
  662. (native-inputs
  663. `(("dbus" ,dbus) ;tests use 'dbus-run-session'
  664. ("pkg-config" ,pkg-config)))
  665. (inputs
  666. `(("cairo" ,cairo)
  667. ("glib" ,glib)
  668. ("gobject-introspection" ,gobject-introspection)
  669. ("gtk" ,gtk+-2)
  670. ("libffi" ,libffi)
  671. ("lua" ,lua)
  672. ("pango" ,pango)
  673. ("xorg-server" ,xorg-server)))
  674. (home-page "https://github.com/pavouk/lgi/")
  675. (synopsis "Lua bridge to GObject based libraries")
  676. (description
  677. "LGI is gobject-introspection based dynamic Lua binding to GObject based
  678. libraries. It allows using GObject-based libraries directly from Lua.
  679. Notable examples are GTK+, GStreamer and Webkit.")
  680. (license license:expat)))
  681. (define-public lua-lgi
  682. (make-lua-lgi "lua-lgi" lua))
  683. (define-public lua5.1-lgi
  684. (make-lua-lgi "lua5.1-lgi" lua-5.1))
  685. (define-public lua5.2-lgi
  686. (make-lua-lgi "lua5.2-lgi" lua-5.2))
  687. (define (make-lua-lpeg name lua)
  688. (package
  689. (name name)
  690. (version "1.0.2")
  691. (source (origin
  692. (method url-fetch)
  693. (uri (string-append "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-"
  694. version ".tar.gz"))
  695. (sha256
  696. (base32 "1zjzl7acvcdavmcg5l7wi12jd4rh95q9pl5aiww7hv0v0mv6bmj8"))))
  697. (build-system gnu-build-system)
  698. (arguments
  699. `(#:phases
  700. (modify-phases %standard-phases
  701. (delete 'configure)
  702. ;; `make install` isn't available, so we have to do it manually
  703. (replace 'install
  704. (lambda* (#:key outputs #:allow-other-keys)
  705. (let ((out (assoc-ref outputs "out"))
  706. (lua-version ,(version-major+minor (package-version lua))))
  707. (install-file "lpeg.so"
  708. (string-append out "/lib/lua/" lua-version))
  709. (install-file "re.lua"
  710. (string-append out "/share/lua/" lua-version))
  711. #t))))
  712. #:test-target "test"))
  713. (inputs `(("lua" ,lua)))
  714. (synopsis "Pattern-matching library for Lua")
  715. (description
  716. "LPeg is a pattern-matching library for Lua, based on Parsing Expression
  717. Grammars (PEGs).")
  718. (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
  719. (license license:expat)))
  720. (define-public lua-lpeg
  721. (make-lua-lpeg "lua-lpeg" lua))
  722. (define-public lua5.1-lpeg
  723. (make-lua-lpeg "lua5.1-lpeg" lua-5.1))
  724. (define-public lua5.2-lpeg
  725. (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
  726. (define (make-lua-luv name lua)
  727. (package
  728. (name name)
  729. (version "1.32.0-0")
  730. (source (origin
  731. ;; The release tarball includes the sources of libuv but does
  732. ;; not include the pkg-config files.
  733. (method git-fetch)
  734. (uri (git-reference
  735. (url "https://github.com/luvit/luv")
  736. (commit version)))
  737. (file-name (git-file-name name version))
  738. (sha256
  739. (base32
  740. "0c65c1lhbl0axnyks3910gjs0z0hw7w6jvl07g8kbpnbvfl4qajh"))))
  741. (build-system cmake-build-system)
  742. (arguments
  743. `(#:tests? #f ; there are none
  744. #:configure-flags
  745. '("-DWITH_LUA_ENGINE=Lua"
  746. "-DWITH_SHARED_LIBUV=On"
  747. "-DBUILD_MODULE=Off"
  748. "-DBUILD_SHARED_LIBS=On"
  749. "-DLUA_BUILD_TYPE=System")
  750. #:phases
  751. (modify-phases %standard-phases
  752. (add-after 'unpack 'copy-lua-compat
  753. (lambda* (#:key inputs #:allow-other-keys)
  754. (copy-recursively (assoc-ref inputs "lua-compat")
  755. "lua-compat")
  756. (setenv "CPATH"
  757. (string-append (getcwd) "/lua-compat:"
  758. (or (getenv "CPATH") "")))
  759. #t)))))
  760. (inputs
  761. `(("lua" ,lua)
  762. ("libuv" ,libuv)))
  763. (native-inputs
  764. `(("lua-compat"
  765. ,(origin
  766. (method git-fetch)
  767. (uri (git-reference
  768. (url "https://github.com/keplerproject/lua-compat-5.3")
  769. (commit "daebe77a2f498817713df37f0bb316db1d82222f")))
  770. (file-name "lua-compat-5.3-checkout")
  771. (sha256
  772. (base32
  773. "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz"))))))
  774. (home-page "https://github.com/luvit/luv/")
  775. (synopsis "Libuv bindings for Lua")
  776. (description
  777. "This library makes libuv available to Lua scripts.")
  778. (license license:asl2.0)))
  779. (define-public lua-luv
  780. (make-lua-luv "lua-luv" lua))
  781. (define-public lua5.1-luv
  782. (make-lua-luv "lua5.1-luv" lua-5.1))
  783. (define-public lua5.2-luv
  784. (make-lua-luv "lua5.2-luv" lua-5.2))
  785. ;; Lua 5.3 is not supported.
  786. (define (make-lua-bitop name lua)
  787. (package
  788. (name name)
  789. (version "1.0.2")
  790. (source (origin
  791. (method url-fetch)
  792. (uri (string-append "http://bitop.luajit.org/download/"
  793. "LuaBitOp-" version ".tar.gz"))
  794. (sha256
  795. (base32
  796. "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"))))
  797. (build-system gnu-build-system)
  798. (arguments
  799. `(#:test-target "test"
  800. #:make-flags
  801. (list "INSTALL=install -pD"
  802. (string-append "INSTALLPATH=printf "
  803. (assoc-ref %outputs "out")
  804. "/lib/lua/"
  805. ,(version-major+minor (package-version lua))
  806. "/bit/bit.so"))
  807. #:phases
  808. (modify-phases %standard-phases
  809. (delete 'configure))))
  810. (inputs `(("lua" ,lua)))
  811. (home-page "https://bitop.luajit.org/index.html")
  812. (synopsis "Bitwise operations on numbers for Lua")
  813. (description
  814. "Lua BitOp is a C extension module for Lua which adds bitwise operations
  815. on numbers.")
  816. (license license:expat)))
  817. (define-public lua5.2-bitop
  818. (make-lua-bitop "lua5.2-bitop" lua-5.2))
  819. (define-public lua5.1-bitop
  820. (make-lua-bitop "lua5.1-bitop" lua-5.1))
  821. (define-public selene
  822. (package
  823. (name "selene")
  824. (version "2017.08.25")
  825. (source (origin
  826. (method git-fetch)
  827. (uri (git-reference
  828. (url "https://github.com/jeremyong/Selene")
  829. ;; The release is quite old.
  830. (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
  831. (file-name "Selene")
  832. (sha256
  833. (base32
  834. "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
  835. (build-system cmake-build-system)
  836. (arguments
  837. `(#:configure-flags
  838. ;; lua pc file in CMakeLists.txt is lua5.3.pc
  839. '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
  840. #:test-target "all"
  841. #:phases
  842. ;; This is a header only library
  843. (modify-phases %standard-phases
  844. (delete 'build)
  845. (replace 'install
  846. (lambda* (#:key inputs outputs #:allow-other-keys)
  847. (let* ((output (assoc-ref outputs "out"))
  848. (source (assoc-ref inputs "source"))
  849. (includedir (string-append output "/include")))
  850. (copy-recursively
  851. (string-append source "/include")
  852. includedir))
  853. #t))
  854. ;; The path of test files are hard coded.
  855. (replace 'check
  856. (lambda* (#:key inputs outputs #:allow-other-keys)
  857. (let* ((output (assoc-ref outputs "out"))
  858. (source (assoc-ref inputs "source"))
  859. (builddir (getcwd))
  860. (testdir (string-append builddir "/test")))
  861. (copy-recursively (string-append source "/test") testdir)
  862. (invoke "make")
  863. (mkdir-p "runner")
  864. (copy-file "./test_runner" "./runner/test_runner")
  865. (chdir "./runner")
  866. (invoke "./test_runner")))))))
  867. (native-inputs
  868. `(("lua" ,lua)
  869. ("pkg-config" ,pkg-config)))
  870. (home-page "https://github.com/jeremyong/Selene")
  871. (synopsis "Lua C++11 bindings")
  872. (description
  873. "Selene is a simple C++11 header-only library enabling seamless
  874. interoperability between C++ and Lua programming language.")
  875. (license license:zlib)))
  876. (define-public lua-resty-core
  877. (package
  878. (name "lua-resty-core")
  879. (version "0.1.18")
  880. (source (origin
  881. (method git-fetch)
  882. (uri (git-reference
  883. (url "https://github.com/openresty/lua-resty-core")
  884. (commit (string-append "v" version))))
  885. (file-name (git-file-name name version))
  886. (sha256
  887. (base32
  888. "1c58hykwpg5zqbyhrcb703pzwbkih409v3bh2gady6z2kj9q32dw"))))
  889. (build-system trivial-build-system)
  890. (arguments
  891. `(#:modules ((guix build utils))
  892. #:builder
  893. (begin
  894. (use-modules (guix build utils))
  895. (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
  896. (package-lua-resty (lambda (input output)
  897. (mkdir-p (string-append output "/lib/lua"))
  898. (copy-recursively (string-append input "/lib/resty")
  899. (string-append output "/lib/lua/resty"))
  900. (copy-recursively (string-append input "/lib/ngx")
  901. (string-append output "/lib/ngx"))
  902. (symlink (string-append output "/lib/lua/resty")
  903. (string-append output "/lib/resty")))))
  904. (package-lua-resty (assoc-ref %build-inputs "source")
  905. (assoc-ref %outputs "out")))
  906. #t)))
  907. (home-page "https://github.com/openresty/lua-resty-core")
  908. (synopsis "Lua API for NGINX")
  909. (description "This package provides a FFI-based Lua API for
  910. @code{ngx_http_lua_module} or @code{ngx_stream_lua_module}.")
  911. (license license:bsd-2)))
  912. (define-public lua-resty-lrucache
  913. (package
  914. (name "lua-resty-lrucache")
  915. (version "0.10")
  916. (source (origin
  917. (method git-fetch)
  918. (uri (git-reference
  919. (url "https://github.com/openresty/lua-resty-lrucache")
  920. (commit (string-append "v" version))))
  921. (file-name (git-file-name name version))
  922. (sha256
  923. (base32
  924. "1bsc54v1rvxmkwg7a2c01p192lvw5g576f589is8fy1m1c6v4ap8"))))
  925. (build-system trivial-build-system)
  926. (arguments
  927. `(#:modules ((guix build utils))
  928. #:builder
  929. (begin
  930. (use-modules (guix build utils))
  931. (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
  932. (package-lua-resty (lambda (input output)
  933. (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
  934. (copy-recursively (string-append input "/lib/resty")
  935. (string-append output "/lib/lua/" luajit-major+minor "/resty"))
  936. (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
  937. (string-append output "/lib/resty")))))
  938. (package-lua-resty (assoc-ref %build-inputs "source")
  939. (assoc-ref %outputs "out")))
  940. #t)))
  941. (home-page "https://github.com/openresty/lua-resty-lrucache")
  942. (synopsis "Lua LRU cache based on the LuaJIT FFI")
  943. (description
  944. "This package provides Lua LRU cache based on the LuaJIT FFI.")
  945. (license license:bsd-2)))
  946. (define-public lua-resty-signal
  947. (package
  948. (name "lua-resty-signal")
  949. (version "0.02")
  950. (source (origin
  951. (method git-fetch)
  952. (uri (git-reference
  953. (url "https://github.com/openresty/lua-resty-signal")
  954. (commit (string-append "v" version))))
  955. (file-name (git-file-name name version))
  956. (sha256
  957. (base32
  958. "13y1pqn45y49mhqwywasfdsid46d0c33yi6mrnracbnmvyxz1cif"))))
  959. (build-system gnu-build-system)
  960. (arguments
  961. `(#:tests? #f ;TODO: Run the test suite.
  962. #:make-flags (list ,(string-append "CC=" (cc-for-target))
  963. (string-append "PREFIX=" %output))
  964. #:phases
  965. (modify-phases %standard-phases
  966. (delete 'configure)
  967. (add-after 'install 'install-lua
  968. (lambda* (#:key inputs outputs #:allow-other-keys)
  969. (use-modules (guix build utils))
  970. (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
  971. (package-lua-resty (lambda (input output)
  972. (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
  973. (copy-recursively (string-append input "/lib/resty")
  974. (string-append output "/lib/lua/" luajit-major+minor "/resty"))
  975. (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
  976. (string-append output "/lib/resty")))))
  977. (package-lua-resty (assoc-ref inputs "source")
  978. (assoc-ref outputs "out")))
  979. #t)))))
  980. (home-page "https://github.com/openresty/lua-resty-signal")
  981. (synopsis "Lua library for killing or sending signals to Linux processes")
  982. (description "This package provides Lua library for killing or sending
  983. signals to Linux processes.")
  984. (license license:bsd-3)))
  985. (define-public lua-tablepool
  986. (package
  987. (name "lua-tablepool")
  988. (version "0.01")
  989. (source (origin
  990. (method git-fetch)
  991. (uri (git-reference
  992. (url "https://github.com/openresty/lua-tablepool")
  993. (commit (string-append "v" version))))
  994. (file-name (git-file-name name version))
  995. (sha256
  996. (base32
  997. "03yjj3w6znvj6843prg84m0lkrn49l901f9hj9bgy3cj9s0awl6y"))))
  998. (build-system trivial-build-system)
  999. (arguments
  1000. `(#:modules ((guix build utils))
  1001. #:builder
  1002. (begin
  1003. (use-modules (guix build utils))
  1004. (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
  1005. (package-lua-resty (lambda (input output)
  1006. (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
  1007. (copy-recursively (string-append input "/lib")
  1008. (string-append output "/lib")))))
  1009. (package-lua-resty (assoc-ref %build-inputs "source")
  1010. (assoc-ref %outputs "out")))
  1011. #t)))
  1012. (home-page "https://github.com/openresty/lua-tablepool")
  1013. (synopsis "Lua table recycling pools for LuaJIT")
  1014. (description "This package provides Lua table recycling pools for LuaJIT.")
  1015. (license license:bsd-2)))
  1016. (define-public lua-resty-shell
  1017. (package
  1018. (name "lua-resty-shell")
  1019. (version "0.03")
  1020. (source (origin
  1021. (method git-fetch)
  1022. (uri (git-reference
  1023. (url "https://github.com/openresty/lua-resty-shell")
  1024. (commit (string-append "v" version))))
  1025. (file-name (git-file-name name version))
  1026. (sha256
  1027. (base32
  1028. "1s6g04ip4hr97r2pd8ry3alq063604s9a3l0hn9nsidh81ps4dp7"))))
  1029. (build-system trivial-build-system)
  1030. (arguments
  1031. `(#:modules ((guix build utils))
  1032. #:builder
  1033. (begin
  1034. (use-modules (guix build utils))
  1035. (let* ((luajit-major+minor ,(version-major+minor (package-version lua)))
  1036. (package-lua-resty (lambda (input output)
  1037. (mkdir-p (string-append output "/lib/lua/" luajit-major+minor))
  1038. (copy-recursively (string-append input "/lib/resty")
  1039. (string-append output "/lib/lua/" luajit-major+minor "/resty"))
  1040. (symlink (string-append output "/lib/lua/" luajit-major+minor "/resty")
  1041. (string-append output "/lib/resty")))))
  1042. (package-lua-resty (assoc-ref %build-inputs "source")
  1043. (assoc-ref %outputs "out")))
  1044. #t)))
  1045. (home-page "https://github.com/openresty/lua-resty-shell")
  1046. (synopsis "Lua module for nonblocking system shell command executions")
  1047. (description "This package provides Lua module for nonblocking system
  1048. shell command executions.")
  1049. (license license:bsd-3)))
  1050. (define-public emilua
  1051. (package
  1052. (name "emilua")
  1053. (version "0.3.2")
  1054. (source (origin
  1055. (method git-fetch)
  1056. (uri (git-reference
  1057. (url "https://gitlab.com/emilua/emilua.git")
  1058. (commit (string-append "v" version))
  1059. ;; Current version requires Trial.Protocol and the HTTP lib
  1060. ;; developed as part of GSoC 2014 for Boost, and these are
  1061. ;; dependencies unlikely to be "unbundled" in future releases.
  1062. (recursive? #t)))
  1063. (file-name (git-file-name name version))
  1064. (sha256
  1065. (base32
  1066. "1999bgrh52124a5g4qizav3x257ff2brjr855srpm1jv1nxzbygv"))))
  1067. (build-system meson-build-system)
  1068. (arguments
  1069. `(;; Tests are disabled for now due to an issue that affecs guix:
  1070. ;; <https://gitlab.com/emilua/emilua/-/issues/22>
  1071. #:configure-flags
  1072. (list "-Denable_http=true"
  1073. "-Denable_tests=false"
  1074. "-Denable_manpages=false"
  1075. "-Dversion_suffix=-guix1")))
  1076. (native-inputs
  1077. `(("gcc" ,gcc-10) ; gcc-7 is too old for our C++17 needs
  1078. ("luajit-lua52-openresty" ,luajit-lua52-openresty)
  1079. ("pkg-config" ,pkg-config)
  1080. ("re2c" ,re2c)
  1081. ("xxd" ,xxd)))
  1082. (inputs
  1083. `(("boost" ,boost)
  1084. ("boost-static" ,boost-static)
  1085. ("fmt" ,fmt)
  1086. ;; LuaJIT has a 2GiB addressing limit[1] that has been fixed on OpenResty
  1087. ;; fork. Emilua is severely affected by this limit, so the upstream package
  1088. ;; is avoided. Emilua also depends on the -DLUAJIT_ENABLE_LUA52COMPAT
  1089. ;; configure flag[2] for some features to work (e.g. __pairs on HTTP
  1090. ;; headers).
  1091. ;;
  1092. ;; [1] <http://hacksoflife.blogspot.com/2012/12/integrating-luajit-with-x-plane-64-bit.html>
  1093. ;; [2] <http://luajit.org/extensions.html#lua52>
  1094. ("luajit-lua52-openresty" ,luajit-lua52-openresty)
  1095. ("ncurses" ,ncurses)
  1096. ("openssl" ,openssl)))
  1097. (native-search-paths
  1098. (list
  1099. (search-path-specification
  1100. (variable "EMILUA_PATH")
  1101. (files
  1102. (list (string-append "lib/emilua-" (version-major+minor version)))))))
  1103. (home-page "https://gitlab.com/emilua/emilua")
  1104. (synopsis "Lua execution engine")
  1105. (description
  1106. "Emilua is a LuaJIT-based Lua execution engine that supports async IO,
  1107. fibers and actor-inspired threading. The experimental builtin HTTP module is
  1108. enabled.")
  1109. (license license:boost1.0)))
  1110. (define-public fennel
  1111. (package
  1112. (name "fennel")
  1113. (version "0.9.1")
  1114. (source (origin
  1115. (method git-fetch)
  1116. (uri (git-reference
  1117. (url "https://git.sr.ht/~technomancy/fennel")
  1118. (commit version)))
  1119. (file-name (git-file-name name version))
  1120. (sha256
  1121. (base32
  1122. "07qgycf5cxm9zcc4fgpgvplg95ndavh3ynpdjpvzkikzbnyj7xia"))
  1123. (modules '((guix build utils)))
  1124. (snippet
  1125. '(begin
  1126. (delete-file "fennelview.lua") #t))))
  1127. (build-system gnu-build-system)
  1128. (arguments
  1129. '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  1130. #:tests? #t ; even on cross-build
  1131. #:test-target "test"
  1132. #:phases
  1133. (modify-phases %standard-phases
  1134. (delete 'configure)
  1135. (add-before 'build 'patch-lua-calls
  1136. (lambda* (#:key inputs #:allow-other-keys)
  1137. (let ((lua (search-input-file inputs "/bin/lua")))
  1138. (setenv "LUA" lua)
  1139. (substitute* "old/launcher.lua"
  1140. (("/usr/bin/env lua") lua))
  1141. #t)))
  1142. (add-after 'build 'patch-fennel
  1143. (lambda* (#:key inputs #:allow-other-keys)
  1144. (substitute* "fennel"
  1145. (("/usr/bin/env .*lua")
  1146. (search-input-file inputs "/bin/lua")))
  1147. #t))
  1148. (delete 'check)
  1149. (add-after 'install 'check
  1150. (assoc-ref %standard-phases 'check))
  1151. (add-after 'install 'install-manpage
  1152. (lambda* (#:key outputs #:allow-other-keys)
  1153. (install-file "fennel.1"
  1154. (string-append (assoc-ref outputs "out")
  1155. "/share/man/man1"))
  1156. #t)))))
  1157. (inputs `(("lua" ,lua)))
  1158. (home-page "https://fennel-lang.org/")
  1159. (synopsis "Lisp that compiles to Lua")
  1160. (description
  1161. "Fennel is a programming language that brings together the speed,
  1162. simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro
  1163. system.")
  1164. (license license:expat)))