@@ -197,7 +197,8 @@ function Start-OpenSSHBootstrap
197197 Write-BuildMsg - AsVerbose - Message " $gitCmdPath already present in Path environment variable" - Silent:$silent
198198 }
199199
200- $nativeMSBuildPath = Get-VS2015BuildToolPath
200+ $VS2015Path = Get-VS2015BuildToolPath
201+ $VS2017Path = Get-VS2017BuildToolPath
201202
202203 # Update machine environment path
203204 if ($newMachineEnvironmentPath -ne $machinePath )
@@ -206,9 +207,24 @@ function Start-OpenSSHBootstrap
206207 }
207208
208209 $vcVars = " ${env: ProgramFiles(x86)} \Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"
209- $sdkPath = " ${env: ProgramFiles(x86)} \Windows Kits\8.1\bin\x86\register_app.vbs"
210- $packageName = " vcbuildtools"
211- If (($nativeMSBuildPath -eq $null ) -or (-not (Test-Path $VcVars )) -or (-not (Test-Path $sdkPath ))) {
210+ $sdkPath = " ${env: ProgramFiles(x86)} \Windows Kits\8.1\bin\x86\register_app.vbs"
211+ # use vs2017 build tool if exists
212+ if ($VS2017Path -ne $null )
213+ {
214+ If (-not (Test-Path $sdkPath ))
215+ {
216+ $packageName = " windows-sdk-8.1"
217+ Write-BuildMsg - AsInfo - Message " $packageName not present. Installing $packageName ..."
218+ choco install $packageName - y -- force -- limitoutput -- execution- timeout 10000 2>&1 >> $script :BuildLogFile
219+ }
220+
221+ if (-not (Test-Path $VcVars ))
222+ {
223+ Write-BuildMsg - AsError - ErrorAction Stop - Message " VC++ 2015.3 v140 toolset are not installed."
224+ }
225+ }
226+ elseIf (($VS2015Path -eq $null ) -or (-not (Test-Path $VcVars )) -or (-not (Test-Path $sdkPath ))) {
227+ $packageName = " vcbuildtools"
212228 Write-BuildMsg - AsInfo - Message " $packageName not present. Installing $packageName ..."
213229 choco install $packageName - ia " /InstallSelectableItems VisualCppBuildTools_ATLMFC_SDK;VisualCppBuildTools_NETFX_SDK;Win81SDK_CppBuildSKUV1" - y -- force -- limitoutput -- execution- timeout 10000 2>&1 >> $script :BuildLogFile
214230 $errorCode = $LASTEXITCODE
@@ -234,24 +250,21 @@ function Start-OpenSSHBootstrap
234250 Write-BuildMsg - AsError - ErrorAction Stop - Message " User choose not to restart the machine to apply the changes."
235251 }
236252 }
237- else
253+ elseif ( $errorCode -ne 0 )
238254 {
239- Write-BuildMsg - AsError - ErrorAction Stop - Message " $packageName installation failed with error code $errorCode "
255+ Write-BuildMsg - AsError - ErrorAction Stop - Message " $packageName installation failed with error code $errorCode . "
240256 }
241257 }
242258 else
243259 {
244260 Write-BuildMsg - AsVerbose - Message ' VC++ 2015 Build Tools already present.'
245261 }
246262
247- if ($NativeHostArch.ToLower ().Startswith(' arm' ))
248- {
249- $nativeMSBuildPath = Get-VS2017BuildToolPath
250- If ($nativeMSBuildPath -eq $null )
251- {
252- # todo, install vs 2017 build tools
253- Write-BuildMsg - AsError - ErrorAction Stop - Message " The required msbuild 15.0 is not installed on the machine."
254- }
263+ if ($NativeHostArch.ToLower ().Startswith(' arm' ) -and ($VS2017Path -eq $null ))
264+ {
265+
266+ # todo, install vs 2017 build tools
267+ Write-BuildMsg - AsError - ErrorAction Stop - Message " The required msbuild 15.0 is not installed on the machine."
255268 }
256269
257270 if ($OneCore -or ($NativeHostArch.ToLower ().Startswith(' arm' )))
@@ -268,7 +281,7 @@ function Start-OpenSSHBootstrap
268281 # Ensure the VS C toolset is installed
269282 if ($null -eq $env: VS140COMNTOOLS )
270283 {
271- Write-BuildMsg - AsError - ErrorAction Stop - Message " Cannot find Visual Studio 2015 Environment variable VS140COMNTOOlS"
284+ Write-BuildMsg - AsError - ErrorAction Stop - Message " Cannot find Visual Studio 2015 Environment variable VS140COMNTOOlS. "
272285 }
273286
274287 $item = Get-Item (Join-Path - Path $env: VS140COMNTOOLS - ChildPath ' ../../vc' )
@@ -314,7 +327,7 @@ function Copy-LibreSSLSDK
314327 Copy-Item - Container - Path $sourcePath - Destination $PSScriptRoot - Recurse - Force - ErrorAction SilentlyContinue - ErrorVariable e
315328 if ($e -ne $null )
316329 {
317- Write-BuildMsg - AsError - ErrorAction Stop - Message " Copy LibreSSLSDK from $sourcePath to $PSScriptRoot failed"
330+ Write-BuildMsg - AsError - ErrorAction Stop - Message " Copy LibreSSLSDK from $sourcePath to $PSScriptRoot failed. "
318331 }
319332}
320333
@@ -330,7 +343,8 @@ function Start-OpenSSHPackage
330343 [string ]$Configuration = " Release" ,
331344
332345 # Copy payload to DestinationPath instead of packaging
333- [string ]$DestinationPath = " "
346+ [string ]$DestinationPath = " " ,
347+ [switch ]$NoOpenSSL
334348 )
335349
336350 [System.IO.DirectoryInfo ] $repositoryRoot = Get-RepositoryRoot
@@ -390,7 +404,10 @@ function Start-OpenSSHPackage
390404
391405 # copy libcrypto dll
392406 $libreSSLSDKPath = Join-Path $PSScriptRoot $script :libreSSLSDKStr
393- Copy-Item - Path $ (Join-Path $libreSSLSDKPath " $NativeHostArch \libcrypto.dll" ) - Destination $packageDir - Force - ErrorAction Stop
407+ if (-not $NoOpenSSL.IsPresent )
408+ {
409+ Copy-Item - Path $ (Join-Path $libreSSLSDKPath " $NativeHostArch \libcrypto.dll" ) - Destination $packageDir - Force - ErrorAction Stop
410+ }
394411
395412 if ($DestinationPath -ne " " ) {
396413 if (Test-Path $DestinationPath ) {
@@ -400,7 +417,7 @@ function Start-OpenSSHPackage
400417 New-Item - ItemType Directory $DestinationPath - Force | Out-Null
401418 }
402419 Copy-Item - Path $packageDir \* - Destination $DestinationPath - Force - Recurse
403- Write-BuildMsg - AsInfo - Message " Copied payload to $DestinationPath "
420+ Write-BuildMsg - AsInfo - Message " Copied payload to $DestinationPath . "
404421 }
405422 else {
406423 Remove-Item ($packageDir + ' .zip' ) - Force - ErrorAction SilentlyContinue
@@ -411,7 +428,7 @@ function Start-OpenSSHPackage
411428 }
412429 else
413430 {
414- Write-BuildMsg - AsInfo - Message " Packaged Payload not compressed."
431+ Write-BuildMsg - AsInfo - Message " Packaged Payload not compressed."
415432 }
416433 }
417434 Remove-Item $packageDir - Recurse - Force - ErrorAction SilentlyContinue
@@ -470,7 +487,7 @@ function Start-OpenSSHBuild
470487 Remove-Item - Path $script :BuildLogFile - force
471488 }
472489
473- Write-BuildMsg - AsInfo - Message " Starting Open SSH build; Build Log: $ ( $script :BuildLogFile ) "
490+ Write-BuildMsg - AsInfo - Message " Starting Open SSH build; Build Log: $ ( $script :BuildLogFile ) . "
474491
475492 Start-OpenSSHBootstrap - OneCore:$OneCore
476493
@@ -523,17 +540,25 @@ function Start-OpenSSHBuild
523540 $xml.Project.PropertyGroup.WindowsSDKVersion = $win10SDKVer.ToString ()
524541 $xml.Project.PropertyGroup.AdditionalDependentLibs = ' onecore.lib'
525542 $xml.Project.PropertyGroup.MinimalCoreWin = ' true'
543+
544+ # Use onecore libcrypto binaries
545+ $xml.Project.PropertyGroup ." LibreSSL-x86-Path" = ' $(SolutionDir)\LibreSSLSDK\onecore\x86\'
546+ $xml.Project.PropertyGroup ." LibreSSL-x64-Path" = ' $(SolutionDir)\LibreSSLSDK\onecore\x64\'
547+ $xml.Project.PropertyGroup ." LibreSSL-arm-Path" = ' $(SolutionDir)\LibreSSLSDK\onecore\arm\'
548+ $xml.Project.PropertyGroup ." LibreSSL-arm64-Path" = ' $(SolutionDir)\LibreSSLSDK\onecore\arm64\'
549+
526550 $xml.Save ($PathTargets )
527551 }
528552
529553 $solutionFile = Get-SolutionFile - root $repositoryRoot.FullName
530- $cmdMsg = @ (" ${solutionFile} " , " /p:Platform=${NativeHostArch} " , " /p:Configuration=${Configuration} " , " /m" , " /noconlog" , " /nologo" , " /fl" , " /flp:LogFile=${ script:BuildLogFile } `;Append`;Verbosity=diagnostic" )
531-
532- if ($NativeHostArch.ToLower ().Startswith(' arm' ))
554+ $cmdMsg = @ (" ${solutionFile} " , " /t:Rebuild" , " /p:Platform=${NativeHostArch} " , " /p:Configuration=${Configuration} " , " /m" , " /nologo" , " /fl" , " /flp:LogFile=${ script:BuildLogFile } `;Append`;Verbosity=diagnostic" )
555+ if ($silent )
533556 {
534- $msbuildCmd = Get-VS2017BuildToolPath
557+ $cmdMsg += " /noconlog "
535558 }
536- else
559+
560+ $msbuildCmd = Get-VS2017BuildToolPath
561+ if ($msbuildCmd -eq $null )
537562 {
538563 $msbuildCmd = Get-VS2015BuildToolPath
539564 }
0 commit comments