From b23dc2f63fa4922f0e667541f8631888e508d536 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Fri, 19 Mar 2021 17:46:21 +0200 Subject: [PATCH 1/4] allow go tool override --- Makefile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 813ddd1..00f50eb 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ BUILDOPTS = -a -tags netgo LDFLAGS = -ldflags '-s -w -extldflags "-static" -X main.version=$(VERSION)' LDFLAGS_NATIVE = -ldflags '-s -w -X main.version=$(VERSION)' +GO := go + src = $(wildcard *.go) native: bin-native @@ -25,46 +27,46 @@ bin-windows-amd64: $(OUTSUFFIX).windows-amd64.exe bin-windows-386: $(OUTSUFFIX).windows-386.exe $(OUTSUFFIX): $(src) - go build $(LDFLAGS_NATIVE) -o $@ + $(GO) build $(LDFLAGS_NATIVE) -o $@ $(OUTSUFFIX).linux-amd64: $(src) - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).linux-386: $(src) - CGO_ENABLED=0 GOOS=linux GOARCH=386 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=linux GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).linux-arm: $(src) - CGO_ENABLED=0 GOOS=linux GOARCH=arm go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=linux GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).freebsd-amd64: $(src) - CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).freebsd-386: $(src) - CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=freebsd GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).freebsd-arm: $(src) - CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=freebsd GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).darwin-amd64: $(src) - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).windows-amd64.exe: $(src) - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(OUTSUFFIX).windows-386.exe: $(src) - CGO_ENABLED=0 GOOS=windows GOARCH=386 go build $(BUILDOPTS) $(LDFLAGS) -o $@ + CGO_ENABLED=0 GOOS=windows GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ clean: rm -f bin/* fmt: - go fmt ./... + $(GO) fmt ./... run: - go run $(LDFLAGS) . + $(GO) run $(LDFLAGS) . install: - go install $(LDFLAGS_NATIVE) . + $(GO) install $(LDFLAGS_NATIVE) . .PHONY: clean all native fmt install \ bin-native \ From 58006c4f6b5c01c7e33db020607b6babf496cf86 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Fri, 19 Mar 2021 20:57:49 +0200 Subject: [PATCH 2/4] introduce Apple M1 support --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 00f50eb..5f83a8e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ src = $(wildcard *.go) native: bin-native all: bin-linux-amd64 bin-linux-386 bin-linux-arm \ bin-freebsd-amd64 bin-freebsd-386 bin-freebsd-arm \ - bin-darwin-amd64 \ + bin-darwin-amd64 bin-darwin-arm64 \ bin-windows-amd64 bin-windows-386 bin-native: $(OUTSUFFIX) @@ -23,6 +23,7 @@ bin-freebsd-amd64: $(OUTSUFFIX).freebsd-amd64 bin-freebsd-386: $(OUTSUFFIX).freebsd-386 bin-freebsd-arm: $(OUTSUFFIX).freebsd-arm bin-darwin-amd64: $(OUTSUFFIX).darwin-amd64 +bin-darwin-arm64: $(OUTSUFFIX).darwin-arm64 bin-windows-amd64: $(OUTSUFFIX).windows-amd64.exe bin-windows-386: $(OUTSUFFIX).windows-386.exe @@ -50,6 +51,9 @@ $(OUTSUFFIX).freebsd-arm: $(src) $(OUTSUFFIX).darwin-amd64: $(src) CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ +$(OUTSUFFIX).darwin-arm64: $(src) + CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ + $(OUTSUFFIX).windows-amd64.exe: $(src) CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ From 839499313b75b37f63a9d909be863d523e5921c9 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Sat, 20 Mar 2021 01:11:57 +0200 Subject: [PATCH 3/4] extend *BSD build support --- Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Makefile b/Makefile index 5f83a8e..86d7fb0 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ src = $(wildcard *.go) native: bin-native all: bin-linux-amd64 bin-linux-386 bin-linux-arm \ bin-freebsd-amd64 bin-freebsd-386 bin-freebsd-arm \ + bin-netbsd-amd64 bin-netbsd-386 \ + bin-openbsd-amd64 bin-openbsd-386 \ bin-darwin-amd64 bin-darwin-arm64 \ bin-windows-amd64 bin-windows-386 @@ -22,6 +24,10 @@ bin-linux-arm: $(OUTSUFFIX).linux-arm bin-freebsd-amd64: $(OUTSUFFIX).freebsd-amd64 bin-freebsd-386: $(OUTSUFFIX).freebsd-386 bin-freebsd-arm: $(OUTSUFFIX).freebsd-arm +bin-netbsd-amd64: $(OUTSUFFIX).netbsd-amd64 +bin-netbsd-386: $(OUTSUFFIX).netbsd-386 +bin-openbsd-amd64: $(OUTSUFFIX).openbsd-amd64 +bin-openbsd-386: $(OUTSUFFIX).openbsd-386 bin-darwin-amd64: $(OUTSUFFIX).darwin-amd64 bin-darwin-arm64: $(OUTSUFFIX).darwin-arm64 bin-windows-amd64: $(OUTSUFFIX).windows-amd64.exe @@ -48,6 +54,18 @@ $(OUTSUFFIX).freebsd-386: $(src) $(OUTSUFFIX).freebsd-arm: $(src) CGO_ENABLED=0 GOOS=freebsd GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ +$(OUTSUFFIX).netbsd-amd64: $(src) + CGO_ENABLED=0 GOOS=netbsd GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ + +$(OUTSUFFIX).netbsd-386: $(src) + CGO_ENABLED=0 GOOS=netbsd GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ + +$(OUTSUFFIX).openbsd-amd64: $(src) + CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ + +$(OUTSUFFIX).openbsd-386: $(src) + CGO_ENABLED=0 GOOS=openbsd GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ + $(OUTSUFFIX).darwin-amd64: $(src) CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ From dbb9b29c81fd5ca7839701a1eaa97be5aa12b5b4 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Sat, 20 Mar 2021 01:24:03 +0200 Subject: [PATCH 4/4] experimental build for Windows on ARM --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 86d7fb0..e4ad3f7 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ all: bin-linux-amd64 bin-linux-386 bin-linux-arm \ bin-netbsd-amd64 bin-netbsd-386 \ bin-openbsd-amd64 bin-openbsd-386 \ bin-darwin-amd64 bin-darwin-arm64 \ - bin-windows-amd64 bin-windows-386 + bin-windows-amd64 bin-windows-386 bin-windows-arm bin-native: $(OUTSUFFIX) bin-linux-amd64: $(OUTSUFFIX).linux-amd64 @@ -32,6 +32,7 @@ bin-darwin-amd64: $(OUTSUFFIX).darwin-amd64 bin-darwin-arm64: $(OUTSUFFIX).darwin-arm64 bin-windows-amd64: $(OUTSUFFIX).windows-amd64.exe bin-windows-386: $(OUTSUFFIX).windows-386.exe +bin-windows-arm: $(OUTSUFFIX).windows-arm.exe $(OUTSUFFIX): $(src) $(GO) build $(LDFLAGS_NATIVE) -o $@ @@ -78,6 +79,9 @@ $(OUTSUFFIX).windows-amd64.exe: $(src) $(OUTSUFFIX).windows-386.exe: $(src) CGO_ENABLED=0 GOOS=windows GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ +$(OUTSUFFIX).windows-arm.exe: $(src) + CGO_ENABLED=0 GOOS=windows GOARCH=arm GOARM=7 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ + clean: rm -f bin/*