summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-22 22:33:39 +0800
committerruki <[email protected]>2024-11-22 22:33:39 +0800
commit75d4f150fb9fddef4672a7793152b6fb2bbe621b (patch)
treed8a7c2fbcc59ac1545c7eedb8c4f989fff0672e5
parent5704354222571b0ad4af27365ba57c1bd32d0112 (diff)
fix pacman.find_package
-rw-r--r--xmake/modules/package/manager/pacman/find_package.lua32
-rw-r--r--xmake/modules/package/manager/pacman/install_package.lua3
2 files changed, 23 insertions, 12 deletions
diff --git a/xmake/modules/package/manager/pacman/find_package.lua b/xmake/modules/package/manager/pacman/find_package.lua
index 2a8244ff3..a6362b1a3 100644
--- a/xmake/modules/package/manager/pacman/find_package.lua
+++ b/xmake/modules/package/manager/pacman/find_package.lua
@@ -158,6 +158,7 @@ end
--
function main(name, opt)
opt = opt or {}
+ local configs = opt.configs or {}
if is_cross(opt.plat, opt.arch) then
return
end
@@ -168,18 +169,27 @@ function main(name, opt)
return
end
- -- for msys2/mingw? mingw-w64-[i686|x86_64]-xxx
- if is_subhost("msys") and opt.plat == "mingw" then
- -- try to get the package prefix from the environment first
- -- https://www.msys2.org/docs/package-naming/
- local prefix = "mingw-w64-"
- local arch = (opt.arch == "x86_64" and "x86_64-" or "i686-")
- local msystem = os.getenv("MSYSTEM")
- if msystem and not msystem:startswith("MINGW") then
- local i, j = msystem:find("%D+")
- name = prefix .. msystem:sub(i, j):lower() .. "-" .. arch .. name
+ -- for msys2
+ if is_subhost("msys") then
+ local msystem = configs.msystem
+ if not msystem and opt.plat == "mingw" then
+ msystem = "mingw"
+ end
+ -- mingw? mingw-w64-[i686|x86_64]-xxx
+ if msystem == "mingw" then
+ -- try to get the package prefix from the environment first
+ -- https://www.msys2.org/docs/package-naming/
+ local prefix = "mingw-w64-"
+ local arch = (opt.arch == "x86_64" and "x86_64-" or "i686-")
+ local msystem_env = os.getenv("MSYSTEM")
+ if msystem_env and not msystem_env:startswith("MINGW") then
+ local i, j = msystem_env:find("%D+")
+ name = prefix .. msystem_env:sub(i, j):lower() .. "-" .. arch .. name
+ else
+ name = prefix .. arch .. name
+ end
else
- name = prefix .. arch .. name
+ -- TODO other msystem, e.g. clang, msys, ucrt, ...
end
end
diff --git a/xmake/modules/package/manager/pacman/install_package.lua b/xmake/modules/package/manager/pacman/install_package.lua
index 046a37f51..179fe1156 100644
--- a/xmake/modules/package/manager/pacman/install_package.lua
+++ b/xmake/modules/package/manager/pacman/install_package.lua
@@ -42,12 +42,13 @@ function main(name, opt)
raise("pacman not found!")
end
- -- for msys2/mingw? mingw-w64-[i686|x86_64]-xxx
+ -- for msys2
if is_subhost("msys") then
local msystem = configs.msystem
if not msystem and opt.plat == "mingw" then
msystem = "mingw"
end
+ -- mingw? mingw-w64-[i686|x86_64]-xxx
if msystem == "mingw" then
-- try to get the package prefix from the environment first
-- https://www.msys2.org/docs/package-naming/