File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,11 +94,11 @@ jobs:
9494 mkdir -p build_assets
9595 COMMID=$(git describe --always --dirty)
9696 echo 'Building Xray for Windows 7...'
97- go build -o build_assets/xray.exe -trimpath -buildvcs=false -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
97+ go build -o build_assets/xray.exe -trimpath -buildvcs=false -gcflags="all=-l=4" - ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
9898 echo 'CreateObject("Wscript.Shell").Run "xray.exe -config config.json",0' > build_assets/xray_no_window.vbs
9999 echo 'Start-Process -FilePath ".\xray.exe" -ArgumentList "-config .\config.json" -WindowStyle Hidden' > build_assets/xray_no_window.ps1
100100 # The line below is for without running conhost.exe version. Commented for not being used. Provided for reference.
101- # go build -o build_assets/wxray.exe -trimpath -buildvcs=false -ldflags="-H windowsgui -X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
101+ # go build -o build_assets/wxray.exe -trimpath -buildvcs=false -gcflags="all=-l=4" - ldflags="-H windowsgui -X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
102102
103103 - name : Restore Geodat Cache
104104 uses : actions/cache/restore@v4
Original file line number Diff line number Diff line change @@ -190,17 +190,19 @@ jobs:
190190 COMMID=$(git describe --always --dirty)
191191 if [[ ${GOOS} == 'windows' ]]; then
192192 echo 'Building Xray for Windows...'
193- go build -o build_assets/xray.exe -trimpath -buildvcs=false -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
193+ go build -o build_assets/xray.exe -trimpath -buildvcs=false -gcflags="all=-l=4" - ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
194194 echo 'CreateObject("Wscript.Shell").Run "xray.exe -config config.json",0' > build_assets/xray_no_window.vbs
195195 echo 'Start-Process -FilePath ".\xray.exe" -ArgumentList "-config .\config.json" -WindowStyle Hidden' > build_assets/xray_no_window.ps1
196196 # The line below is for without running conhost.exe version. Commented for not being used. Provided for reference.
197- # go build -o build_assets/wxray.exe -trimpath -buildvcs=false -ldflags="-H windowsgui -X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
197+ # go build -o build_assets/wxray.exe -trimpath -buildvcs=false -gcflags="all=-l=4" - ldflags="-H windowsgui -X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
198198 else
199199 echo 'Building Xray...'
200- go build -o build_assets/xray -trimpath -buildvcs=false -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
201200 if [[ ${GOARCH} == 'mips' || ${GOARCH} == 'mipsle' ]]; then
201+ go build -o build_assets/xray -trimpath -buildvcs=false -gcflags="-l=4" -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
202202 echo 'Building soft-float Xray for MIPS/MIPSLE 32-bit...'
203- GOMIPS=softfloat go build -o build_assets/xray_softfloat -trimpath -buildvcs=false -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
203+ GOMIPS=softfloat go build -o build_assets/xray_softfloat -trimpath -buildvcs=false -gcflags="-l=4" -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
204+ else
205+ go build -o build_assets/xray -trimpath -buildvcs=false -gcflags="all=-l=4" -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
204206 fi
205207 fi
206208
Original file line number Diff line number Diff line change @@ -165,7 +165,13 @@ CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -ldflags="-s -w -buildi
165165Make sure that you are using the same Go version, and remember to set the git commit id (7 bytes):
166166
167167``` bash
168- CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -ldflags=" -X github.com/xtls/xray-core/core.build=REPLACE -s -w -buildid=" -v ./main
168+ CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -gcflags=" all=-l=4" -ldflags=" -X github.com/xtls/xray-core/core.build=REPLACE -s -w -buildid=" -v ./main
169+ ```
170+
171+ If you are compiling a 32-bit MIPS/MIPSLE target, use this command instead:
172+
173+ ``` bash
174+ CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -gcflags=" -l=4" -ldflags=" -X github.com/xtls/xray-core/core.build=REPLACE -s -w -buildid=" -v ./main
169175```
170176
171177## Stargazers over time
You can’t perform that action at this time.
0 commit comments