summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-24 23:02:54 +0800
committerruki <[email protected]>2020-11-24 23:02:54 +0800
commitb6ddb3b69b5cbf0f6068df78a0a38834eb9da68e (patch)
tree3791d829095b029a495974301b4ef201bf5920f4
parent253f2062cf56f48379092793469f063a9f0f504c (diff)
improve default platform for msys/mingw
-rw-r--r--xmake/actions/config/xmake.lua19
-rw-r--r--xmake/modules/net/http/download.lua2
2 files changed, 17 insertions, 4 deletions
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index 3399a027d..b1da4ffa5 100644
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -18,6 +18,18 @@
-- @file xmake.lua
--
+-- get the default platform
+function get_default_plat()
+ local subhost = os.subhost()
+ if subhost == "msys" then
+ local msystem = os.getenv("MSYSTEM")
+ if msystem and msystem:lower():find("mingw", 1, true) then
+ return "mingw"
+ end
+ end
+ return subhost
+end
+
-- define task
task("config")
@@ -41,10 +53,11 @@ task("config")
-- options
, options =
{
- {'c', "clean", "k", nil , "Clean the cached configure and configure all again." }
- , {nil, "menu", "k", nil , "Configure project with a menu-driven user interface." }
+ {'c', "clean", "k", nil , "Clean the cached configure and configure all again." }
+ , {nil, "menu", "k", nil , "Configure project with a menu-driven user interface." }
, {category = "."}
- , {'p', "plat", "kv", "$(subhost)", "Compile for the given platform."
+ , {'p', "plat", "kv", get_default_plat()
+ , "Compile for the given platform."
, values = function (complete, opt)
-- imports
diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua
index f4a21faef..e076836d1 100644
--- a/xmake/modules/net/http/download.lua
+++ b/xmake/modules/net/http/download.lua
@@ -39,7 +39,7 @@ function _get_user_agent()
if osver then
os_user_agent = ("Intel Mac OS X " .. (osver or "")):trim()
end
- elseif is_host("linux", "msys", "cygwin") then
+ elseif is_subhost("linux", "msys", "cygwin") then
local osver = try { function () return os.iorun("uname -r") end }
if osver then
os_user_agent = (os_user_agent .. " " .. (osver or "")):trim()