Skip to content

Commit

Permalink
Merge pull request #4 from janisozaur/openssl
Browse files Browse the repository at this point in the history
Fix AppVeyor / OpenSSL and zlib compress API
  • Loading branch information
IntelOrca committed Jan 21, 2016
2 parents a45d804 + 789427c commit 3047d85
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 19 deletions.
60 changes: 45 additions & 15 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $binDir = ".\bin"
$includeDir = ".\artifacts\include"
$artifactsDir = ".\artifacts"
$outZip = "$artifactsDir\openrct2-libs-vs2015.zip"
$buildOpenSSL = false

Remove-Item -Force -Recurse $binDir -ErrorAction SilentlyContinue
Remove-Item -Force -Recurse $artifactsDir -ErrorAction SilentlyContinue
Expand Down Expand Up @@ -64,23 +65,46 @@ Write-Host "Building nonproject (jansson, libspeex)..." -ForegroundColor Cyan
msbuild ".\src\nonproject\nonproject.sln" "/p:Configuration=Release" "/p:Platform=x86" "/p:PlatformToolset=v140" "/v:minimal"
Copy-Item -Force ".\src\nonproject\bin\nonproject.lib" $binDir

# Download OpenSSL
$opensslDownloadUrl = "https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip"
$opensslDownloadOut = ".\openssl.zip"
if (-not (Test-Path -PathType Leaf $opensslDownloadOut))
if ($buildOpenSSL)
{
$extractDir = ".\src\openssl-OpenSSL_1_0_2-stable"
Invoke-WebRequest $opensslDownloadUrl -OutFile $opensslDownloadOut
Remove-Item -Force -Recurse $extractDir -ErrorAction SilentlyContinue
Remove-Item -Force -Recurse ".\src\openssl" -ErrorAction SilentlyContinue
& $7zcmd x $opensslDownloadOut -osrc | Write-Host
Move-Item $extractDir ".\src\openssl"
# Download OpenSSL
$opensslDownloadUrl = "https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip"
$opensslDownloadOut = ".\openssl.zip"
if (-not (Test-Path -PathType Leaf $opensslDownloadOut))
{
$extractDir = ".\src\openssl-OpenSSL_1_0_2-stable"
Invoke-WebRequest $opensslDownloadUrl -OutFile $opensslDownloadOut
Remove-Item -Force -Recurse $extractDir -ErrorAction SilentlyContinue
Remove-Item -Force -Recurse ".\src\openssl" -ErrorAction SilentlyContinue
& $7zcmd x $opensslDownloadOut -osrc | Write-Host
Move-Item $extractDir ".\src\openssl"
}

# Build OpenSSL
Write-Host "Building OpenSSL..." -ForegroundColor Cyan
$env:VSCOMNTOOLS = (Get-Content("env:VS140COMNTOOLS"))
& ".\build_openssl.bat"
} else {
# Download OpenSSL
$opensslVersion = "1.0.2e"
$opensslDownloadUrl = "http://www.npcglib.org/~stathis/downloads/openssl-$opensslVersion-vs2015.7z"
$opensslDownloadOut = ".\openssl-precompiled.7z"
if (-not (Test-Path -PathType Leaf $opensslDownloadOut))
{
$extractDir = ".\src\openssl-$opensslVersion-vs2015"
Invoke-WebRequest $opensslDownloadUrl -OutFile $opensslDownloadOut
Remove-Item -Force -Recurse $extractDir -ErrorAction SilentlyContinue
Remove-Item -Force -Recurse ".\src\openssl" -ErrorAction SilentlyContinue
& $7zcmd x $opensslDownloadOut -osrc | Write-Host
Move-Item $extractDir ".\src\openssl"
# Shuffle layout of files to what cURL expects them to be
Move-Item ".\src\openssl\include" ".\src\openssl\inc32"
Move-Item ".\src\openssl\lib\libeay32MT.lib" ".\src\openssl\lib\libeay32.lib"
Move-Item ".\src\openssl\lib\ssleay32MT.lib" ".\src\openssl\lib\ssleay32.lib"
Move-Item ".\src\openssl\lib" ".\src\openssl\out32"
}
}

# Build OpenSSL
Write-Host "Building OpenSSL..." -ForegroundColor Cyan
$env:VSCOMNTOOLS = (Get-Content("env:VS140COMNTOOLS"))
& ".\build_openssl.bat"

# Build libcurl
Write-Host "Building libcurl..." -ForegroundColor Cyan
Expand All @@ -98,6 +122,12 @@ Push-Location ".\bin"
".\zlib.lib" `
".\nonproject.lib" `
".\libcurl.lib"
if ($LASTEXITCODE -ne 0)
{
Write-Host "Failed to create merged library." -ForegroundColor Red
return 1
}

Pop-Location

Write-Host "-----------------------------------------------------" -ForegroundColor Cyan
Expand Down Expand Up @@ -144,4 +174,4 @@ if ($LASTEXITCODE -ne 0)
{
Write-Host "Failed to create zip." -ForegroundColor Red
return 1
}
}
8 changes: 4 additions & 4 deletions src/libpng/projects/vstudio/zlib/zlib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;Z_SOLO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand All @@ -102,7 +102,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;Z_SOLO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -128,7 +128,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;Z_SOLO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
Expand All @@ -150,7 +150,7 @@
<BrowseInformation>true</BrowseInformation>
<FunctionLevelLinking>true</FunctionLevelLinking>
<TreatWarningAsError>true</TreatWarningAsError>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;Z_SOLO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
Expand Down

0 comments on commit 3047d85

Please sign in to comment.