From bdbda5892a97753862750937780fe6a09fe34bdb Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Mon, 11 Sep 2023 09:14:00 +0200 Subject: [PATCH] [BUGFIX] Use goreleaser build for crosscompile (#2635) This should make sure that we catch all platforms we target during release. Signed-off-by: Dominik Schulz --- .goreleaser.yml | 4 ++-- Makefile | 20 +++++--------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 35ae4e99c0..90e39d0cdf 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -19,9 +19,9 @@ builds: env: - CGO_ENABLED=0 asmflags: - - all=-trimpath={{.Env.GOPATH}} + - all=-trimpath={{.Env.HOME}} gcflags: - - all=-trimpath={{.Env.GOPATH}} + - all=-trimpath={{.Env.HOME}} ldflags: | -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.CommitDate}} -extldflags '-static' goos: diff --git a/Makefile b/Makefile index abcce14988..907c71b046 100644 --- a/Makefile +++ b/Makefile @@ -117,21 +117,11 @@ test-integration: $(GOPASS_OUTPUT) cd tests && GOPASS_BINARY=$(PWD)/$(GOPASS_OUTPUT) GOPASS_TEST_DIR=$(PWD)/tests $(GO) test -v $(TESTFLAGS) crosscompile: - @echo -n ">> CROSSCOMPILE linux/amd64" - @GOOS=linux GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-linux-amd64 - @printf '%s\n' '$(OK)' - @echo -n ">> CROSSCOMPILE darwin/amd64" - @GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-darwin-amd64 - @printf '%s\n' '$(OK)' - @echo -n ">> CROSSCOMPILE windows/amd64" - @GOOS=windows GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-windows-amd64 - @printf '%s\n' '$(OK)' - @echo -n ">> CROSSCOMPILE freebsd/amd64" - @GOOS=freebsd GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-freebsd-amd64 - @printf '%s\n' '$(OK)' - @echo -n ">> CROSSCOMPILE openbsd/amd64" - @GOOS=openbsd GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-openbsd-amd64 - @printf '%s\n' '$(OK)' + @echo ">> CROSSCOMPILE" + @which goreleaser > /dev/null; if [ $$? -ne 0 ]; then \ + $(GO) install github.com/goreleaser/goreleaser@latest; \ + fi + @goreleaser build --snapshot %.completion: $(GOPASS_OUTPUT) @printf ">> $* completion, output = $@"