Files
SimpleRemoter/build.cmd
T
yuanyuanxianganddeepseek-flash 23fb50b7d4 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
2026-11-12 11:42:27 +01:00

51 lines
2.0 KiB
Batchfile

@echo off
:: SimpleRemoter Quick Build Script
:: 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
setlocal enabledelayedexpansion
set CONFIG=Release
set PLATFORM=x64
set EXTRA_ARGS=
:parse_args
if "%~1"=="" goto :run
if /i "%~1"=="release" (set CONFIG=Release& shift& goto :parse_args)
if /i "%~1"=="debug" (set CONFIG=Debug& shift& goto :parse_args)
if /i "%~1"=="x64" (set PLATFORM=x64& shift& goto :parse_args)
if /i "%~1"=="x86" (set PLATFORM=x86& shift& goto :parse_args)
if /i "%~1"=="all" (set PLATFORM=all& shift& goto :parse_args)
if /i "%~1"=="server" (set EXTRA_ARGS=!EXTRA_ARGS! -ServerOnly& shift& goto :parse_args)
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)
echo Unknown argument: %~1
shift
goto :parse_args
:run
echo.
echo Building SimpleRemoter: %CONFIG% ^| %PLATFORM%
echo.
powershell -ExecutionPolicy Bypass -File "%~dp0build.ps1" -Config %CONFIG% -Platform %PLATFORM% %EXTRA_ARGS%
if %errorlevel% neq 0 (
echo.
echo Build FAILED!
pause
exit /b 1
)
echo.
pause