Make builds reproducible

This commit is contained in:
loyalsoldier
2020-10-08 15:10:10 +08:00
parent 1647f2611c
commit 953b5dbc22
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ COMMIT := `git rev-parse HEAD`
PLATFORM := linux
BUILD_DIR := build
VAR_SETTING := -X $(PACKAGE_NAME)/constant.Version=$(VERSION) -X $(PACKAGE_NAME)/constant.Commit=$(COMMIT)
GOBUILD = env CGO_ENABLED=0 $(GO_DIR)go build -tags "full" -ldflags="-s -w $(VAR_SETTING)" -o $(BUILD_DIR)
GOBUILD = env CGO_ENABLED=0 $(GO_DIR)go build -tags "full" -trimpath -ldflags="-s -w -buildid= $(VAR_SETTING)" -o $(BUILD_DIR)
.PHONY: trojan-go release
normal: clean trojan-go
@@ -138,4 +138,4 @@ windows-amd64:
windows-arm:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=windows $(GOBUILD)/$@
GOARCH=arm GOOS=windows $(GOBUILD)/$@
+1 -1
View File
@@ -148,7 +148,7 @@ Trojan-Go服务端可以兼容所有原Trojan客户端,如IgniterShadowRock
例如,交叉编译一个在mips处理器,linux操作系统上运行的,只有客户端功能的Trojan-Go,只需执行下面的命令即可
```shell
CGO_ENABLE=0 GOOS=linux GOARCH=mips go build -tags "client" -ldflags "-s -w"
CGO_ENABLE=0 GOOS=linux GOARCH=mips go build -tags "client" -trimpath -ldflags "-s -w -buildid="
```
得到的可执行文件可以直接在目标平台运行。
+1 -1
View File
@@ -32,7 +32,7 @@ Trojan-Go的大多数模块是可插拔的。在build文件夹下可以找到各
```shell
go build -tags "full" #编译所有模块
go build -tags "client" -ldflags="-s -w" #只有客户端功能,且去除符号表缩小体积
go build -tags "client" -trimpath -ldflags="-s -w -buildid=" #只有客户端功能,且去除符号表缩小体积
go build -tags "server mysql" #只有服务端和mysql支持
```