mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-12-25 01:02:17 +08:00
Added build script for building packages on Windows
This commit is contained in:
parent
471609094d
commit
9cb81da20e
1 changed files with 41 additions and 0 deletions
41
build.ps1
Normal file
41
build.ps1
Normal file
|
@ -0,0 +1,41 @@
|
|||
param (
|
||||
[string]$SHA = ""
|
||||
)
|
||||
|
||||
if ($SHA -eq ""){
|
||||
$SHA = (git rev-parse HEAD) | Out-String
|
||||
$SHA = $SHA.Replace([System.Environment]::NewLine,"")
|
||||
}
|
||||
|
||||
|
||||
$PKG = "github.com/StackExchange/dnscontrol"
|
||||
$DATE = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
$FLAGS="-s -w -X main.SHA=$SHA -X main.BuildTime=$DATE"
|
||||
Write-Host $FLAGS
|
||||
|
||||
$OrigGOOS = $env:GOOS
|
||||
|
||||
Write-Host 'Building Linux'
|
||||
$env:GOOS = "linux"
|
||||
go build -o dnscontrol-Linux -ldflags "$FLAGS" $PKG
|
||||
|
||||
Write-Host 'Building Windows'
|
||||
$env:GOOS = "windows"
|
||||
go build -o dnscontrol.exe -ldflags "$FLAGS" $PKG
|
||||
|
||||
Write-Host 'Building Darwin'
|
||||
$env:GOOS = "darwin"
|
||||
go build -o dnscontrol-Darwin -ldflags "$FLAGS" $PKG
|
||||
|
||||
$env:GOOS = $OrigGOOS
|
||||
|
||||
#No compression if building on windows
|
||||
<#
|
||||
if [ "$COMPRESS" = "1" ]
|
||||
then
|
||||
echo 'Compressing executables'
|
||||
upx dnscontrol.exe
|
||||
upx dnscontrol-Linux
|
||||
upx dnscontrol-Darwin
|
||||
fi
|
||||
#>
|
Loading…
Reference in a new issue