summaryrefslogtreecommitdiff
path: root/gnu/packages/lua.scm
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2025-09-17 11:07:55 +1000
committerAndreas Enge <andreas@enge.fr>2026-02-18 21:02:26 +0100
commit906b1e13aa5fb939244758c59ea34e1cc738343e (patch)
tree1f9939a68f2cfd322d8ccbd748299878ade4624c /gnu/packages/lua.scm
parentd09dcc30cf283d2a8baf2d402a7ed86bec366196 (diff)
gnu: lua: Introduce GUIX_LUA_{,C}PATH to set default Lua search paths.
Fixes <https://issues.guix.gnu.org/issue/25425>. * gnu/packages/patches/luajit-search-paths.patch: New file. * gnu/packages/patches/lua-5.1-search-paths.patch: New file. * gnu/packages/patches/lua-5.2-search-paths.patch: New file. * gnu/packages/patches/lua-5.3-search-paths.patch: New file. * gnu/packages/patches/lua-5.4-search-paths.patch: New file. * gnu/packages/patches/lua-5.x-search-path-helpers: New file. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/lua.scm (lua-search-paths): New procedure. (lua) [source]: Apply patches. [native-search-paths]: Define using lua-search-paths. (lua-5.4) [source]: Apply patches. [native-search-paths]: Define using lua-search-paths. (lua-5.2) [source]: Apply patches. [native-search-paths]: Define using lua-search-paths. (lua-5.1) [source]: Apply patches. [native-search-paths]: Define using lua-search-paths. (luajit) [source]: Apply patches. [native-search-paths]: Define GUIX_LUA_PATH and GUIX_LUA_CPATH. Change-Id: I8adc08076e615b3dacc10007eae7c1e9b7d527c0 Signed-off-by: Andreas Enge <andreas@enge.fr>
Diffstat (limited to 'gnu/packages/lua.scm')
-rw-r--r--gnu/packages/lua.scm44
1 files changed, 39 insertions, 5 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index fe6d09f5dff..c40e4ed94fe 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -90,6 +90,16 @@
#:use-module (gnu packages xorg)
#:use-module ((srfi srfi-1) #:hide (zip)))
+(define (lua-search-paths version)
+ (list (search-path-specification
+ (variable "GUIX_LUA_PATH")
+ (separator ";")
+ (files (list (string-append "share/lua/" version))))
+ (search-path-specification
+ (variable "GUIX_LUA_CPATH")
+ (separator ";")
+ (files (list (string-append "lib/lua/" version))))))
+
(define-public lua
(package
(name "lua")
@@ -101,7 +111,9 @@
(sha256
(base32 "1b2qn2rv96nmbm6zab4l877bd4zq7wpwm8drwjiy2ih4jqzysbhc"))
(patches (search-patches "lua-pkgconfig.patch"
- "lua-liblua-so.patch"))))
+ "lua-liblua-so.patch"
+ "lua-5.x-search-path-helpers.patch"
+ "lua-5.3-search-paths.patch"))))
(build-system gnu-build-system)
(inputs (list readline))
(arguments
@@ -125,6 +137,7 @@
(string-append "INSTALL_TOP=" out)
(string-append "INSTALL_MAN=" out
"/share/man/man1"))))))))
+ (native-search-paths (lua-search-paths "5.3"))
(home-page "https://www.lua.org/")
(synopsis "Embeddable scripting language")
(description
@@ -151,7 +164,10 @@ for configuration, scripting, and rapid prototyping.")
(sha256
(base32 "1bi90r9nzmqhjwhr8ysffhmhq30wxxcpqwmbxr33wyaf2npds62g"))
(patches (search-patches "lua-5.4-pkgconfig.patch"
- "lua-5.4-liblua-so.patch"))))))
+ "lua-5.4-liblua-so.patch"
+ "lua-5.x-search-path-helpers.patch"
+ "lua-5.4-search-paths.patch"))))
+ (native-search-paths (lua-search-paths "5.4"))))
(define-public lua-5.2
(package (inherit lua)
@@ -164,7 +180,10 @@ for configuration, scripting, and rapid prototyping.")
(sha256
(base32 "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"))
(patches (search-patches "lua-pkgconfig.patch"
- "lua-liblua-so.patch"))))))
+ "lua-liblua-so.patch"
+ "lua-5.x-search-path-helpers.patch"
+ "lua-5.2-search-paths.patch"))))
+ (native-search-paths (lua-search-paths "5.2"))))
(define-public lua-5.1
(package (inherit lua)
@@ -177,7 +196,10 @@ for configuration, scripting, and rapid prototyping.")
(base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
(patches (search-patches "lua51-liblua-so.patch"
"lua-CVE-2014-5461.patch"
- "lua51-pkgconfig.patch"))))))
+ "lua51-pkgconfig.patch"
+ "lua-5.x-search-path-helpers.patch"
+ "lua-5.1-search-paths.patch"))))
+ (native-search-paths (lua-search-paths "5.1"))))
(define-public luajit
(let ((branch "v2.1")
@@ -193,7 +215,9 @@ for configuration, scripting, and rapid prototyping.")
(file-name (git-file-name name version))
(sha256
(base32
- "0srwk9nmiz8a93f70inq2597ff6xy203ckr4c0k7jcksdixymi9v"))))
+ "0srwk9nmiz8a93f70inq2597ff6xy203ckr4c0k7jcksdixymi9v"))
+ (patches (search-patches "lua-5.x-search-path-helpers.patch"
+ "luajit-search-paths.patch"))))
(build-system gnu-build-system)
(arguments
(list #:tests? #f ; luajit is distributed without tests
@@ -211,6 +235,16 @@ for configuration, scripting, and rapid prototyping.")
(delete 'configure)) ; no configure script
#:make-flags #~(list (string-append "PREFIX="
(assoc-ref %outputs "out")))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_LUA_PATH")
+ (separator ";")
+ (files (list "share/lua/5.1"
+ "share/luajit-2.1")))
+ (search-path-specification
+ (variable "GUIX_LUA_CPATH")
+ (separator ";")
+ (files (list "lib/lua/5.1")))))
(home-page "https://www.luajit.org/")
(synopsis
"Just in time compiler for Lua programming language version 5.1")