diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-09-09 13:13:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-09 13:13:06 (GMT) |
commit | b84bcc48ae31c385fe480c08c05d95212ef7fcdc (patch) | |
tree | e05a3904af68a4e2149e4152b52ee2aacd46436b /PCbuild | |
parent | efb1d0a3c001a6153211063ba439b9847aa03509 (diff) | |
download | cpython-b84bcc48ae31c385fe480c08c05d95212ef7fcdc.zip cpython-b84bcc48ae31c385fe480c08c05d95212ef7fcdc.tar.gz cpython-b84bcc48ae31c385fe480c08c05d95212ef7fcdc.tar.bz2 |
bpo-31392: Update SSL build for 1.1.0 (#3448)
Diffstat (limited to 'PCbuild')
-rw-r--r-- | PCbuild/get_externals.bat | 4 | ||||
-rw-r--r-- | PCbuild/openssl.props | 14 | ||||
-rw-r--r-- | PCbuild/openssl.vcxproj | 60 | ||||
-rw-r--r-- | PCbuild/prepare_ssl.bat | 10 | ||||
-rw-r--r-- | PCbuild/python.props | 4 |
5 files changed, 61 insertions, 31 deletions
diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index 0bbd2ad..1830726 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -49,7 +49,7 @@ echo.Fetching external libraries... set libraries= set libraries=%libraries% bzip2-1.0.6 -if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.0.2k +if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.0f set libraries=%libraries% sqlite-3.14.2.0 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.6.0 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.6.0 @@ -72,7 +72,7 @@ for %%e in (%libraries%) do ( echo.Fetching external binaries... set binaries= -if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.0.2k +if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.0f if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.6.0 if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06 diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props index 9ebe8a6..257cc85 100644 --- a/PCbuild/openssl.props +++ b/PCbuild/openssl.props @@ -6,14 +6,18 @@ </ClCompile> <Link> <AdditionalLibraryDirectories>$(opensslOutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> + <PropertyGroup> + <_DLLSuffix>-1_1</_DLLSuffix> + <_DLLSuffix Condition="$(Platform) == 'x64'">$(_DLLSuffix)-x64</_DLLSuffix> + </PropertyGroup> <ItemGroup> - <_SSLDLL Include="$(opensslOutDir)\libeay32.dll" /> - <_SSLDLL Include="$(opensslOutDir)\libeay32.pdb" /> - <_SSLDLL Include="$(opensslOutDir)\ssleay32.dll" /> - <_SSLDLL Include="$(opensslOutDir)\ssleay32.pdb" /> + <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" /> + <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).pdb" /> + <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" /> + <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" /> </ItemGroup> <Target Name="_CopySSLDLL" Inputs="@(_SSLDLL)" Outputs="@(_SSLDLL->'$(OutDir)%(Filename)%(Extension)')" AfterTargets="Build"> <Copy SourceFiles="@(_SSLDLL)" DestinationFolder="$(OutDir)" /> diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index 2d42b12..1a36d08 100644 --- a/PCbuild/openssl.vcxproj +++ b/PCbuild/openssl.vcxproj @@ -47,52 +47,68 @@ <Bitness Condition="$(Platform) == 'x64'">64</Bitness> <ArchName>x86</ArchName> <ArchName Condition="$(Platform) == 'x64'">amd64</ArchName> + <OpenSSLPlatform>VC-WIN32</OpenSSLPlatform> + <OpenSSLPlatform Condition="$(Platform) == 'x64'">VC-WIN64A</OpenSSLPlatform> <SupportSigning>true</SupportSigning> </PropertyGroup> - <ItemGroup> - <PrepareSSL Include="prepare_ssl.py" /> - <Perl Include="$(Perl)" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="pyproject.props" /> <PropertyGroup> <IntDir>$(opensslDir)\tmp$(Bitness)dll</IntDir> - <OutDir>$(opensslDir)\out$(Bitness)dll</OutDir> - <MakeFile>ms\ntdll$(Bitness).mak</MakeFile> - <NMakeOptions>LIB_D="$(opensslOutDir.TrimEnd(`\`))" OUT_D=out$(Bitness)dll TMP_D=tmp$(Bitness)dll INC_D=inc$(Bitness) INCO_D=inc$(Bitness)\openssl</NMakeOptions> + <OutDir>$(opensslOutDir)</OutDir> <NMakeBuildCommandLine>setlocal -set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';') set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(opensslDir.TrimEnd(`\`))" if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" -if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" -if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" -$(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) -nmake -f $(MakeFile) $(NMakeOptions) headers lib -copy /y LICENSE "$(opensslOutDir)\LICENSE" +cd /D "$(IntDir.TrimEnd('\'))" +$(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm +nmake </NMakeBuildCommandLine> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <Target Name="SuppressOriginalBuildinfH" Condition="Exists('$(opensslDir)crypto\buildinf.h')" BeforeTargets="CreateBuildinfH"> - <Move SourceFiles="$(opensslDir)crypto\buildinf.h" DestinationFiles="$(opensslDir)crypto\buildinf.h.orig" /> + <Target Name="_PatchUplink" BeforeTargets="Build"> + <PropertyGroup> + <Uplink>$(opensslDir)\ms\uplink.c</Uplink> + <BeforePatch>((h = GetModuleHandle(NULL)) == NULL)</BeforePatch> + <AfterPatch>((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL /*patched*/)</AfterPatch> + </PropertyGroup> + <Error Text="Cannot find $(Uplink)" Condition="!Exists($(Uplink))" /> + <PropertyGroup> + <_Original>$([System.IO.File]::ReadAllText($(Uplink)))</_Original> + <_Patched>$(_Original.Replace($(BeforePatch), $(AfterPatch)))</_Patched> + <IsPatched>false</IsPatched> + <IsPatched Condition="$(_Patched) == $(_Original)">true</IsPatched> + </PropertyGroup> + <Message Text="$(Uplink) is already patched" Importance="normal" Condition="$(IsPatched)" /> + <Message Text="Patching $(Uplink)" Importance="high" Condition="!$(IsPatched)" /> + <WriteLinesToFile File="$(Uplink)" + Lines="$(_Patched)" + Overwrite="true" + Encoding="ASCII" + Condition="!$(IsPatched)" /> </Target> - <Target Name="_CopyIncludes" AfterTargets="Build"> + <Target Name="_CopyToOutput" AfterTargets="Build"> <ItemGroup> - <Sources Include="$(opensslDir)inc$(Bitness)\**\*.h" /> - <Sources Include="$(opensslDir)ms\applink.c" /> + <_Built Include="$(opensslDir)\LICENSE" /> + <_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" /> + <_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" /> + <_AppLink Include="$(opensslDir)\ms\applink.c" /> + <_Include Include="$(opensslDir)\Include\openssl\*.h" /> + <_Include Include="$(IntDir)\include\openssl\*.h" /> </ItemGroup> - <Copy SourceFiles="%(Sources.FullPath)" DestinationFiles="$(opensslOutDir)\include\%(Sources.RecursiveDir)\%(Sources.Filename)%(Sources.Extension)" /> + <MakeDir Directories="$(opensslOutDir)\include\openssl" /> + <Copy SourceFiles="@(_Built)" DestinationFolder="$(opensslOutDir)" /> + <Copy SourceFiles="@(_AppLink)" DestinationFolder="$(opensslOutDir)\include" /> + <Copy SourceFiles="@(_Include)" DestinationFolder="$(opensslOutDir)\include\openssl" /> </Target> <Target Name="SignFiles" AfterTargets="Build" Condition="$(_SignCommand) != ''"> <ItemGroup> - <FilesToSign Include="$(opensslOutDir)\libeay32.dll;$(opensslOutDir)\ssleay32.dll" /> + <FilesToSign Include="$(opensslOutDir)\lib*.dll" /> </ItemGroup> <Exec Command="$(_SignCommand) %(FilesToSign.FullPath)" ContinueOnError="true" /> </Target> diff --git a/PCbuild/prepare_ssl.bat b/PCbuild/prepare_ssl.bat index 1df5b8d..5a3de2d 100644 --- a/PCbuild/prepare_ssl.bat +++ b/PCbuild/prepare_ssl.bat @@ -23,6 +23,8 @@ setlocal if "%PCBUILD%"=="" (set PCBUILD=%~dp0) if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) +set OUT= +set SRC= set ORG_SETTING= :CheckOpts @@ -30,12 +32,19 @@ if "%~1"=="-h" shift & goto Usage if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts +if "%~1"=="-i" (SET SRC=$~2) && shift && shift && goto CheckOpts +if "%~1"=="--in" (SET SRC=$~2) && shift && shift && goto CheckOpts +if "%~1"=="-o" (set OUT=$~2) && shift && shift && goto CheckOpts +if "%~1"=="--out" (set OUT=$~2) && shift && shift && goto CheckOpts if "%~1"=="" goto Build echo Unrecognized option: %1 goto Usage :Build +if not defined SRC (echo --in directory is required & exit /b 1) +if not defined OUT (echo --out directory is required & exit /b 1) + call "%PCBUILD%find_msbuild.bat" %MSBUILD% if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) @@ -51,3 +60,4 @@ if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exi if errorlevel 1 exit /b %MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=x64 if errorlevel 1 exit /b + diff --git a/PCbuild/python.props b/PCbuild/python.props index 3bfbb77..ebb1631 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -47,8 +47,8 @@ <sqlite3Dir>$(ExternalsDir)sqlite-3.14.2.0\</sqlite3Dir> <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir> <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir> - <opensslDir>$(ExternalsDir)openssl-1.0.2k\</opensslDir> - <opensslOutDir>$(ExternalsDir)openssl-bin-1.0.2k\$(ArchName)\</opensslOutDir> + <opensslDir>$(ExternalsDir)openssl-1.1.0f\</opensslDir> + <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.0f\$(ArchName)\</opensslOutDir> <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir> <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir> <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir> |