summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-16 23:20:15 +0800
committerruki <[email protected]>2022-03-16 23:20:15 +0800
commitb2324c456276dc451a19edb9ace2fb640df3e0c4 (patch)
treed6482ca445a0b53b2fa94cef79996e66c6e726be
parent35fa885c6a76ab273f2169885ccebe0373dedfea (diff)
improve find_mingw
-rw-r--r--xmake/modules/detect/sdks/find_mingw.lua5
-rw-r--r--xmake/modules/private/action/require/impl/actions/install.lua1
2 files changed, 4 insertions, 2 deletions
diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua
index e5276834b..52cf75608 100644
--- a/xmake/modules/detect/sdks/find_mingw.lua
+++ b/xmake/modules/detect/sdks/find_mingw.lua
@@ -48,8 +48,11 @@ function _find_mingwdir(sdkdir)
if not sdkdir then
local pathenv = os.getenv("PATH")
if pathenv then
+ local buildhash_pattern = string.rep('%x', 32)
+ local match_pattern = "[\\/]packages[\\/]%w[\\/][^\\/]+[\\/][^\\/]+[\\/]" .. buildhash_pattern .. "[\\/]bin"
for _, p in ipairs(path.splitenv(pathenv)) do
- if p:find(string.ipattern("mingw[%w%-%_%+]*[\\/]bin")) and path.filename(p) == "bin" and os.isdir(p) then
+ if (p:find(match_pattern) or p:find(string.ipattern("mingw[%w%-%_%+]*[\\/]bin"))) and
+ path.filename(p) == "bin" and os.isdir(p) then
sdkdir = path.directory(p)
break
end
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua
index fb8abd6b4..9548b9f5b 100644
--- a/xmake/modules/private/action/require/impl/actions/install.lua
+++ b/xmake/modules/private/action/require/impl/actions/install.lua
@@ -109,7 +109,6 @@ function _fix_paths_for_precompiled_package(package)
local buildhash_pattern = string.rep('%x', 32)
local match_pattern = "[\\/]packages[\\/]%w[\\/][^\\/]+[\\/][^\\/]+[\\/]" .. buildhash_pattern .. "[\\/]"
local prefix = path.directory(core_package.installdir())
-
local filepaths = {path.join(package:installdir(), "**.cmake|include/**")}
for _, filepath in ipairs(filepaths) do
for _, file in ipairs(os.files(filepath)) do