From 2f80f249fa152271708ec2485efa7e216d6d7b02 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 19 Aug 2024 22:27:41 +0800 Subject: improve to get pkgconf for meson --- xmake/modules/package/tools/meson.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xmake/modules') diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index caa75c620..ddac3c5a4 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -50,6 +50,20 @@ end -- get pkg-config, we need force to find it, because package install environments will be changed function _get_pkgconfig(package) + -- meson need fullpath pkgconfig + -- @see https://github.com/xmake-io/xmake/issues/5474 + local dep = package:dep("pkgconf") or package:dep("pkg-config") + if dep then + local suffix = dep:is_plat("windows", "mingw") and ".exe" or "" + local pkgconf = path.join(dep:installdir("bin"), "pkgconf" .. suffix) + if os.isfile(pkgconf) then + return pkgconf + end + local pkgconfig = path.join(dep:installdir("bin"), "pkg-config" .. suffix) + if os.isfile(pkgconfig) then + return pkgconfig + end + end if package:is_plat("windows") then local pkgconf = find_tool("pkgconf", {force = true}) if pkgconf then -- cgit v1.3.1