From 811e7fb8d4cd1bea3e32635d24aa82194d28a4eb Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 14 Aug 2024 21:59:22 +0800 Subject: [PATCH] Experimental Windows arm64 build Signed-off-by: Chad Wilson --- build/make.go | 5 +++-- plugin/install/install.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build/make.go b/build/make.go index 68975cf96..ae2019a25 100644 --- a/build/make.go +++ b/build/make.go @@ -159,8 +159,9 @@ var ( {GOARCH: ARM64, GOOS: linux, CGO_ENABLED: "0"}, {GOARCH: X86, GOOS: freebsd, CGO_ENABLED: "0"}, {GOARCH: X86_64, GOOS: freebsd, CGO_ENABLED: "0"}, - {GOARCH: X86, GOOS: windows, CC: "i586-mingw32-gcc", CGO_ENABLED: "1"}, - {GOARCH: X86_64, GOOS: windows, CC: "x86_64-w64-mingw32-gcc", CGO_ENABLED: "1"}, + {GOARCH: X86, GOOS: windows, CGO_ENABLED: "0"}, + {GOARCH: X86_64, GOOS: windows, CGO_ENABLED: "0"}, + {GOARCH: ARM64, GOOS: windows, CGO_ENABLED: "0"}, } osDistroMap = map[string]distroFunc{windows: createWindowsDistro, linux: createLinuxPackage, freebsd: createLinuxPackage, darwin: createDarwinPackage} ) diff --git a/plugin/install/install.go b/plugin/install/install.go index 83b6fe71b..aee7c17bc 100644 --- a/plugin/install/install.go +++ b/plugin/install/install.go @@ -142,9 +142,9 @@ func isPlatformIndependent(zipfile string) bool { func isOSCompatible(zipfile string) bool { os := runtime.GOOS arch := getGoArch() - if os == "darwin" && arch == "arm64" { - // darwin/arm64 can run darwin/x86_64 binaries under rosetta. - return strings.Contains(zipfile, "darwin.arm64") || strings.Contains(zipfile, "darwin.x86_64") + if (os == "darwin" || os == "windows") && arch == "arm64" { + // darwin/windows arm64 can run x86_64 binaries under rosetta. + return strings.Contains(zipfile, fmt.Sprintf("%s.arm64", os)) || strings.Contains(zipfile, fmt.Sprintf("%s.x86_64", os)) } return strings.Contains(zipfile, fmt.Sprintf("%s.%s", os, arch)) }