Build: add server-linux target for cross-compiling the Go server

`build server-linux` now builds the Go server as a Linux/amd64 binary at
Bin\server_linux_amd64 instead of the Windows YamaGo_x64.exe, so the
artifact can be copied to a Linux host as-is. It reuses the go-server
flow: web asset sync, Release builds strip with -s -w (debug keeps
symbols), and the caller's GOOS/GOARCH/CGO_ENABLED are restored
afterwards so a direct .\build.ps1 run does not leak the cross-compile
environment into later builds.

UPX compression is skipped for Linux output (the script only ships
upx.exe for the Windows build) and logs a warning instead.

Verified: the generated binary is a stripped static ELF that runs under
WSL and prints its flags.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-12 11:42:27 +01:00
1 parent 81f0d6c031
commit 23fb50b7d4
2 files changed
+38 -10

No files matched your search

+3 -1
View File
@@ -1,8 +1,9 @@
@echo off
:: SimpleRemoter Quick Build Script
:: Usage: build.cmd [release|debug] [x64|x86|all] [server|clean|publish|go-server|serverd|client]
:: Usage: build.cmd [release|debug] [x64|x86|all] [server|clean|publish|go-server|server-linux|serverd|client]
:: go-server Build Go fallback server only -> Bin\YamaGo_x64.exe
:: go-server publish Same, plus UPX --best compression
:: server-linux Cross-compile Go server for Linux -> Bin\server_linux_amd64
:: serverd Debug server only (x64) -> Bin\Yama_x64d.exe
:: client Debug client (x64) -> x64\Debug\ghost.exe
@@ -23,6 +24,7 @@ if /i "%~1"=="server" (set EXTRA_ARGS=!EXTRA_ARGS! -ServerOnly& shift& goto :par
if /i "%~1"=="clean" (set EXTRA_ARGS=!EXTRA_ARGS! -Clean& shift& goto :parse_args)
if /i "%~1"=="publish" (set EXTRA_ARGS=!EXTRA_ARGS! -Publish& shift& goto :parse_args)
if /i "%~1"=="go-server" (set EXTRA_ARGS=!EXTRA_ARGS! -GoServer& shift& goto :parse_args)
if /i "%~1"=="server-linux" (set EXTRA_ARGS=!EXTRA_ARGS! -GoServerLinux& shift& goto :parse_args)
:: Debug presets: serverd = debug server x64 only, client = debug ghost x64 only
if /i "%~1"=="serverd" (set CONFIG=Debug& set PLATFORM=x64& set EXTRA_ARGS=!EXTRA_ARGS! -ServerOnly& shift& goto :parse_args)
if /i "%~1"=="client" (set CONFIG=Debug& set PLATFORM=x64& set EXTRA_ARGS=!EXTRA_ARGS! -ClientOnly& shift& goto :parse_args)