mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
Make builds reproducible
This commit is contained in:
@@ -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)/$@
|
||||
|
||||
@@ -148,7 +148,7 @@ Trojan-Go服务端可以兼容所有原Trojan客户端,如Igniter,ShadowRock
|
||||
例如,交叉编译一个在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="
|
||||
```
|
||||
|
||||
得到的可执行文件可以直接在目标平台运行。
|
||||
|
||||
@@ -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支持
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user