diff options
| author | ruki <[email protected]> | 2024-03-08 23:52:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-03-08 23:52:04 +0800 |
| commit | 20d23ff606069854eec5fb458b18c3c524928927 (patch) | |
| tree | ea4c9b5009665f6a93f89e472fd2afbe5794d407 /xmake/modules/package/tools/autoconf.lua | |
| parent | b8c4fd3d1cc5bc787d7f85196f31f191d2dbf6e5 (diff) | |
fix PKG_CONFIG_PATH on msys
Diffstat (limited to 'xmake/modules/package/tools/autoconf.lua')
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 7773d52de..fdaa3f842 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -28,13 +28,13 @@ import("lib.detect.find_tool") -- translate paths function _translate_paths(package, paths) - if paths and is_host("windows") and (package:is_plat("mingw") or package:is_plat("msys") or package:is_plat("cygwin")) then + if paths and is_host("windows") and package:is_plat("mingw", "msys", "cygwin") then if type(paths) == "string" then - return (paths:gsub("\\", "/")) + return path.unix(paths) elseif type(paths) == "table" then local result = {} for _, p in ipairs(paths) do - table.insert(result, (p:gsub("\\", "/"))) + table.insert(result, path.unix(p)) end return result end @@ -42,6 +42,20 @@ function _translate_paths(package, paths) return paths end +-- translate cygwin paths +function _translate_cygwin_paths(package, paths) + if type(paths) == "string" then + return path.cygwin(paths) + elseif type(paths) == "table" then + local result = {} + for _, p in ipairs(paths) do + table.insert(result, path.cygwin(p)) + end + return result + end + return paths +end + -- translate windows bin path function _translate_windows_bin_path(bin_path) if bin_path then @@ -390,6 +404,11 @@ function buildenvs(package, opt) table.insert(ACLOCAL_PATH, aclocal) end end + -- fix PKG_CONFIG_PATH for windows/msys2 + -- @see https://github.com/xmake-io/xmake-repo/issues/3442 + if is_subhost("msys", "cygwin") then + PKG_CONFIG_PATH = _translate_cygwin_paths(PKG_CONFIG_PATH) + end envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH) envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH) return envs |
