Fix of issues 1139 (#341)
Fix of PowerShell/Win32-OpenSSH#1139. Now user can build use solution file without manual steps 1. Added prebuildevent to copy libressl 2. When there is no '.git' in the environment, $psscriptroot is the default location to look for the solution and log file
This commit is contained in:
parent
3b303808b8
commit
06ba674c67
|
@ -0,0 +1,55 @@
|
|||
param (
|
||||
[string]$sourceUrl = "https://github.com/PowerShell/libressl/releases/latest/",
|
||||
[string]$zipDir,
|
||||
[string]$destDir,
|
||||
[switch]$override
|
||||
)
|
||||
|
||||
If ($PSVersiontable.PSVersion.Major -le 2) {$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path}
|
||||
# Workaround that $PSScriptRoot is not support on ps version 2
|
||||
if([string]::IsNullOrEmpty($zipDir))
|
||||
{
|
||||
$zipDir = $PSScriptRoot
|
||||
}
|
||||
|
||||
if([string]::IsNullOrEmpty($destDir))
|
||||
{
|
||||
$destDir = $PSScriptRoot
|
||||
}
|
||||
|
||||
if($override)
|
||||
{
|
||||
Remove-Item (join-path $destDir "LibreSSL") -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
elseif (Test-Path (Join-Path $destDir "LibreSSL") -PathType Container)
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor `
|
||||
[Net.SecurityProtocolType]::Tls11 -bor `
|
||||
[Net.SecurityProtocolType]::Tls
|
||||
|
||||
$request = [System.Net.WebRequest]::Create($sourceUrl)
|
||||
$request.AllowAutoRedirect = $false
|
||||
$request.Timeout = 60000; # 1 mins for the download to complete
|
||||
$response = $request.GetResponse()
|
||||
$release_url = $([String]$response.GetResponseHeader("Location")).Replace('tag','download') + '/LibreSSL.zip'
|
||||
$zip_path = Join-Path $zipDir "libressl.zip"
|
||||
|
||||
# Download libressl latest release binaries
|
||||
Remove-Item $zip_path -Force -ErrorAction SilentlyContinue
|
||||
(New-Object System.Net.WebClient).DownloadFile($release_url, $zip_path)
|
||||
if(-not (Test-Path $zip_path))
|
||||
{
|
||||
throw "failed to download ssl zip file"
|
||||
}
|
||||
|
||||
# Expand the zip file
|
||||
Expand-Archive -Path $zip_path -DestinationPath $destDir -Force -ErrorAction SilentlyContinue -ErrorVariable e
|
||||
if($e -ne $null)
|
||||
{
|
||||
throw "Error when expand zip file"
|
||||
}
|
||||
|
||||
Remove-Item $zip_path -Force -ErrorAction SilentlyContinue
|
|
@ -690,9 +690,13 @@ function Get-BuildLogFile
|
|||
|
||||
[ValidateSet('Debug', 'Release')]
|
||||
[string]$Configuration = "Release"
|
||||
|
||||
)
|
||||
return Join-Path -Path $root -ChildPath "contrib\win32\openssh\OpenSSH$($Configuration)$($NativeHostArch).log"
|
||||
)
|
||||
if($root -ieq $PSScriptRoot)
|
||||
{
|
||||
return Join-Path -Path $PSScriptRoot -ChildPath "OpenSSH$($Configuration)$($NativeHostArch).log"
|
||||
} else {
|
||||
return Join-Path -Path $root -ChildPath "contrib\win32\openssh\OpenSSH$($Configuration)$($NativeHostArch).log"
|
||||
}
|
||||
}
|
||||
|
||||
function Get-SolutionFile
|
||||
|
@ -701,9 +705,14 @@ function Get-SolutionFile
|
|||
(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[ValidateNotNull()]
|
||||
[System.IO.DirectoryInfo] $root
|
||||
[System.IO.DirectoryInfo] $root
|
||||
)
|
||||
return Join-Path -Path $root -ChildPath "contrib\win32\openssh\Win32-OpenSSH.sln"
|
||||
if($root -ieq $PSScriptRoot)
|
||||
{
|
||||
return Join-Path -Path $PSScriptRoot -ChildPath "Win32-OpenSSH.sln"
|
||||
} else {
|
||||
return Join-Path -Path $root -ChildPath "contrib\win32\openssh\Win32-OpenSSH.sln"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -186,10 +186,11 @@
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-x86-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -219,10 +220,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-x64-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -252,10 +254,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-arm64-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -285,10 +288,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-arm-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -322,10 +326,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-x86-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -359,10 +364,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-x64-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -396,10 +402,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-arm64-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
@ -433,10 +440,11 @@ copy /Y "$(SolutionDir)openssh-events.man" "$(OutDir)"</Command>
|
|||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(LibreSSL-arm-Path);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"</Command>
|
||||
<Command>powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)config.ps1" -Config_h_vs "$(SolutionDir)config.h.vs" -Config_h "$(OpenSSH-Src-Path)config.h" -VCIncludePath "$(VC_IncludePath)" -OutCRTHeader "$(OpenSSH-Src-Path)contrib\win32\win32compat\inc\crtheaders.h"
|
||||
powershell.exe -Executionpolicy Bypass -File "$(SolutionDir)GetLibreSSL.ps1"</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generate crtheaders.h and config.h</Message>
|
||||
<Message>Generate crtheaders.h and config.h; fetch libressl sdk</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)install-ssh*ps1" "$(OutDir)"
|
||||
|
|
Loading…
Reference in New Issue