|
47 | 47 | <Bitness Condition="$(Platform) == 'x64'">64</Bitness> |
48 | 48 | <ArchName>x86</ArchName> |
49 | 49 | <ArchName Condition="$(Platform) == 'x64'">amd64</ArchName> |
| 50 | + <OpenSSLPlatform>VC-WIN32</OpenSSLPlatform> |
| 51 | + <OpenSSLPlatform Condition="$(Platform) == 'x64'">VC-WIN64A</OpenSSLPlatform> |
50 | 52 | <SupportSigning>true</SupportSigning> |
51 | 53 | </PropertyGroup> |
52 | 54 |
|
53 | | - <ItemGroup> |
54 | | - <PrepareSSL Include="prepare_ssl.py" /> |
55 | | - <Perl Include="$(Perl)" /> |
56 | | - </ItemGroup> |
57 | | - |
58 | 55 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
59 | 56 | <Import Project="pyproject.props" /> |
60 | 57 |
|
61 | 58 | <PropertyGroup> |
62 | 59 | <IntDir>$(opensslDir)\tmp$(Bitness)dll</IntDir> |
63 | | - <OutDir>$(opensslDir)\out$(Bitness)dll</OutDir> |
64 | | - <MakeFile>ms\ntdll$(Bitness).mak</MakeFile> |
65 | | - <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> |
| 60 | + <OutDir>$(opensslOutDir)</OutDir> |
66 | 61 | <NMakeBuildCommandLine>setlocal |
67 | | -set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';') |
68 | 62 | set VCINSTALLDIR=$(VCInstallDir) |
69 | | -cd /D "$(opensslDir.TrimEnd(`\`))" |
70 | 63 | if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" |
71 | | -if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" |
72 | | -if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" |
73 | | -$(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) |
74 | | -nmake -f $(MakeFile) $(NMakeOptions) headers lib |
75 | | -copy /y LICENSE "$(opensslOutDir)\LICENSE" |
| 64 | +cd /D "$(IntDir.TrimEnd('\'))" |
| 65 | +$(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm |
| 66 | +nmake |
76 | 67 | </NMakeBuildCommandLine> |
77 | 68 | </PropertyGroup> |
78 | 69 |
|
79 | 70 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
80 | 71 |
|
81 | | - <Target Name="SuppressOriginalBuildinfH" Condition="Exists('$(opensslDir)crypto\buildinf.h')" BeforeTargets="CreateBuildinfH"> |
82 | | - <Move SourceFiles="$(opensslDir)crypto\buildinf.h" DestinationFiles="$(opensslDir)crypto\buildinf.h.orig" /> |
| 72 | + <Target Name="_PatchUplink" BeforeTargets="Build"> |
| 73 | + <PropertyGroup> |
| 74 | + <Uplink>$(opensslDir)\ms\uplink.c</Uplink> |
| 75 | + <BeforePatch>((h = GetModuleHandle(NULL)) == NULL)</BeforePatch> |
| 76 | + <AfterPatch>((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL /*patched*/)</AfterPatch> |
| 77 | + </PropertyGroup> |
| 78 | + <Error Text="Cannot find $(Uplink)" Condition="!Exists($(Uplink))" /> |
| 79 | + <PropertyGroup> |
| 80 | + <_Original>$([System.IO.File]::ReadAllText($(Uplink)))</_Original> |
| 81 | + <_Patched>$(_Original.Replace($(BeforePatch), $(AfterPatch)))</_Patched> |
| 82 | + <IsPatched>false</IsPatched> |
| 83 | + <IsPatched Condition="$(_Patched) == $(_Original)">true</IsPatched> |
| 84 | + </PropertyGroup> |
| 85 | + <Message Text="$(Uplink) is already patched" Importance="normal" Condition="$(IsPatched)" /> |
| 86 | + <Message Text="Patching $(Uplink)" Importance="high" Condition="!$(IsPatched)" /> |
| 87 | + <WriteLinesToFile File="$(Uplink)" |
| 88 | + Lines="$(_Patched)" |
| 89 | + Overwrite="true" |
| 90 | + Encoding="ASCII" |
| 91 | + Condition="!$(IsPatched)" /> |
83 | 92 | </Target> |
84 | 93 |
|
85 | | - <Target Name="_CopyIncludes" AfterTargets="Build"> |
| 94 | + <Target Name="_CopyToOutput" AfterTargets="Build"> |
86 | 95 | <ItemGroup> |
87 | | - <Sources Include="$(opensslDir)inc$(Bitness)\**\*.h" /> |
88 | | - <Sources Include="$(opensslDir)ms\applink.c" /> |
| 96 | + <_Built Include="$(opensslDir)\LICENSE" /> |
| 97 | + <_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" /> |
| 98 | + <_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" /> |
| 99 | + <_AppLink Include="$(opensslDir)\ms\applink.c" /> |
| 100 | + <_Include Include="$(opensslDir)\Include\openssl\*.h" /> |
| 101 | + <_Include Include="$(IntDir)\include\openssl\*.h" /> |
89 | 102 | </ItemGroup> |
90 | | - <Copy SourceFiles="%(Sources.FullPath)" DestinationFiles="$(opensslOutDir)\include\%(Sources.RecursiveDir)\%(Sources.Filename)%(Sources.Extension)" /> |
| 103 | + <MakeDir Directories="$(opensslOutDir)\include\openssl" /> |
| 104 | + <Copy SourceFiles="@(_Built)" DestinationFolder="$(opensslOutDir)" /> |
| 105 | + <Copy SourceFiles="@(_AppLink)" DestinationFolder="$(opensslOutDir)\include" /> |
| 106 | + <Copy SourceFiles="@(_Include)" DestinationFolder="$(opensslOutDir)\include\openssl" /> |
91 | 107 | </Target> |
92 | 108 |
|
93 | 109 | <Target Name="SignFiles" AfterTargets="Build" Condition="$(_SignCommand) != ''"> |
94 | 110 | <ItemGroup> |
95 | | - <FilesToSign Include="$(opensslOutDir)\libeay32.dll;$(opensslOutDir)\ssleay32.dll" /> |
| 111 | + <FilesToSign Include="$(opensslOutDir)\lib*.dll" /> |
96 | 112 | </ItemGroup> |
97 | 113 | <Exec Command="$(_SignCommand) %(FilesToSign.FullPath)" ContinueOnError="true" /> |
98 | 114 | </Target> |
|
0 commit comments