Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib)

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Darek Ślusarczyk <dslusarczyk(at)splunk(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib)
Date: 2024-12-30 12:39:18
Message-ID: CAN55FZ1Nk8wqY=mTrN78H026TuGV50h2H6uq1PwxhTauPYi3ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thank you for working on this!

On Tue, 10 Dec 2024 at 00:15, Darek Ślusarczyk <dslusarczyk(at)splunk(dot)com> wrote:
>
> 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'

I think this should be host_system instead of build_system.

> +
> + 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'

It would be nice to explain why we are trying another library for Windows.

> + 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'

Same above.

> + 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)

Other than these LGTM.

--
Regards,
Nazir Bilal Yavuz
Microsoft

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-12-30 13:37:18 Re: Row pattern recognition
Previous Message Peter Eisentraut 2024-12-30 12:29:36 Re: Support regular expressions with nondeterministic collations