diff --git a/.appveyor.yml b/.appveyor.yml index 54a71ab54..81515e40e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -24,7 +24,7 @@ environment: - {PYVER: "34", PYTHON_ARCH: "32"} - {PYVER: "34", PYTHON_ARCH: "64"} - OPENSSL_VERSION: "1_0_2r" + OPENSSL_VERSION: "1_1_1b" POSTGRES_VERSION: "11_2" PSYCOPG2_TESTDB: psycopg2_test @@ -135,11 +135,9 @@ install: If ($env:PYTHON_ARCH -Match "32" ) { $env:VCVARS_PLATFORM="x86" $env:TARGET="VC-WIN32" - $env:DO="do_ms" } Else { $env:VCVARS_PLATFORM="amd64" $env:TARGET="VC-WIN64A" - $env:DO="do_win64a" $env:CPU="AMD64" } # Download OpenSSL source @@ -148,22 +146,12 @@ install: curl -fsSL -o OpenSSL_%OPENSSL_VERSION%.zip https://github.com/openssl/openssl/archive/OpenSSL_%OPENSSL_VERSION%.zip ) - # To use OpenSSL >= 1.1.0, both libpq and psycopg build environments have - # to support the new library names. Below are commands to build OpenSSL - # 1.1.0: - # - mkdir _build - # - cd _build - # - perl ..\Configure %TARGET% no-asm no-shared --prefix=%BASE_DIR%\openssl --openssldir=%BASE_DIR%\openssl - # - nmake build_libs install_dev - - IF NOT EXIST %OPENSSLTOP%\lib\ssleay32.lib ( + - IF NOT EXIST %OPENSSLTOP%\lib\libssl.lib ( CD %BUILD_DIR% && 7z x C:\Others\OpenSSL_%OPENSSL_VERSION%.zip && CD openssl-OpenSSL_%OPENSSL_VERSION% && perl Configure %TARGET% no-asm no-shared no-zlib --prefix=%OPENSSLTOP% --openssldir=%OPENSSLTOP% && - CALL ms\%DO% && - nmake -f ms\nt.mak init headers lib && - COPY inc32\openssl\*.h %OPENSSLTOP%\include\openssl && - COPY out32\*.lib %OPENSSLTOP%\lib && + nmake build_libs install_dev && CD %BASE_DIR% && RMDIR /S /Q %BUILD_DIR%\openssl-OpenSSL_%OPENSSL_VERSION% ) @@ -190,12 +178,16 @@ install: # Copy over built libraries # Prepare local include directory for building from # Build pg_config in place + # Note patch for OpenSSL 1.1 configuration. See: + # https://www.postgresql-archive.org/Compile-psql-9-6-with-SSL-Version-1-1-0-td6054118.html # NOTE: Cannot set and use the same variable inside an IF - SET PGBUILD=%BUILD_DIR%\postgres-REL_%POSTGRES_VERSION% - IF NOT EXIST %PGTOP%\lib\libpq.lib ( CD %BUILD_DIR% && 7z x C:\Others\postgres-REL_%POSTGRES_VERSION%.zip && - CD postgres-REL_%POSTGRES_VERSION%\src\tools\msvc && + CD postgres-REL_%POSTGRES_VERSION% && + patch -p1 < %APPVEYOR_BUILD_FOLDER%\scripts\win_openssl_11.patch && + CD src\tools\msvc && ECHO $config-^>{ldap} = 0; > config.pl && ECHO $config-^>{openssl} = "%OPENSSLTOP:\=\\%"; >> config.pl && ECHO.>> config.pl && diff --git a/scripts/appveyor.cache_rebuild b/scripts/appveyor.cache_rebuild index 28cd082c9..c09e36d00 100644 --- a/scripts/appveyor.cache_rebuild +++ b/scripts/appveyor.cache_rebuild @@ -9,7 +9,7 @@ To invalidate the cache, update this file and check it into git. Currently used modules built in the cache: OpenSSL - Version: 1.0.2r + Version: 1.1.1b PostgreSQL Version: 11.2 diff --git a/scripts/win_openssl_11.patch b/scripts/win_openssl_11.patch new file mode 100644 index 000000000..57d0bd818 --- /dev/null +++ b/scripts/win_openssl_11.patch @@ -0,0 +1,20 @@ +diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 +index dfd6972383..72d1259ffb 100644 +--- a/src/include/pg_config.h.win32 ++++ b/src/include/pg_config.h.win32 +@@ -74,12 +74,15 @@ + + /* Define to 1 if you have the `ASN1_STRING_get0_data' function. */ + /* #undef HAVE_ASN1_STRING_GET0_DATA */ ++#define HAVE_ASN1_STRING_GET0_DATA 1 + + /* Define to 1 if you have the `BIO_get_data' function. */ + /* #undef HAVE_BIO_GET_DATA */ ++#define HAVE_BIO_GET_DATA 1 + + /* Define to 1 if you have the `BIO_meth_new' function. */ + /* #undef HAVE_BIO_METH_NEW */ ++#define HAVE_BIO_METH_NEW 1 + + /* Define to 1 if you have the `cbrt' function. */ + //#define HAVE_CBRT 1 diff --git a/setup.py b/setup.py index 660d0c9a3..d5eac11d5 100644 --- a/setup.py +++ b/setup.py @@ -366,8 +366,8 @@ def finalize_win32(self): self.library_dirs.append(os.path.join(path, "ms")) break if self.have_ssl: - self.libraries.append("libeay32") - self.libraries.append("ssleay32") + self.libraries.append("libcrypto") + self.libraries.append("libssl") self.libraries.append("crypt32") self.libraries.append("user32") self.libraries.append("gdi32")