File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ $PSDefaultParameterValues = @ {}
2+ $PSDefaultParameterValues += @ {' New-RegKey:ErrorAction' = ' SilentlyContinue' }
3+
4+ $name = " cisextractor"
5+ $sourcefolder = " C:\<...>\cisextractor\src"
6+ $buildfolder = " ${sourcefolder} \build"
7+ $upxpath = " ${sourcefolder} \upx.exe"
8+ $Env: GOARCH = " amd64"
9+
10+ $buildnames = @ {
11+ linux = " ${name} _linux_amd64" ;
12+ darwin = " ${name} _mac_amd64" ;
13+ windows = " ${name} _win_amd64.exe"
14+ }
15+
16+ $buildnames.GetEnumerator () | % {
17+ $key = $ ($_.key )
18+ $value = $ ($_.value )
19+ $filepath = " ${buildfolder} \${value} "
20+ Write-Host " `n NOW BUILDING: $key - $value "
21+ Write-Host " Compiling ..."
22+ $Env: GOOS = $key
23+ go build - ldflags= " -s -w" - o $filepath
24+ Write-Host " Compressing..."
25+ & $upxpath -9 - k $filepath
26+ }
27+
28+ Write-Host " `n`n Cleaning up...`n "
29+ Get-ChildItem $buildfolder | Foreach-Object {
30+ if ($_.FullName -match ' ~$' -or $_.FullName -match ' 000' ) {
31+ rm $_.FullName
32+ }
33+ }
34+
35+ Write-Host " DONE`n "
You can’t perform that action at this time.
0 commit comments