From deab86867c236c466e5785ebfbcbfdddf6d1e60b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 22 Apr 2022 17:46:12 +0100 Subject: [PATCH] build: support mount on windows/arm64 - all windows binaries now not cgo This builds all windows binaries without CGO but with cmount. cgofuse has a compile mode which works without CGO on Windows for amd64/x86/arm64 architectures so switch to using that. --- .github/workflows/build.yml | 21 +++++---------------- Makefile | 2 +- bin/cross-compile.go | 5 ++++- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84abb827c..784a236cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - job_name: ['linux', 'mac_amd64', 'mac_arm64', 'windows_amd64', 'windows_386', 'other_os', 'go1.16', 'go1.17'] + job_name: ['linux', 'mac_amd64', 'mac_arm64', 'windows', 'other_os', 'go1.16', 'go1.17'] include: - job_name: linux @@ -55,23 +55,12 @@ jobs: build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64 -cgo-cflags=-I/usr/local/include -cgo-ldflags=-L/usr/local/lib' deploy: true - - job_name: windows_amd64 + - job_name: windows os: windows-latest go: '1.18.x' gotags: cmount - build_flags: '-include "^windows/amd64" -cgo' - build_args: '-buildmode exe' - quicktest: true - racequicktest: true - deploy: true - - - job_name: windows_386 - os: windows-latest - go: '1.18.x' - gotags: cmount - goarch: '386' - cgo: '1' - build_flags: '-include "^windows/386" -cgo' + cgo: '0' + build_flags: '-include "^windows/"' build_args: '-buildmode exe' quicktest: true deploy: true @@ -79,7 +68,7 @@ jobs: - job_name: other_os os: ubuntu-latest go: '1.18.x' - build_flags: '-exclude "^(windows/(386|amd64)|darwin/|linux/)"' + build_flags: '-exclude "^(windows/|darwin/|linux/)"' compile_all: true deploy: true diff --git a/Makefile b/Makefile index c155b2240..f96e1d92a 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ release_dep_linux: # Get the release dependencies we only install on Windows release_dep_windows: - GO111MODULE=off GOOS="" GOARCH="" go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo + GOOS="" GOARCH="" go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest # Update dependencies showupdates: diff --git a/bin/cross-compile.go b/bin/cross-compile.go index 2d10dec88..405f1b79c 100644 --- a/bin/cross-compile.go +++ b/bin/cross-compile.go @@ -265,9 +265,12 @@ func buildWindowsResourceSyso(goarch string, versionTag string) string { "-o", sysoPath, } - if goarch == "amd64" { + if strings.Contains(goarch, "64") { args = append(args, "-64") // Make the syso a 64-bit coff file } + if strings.Contains(goarch, "arm") { + args = append(args, "-arm") // Make the syso an arm binary + } args = append(args, jsonPath) err = runEnv(args, nil) if err != nil {