diff options
| author | ruki <[email protected]> | 2020-07-20 22:50:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-07-20 22:50:50 +0800 |
| commit | 7ced056acb06192860d381f554fed844b809e3e2 (patch) | |
| tree | ed8dd04098685f281e2ca9c632ae8042fe77a61a /xmake/toolchains | |
| parent | 4ef022737b74da6e2c2e2a351424dd281ea7cf0c (diff) | |
build goenv for supporting cross-compilation
Diffstat (limited to 'xmake/toolchains')
| -rw-r--r-- | xmake/toolchains/go/xmake.lua | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/xmake/toolchains/go/xmake.lua b/xmake/toolchains/go/xmake.lua index 60fed9041..74a7ea6c4 100644 --- a/xmake/toolchains/go/xmake.lua +++ b/xmake/toolchains/go/xmake.lua @@ -33,20 +33,12 @@ toolchain("go") -- on load on_load(function (toolchain) if not toolchain:is_plat(os.host()) or not toolchain:is_arch(os.arch()) then - local goos, goarch - if toolchain:is_plat("windows", "mingw", "msys", "cygwin") then - goos = "windows" - goarch = toolchain:is_arch("x64", "x86_64") and "amd64" or "386" - elseif toolchain:is_plat("linux") then - goos = "linux" - goarch = toolchain:is_arch("x86_64") and "amd64" or "386" - elseif toolchain:is_plat("macosx") then - goos = "darwin" - goarch = toolchain:is_arch("x86_64") and "amd64" or "386" - end + import("private.tools.go.goenv") + local goos = goenv.GOOS(toolchain:plat()) if goos then toolchain:add("runenvs", "GOOS", goos) end + local goarch = goenv.GOARCH(toolchain:arch()) if goarch then toolchain:add("runenvs", "GOARCH", goarch) end |
