summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-14 23:02:04 +0800
committerruki <[email protected]>2020-02-14 12:12:28 +0800
commitffb92f48bcfbe4c34d027a7e01ff27b18b97c431 (patch)
treed1878aeac54ac4faf1905a964800ff8956cc78f7 /xmake/core/base/os.lua
parentb44a566e16e9022428d0f4453c8f1df0af1577d5 (diff)
improve host and arch
Diffstat (limited to 'xmake/core/base/os.lua')
-rw-r--r--xmake/core/base/os.lua23
1 files changed, 19 insertions, 4 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 5c193a48d..05e12fa3a 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -800,16 +800,31 @@ function os.isexec(filepath)
return os.isfile(filepath)
end
--- get the system host
+-- get host of subsystem, maybe msys/cygwin on windows
function os.host()
return xmake._HOST
end
--- get the system architecture
+-- get host architecture of subsystem
function os.arch()
return xmake._ARCH
end
+-- get system host, msys/cygwin are always windows
+function os.syshost()
+ return xmake._SYSHOST
+end
+
+-- get system host architecture
+function os.sysarch()
+ return xmake._SYSARCH
+end
+
+-- get features
+function os.features()
+ return xmake._FEATURES
+end
+
-- the current host is belong to the given hosts?
function os.is_host(...)
@@ -883,7 +898,7 @@ function os.user_agent()
if os._USER_AGENT == nil then
-- init systems
- local systems = {macosx = "Macintosh", linux = "Linux", windows = "Windows"}
+ local systems = {macosx = "Macintosh", linux = "Linux", windows = "Windows", msys = "MSYS", cygwin = "Cygwin"}
-- os user agent
local os_user_agent = ""
@@ -892,7 +907,7 @@ function os.user_agent()
if ok then
os_user_agent = ("Intel Mac OS X " .. (osver or "")):trim()
end
- elseif os.host() == "linux" then
+ elseif os.host() == "linux" or os.host() == "msys" or os.host() == "cygwin" then
local ok, osarch = os.iorun("uname -m")
if ok then
os_user_agent = (os_user_agent .. " " .. (osarch or "")):trim()