From d824390167738b875d92337cd4408f073d4d459f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 13 Mar 2023 19:46:08 +0800 Subject: [PATCH] Fix cross make build --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b2d226c4..6b38a1d5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,11 @@ NAME = sing-box COMMIT = $(shell git rev-parse --short HEAD) TAGS ?= with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api TAGS_TEST ?= with_gvisor,with_quic,with_wireguard,with_grpc,with_ech,with_utls,with_reality_server,with_shadowsocksr -VERSION=$(shell go run ./cmd/internal/read_tag) + +GOHOSTOS = $(shell go env GOHOSTOS) +GOHOSTARCH = $(shell go env GOHOSTARCH) +VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run ./cmd/internal/read_tag) + PARAMS = -v -trimpath -tags "$(TAGS)" -ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$(VERSION)\" -s -w -buildid=" MAIN = ./cmd/sing-box PREFIX ?= $(shell go env GOPATH)