diff options
| -rw-r--r-- | xmake/actions/config/xmake.lua | 19 | ||||
| -rw-r--r-- | xmake/modules/net/http/download.lua | 2 |
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() |
