aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2023-10-31 21:28:45 -0300
committerGitHub <noreply@github.com>2023-10-31 21:28:45 -0300
commit4cfcf9d8df1abd7cca9f2c3590402ada543df327 (patch)
tree84ca4100af7fe6d64bd53a7badefc27f436772d0 /src
parent82cca3c53aeedfa5ed1415f3a63e6d85117a8264 (diff)
downloadluarocks-4cfcf9d8df1abd7cca9f2c3590402ada543df327.tar.gz
luarocks-4cfcf9d8df1abd7cca9f2c3590402ada543df327.tar.bz2
luarocks-4cfcf9d8df1abd7cca9f2c3590402ada543df327.zip
feat: auto-add luarocks-build-<build.type> build dependency (#1542)
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/rockspecs.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/luarocks/rockspecs.lua b/src/luarocks/rockspecs.lua
index 94462951..c9e17530 100644
--- a/src/luarocks/rockspecs.lua
+++ b/src/luarocks/rockspecs.lua
@@ -8,6 +8,15 @@ local type_rockspec = require("luarocks.type.rockspec")
8local util = require("luarocks.util") 8local util = require("luarocks.util")
9local vers = require("luarocks.core.vers") 9local vers = require("luarocks.core.vers")
10 10
11local vendored_build_type_set = {
12 ["builtin"] = true,
13 ["cmake"] = true,
14 ["command"] = true,
15 ["make"] = true,
16 ["module"] = true, -- compatibility alias
17 ["none"] = true,
18}
19
11local rockspec_mt = {} 20local rockspec_mt = {}
12 21
13rockspec_mt.__index = rockspec_mt 22rockspec_mt.__index = rockspec_mt
@@ -151,6 +160,27 @@ function rockspecs.from_persisted_table(filename, rockspec, globals, quick)
151 end 160 end
152 end 161 end
153 162
163 if rockspec.build
164 and rockspec.build.type
165 and not vendored_build_type_set[rockspec.build.type] then
166 local build_pkg_name = "luarocks-build-" .. rockspec.build.type
167 if not rockspec.build_dependencies then
168 rockspec.build_dependencies = {}
169 end
170
171 local found = false
172 for _, dep in ipairs(rockspec.build_dependencies) do
173 if dep.name == build_pkg_name then
174 found = true
175 break
176 end
177 end
178
179 if not found then
180 table.insert(rockspec.build_dependencies, queries.from_dep_string(build_pkg_name))
181 end
182 end
183
154 if not quick then 184 if not quick then
155 configure_paths(rockspec) 185 configure_paths(rockspec)
156 end 186 end