From: | Darek Ślusarczyk <dslusarczyk(at)splunk(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib) |
Date: | 2024-12-09 06:25:51 |
Message-ID: | CAHrt667hXhHkkUr0smnhvBFhoB0h-AWSjua2hotqtTqiz6TwVw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 4, 2024 at 3:48 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> > On 2 Dec 2024, at 22:12, Darek Ślusarczyk <dslusarczyk(at)splunk(dot)com>
> wrote:
> [...]
> > - ssl_lib = cc.find_library('ssl',
> > + ssl_lib = cc.find_library(['ssl', 'ssleay32'],
>
> I'm not a meson expert by any means but I was suprised to see this,
> libname is
> defined as str and not list[str] in the meson documentaion so I didn't
> expect
> that to work. Is the list prioritized in order in case both libs exist on
> the
> system? On a non-Windows system I wouldn't want libssleay32 to be picked
> up
> over libssl if it happened to exist etc.
>
Good catch - indeed, you are right. Due to some other changes, the flow in
our internal builds went through
https://github.com/postgres/postgres/blob/master/meson.build#L1358
instead of
https://github.com/postgres/postgres/blob/master/meson.build#L1346
and I thought I fixed the issue by making the build green. But it wasn't
the case :-P
I've prepared another patch:
- it prioritizes libssl and libcrypto over ssleay32 and libeay32
- it checks ssleay32 and libeay32 on windows only
- I tested it locally on both lnx/win enforcing various possible scenarios
diff --git a/meson.build b/meson.build
index e5ce437a5c7..70b003a5f23 100644
--- a/meson.build
+++ b/meson.build
@@ -1343,14 +1343,35 @@ if sslopt in ['auto', 'openssl']
# via library + headers
if not ssl.found()
+ is_windows = build_system == 'windows'
+
+ ssl_lib_common_params = {
+ 'dirs': test_lib_d,
+ 'header_include_directories': postgres_inc,
+ 'has_headers': ['openssl/ssl.h', 'openssl/err.h'],
+ }
ssl_lib = cc.find_library('ssl',
- dirs: test_lib_d,
- header_include_directories: postgres_inc,
- has_headers: ['openssl/ssl.h', 'openssl/err.h'],
- required: openssl_required)
+ kwargs: ssl_lib_common_params,
+ required: openssl_required and not is_windows
+ )
+ # if 'ssl' is not found and it's windows, try 'ssleay32'
+ if not ssl_lib.found() and is_windows
+ ssl_lib = cc.find_library('ssleay32',
+ kwargs: ssl_lib_common_params,
+ required: openssl_required
+ )
+ endif
+
crypto_lib = cc.find_library('crypto',
dirs: test_lib_d,
- required: openssl_required)
+ required: openssl_required and not is_windows)
+ # if 'crypto' is not found and it's windows, try 'libeay32'
+ if not crypto_lib.found() and is_windows
+ crypto_lib = cc.find_library('libeay32',
+ dirs: test_lib_d,
+ required: openssl_required)
+ endif
+
if ssl_lib.found() and crypto_lib.found()
ssl_int = [ssl_lib, crypto_lib]
ssl = declare_dependency(dependencies: ssl_int, include_directories:
postgres_inc)
for easier reading, it is also available as a pull-request (closed
automatically as expected)
https://github.com/postgres/postgres/pull/191
--
marines() {
return Darek_Slusarczyk;
}
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2024-12-09 06:36:25 | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Previous Message | Dilip Kumar | 2024-12-09 06:22:30 | Re: BitmapHeapScan streaming read user and prelim refactoring |