summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-25 12:00:26 +0800
committerGitHub <[email protected]>2024-07-25 12:00:26 +0800
commit4d53a1fbe312d896756bf86b35fa45d9e6fe90e2 (patch)
tree7a6186ae34a3e574420f70126891795d851e9d88
parent001cb3aff6bf009b942c2fd882f2b06012b7b6a5 (diff)
parent7ad05dc941aa400582ad2357217ab976fd55b576 (diff)
Merge pull request #5392 from xmake-io/bindirs
add bindirs for pacakge
-rw-r--r--xmake/core/package/package.lua8
-rw-r--r--xmake/modules/package/manager/xmake/find_package.lua9
2 files changed, 13 insertions, 4 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index b4249c6a0..fd5d52433 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1032,7 +1032,10 @@ function _instance:_rawenvs()
envs = {}
-- add bin PATH
- if self:is_binary() or self:is_plat("windows", "mingw") then -- bin/*.dll for windows
+ local bindirs = self:get("bindirs")
+ if bindirs then
+ envs.PATH = table.wrap(bindirs)
+ elseif self:is_binary() or self:is_plat("windows", "mingw") then -- bin/*.dll for windows
envs.PATH = {"bin"}
end
@@ -1863,6 +1866,7 @@ function _instance:find_tool(name, opt)
self._find_tool = self._find_tool or sandbox_module.import("lib.detect.find_tool", {anonymous = true})
return self._find_tool(name, {cachekey = opt.cachekey or "fetch_package_system",
installdir = self:installdir({readonly = true}),
+ bindirs = self:get("bindirs"),
version = true, -- we alway check version
require_version = opt.require_version,
norun = opt.norun,
@@ -1888,6 +1892,7 @@ function _instance:find_package(name, opt)
return self._find_package(name, {
force = opt.force,
installdir = self:installdir({readonly = true}),
+ bindirs = self:get("bindirs"),
version = true, -- we alway check version
require_version = opt.require_version,
mode = self:mode(),
@@ -2714,6 +2719,7 @@ function package.apis()
, "package.set_sourcedir"
, "package.set_cachedir"
, "package.set_installdir"
+ , "package.add_bindirs"
-- package.add_xxx
, "package.add_deps"
, "package.add_urls"
diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua
index e3aed1294..18f6908ee 100644
--- a/xmake/modules/package/manager/xmake/find_package.lua
+++ b/xmake/modules/package/manager/xmake/find_package.lua
@@ -163,9 +163,12 @@ function _find_package_from_repo(name, opt)
end
end
if opt.plat == "windows" or opt.plat == "mingw" then
- for _, file in ipairs(os.files(path.join(installdir, "bin", "*.dll"))) do
- result.shared = true
- table.insert(libfiles, file)
+ local bindirs = opt.bindirs or "bin"
+ for _, bindir in ipairs(bindirs) do
+ for _, file in ipairs(os.files(path.join(installdir, bindir, "*.dll"))) do
+ result.shared = true
+ table.insert(libfiles, file)
+ end
end
-- @see https://github.com/xmake-io/xmake/issues/5325#issuecomment-2242513463
if not result.shared then