Skip to content

Commit

Permalink
Add Zlib Library For Compression Support
Browse files Browse the repository at this point in the history
- Added an empty project with a script to dynamically download zlib source and compile it into a static library.
- Updated other projects to link with new zlib library.
- Removed zlib preprocessor workarounds and function stubs now that real library is in place.
  • Loading branch information
NoMoreFood committed Dec 8, 2018
1 parent 54b0ce9 commit 023b9a4
Show file tree
Hide file tree
Showing 30 changed files with 801 additions and 454 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ sshd
/contrib/win32/openssh/Win32/Debug/libssh
/config.h
/contrib/win32/openssh/LibreSSL
/contrib/win32/openssh/Zlib
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand Down
52 changes: 52 additions & 0 deletions contrib/win32/openssh/GetZlib.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
param
(
[string]$ZLibUrl = 'https://zlib.net/zlib1211.zip',
[string]$SourceDirectory = $null,
[string]$TargetLibrary = $null
)

Set-StrictMode -Version 2.0

# Exit immediately if compiled zip file already exist
If (-not [string]::IsNullOrEmpty($TargetLibrary))
{
If (Test-Path -LiteralPath $TargetLibrary)
{
Exit 0
}
}

# Workaround that $PSScriptRoot is not support on ps version 2
If ($PSVersiontable.PSVersion.Major -le 2)
{
$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
}

# Allow broad arrange of TLS protocols to do download
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor `
[Net.SecurityProtocolType]::Tls11 -bor `
[Net.SecurityProtocolType]::Tls

# Download Zlib to local directory
$ZlibZipLocalPath = Join-Path ([System.IO.Path]::GetTempPath()) 'Zlib.zip'
Invoke-WebRequest -Uri $ZLibUrl -OutFile $ZlibZipLocalPath


# Set the project directory
If ([string]::IsNullOrEmpty($SourceDirectory))
{
$SourceDirectory = Join-Path $PSScriptRoot 'zlib'
}

# Ensure the destination directory exists
New-Item -ItemType Directory $SourceDirectory -ErrorAction SilentlyContinue | Out-Null

# Expand the zip file
$ZlibTempDir = Join-Path ([System.IO.Path]::GetTempPath()) 'Zlib'
Expand-Archive -Path $ZlibZipLocalPath -DestinationPath $ZlibTempDir -Force -ErrorAction SilentlyContinue
$SourceDirectory = Get-Item $SourceDirectory | Select-Object -ExpandProperty FullName
Get-ChildItem -Path "${ZlibTempDir}\*\*.c" | Copy-Item -Destination $SourceDirectory -Force
Get-ChildItem -Path "${ZlibTempDir}\*\*.h" | Copy-Item -Destination $SourceDirectory -Force

# Cleanup local zip file
Remove-Item $ZlibZipLocalPath -Force -ErrorAction SilentlyContinue
23 changes: 23 additions & 0 deletions contrib/win32/openssh/Win32-OpenSSH.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh", "ssh.vcxproj", "{74E6
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libssh", "libssh.vcxproj", "{05E1115F-8529-46D0-AAAF-52A404CE79A7}"
ProjectSection(ProjectDependencies) = postProject
{05E1115F-8529-46D0-AAAF-52A404CE79A8} = {05E1115F-8529-46D0-AAAF-52A404CE79A8}
{8F9D3B74-8D33-448E-9762-26E8DCC6B2F4} = {8F9D3B74-8D33-448E-9762-26E8DCC6B2F4}
EndProjectSection
EndProject
Expand Down Expand Up @@ -157,6 +158,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh-keyscan", "ssh-keyscan.
{0D02F0F0-013B-4EE3-906D-86517F3822C0} = {0D02F0F0-013B-4EE3-906D-86517F3822C0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{05E1115F-8529-46D0-AAAF-52A404CE79A8}"
ProjectSection(ProjectDependencies) = postProject
{8F9D3B74-8D33-448E-9762-26E8DCC6B2F4} = {8F9D3B74-8D33-448E-9762-26E8DCC6B2F4}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Expand Down Expand Up @@ -505,6 +511,22 @@ Global
{7D0A75FC-F366-4B60-B72F-B37C3EA07CCA}.Release|x64.Build.0 = Release|x64
{7D0A75FC-F366-4B60-B72F-B37C3EA07CCA}.Release|x86.ActiveCfg = Release|Win32
{7D0A75FC-F366-4B60-B72F-B37C3EA07CCA}.Release|x86.Build.0 = Release|Win32
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|ARM.ActiveCfg = Debug|ARM
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|ARM.Build.0 = Debug|ARM
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|ARM64.ActiveCfg = Debug|ARM64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|ARM64.Build.0 = Debug|ARM64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|x64.ActiveCfg = Debug|x64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|x64.Build.0 = Debug|x64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|x86.ActiveCfg = Debug|Win32
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Debug|x86.Build.0 = Debug|Win32
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|ARM.ActiveCfg = Release|ARM
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|ARM.Build.0 = Release|ARM
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|ARM64.ActiveCfg = Release|ARM64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|ARM64.Build.0 = Release|ARM64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|x64.ActiveCfg = Release|x64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|x64.Build.0 = Release|x64
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|x86.ActiveCfg = Release|Win32
{05E1115F-8529-46D0-AAAF-52A404CE79A8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -531,6 +553,7 @@ Global
{FC568FF0-60F2-4B2E-AF62-FD392EDBA1B9} = {A8096E32-E084-4FA0-AE01-A8D909EB2BB4}
{484A8CDE-B949-4BDA-B447-74685C8E032F} = {A8096E32-E084-4FA0-AE01-A8D909EB2BB4}
{7D0A75FC-F366-4B60-B72F-B37C3EA07CCA} = {17322AAF-808F-4646-AD37-5B0EDDCB8F3E}
{05E1115F-8529-46D0-AAAF-52A404CE79A8} = {17322AAF-808F-4646-AD37-5B0EDDCB8F3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AC224E8-C215-4270-954A-A2ACEE06DE58}
Expand Down
Loading

0 comments on commit 023b9a4

Please sign in to comment.