builds.ps1 779 B

12345678910111213141516171819202122232425262728
  1. Set-StrictMode -Version Latest
  2. $ErrorActionPreference = "Stop"
  3. $ProgressPreference = "SilentlyContinue"
  4. # Relative path to working directory
  5. $CloudflaredDirectory = "go\src\github.com\cloudflare\cloudflared"
  6. cd $CloudflaredDirectory
  7. Write-Output "Building for amd64"
  8. $env:TARGET_OS = "windows"
  9. $env:CGO_ENABLED = 1
  10. $env:TARGET_ARCH = "amd64"
  11. $env:Path = "$Env:Temp\go\bin;$($env:Path)"
  12. go env
  13. go version
  14. & make cloudflared
  15. if ($LASTEXITCODE -ne 0) { throw "Failed to build cloudflared for amd64" }
  16. copy .\cloudflared.exe .\cloudflared-windows-amd64.exe
  17. Write-Output "Building for 386"
  18. $env:CGO_ENABLED = 0
  19. $env:TARGET_ARCH = "386"
  20. make cloudflared
  21. if ($LASTEXITCODE -ne 0) { throw "Failed to build cloudflared for 386" }
  22. copy .\cloudflared.exe .\cloudflared-windows-386.exe