summaryrefslogtreecommitdiff
path: root/xmake/modules/package
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/package')
-rw-r--r--xmake/modules/package/manager/xmake/search_package.lua16
-rw-r--r--xmake/modules/package/tools/autoconf.lua4
-rw-r--r--xmake/modules/package/tools/cmake.lua4
-rw-r--r--xmake/modules/package/tools/ninja.lua2
4 files changed, 19 insertions, 7 deletions
diff --git a/xmake/modules/package/manager/xmake/search_package.lua b/xmake/modules/package/manager/xmake/search_package.lua
index f4a235246..cfd384ac6 100644
--- a/xmake/modules/package/manager/xmake/search_package.lua
+++ b/xmake/modules/package/manager/xmake/search_package.lua
@@ -26,19 +26,31 @@ import("private.action.require.impl.repository")
-- search package using the xmake package manager
--
-- @param name the package name with pattern
+-- @param opt the options, e.g. {require_version = "1.x"}
--
-function main(name)
+function main(name, opt)
+ opt = opt or {}
local results = {}
for _, packageinfo in ipairs(repository.searchdirs(name)) do
local package = core_package.load_from_repository(packageinfo.name, packageinfo.repo, packageinfo.packagedir)
if package then
local repo = package:repo()
+ local version
local versions = package:versions()
if versions then
versions = table.copy(versions)
table.sort(versions, function (a, b) return semver.compare(a, b) > 0 end)
+ if opt.require_version then
+ for _, ver in ipairs(versions) do
+ if semver.satisfies(ver, opt.require_version) then
+ version = ver
+ end
+ end
+ else
+ version = versions[1]
+ end
end
- table.insert(results, {name = package:name(), version = versions and versions[1], description = package:get("description"), reponame = repo and repo:name()})
+ table.insert(results, {name = package:name(), version = version, description = package:get("description"), reponame = repo and repo:name()})
end
end
return results
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index b8429e9f5..c9fa019bf 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -444,7 +444,7 @@ function build(package, configs, opt)
opt = opt or {}
local njob = opt.jobs or option.get("jobs") or tostring(os.default_njob())
local argv = {"-j" .. njob}
- if option.get("verbose") then
+ if option.get("diagnosis") then
table.insert(argv, "V=1")
end
if opt.makeconfigs then
@@ -471,7 +471,7 @@ function install(package, configs, opt)
-- do install
local argv = {"install"}
- if option.get("verbose") then
+ if option.get("diagnosis") then
table.insert(argv, "V=1")
end
if opt.makeconfigs then
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index a9223ce85..30f809671 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -649,7 +649,7 @@ function _build_for_make(package, configs, opt)
end
local jobs = _get_parallel_njobs(opt)
table.insert(argv, "-j" .. jobs)
- if option.get("verbose") then
+ if option.get("diagnosis") then
table.insert(argv, "VERBOSE=1")
end
if is_host("bsd") then
@@ -727,7 +727,7 @@ end
function _install_for_make(package, configs, opt)
local jobs = _get_parallel_njobs(opt)
local argv = {"-j" .. jobs}
- if option.get("verbose") then
+ if option.get("diagnosis") then
table.insert(argv, "VERBOSE=1")
end
if is_host("bsd") then
diff --git a/xmake/modules/package/tools/ninja.lua b/xmake/modules/package/tools/ninja.lua
index d61e144b2..42dc73ed6 100644
--- a/xmake/modules/package/tools/ninja.lua
+++ b/xmake/modules/package/tools/ninja.lua
@@ -34,7 +34,7 @@ function build(package, configs, opt)
end
table.insert(argv, "-C")
table.insert(argv, buildir)
- if option.get("verbose") then
+ if option.get("diagnosis") then
table.insert(argv, "-v")
end
table.insert(argv, "-j")