Skip to content

Commit 72c5e74

Browse files
committed
Updated Build helper PS module to support builds with NoOpenSSL
1 parent c156f14 commit 72c5e74

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

contrib/win32/openssh/OpenSSHBuildHelper.psm1

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,6 @@ function Start-OpenSSHBootstrap
190190
[Environment]::SetEnvironmentVariable('Path', $newMachineEnvironmentPath, 'MACHINE')
191191
}
192192

193-
# install nasm
194-
$packageName = "nasm"
195-
$nasmPath = "${env:ProgramFiles(x86)}\NASM"
196-
197-
if (-not (Test-Path -Path $nasmPath -PathType Container))
198-
{
199-
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName." -Silent:$silent
200-
choco install $packageName -y --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile
201-
}
202-
else
203-
{
204-
Write-BuildMsg -AsVerbose -Message "$packageName present. Skipping installation." -Silent:$silent
205-
}
206-
207193
# Install Visual Studio 2015 Community
208194
$packageName = "VisualStudio2015Community"
209195
$VSPackageInstalled = Get-ItemProperty "HKLM:\software\WOW6432Node\Microsoft\VisualStudio\14.0\setup\vs" -ErrorAction SilentlyContinue
@@ -380,7 +366,9 @@ function Build-OpenSSH
380366
[string]$NativeHostArch = "x64",
381367

382368
[ValidateSet('Debug', 'Release', '')]
383-
[string]$Configuration = "Release"
369+
[string]$Configuration = "Release",
370+
371+
[switch]$NoOpenSSL
384372
)
385373
Set-StrictMode -Version Latest
386374
$script:BuildLogFile = $null
@@ -407,12 +395,30 @@ function Build-OpenSSH
407395

408396
Start-OpenSSHBootstrap
409397

410-
Clone-Win32OpenSSH
411-
Copy-OpenSSLSDK
398+
if (-not (Test-Path (Join-Path $PSScriptRoot OpenSSLSDK)))
399+
{
400+
Clone-Win32OpenSSH
401+
Copy-OpenSSLSDK
402+
}
403+
404+
if ($NoOpenSSL)
405+
{
406+
$f = Join-Path $PSScriptRoot paths.targets
407+
(Get-Content $f).Replace('<!-- <UseOpenSSL>false</UseOpenSSL> -->', '<UseOpenSSL>false</UseOpenSSL>') | Set-Content $f
408+
$f = Join-Path $PSScriptRoot config.h.vs
409+
(Get-Content $f).Replace('#define WITH_OPENSSL 1','') | Set-Content $f
410+
(Get-Content $f).Replace('#define OPENSSL_HAS_ECC 1','') | Set-Content $f
411+
(Get-Content $f).Replace('#define OPENSSL_HAS_NISTP521 1','') | Set-Content $f
412+
}
413+
412414
$msbuildCmd = "msbuild.exe"
413415
$solutionFile = Get-SolutionFile -root $repositoryRoot.FullName
414416
$cmdMsg = @("${solutionFile}", "/p:Platform=${NativeHostArch}", "/p:Configuration=${Configuration}", "/m", "/noconlog", "/nologo", "/fl", "/flp:LogFile=${script:BuildLogFile}`;Append`;Verbosity=diagnostic")
415417

418+
if ($NoOpenSSL) {
419+
$cmdMsg += @("/t:core\scp", "/t:core\sftp", "/t:core\sftp-server", "/t:core\ssh", "/t:core\ssh-add", "/t:core\ssh-agent", "/t:core\sshd", "/t:core\ssh-keygen", "/t:core\ssh-shellhost")
420+
}
421+
416422
& $msbuildCmd $cmdMsg
417423
$errorCode = $LASTEXITCODE
418424

0 commit comments

Comments
 (0)