Last active
          August 16, 2024 18:45 
        
      - 
      
 - 
        
Save gpant/2078fc6d1c77dd14ab30d83e538bddbc to your computer and use it in GitHub Desktop.  
Revisions
- 
        
gpant revised this gist
Jun 30, 2017 . 1 changed file with 35 additions and 30 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,28 +1,44 @@ @echo off SET @version=0.1.34 SET BINARYNAME=cacti-go-tools SET BUILDSPATH=builds SET ARCH[0]=386 SET ARCH[1]=amd64 SET ARCH[2]=arm SET ARCH[3]=arm64 SET ARCH[4]=ppc64 SET ARCH[5]=ppc64le SET ARCH[6]=mips SET ARCH[7]=mipsle SET ARCH[8]=mips64 SET ARCH[9]=mips64le SET ARCH[10]=s390x SET BUILD[0]=darwin SET BUILD[1]=dragonfly SET BUILD[2]=freebsd SET BUILD[3]=linux SET BUILD[4]=nacl SET BUILD[5]=netbsd SET BUILD[6]=openbsd SET BUILD[7]=plan9 SET BUILD[8]=solaris SET BUILD[9]=windows setlocal enabledelayedexpansion set CGO_ENABLED=0 If EXIST "!BUILDSPATH!" ( echo Build structure is already there echo. ) ELSE ( echo Creating build structure... echo. md !BUILDSPATH! for /F "tokens=2 delims==" %%a in ('set BUILD[') do ( md !BUILDSPATH!\%%a ) echo Build structure created echo. ) @@ -42,19 +58,7 @@ for /f %%i in ('git rev-parse HEAD') do set @gitrev=%%i for /f %%i in ('date /t') do set @bdate=%%i for /f %%i in ('time /t') do set @btime=%%i for /F "tokens=2 delims==" %%a in ('set BUILD[') do ( for /F "tokens=2 delims==" %%s in ('set ARCH[') do ( SET GOOS=%%a SET GOARCH=%%s @@ -66,10 +70,11 @@ for /D %%a in (builds/*) do ( SET EXTENSION=".exe" ) go build -ldflags "-s -w -X main.version=%@version% -X main.buildstamp=%@bdate%-%@btime% -X main.hash=%@gitrev%" -o !BUILDSPATH!/!GOOS!/!BINARYNAME!_!GOARCH!!EXTENSION! IF EXIST "!BUILDSPATH!/!GOOS!/!BINARYNAME!_!GOARCH!!EXTENSION!" ( echo Compressing !GOOS!/!GOARCH! upx -qq !BUILDSPATH!/!GOOS!/!BINARYNAME!_!GOARCH!!EXTENSION! ) echo. )  - 
        
gpant created this gist
Apr 13, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,79 @@ @echo off SET @version=0.1.31 SET BINARYNAME=cacti-go-tools setlocal enabledelayedexpansion set CGO_ENABLED=0 If EXIST "builds" ( echo Build structure is already there echo. ) ELSE ( echo Creating build structure... echo. md builds md builds\android md builds\darwin md builds\dragonfly md builds\freebsd md builds\linux md builds\nacl md builds\netbsd md builds\openbsd md builds\plan9 md builds\solaris md builds\windows echo Build structure created echo. ) REM Bring code to last version echo Pulling all commits... git pull echo. REM Create Changelog echo Building changelog... git log --oneline --decorate > CHANGELOG echo Changelog Build Finished echo. for /f %%i in ('git rev-parse HEAD') do set @gitrev=%%i for /f %%i in ('date /t') do set @bdate=%%i for /f %%i in ('time /t') do set @btime=%%i SET ARCH[0]=386 SET ARCH[1]=amd64 SET ARCH[2]=arm SET ARCH[3]=arm64 SET ARCH[4]=ppc64 SET ARCH[5]=ppc64le SET ARCH[6]=mips SET ARCH[7]=mipsle SET ARCH[8]=mips64 SET ARCH[9]=mips64le SET ARCH[10]=s390x for /D %%a in (builds/*) do ( for /F "tokens=2 delims==" %%s in ('set ARCH[') do ( SET GOOS=%%a SET GOARCH=%%s SET GOARM=6 echo Building !GOOS!/!GOARCH! SET EXTENSION="" IF "%%a"=="windows" ( SET EXTENSION=".exe" ) go build -ldflags "-s -w -X main.version=%@version% -X main.buildstamp=%@bdate%-%@btime% -X main.hash=%@gitrev%" -o builds/%%a/%BINARYNAME%_!GOARCH!!EXTENSION! IF EXIST "builds/%%a/%BINARY_NAME%_!GOARCH!!EXTENSION!" ( echo Compressing !GOOS!/!GOARCH! upx -qq builds/%%a/%BINARY_NAME%_!GOARCH!!EXTENSION! ) echo. ) ) echo. echo Finished Building