0001_windows_openssl_1.1.0_build_v11.patch
application/x-patch
Filename: 0001_windows_openssl_1.1.0_build_v11.patch
Type: application/x-patch
Part: 0
Patch
Format: unified
Series: patch v11
| File | + | − |
|---|---|---|
| src/tools/msvc/Solution.pm | 75 | 12 |
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 78db247..31a7a77 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -174,7 +174,17 @@ sub GenerateFiles
if ($self->{options}->{asserts});
print $o "#define USE_LDAP 1\n" if ($self->{options}->{ldap});
print $o "#define HAVE_LIBZ 1\n" if ($self->{options}->{zlib});
- print $o "#define USE_OPENSSL 1\n" if ($self->{options}->{openssl});
+ if ($self->{options}->{openssl})
+ {
+ print $o "#define USE_OPENSSL 1\n";
+ # We need to know if we are using version 1.1.0 or above
+ my ($major, $minor) = $self->GetOpenSSLVersion();
+ if ($major == 1 && $minor == 1)
+ {
+ print $o "#define HAVE_BIO_GET_DATA 1\n";
+ print $o "#define HAVE_BIO_METH_NEW 1\n";
+ }
+ }
print $o "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
print $o "#define BLCKSZ ", 1024 * $self->{options}->{blocksize},
@@ -579,21 +589,52 @@ sub AddProject
if ($self->{options}->{openssl})
{
$proj->AddIncludeDir($self->{options}->{openssl} . '\include');
- if (-e "$self->{options}->{openssl}/lib/VC/ssleay32MD.lib")
+ my ($major, $minor) = $self->GetOpenSSLVersion();
+ if ($major == 1 && $minor == 1)
{
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\VC\ssleay32.lib', 1);
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\VC\libeay32.lib', 1);
+ # Startint at version 1.1.0 OpenSSL have changed their library names from:
+ # libeay to libcrypto
+ # ssleay to libssl
+ if (-e "$self->{options}->{openssl}/lib/VC/libssl32MD.lib")
+ {
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\VC\libssl32.lib', 1);
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\VC\libcrypto32.lib', 1);
+ }
+ elsif (-e "$self->{options}->{openssl}/lib/VC/libssl64MD.lib")
+ {
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\VC\libssl64.lib', 1);
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\VC\libcrypto64.lib', 1);
+ }
+ else
+ {
+ # We don't expect the config-specific library to be here,
+ # so don't ask for it in last parameter
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\libssl.lib', 0);
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\libcrypto.lib', 0);
+ }
}
else
{
- # We don't expect the config-specific library to be here,
- # so don't ask for it in last parameter
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\ssleay32.lib', 0);
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\libeay32.lib', 0);
+ if (-e "$self->{options}->{openssl}/lib/VC/ssleay32MD.lib")
+ {
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\VC\ssleay32.lib', 1);
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\VC\libeay32.lib', 1);
+ }
+ else
+ {
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\ssleay32.lib', 0);
+ $proj->AddLibrary(
+ $self->{options}->{openssl} . '\lib\libeay32.lib', 0);
+ }
}
}
if ($self->{options}->{nls})
@@ -955,4 +996,26 @@ MinimumVisualStudioVersion = $self->{MinimumVisualStudioVersion}
|;
}
+sub GetOpenSSLVersion
+{
+ my $self = shift;
+
+ # Attempt to get OpenSSL version and location.
+ # Assume openssl.exe in specified dir.
+ my $opensslprog = '\bin\openssl.exe version 2>&1';
+ my $opensslcmd =
+ $self->{options}->{openssl} . $opensslprog;
+ my $sslout = `$opensslcmd`;
+ die "Unable to determine OpenSSL: The openssl.exe command was not found." if $?;
+
+ if ($sslout =~ /(\d+)\.(\d+)\.(\d+)/m)
+ {
+ return ($1, $2)
+ }
+ else
+ {
+ die "Unable to determine OpenSSL version: The openssl.exe version could not be determined.";
+ }
+}
+
1;