summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-01 17:58:50 +0800
committerGitHub <[email protected]>2025-12-01 17:58:50 +0800
commite87feba55758263fd272855c4963e8e8245edd77 (patch)
tree1867bf0f701d68042adc53e99f903884fb3a2ef9
parent25c3526637322cdd36a0bc78b3cd7716dcc62382 (diff)
parent20cdfc49126d86c28a9c298ab92ac64e19f2aefc (diff)
Merge pull request #7084 from choyy/fix_findpackage
fix pacman find package
-rw-r--r--xmake/modules/package/manager/pacman/find_package.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/modules/package/manager/pacman/find_package.lua b/xmake/modules/package/manager/pacman/find_package.lua
index 7a38b0f46..3b200db26 100644
--- a/xmake/modules/package/manager/pacman/find_package.lua
+++ b/xmake/modules/package/manager/pacman/find_package.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.semver")
import("core.project.target")
import("lib.detect.find_tool")
import("private.core.base.is_cross")
@@ -218,8 +219,6 @@ function main(name, opt)
result.libfiles = result.libfiles or {}
table.insert(result.libfiles, libfile)
end
- -- version should be the same if a pacman package contains multiples .pc
- result.version = pcresult.version
result.shared = pcresult.shared
result.static = pcresult.static
end
@@ -238,6 +237,15 @@ function main(name, opt)
if result.links then
result.links = table.reverse_unique(result.links)
end
+
+ -- We should get version from pacman, because if a pacman package contains multiples .pc we may get a wrong version
+ local verstr = try { function() return os.iorunv(pacman.program, {"-Q", name}) end }
+ if verstr then
+ local version = semver.match(verstr)
+ if version then
+ result.version = version:rawstr():split('-')[1]
+ end
+ end
else
-- if there is no .pc, we parse the package content to obtain the data we want
result = _find_package_from_list(list, name, pacman, opt)