Last active
December 21, 2015 07:48
-
-
Save jonforums/6273338 to your computer and use it in GitHub Desktop.
Build Go from source using PowerShell
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 characters
# Author: Jon Maken, All Rights Reserved | |
# License: 3-clause BSD | |
# Revision: 2014-04-05 17:44:19 -0600 | |
$toolkit = 'C:\Apps\DevTools\msys32\mingw64\bin' | |
$targets = 'windows:amd64:1', 'windows:386:0', | |
'linux:amd64:0', 'linux:386:0', | |
'darwin:amd64:0', 'darwin:386:0' | |
$orig_path = $env:PATH | |
$env:PATH = "$toolkit;$env:PATH" | |
Push-Location src | |
$targets | % { | |
$env:GOOS, $env:GOARCH, $env:CGO_ENABLED = $_.Split(':') | |
switch ($env:CGO_ENABLED) { | |
'0' { $cmd = 'make.bat --no-clean' } | |
'1' { $cmd = 'all.bat' } | |
} | |
Write-Host "`n---> building for $env:GOOS/$env:GOARCH platform`n" ` | |
-foregroundcolor yellow | |
Invoke-Expression ".\$cmd" | |
} | |
Pop-Location | |
Remove-Item env:GOOS, env:GOARCH, env:CGO_ENABLED | |
$env:PATH = $orig_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment