diff options
| author | ruki <[email protected]> | 2019-04-28 21:24:25 +0900 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-04-28 21:24:25 +0900 |
| commit | 2f36d5f5cd54d49ffe7eff324dc0522451deaae5 (patch) | |
| tree | dfb4f8bc4cdb179f722ae3c608505b2de659fb2a /xmake/core/package/package.lua | |
| parent | 6051aaec944bc40dd8e53316bdd88451b14a8a19 (diff) | |
improve on_install for host
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index f85a33e04..ff5335291 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -666,7 +666,15 @@ function _instance:script(name, generic) -- match script for special plat and arch local pattern = plat .. '|' .. arch for _pattern, _script in pairs(script) do - if not _pattern:startswith("__") and pattern:find('^' .. _pattern .. '$') then + local hosts = {} + _pattern = _pattern:gsub("@(.+)|", function (v) + -- get and remove hosts for `android@macosx,linux` + for _, host in ipairs(v:split(',')) do + hosts[host] = true + end + return "|" + end) + if not _pattern:startswith("__") and pattern:find('^' .. _pattern .. '$') and (#hosts == 0 or hosts[os.host()]) then result = _script break end @@ -675,7 +683,15 @@ function _instance:script(name, generic) -- match script for special plat if result == nil then for _pattern, _script in pairs(script) do - if not _pattern:startswith("__") and plat:find('^' .. _pattern .. '$') then + local hosts = {} + _pattern = _pattern:gsub("@(.+)", function (v) + -- get and remove hosts for `android@macosx,linux` + for _, host in ipairs(v:split(',')) do + hosts[host] = true + end + return "" + end) + if not _pattern:startswith("__") and pattern:find('^' .. _pattern .. '$') and (#hosts == 0 or hosts[os.host()]) then result = _script break end |
