Skip to content

Commit f4b82c6

Browse files
authored
Pass mandatory strings from rockspec through to cargo build (#16)
1 parent 5e108bf commit f4b82c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/luarocks/build/rust-mlua.lua

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function mlua.run(rockspec, no_install)
3535
return nil, "Lua version " .. lua_version .. " is not supported"
3636
end
3737

38+
local envs = {}
39+
for _, key in ipairs({ "package", "version" }) do
40+
envs[("LUA_ROCKSPEC_%s"):format(key:upper())] = fs.Q(rockspec[key])
41+
end
42+
3843
local cmd = {"cargo build --release"}
3944

4045
local target_path = rockspec.build and rockspec.build.target_path or "target"
@@ -57,7 +62,7 @@ function mlua.run(rockspec, no_install)
5762
table.insert(cmd, "--features")
5863
table.insert(cmd, table.concat(features, ","))
5964

60-
if not fs.execute(table.concat(cmd, " ")) then
65+
if not fs.execute_env(envs, table.concat(cmd, " ")) then
6166
return nil, "Failed building."
6267
end
6368

0 commit comments

Comments
 (0)