mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 06:05:06 +03:00
Merge af1888c5d7
into 47818a1a7c
This commit is contained in:
commit
c7ff43cded
1 changed files with 43 additions and 0 deletions
43
build.bat
Normal file
43
build.bat
Normal file
|
@ -0,0 +1,43 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set PKGSRC=github.com/yggdrasil-network/yggdrasil-go/src/version
|
||||
|
||||
set LDFLAGS=-X %PKGSRC%.buildName=%PKGNAME% -X %PKGSRC%.buildVersion=%PKGVER%
|
||||
set ARGS=-v
|
||||
|
||||
:parse_args
|
||||
if "%1"=="" goto end_args
|
||||
if "%1"=="-u" set UPX=true
|
||||
if "%1"=="-t" set TABLES=true
|
||||
if "%1"=="-d" set ARGS=%ARGS% -tags debug & set DEBUG=true
|
||||
if "%1"=="-r" set ARGS=%ARGS% -race
|
||||
if "%1"=="-p" set ARGS=%ARGS% -buildmode=pie
|
||||
if "%1"=="-c" (
|
||||
shift
|
||||
set GCFLAGS=%GCFLAGS% %1
|
||||
)
|
||||
if "%1"=="-l" (
|
||||
shift
|
||||
set LDFLAGS=%LDFLAGS% %1
|
||||
)
|
||||
if "%1"=="-o" (
|
||||
shift
|
||||
set ARGS=%ARGS% -o %1
|
||||
)
|
||||
shift
|
||||
goto parse_args
|
||||
|
||||
:end_args
|
||||
if "%TABLES%"=="" if "%DEBUG%"=="" (
|
||||
set LDFLAGS=%LDFLAGS% -s -w
|
||||
)
|
||||
|
||||
for %%C in (yggdrasil yggdrasilctl) do (
|
||||
echo Building: %%C.exe
|
||||
go build %ARGS% -ldflags="%LDFLAGS%" -gcflags="%GCFLAGS%" ./cmd/%%C
|
||||
|
||||
if "%UPX%"=="true" (
|
||||
upx --brute %%C.exe
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue