From 6ce61a6aea71be0490451dbecbf854d74ad0f5d1 Mon Sep 17 00:00:00 2001 From: lixingjia <49072684+lixingjia77@users.noreply.github.com> Date: Mon, 2 Jun 2025 21:11:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20update=20SHA256=20checksum=20comman?= =?UTF-8?q?d=20in=20makefile=20for=20cross-platfo=E2=80=A6=20(#824)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: update SHA256 checksum command in makefile for cross-platform compatibility --- makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 9b3ee11f..ce25e203 100644 --- a/makefile +++ b/makefile @@ -24,6 +24,11 @@ GO_OS = $(shell $(GO) env GOOS) ifeq ($(GO_OS), darwin) GO_OS = mac endif +ifeq ($(shell uname -s), Darwin) + SHA256_CMD = shasum -a 256 +else + SHA256_CMD = sha256sum +endif # License environment GO_LICENSE_CHECKER_DIR = license-header-checker-$(GO_OS) @@ -44,15 +49,15 @@ dist dist/seatago-linux-amd64 dist/seatago-darwin-amd64 dist/seatago-linux-amd64 mkdir -p ./dist GOOS="linux" GOARCH="amd64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/seatago-linux-amd64 ./cmd GOOS="darwin" GOARCH="amd64" CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/seatago-darwin-amd64 ./cmd - sha256sum ./dist/seatago-darwin-amd64 | cut -d ' ' -f 1 > ./dist/seatago-darwin-amd64-sha-256 - sha256sum ./dist/seatago-linux-amd64 | cut -d ' ' -f 1 > ./dist/seatago-linux-amd64-sha-256 + $(SHA256_CMD) ./dist/seatago-darwin-amd64 | cut -d ' ' -f 1 > ./dist/seatago-darwin-amd64-sha-256 + $(SHA256_CMD) ./dist/seatago-linux-amd64 | cut -d ' ' -f 1 > ./dist/seatago-linux-amd64-sha-256 # Generate binaries for a Cortex release build dist/seatago dist/seatago-sha-256: rm -fr ./dist mkdir -p ./dist CGO_ENABLED=0 go build $(GO_FLAGS) -o ./dist/seatago ./cmd - sha256sum ./dist/seatago | cut -d ' ' -f 1 > ./dist/seatago-sha-256 + $(SHA256_CMD) ./dist/seatago | cut -d ' ' -f 1 > ./dist/seatago-sha-256 #docker-build: # docker build -t seatago/seatago:latest .