@@ -77,9 +77,12 @@ mkdirp "bin"
77
77
Write-Host $_.file
78
78
}
79
79
80
- if ($_ | Get-Member prebuild) {
81
- $0 = $outfile
82
- Invoke-Expression $_.prebuild
80
+ if ($_ | Get-Member dirName) {
81
+ $strip = 0 ;
82
+ if ($_ | Get-Member extractStrip) { $strip = $_.extractStrip }
83
+
84
+ mkdirp " build\$ ( $_.dirName ) " - clean
85
+ exec { tar - xf $outfile - C " build\$ ( $_.dirName ) " -- strip- components $strip }
83
86
}
84
87
}
85
88
@@ -125,6 +128,13 @@ if (-not (Test-Path build\NSIS)) {
125
128
Expand-Archive ' .\downloads\nsis-log.zip' - DestinationPath ' .\build\NSIS' - Force
126
129
}
127
130
131
+ function sign {
132
+ param ([string []] $filesToSign )
133
+
134
+ $cert = Get-ChildItem - Path Cert:\CurrentUser\My - CodeSigningCert | Where-Object { $_.Subject -like " CN=Raspberry Pi*" }
135
+ $filesToSign | Set-AuthenticodeSignature - Certificate $cert - TimestampServer " http://timestamp.digicert.com" - HashAlgorithm SHA256
136
+ }
137
+
128
138
function msys {
129
139
param ([string ] $cmd )
130
140
@@ -366,9 +376,9 @@ Section "$($_.name)" Sec$($_.shortName)
366
376
"@
367
377
})
368
378
369
- $ ( if ($_ | Get-Member copy ) {
370
- " SetOutPath '`$ INSTDIR\$ ( $_.copy ) '`r`n "
371
- " File /r build\$ ( $_.copy ) \*.*"
379
+ $ ( if ($_ | Get-Member dirName ) {
380
+ " SetOutPath '`$ INSTDIR\$ ( $_.dirName ) '`r`n "
381
+ " File /r build\$ ( $_.dirName ) \*.*"
372
382
})
373
383
374
384
SectionEnd
@@ -484,9 +494,19 @@ $env:__COMPAT_LAYER = "RunAsInvoker"
484
494
exec { Start-Process - FilePath " .\build\build-uninstaller-$suffix .exe" - ArgumentList " /S /D=$PSScriptRoot \build" - Wait }
485
495
$env: __COMPAT_LAYER = " "
486
496
497
+ # Sign files before packaging up the installer
498
+ sign " build\uninstall-$suffix .exe" ,
499
+ " build\openocd-install\mingw$bitness \bin\openocd.exe" ,
500
+ " build\pico-sdk-tools\mingw$bitness \elf2uf2.exe" ,
501
+ " build\pico-sdk-tools\mingw$bitness \pioasm.exe" ,
502
+ " build\picotool-install\mingw$bitness \picotool.exe"
503
+
487
504
exec { .\build\NSIS\makensis " .\$basename -$suffix .nsi" }
488
505
Write-Host " Installer saved to $binfile "
489
506
507
+ # Sign the installer
508
+ sign $binfile
509
+
490
510
# Package OpenOCD separately as well
491
511
492
512
$version = (cmd / c " .\build\openocd-install\mingw$bitness \bin\openocd.exe" -- version ' 2>&1' )[0 ]
0 commit comments