Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib) - Mailing list pgsql-hackers

From Nazir Bilal Yavuz
Subject Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib)
Date
Msg-id CAN55FZ1Nk8wqY=mTrN78H026TuGV50h2H6uq1PwxhTauPYi3ug@mail.gmail.com
Whole thread Raw
In response to Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib)  (Darek Ślusarczyk <dslusarczyk@splunk.com>)
List pgsql-hackers
Hi,

Thank you for working on this!

On Tue, 10 Dec 2024 at 00:15, Darek Ślusarczyk <dslusarczyk@splunk.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



pgsql-hackers by date:

Previous
From: "Jelte Fennema-Nio"
Date:
Subject: Re: IANA timezone abbreviations versus timezone_abbreviations
Next
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition