public inbox for [email protected]
help / color / mirror / Atom feedRe: meson: Non-feature feature options
22+ messages / 6 participants
[nested] [flat]
* Re: meson: Non-feature feature options
@ 2023-02-24 13:01 Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-02-24 13:01 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
Hi,
On Wed, 22 Feb 2023 at 12:14, Peter Eisentraut
<[email protected]> wrote:
>
> On 21.02.23 17:32, Nazir Bilal Yavuz wrote:
> >>> I like the second approach, with a 'uuid' feature option. As you wrote
> >>> earlier, adding an 'auto' choice to a combo option doesn't work fully like a
> >>> real feature option.
> >> But we can make it behave exactly like one, by checking the auto_features
> >> option.
> > Yes, we can set it like `uuidopt = get_option('auto_features')`.
> > However, if someone wants to set 'auto_features' to 'disabled' but
> > 'uuid' to 'enabled'(to find at least one working uuid library); this
> > won't be possible. We can add 'enabled', 'disabled and 'auto' choices
> > to 'uuid' combo option to make all behaviours possible but adding
> > 'uuid' feature option and 'uuid_library' combo option seems better to
> > me.
>
> I think the uuid side of this is making this way too complicated. I'm
> content leaving this as a manual option for now.
>
> There is much more value in making the ssl option work automatically.
> So I would welcome a patch that just makes -Dssl=auto work smoothly,
> perhaps using the "trick" that Andres described.
>
Thanks for the feedback. I updated the ssl patch and if you like
changes, I can apply the same logic to uuid.
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
[application/octet-stream] v2-0001-meson-Refactor-SSL-option.patch (10.5K, ../../CAN55FZ3JkWJRgBOvaB0VDYg1F+v3QMg4vwVae1gpQ+mnsYc-3g@mail.gmail.com/2-v2-0001-meson-Refactor-SSL-option.patch)
download | inline diff:
From 09e4c80b3d325e739bdbe6ac02b46df24c9d0c29 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <[email protected]>
Date: Fri, 24 Feb 2023 15:35:32 +0300
Subject: [PATCH v2] meson: Refactor SSL option
---
.cirrus.yml | 7 +-
meson.build | 153 ++++++++++++++++++-------------
meson_options.txt | 4 +-
src/interfaces/libpq/meson.build | 2 +-
src/makefiles/meson.build | 2 +-
src/test/ssl/meson.build | 2 +-
6 files changed, 97 insertions(+), 73 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index f212978752..aaf4066366 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -181,7 +181,7 @@ task:
su postgres <<-EOF
meson setup \
--buildtype=debug \
- -Dcassert=true -Dssl=openssl -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
+ -Dcassert=true -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
-DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
-Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
build
@@ -243,7 +243,6 @@ LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
-Dllvm=enabled
- -Dssl=openssl
-Duuid=e2fs
@@ -497,7 +496,7 @@ task:
-Dextra_include_dirs=${brewpath}/include \
-Dextra_lib_dirs=${brewpath}/lib \
-Dcassert=true \
- -Dssl=openssl -Duuid=e2fs -Ddtrace=auto \
+ -Duuid=e2fs -Ddtrace=auto \
-Dsegsize_blocks=6 \
-DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
build
@@ -568,7 +567,7 @@ task:
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
- meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
diff --git a/meson.build b/meson.build
index 656777820c..7fae0e1c49 100644
--- a/meson.build
+++ b/meson.build
@@ -43,6 +43,7 @@ cc = meson.get_compiler('c')
not_found_dep = dependency('', required: false)
thread_dep = dependency('threads')
+auto_features = get_option('auto_features')
@@ -1171,80 +1172,104 @@ cdata.set('USE_SYSTEMD', systemd.found() ? 1 : false)
# Library: SSL
###############################################################
-if get_option('ssl') == 'openssl'
+ssl = not_found_dep
+ssl_library = 'none'
+sslopt = get_option('ssl')
- # Try to find openssl via pkg-config et al, if that doesn't work
- # (e.g. because it's provided as part of the OS, like on FreeBSD), look for
- # the library names that we know about.
+if (sslopt == 'auto' and auto_features.disabled())
+ sslopt = 'none'
+endif
- # via pkg-config et al
- ssl = dependency('openssl', required: false)
+if sslopt != 'none'
- # via library + headers
- if not ssl.found()
- ssl_lib = cc.find_library('ssl',
- dirs: test_lib_d,
- header_include_directories: postgres_inc,
- has_headers: ['openssl/ssl.h', 'openssl/err.h'])
- crypto_lib = cc.find_library('crypto',
- dirs: test_lib_d,
- header_include_directories: postgres_inc)
- ssl_int = [ssl_lib, crypto_lib]
+ if not ssl.found() and sslopt in ['auto', 'openssl']
+ openssl_required = sslopt == 'openssl'
- ssl = declare_dependency(dependencies: ssl_int,
- include_directories: postgres_inc)
- else
- cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: true)
- cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: true)
+ # Try to find openssl via pkg-config et al, if that doesn't work
+ # (e.g. because it's provided as part of the OS, like on FreeBSD), look for
+ # the library names that we know about.
+
+ # via pkg-config et al
+ ssl = dependency('openssl', required: false)
+ # via library + headers
+ if not ssl.found()
+ ssl_lib = cc.find_library('ssl',
+ dirs: test_lib_d,
+ header_include_directories: postgres_inc,
+ has_headers: ['openssl/ssl.h', 'openssl/err.h'])
+ crypto_lib = cc.find_library('crypto',
+ dirs: test_lib_d,
+ header_include_directories: postgres_inc)
+ ssl_int = [ssl_lib, crypto_lib]
+
+ ssl = declare_dependency(dependencies: ssl_int,
+ include_directories: postgres_inc)
+ elif cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: openssl_required) and \
+ cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: openssl_required)
ssl_int = [ssl]
- endif
+ endif
- check_funcs = [
- ['CRYPTO_new_ex_data', {'required': true}],
- ['SSL_new', {'required': true}],
-
- # Function introduced in OpenSSL 1.0.2.
- ['X509_get_signature_nid'],
-
- # Functions introduced in OpenSSL 1.1.0. We used to check for
- # OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
- # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it
- # doesn't have these OpenSSL 1.1.0 functions. So check for individual
- # functions.
- ['OPENSSL_init_ssl'],
- ['BIO_get_data'],
- ['BIO_meth_new'],
- ['ASN1_STRING_get0_data'],
- ['HMAC_CTX_new'],
- ['HMAC_CTX_free'],
-
- # OpenSSL versions before 1.1.0 required setting callback functions, for
- # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
- # function was removed.
- ['CRYPTO_lock'],
-
- # Function introduced in OpenSSL 1.1.1
- ['X509_get_signature_info'],
- ]
+ if ssl.found()
+ check_funcs = [
+ ['CRYPTO_new_ex_data', {'required': true}],
+ ['SSL_new', {'required': true}],
+
+ # Function introduced in OpenSSL 1.0.2.
+ ['X509_get_signature_nid'],
+
+ # Functions introduced in OpenSSL 1.1.0. We used to check for
+ # OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
+ # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it
+ # doesn't have these OpenSSL 1.1.0 functions. So check for individual
+ # functions.
+ ['OPENSSL_init_ssl'],
+ ['BIO_get_data'],
+ ['BIO_meth_new'],
+ ['ASN1_STRING_get0_data'],
+ ['HMAC_CTX_new'],
+ ['HMAC_CTX_free'],
+
+ # OpenSSL versions before 1.1.0 required setting callback functions, for
+ # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
+ # function was removed.
+ ['CRYPTO_lock'],
+
+ # Function introduced in OpenSSL 1.1.1
+ ['X509_get_signature_info'],
+ ]
- foreach c : check_funcs
- func = c.get(0)
- val = cc.has_function(func, args: test_c_args, dependencies: ssl_int)
- required = c.get(1, {}).get('required', false)
- if required and not val
- error('openssl function @0@ is required'.format(func))
- elif not required
- cdata.set('HAVE_' + func.to_upper(), val ? 1 : false)
+ are_openssl_funcs_complete = true
+ foreach c : check_funcs
+ func = c.get(0)
+ val = cc.has_function(func, args: test_c_args, dependencies: ssl_int)
+ required = c.get(1, {}).get('required', false)
+ if required and not val
+ are_openssl_funcs_complete = false
+ openssl_required ? error('openssl function @0@ is required'.format(func)) : \
+ message('openssl function @0@ is required'.format(func))
+ break
+ elif not required
+ cdata.set('HAVE_' + func.to_upper(), val ? 1 : false)
+ endif
+ endforeach
+
+ if are_openssl_funcs_complete
+ cdata.set('USE_OPENSSL', 1,
+ description: 'Define to 1 to build with OpenSSL support. (-Dssl=openssl)')
+ cdata.set('OPENSSL_API_COMPAT', '0x10001000L',
+ description: '''Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.''')
+ ssl_library = 'openssl'
+ else
+ ssl = not_found_dep
+ endif
endif
- endforeach
+ endif
- cdata.set('USE_OPENSSL', 1,
- description: 'Define to 1 to build with OpenSSL support. (-Dssl=openssl)')
- cdata.set('OPENSSL_API_COMPAT', '0x10001000L',
- description: '''Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.''')
-else
- ssl = not_found_dep
+ # At least one SSL library must be found, otherwise throw an error
+ if sslopt == 'auto' and auto_features.enabled()
+ error('SSL Library could not be found')
+ endif
endif
diff --git a/meson_options.txt b/meson_options.txt
index 9d3ef4aa20..3edd3e25df 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -127,8 +127,8 @@ option('readline', type : 'feature', value : 'auto',
option('selinux', type : 'feature', value : 'disabled',
description: 'build with SELinux support')
-option('ssl', type : 'combo', choices : ['none', 'openssl'],
- value : 'none',
+option('ssl', type : 'combo', choices : ['auto', 'none', 'openssl'],
+ value : 'auto',
description: 'use LIB for SSL/TLS support (openssl)')
option('systemd', type : 'feature', value: 'auto',
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 573fd9b6ea..3cd0ddb494 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -117,7 +117,7 @@ tests += {
't/001_uri.pl',
't/002_api.pl',
],
- 'env': {'with_ssl': get_option('ssl')},
+ 'env': {'with_ssl': ssl_library},
},
}
diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build
index bf7303dc99..98c2bf9ed1 100644
--- a/src/makefiles/meson.build
+++ b/src/makefiles/meson.build
@@ -66,7 +66,7 @@ pgxs_kv = {
'SUN_STUDIO_CC': 'no', # not supported so far
# want the chosen option, rather than the library
- 'with_ssl' : get_option('ssl'),
+ 'with_ssl' : ssl_library,
'with_uuid': uuidopt,
'default_port': get_option('pgport'),
diff --git a/src/test/ssl/meson.build b/src/test/ssl/meson.build
index a8d9a5424d..4cda81f3bc 100644
--- a/src/test/ssl/meson.build
+++ b/src/test/ssl/meson.build
@@ -6,7 +6,7 @@ tests += {
'bd': meson.current_build_dir(),
'tap': {
'env': {
- 'with_ssl': get_option('ssl'),
+ 'with_ssl': ssl_library,
'OPENSSL': openssl.path(),
},
'tests': [
--
2.25.1
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-01 15:52 ` Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Peter Eisentraut @ 2023-03-01 15:52 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
On 24.02.23 14:01, Nazir Bilal Yavuz wrote:
> Thanks for the feedback. I updated the ssl patch and if you like
> changes, I can apply the same logic to uuid.
Maybe we can make some of the logic less nested. Right now there is
if sslopt != 'none'
if not ssl.found() and sslopt in ['auto', 'openssl']
I think at that point, ssl.found() is never true, so it can be removed.
And the two checks for sslopt are nearly redundant.
At the end of the block, there is
# At least one SSL library must be found, otherwise throw an error
if sslopt == 'auto' and auto_features.enabled()
error('SSL Library could not be found')
endif
endif
which also implies sslopt != 'none'. So I think the whole thing could be
if sslopt in ['auto', 'openssl']
...
endif
if sslopt == 'auto' and auto_features.enabled()
error('SSL Library could not be found')
endif
both at the top level.
Another issue, I think this is incorrect:
+ openssl_required ? error('openssl function @0@ is
required'.format(func)) : \
+ message('openssl function @0@ is
required'.format(func))
We don't want to issue a message like this when a non-required function
is missing.
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
@ 2023-03-02 10:41 ` Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-03-02 10:41 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
Hi,
Thanks for the review.
On Wed, 1 Mar 2023 at 18:52, Peter Eisentraut
<[email protected]> wrote:
>
> Maybe we can make some of the logic less nested. Right now there is
>
> if sslopt != 'none'
>
> if not ssl.found() and sslopt in ['auto', 'openssl']
>
> I think at that point, ssl.found() is never true, so it can be removed.
I agree, ssl.found() can be removed.
> And the two checks for sslopt are nearly redundant.
>
> At the end of the block, there is
>
> # At least one SSL library must be found, otherwise throw an error
> if sslopt == 'auto' and auto_features.enabled()
> error('SSL Library could not be found')
> endif
> endif
>
> which also implies sslopt != 'none'. So I think the whole thing could be
>
> if sslopt in ['auto', 'openssl']
>
> ...
>
> endif
>
> if sslopt == 'auto' and auto_features.enabled()
> error('SSL Library could not be found')
> endif
>
> both at the top level.
>
I am kind of confused. I added these checks for considering other SSL
implementations in the future, for this reason I have two nested if
checks. The top one is for checking if we need to search an SSL
library and the nested one is for checking if we need to search this
specific SSL library. What do you think?
The other thing is(which I forgot before) I need to add "and not
ssl.found()" condition to the "if sslopt == 'auto' and
auto_features.enabled()" check.
> Another issue, I think this is incorrect:
>
> + openssl_required ? error('openssl function @0@ is
> required'.format(func)) : \
> + message('openssl function @0@ is
> required'.format(func))
>
> We don't want to issue a message like this when a non-required function
> is missing.
I agree, the message part can be removed.
Regards,
Nazir Bilal Yavuz
Microsoft
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-03 09:16 ` Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Peter Eisentraut @ 2023-03-03 09:16 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
On 02.03.23 11:41, Nazir Bilal Yavuz wrote:
> I am kind of confused. I added these checks for considering other SSL
> implementations in the future, for this reason I have two nested if
> checks. The top one is for checking if we need to search an SSL
> library and the nested one is for checking if we need to search this
> specific SSL library. What do you think?
I suppose that depends on how you envision integrating other SSL
libraries into this logic. It's not that important right now; if the
structure makes sense to you, that's fine.
Please send an updated patch with the small changes that have been
mentioned.
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
@ 2023-03-03 10:01 ` Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-03-03 10:01 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
Hi,
On Fri, 3 Mar 2023 at 12:16, Peter Eisentraut
<[email protected]> wrote:
>
> On 02.03.23 11:41, Nazir Bilal Yavuz wrote:
> > I am kind of confused. I added these checks for considering other SSL
> > implementations in the future, for this reason I have two nested if
> > checks. The top one is for checking if we need to search an SSL
> > library and the nested one is for checking if we need to search this
> > specific SSL library. What do you think?
>
> I suppose that depends on how you envision integrating other SSL
> libraries into this logic. It's not that important right now; if the
> structure makes sense to you, that's fine.
>
> Please send an updated patch with the small changes that have been
> mentioned.
>
The updated patch is attached.
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
[text/x-diff] v3-0001-meson-Refactor-SSL-option.patch (9.3K, ../../CAN55FZ1=-jb38PujfcMWjAH8vDTYoxrgvz_oha_p+q0quMtzCw@mail.gmail.com/2-v3-0001-meson-Refactor-SSL-option.patch)
download | inline diff:
From 9cb9d50ba008e2a385a7b72219a759490a3de00e Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <[email protected]>
Date: Fri, 3 Mar 2023 12:24:46 +0300
Subject: [PATCH v3] meson: Refactor SSL option
---
.cirrus.yml | 7 +-
meson.build | 121 ++++++++++++++++++-------------
meson_options.txt | 4 +-
src/interfaces/libpq/meson.build | 2 +-
src/makefiles/meson.build | 2 +-
src/test/ssl/meson.build | 2 +-
6 files changed, 80 insertions(+), 58 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index f2129787529..aaf4066366c 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -181,7 +181,7 @@ task:
su postgres <<-EOF
meson setup \
--buildtype=debug \
- -Dcassert=true -Dssl=openssl -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
+ -Dcassert=true -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
-DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
-Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
build
@@ -243,7 +243,6 @@ LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
-Dllvm=enabled
- -Dssl=openssl
-Duuid=e2fs
@@ -497,7 +496,7 @@ task:
-Dextra_include_dirs=${brewpath}/include \
-Dextra_lib_dirs=${brewpath}/lib \
-Dcassert=true \
- -Dssl=openssl -Duuid=e2fs -Ddtrace=auto \
+ -Duuid=e2fs -Ddtrace=auto \
-Dsegsize_blocks=6 \
-DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
build
@@ -568,7 +567,7 @@ task:
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
- meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
diff --git a/meson.build b/meson.build
index 26be83afb61..1e9411eb247 100644
--- a/meson.build
+++ b/meson.build
@@ -43,6 +43,7 @@ cc = meson.get_compiler('c')
not_found_dep = dependency('', required: false)
thread_dep = dependency('threads')
+auto_features = get_option('auto_features')
@@ -1171,7 +1172,16 @@ cdata.set('USE_SYSTEMD', systemd.found() ? 1 : false)
# Library: SSL
###############################################################
-if get_option('ssl') == 'openssl'
+ssl = not_found_dep
+ssl_library = 'none'
+sslopt = get_option('ssl')
+
+if (sslopt == 'auto' and auto_features.disabled())
+ sslopt = 'none'
+endif
+
+if sslopt in ['auto', 'openssl']
+ openssl_required = sslopt == 'openssl'
# Try to find openssl via pkg-config et al, if that doesn't work
# (e.g. because it's provided as part of the OS, like on FreeBSD), look for
@@ -1192,59 +1202,72 @@ if get_option('ssl') == 'openssl'
ssl_int = [ssl_lib, crypto_lib]
ssl = declare_dependency(dependencies: ssl_int,
- include_directories: postgres_inc)
- else
- cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: true)
- cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: true)
-
- ssl_int = [ssl]
+ include_directories: postgres_inc)
+ elif cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: openssl_required) and \
+ cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: openssl_required)
+ ssl_int = [ssl]
endif
- check_funcs = [
- ['CRYPTO_new_ex_data', {'required': true}],
- ['SSL_new', {'required': true}],
-
- # Function introduced in OpenSSL 1.0.2.
- ['X509_get_signature_nid'],
-
- # Functions introduced in OpenSSL 1.1.0. We used to check for
- # OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
- # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it
- # doesn't have these OpenSSL 1.1.0 functions. So check for individual
- # functions.
- ['OPENSSL_init_ssl'],
- ['BIO_get_data'],
- ['BIO_meth_new'],
- ['ASN1_STRING_get0_data'],
- ['HMAC_CTX_new'],
- ['HMAC_CTX_free'],
-
- # OpenSSL versions before 1.1.0 required setting callback functions, for
- # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
- # function was removed.
- ['CRYPTO_lock'],
-
- # Function introduced in OpenSSL 1.1.1
- ['X509_get_signature_info'],
- ]
+ if ssl.found()
+ check_funcs = [
+ ['CRYPTO_new_ex_data', {'required': true}],
+ ['SSL_new', {'required': true}],
+
+ # Function introduced in OpenSSL 1.0.2.
+ ['X509_get_signature_nid'],
+
+ # Functions introduced in OpenSSL 1.1.0. We used to check for
+ # OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
+ # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it
+ # doesn't have these OpenSSL 1.1.0 functions. So check for individual
+ # functions.
+ ['OPENSSL_init_ssl'],
+ ['BIO_get_data'],
+ ['BIO_meth_new'],
+ ['ASN1_STRING_get0_data'],
+ ['HMAC_CTX_new'],
+ ['HMAC_CTX_free'],
+
+ # OpenSSL versions before 1.1.0 required setting callback functions, for
+ # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
+ # function was removed.
+ ['CRYPTO_lock'],
+
+ # Function introduced in OpenSSL 1.1.1
+ ['X509_get_signature_info'],
+ ]
+
+ are_openssl_funcs_complete = true
+ foreach c : check_funcs
+ func = c.get(0)
+ val = cc.has_function(func, args: test_c_args, dependencies: ssl_int)
+ required = c.get(1, {}).get('required', false)
+ if required and not val
+ are_openssl_funcs_complete = false
+ if openssl_required
+ error('openssl function @0@ is required'.format(func))
+ endif
+ break
+ elif not required
+ cdata.set('HAVE_' + func.to_upper(), val ? 1 : false)
+ endif
+ endforeach
- foreach c : check_funcs
- func = c.get(0)
- val = cc.has_function(func, args: test_c_args, dependencies: ssl_int)
- required = c.get(1, {}).get('required', false)
- if required and not val
- error('openssl function @0@ is required'.format(func))
- elif not required
- cdata.set('HAVE_' + func.to_upper(), val ? 1 : false)
+ if are_openssl_funcs_complete
+ cdata.set('USE_OPENSSL', 1,
+ description: 'Define to 1 to build with OpenSSL support. (-Dssl=openssl)')
+ cdata.set('OPENSSL_API_COMPAT', '0x10001000L',
+ description: '''Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.''')
+ ssl_library = 'openssl'
+ else
+ ssl = not_found_dep
endif
- endforeach
+ endif
+endif
- cdata.set('USE_OPENSSL', 1,
- description: 'Define to 1 to build with OpenSSL support. (-Dssl=openssl)')
- cdata.set('OPENSSL_API_COMPAT', '0x10001000L',
- description: '''Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.''')
-else
- ssl = not_found_dep
+# At least one SSL library must be found, otherwise throw an error
+if sslopt == 'auto' and auto_features.enabled() and not ssl.found()
+ error('SSL Library could not be found')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 7d33c9f1d4b..4402dd4299d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -130,8 +130,8 @@ option('readline', type : 'feature', value : 'auto',
option('selinux', type : 'feature', value : 'disabled',
description: 'build with SELinux support')
-option('ssl', type : 'combo', choices : ['none', 'openssl'],
- value : 'none',
+option('ssl', type : 'combo', choices : ['auto', 'none', 'openssl'],
+ value : 'auto',
description: 'use LIB for SSL/TLS support (openssl)')
option('systemd', type : 'feature', value: 'auto',
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 573fd9b6ea4..3cd0ddb4945 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -117,7 +117,7 @@ tests += {
't/001_uri.pl',
't/002_api.pl',
],
- 'env': {'with_ssl': get_option('ssl')},
+ 'env': {'with_ssl': ssl_library},
},
}
diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build
index 5a0032ab0d2..7635771c5ae 100644
--- a/src/makefiles/meson.build
+++ b/src/makefiles/meson.build
@@ -66,7 +66,7 @@ pgxs_kv = {
'SUN_STUDIO_CC': 'no', # not supported so far
# want the chosen option, rather than the library
- 'with_ssl' : get_option('ssl'),
+ 'with_ssl' : ssl_library,
'with_uuid': uuidopt,
'default_port': get_option('pgport'),
diff --git a/src/test/ssl/meson.build b/src/test/ssl/meson.build
index a8d9a5424d4..4cda81f3bc2 100644
--- a/src/test/ssl/meson.build
+++ b/src/test/ssl/meson.build
@@ -6,7 +6,7 @@ tests += {
'bd': meson.current_build_dir(),
'tap': {
'env': {
- 'with_ssl': get_option('ssl'),
+ 'with_ssl': ssl_library,
'OPENSSL': openssl.path(),
},
'tests': [
--
2.39.2
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-09 13:45 ` Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Peter Eisentraut @ 2023-03-09 13:45 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
On 03.03.23 11:01, Nazir Bilal Yavuz wrote:
> On Fri, 3 Mar 2023 at 12:16, Peter Eisentraut
> <[email protected]> wrote:
>>
>> On 02.03.23 11:41, Nazir Bilal Yavuz wrote:
>>> I am kind of confused. I added these checks for considering other SSL
>>> implementations in the future, for this reason I have two nested if
>>> checks. The top one is for checking if we need to search an SSL
>>> library and the nested one is for checking if we need to search this
>>> specific SSL library. What do you think?
>>
>> I suppose that depends on how you envision integrating other SSL
>> libraries into this logic. It's not that important right now; if the
>> structure makes sense to you, that's fine.
>>
>> Please send an updated patch with the small changes that have been
>> mentioned.
>>
>
> The updated patch is attached.
This seems to work well.
One flaw, the "External libraries" summary shows something like
ssl : YES 3.0.7
It would be nice if it showed "openssl".
How about we just hardcode "openssl" here instead? We could build that
array dynamically, of course, but maybe we leave that until we actually
have a need?
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
@ 2023-03-09 13:54 ` Daniel Gustafsson <[email protected]>
2023-03-09 14:12 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
0 siblings, 2 replies; 22+ messages in thread
From: Daniel Gustafsson @ 2023-03-09 13:54 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Nazir Bilal Yavuz <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
> On 9 Mar 2023, at 14:45, Peter Eisentraut <[email protected]> wrote:
> How about we just hardcode "openssl" here instead? We could build that array dynamically, of course, but maybe we leave that until we actually have a need?
At least for 16 keeping it hardcoded is an entirely safe bet so +1 for leaving
additional complexity for when needed.
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
@ 2023-03-09 14:12 ` Nazir Bilal Yavuz <[email protected]>
2023-03-09 14:15 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-09 14:18 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
1 sibling, 2 replies; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-03-09 14:12 UTC (permalink / raw)
To: Daniel Gustafsson <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
Hi,
On Thu, 9 Mar 2023 at 16:54, Daniel Gustafsson <[email protected]> wrote:
>
> > On 9 Mar 2023, at 14:45, Peter Eisentraut <[email protected]> wrote:
>
> > How about we just hardcode "openssl" here instead? We could build that array dynamically, of course, but maybe we leave that until we actually have a need?
>
> At least for 16 keeping it hardcoded is an entirely safe bet so +1 for leaving
> additional complexity for when needed.
We already have the 'ssl_library' variable. Can't we use that instead
of hardcoding 'openssl'? e.g:
summary(
{
'ssl': ssl.found() ? [ssl, '(@0@)'.format(ssl_library)] : ssl,
},
section: 'External libraries',
list_sep: ', ',
)
And it will output:
ssl : YES 3.0.8, (openssl)
I don't think that using 'ssl_library' will increase the complexity.
Regards,
Nazir Bilal Yavuz
Microsoft
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-09 14:12 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-09 14:15 ` Daniel Gustafsson <[email protected]>
1 sibling, 0 replies; 22+ messages in thread
From: Daniel Gustafsson @ 2023-03-09 14:15 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
> On 9 Mar 2023, at 15:12, Nazir Bilal Yavuz <[email protected]> wrote:
>
> Hi,
>
> On Thu, 9 Mar 2023 at 16:54, Daniel Gustafsson <[email protected]> wrote:
>>
>>> On 9 Mar 2023, at 14:45, Peter Eisentraut <[email protected]> wrote:
>>
>>> How about we just hardcode "openssl" here instead? We could build that array dynamically, of course, but maybe we leave that until we actually have a need?
>>
>> At least for 16 keeping it hardcoded is an entirely safe bet so +1 for leaving
>> additional complexity for when needed.
>
> We already have the 'ssl_library' variable. Can't we use that instead
> of hardcoding 'openssl'? e.g:
>
> summary(
> {
> 'ssl': ssl.found() ? [ssl, '(@0@)'.format(ssl_library)] : ssl,
> },
> section: 'External libraries',
> list_sep: ', ',
> )
>
> And it will output:
> ssl : YES 3.0.8, (openssl)
>
> I don't think that using 'ssl_library' will increase the complexity.
That seems like a good idea.
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-09 14:12 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-09 14:18 ` Peter Eisentraut <[email protected]>
2023-03-09 14:40 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
1 sibling, 1 reply; 22+ messages in thread
From: Peter Eisentraut @ 2023-03-09 14:18 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; Daniel Gustafsson <[email protected]>; +Cc: Andres Freund <[email protected]>; pgsql-hackers
On 09.03.23 15:12, Nazir Bilal Yavuz wrote:
> Hi,
>
> On Thu, 9 Mar 2023 at 16:54, Daniel Gustafsson <[email protected]> wrote:
>>
>>> On 9 Mar 2023, at 14:45, Peter Eisentraut <[email protected]> wrote:
>>
>>> How about we just hardcode "openssl" here instead? We could build that array dynamically, of course, but maybe we leave that until we actually have a need?
>>
>> At least for 16 keeping it hardcoded is an entirely safe bet so +1 for leaving
>> additional complexity for when needed.
>
> We already have the 'ssl_library' variable. Can't we use that instead
> of hardcoding 'openssl'? e.g:
>
> summary(
> {
> 'ssl': ssl.found() ? [ssl, '(@0@)'.format(ssl_library)] : ssl,
> },
> section: 'External libraries',
> list_sep: ', ',
> )
>
> And it will output:
> ssl : YES 3.0.8, (openssl)
>
> I don't think that using 'ssl_library' will increase the complexity.
Then we might as well use ssl_library as the key, like:
{
...
'selinux': selinux,
ssl_library: ssl,
'systemd': systemd,
...
}
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-09 14:12 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 14:18 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
@ 2023-03-09 14:40 ` Nazir Bilal Yavuz <[email protected]>
0 siblings, 0 replies; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-03-09 14:40 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Daniel Gustafsson <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
Hi,
On Thu, 9 Mar 2023 at 17:18, Peter Eisentraut
<[email protected]> wrote:
>
> On 09.03.23 15:12, Nazir Bilal Yavuz wrote:
> > Hi,
> >
> > On Thu, 9 Mar 2023 at 16:54, Daniel Gustafsson <[email protected]> wrote:
> >>
> >>> On 9 Mar 2023, at 14:45, Peter Eisentraut <[email protected]> wrote:
> >>
> >>> How about we just hardcode "openssl" here instead? We could build that array dynamically, of course, but maybe we leave that until we actually have a need?
> >>
> >> At least for 16 keeping it hardcoded is an entirely safe bet so +1 for leaving
> >> additional complexity for when needed.
> >
> > We already have the 'ssl_library' variable. Can't we use that instead
> > of hardcoding 'openssl'? e.g:
> >
> > summary(
> > {
> > 'ssl': ssl.found() ? [ssl, '(@0@)'.format(ssl_library)] : ssl,
> > },
> > section: 'External libraries',
> > list_sep: ', ',
> > )
> >
> > And it will output:
> > ssl : YES 3.0.8, (openssl)
> >
> > I don't think that using 'ssl_library' will increase the complexity.
>
> Then we might as well use ssl_library as the key, like:
>
> {
> ...
> 'selinux': selinux,
> ssl_library: ssl,
> 'systemd': systemd,
> ...
> }
>
There will be a problem if ssl is not found. It will output 'none: NO'
because 'ssl_library' is initialized as 'none' for now. We can
initialize 'ssl_library' as 'ssl' but I am not sure that is a good
idea.
Regards,
Nazir Bilal Yavuz
Microsoft
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
@ 2023-03-13 06:27 ` Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
1 sibling, 1 reply; 22+ messages in thread
From: Peter Eisentraut @ 2023-03-13 06:27 UTC (permalink / raw)
To: Daniel Gustafsson <[email protected]>; +Cc: Nazir Bilal Yavuz <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
On 09.03.23 14:54, Daniel Gustafsson wrote:
>> On 9 Mar 2023, at 14:45, Peter Eisentraut <[email protected]> wrote:
>
>> How about we just hardcode "openssl" here instead? We could build that array dynamically, of course, but maybe we leave that until we actually have a need?
>
> At least for 16 keeping it hardcoded is an entirely safe bet so +1 for leaving
> additional complexity for when needed.
I have committed it like this.
I didn't like the other variants, because they would cause the openssl
line to stick out for purely implementation reasons (e.g., we don't have
a line "compression: YES (lz4)". If we get support for another ssl
library, we can easily reconsider this.
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
@ 2023-03-13 18:04 ` Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-13 20:13 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
0 siblings, 2 replies; 22+ messages in thread
From: Nathan Bossart @ 2023-03-13 18:04 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Daniel Gustafsson <[email protected]>; Nazir Bilal Yavuz <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
On Mon, Mar 13, 2023 at 07:27:18AM +0100, Peter Eisentraut wrote:
> I have committed it like this.
I noticed that after 6a30027, if you don't have the OpenSSL headers
installed, 'meson setup' will fail:
meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
headers are not present?
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
@ 2023-03-13 18:57 ` Nazir Bilal Yavuz <[email protected]>
2023-03-13 19:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 20:14 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
1 sibling, 2 replies; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-03-13 18:57 UTC (permalink / raw)
To: Nathan Bossart <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
Hi,
On Mon, 13 Mar 2023 at 21:04, Nathan Bossart <[email protected]> wrote:
>
> On Mon, Mar 13, 2023 at 07:27:18AM +0100, Peter Eisentraut wrote:
> > I have committed it like this.
>
> I noticed that after 6a30027, if you don't have the OpenSSL headers
> installed, 'meson setup' will fail:
>
> meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
>
> Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
> headers are not present?
Yes, I tested again and it is working as expected on my end. It
shouldn't fail like that unless the 'ssl' option is set to 'openssl'.
Is it possible that it has been set to 'openssl' without you noticing?
Regards,
Nazir Bilal Yavuz
Microsoft
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-13 19:04 ` Nathan Bossart <[email protected]>
1 sibling, 0 replies; 22+ messages in thread
From: Nathan Bossart @ 2023-03-13 19:04 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Andres Freund <[email protected]>; pgsql-hackers
On Mon, Mar 13, 2023 at 09:57:22PM +0300, Nazir Bilal Yavuz wrote:
> On Mon, 13 Mar 2023 at 21:04, Nathan Bossart <[email protected]> wrote:
>> Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
>> headers are not present?
>
> Yes, I tested again and it is working as expected on my end. It
> shouldn't fail like that unless the 'ssl' option is set to 'openssl'.
> Is it possible that it has been set to 'openssl' without you noticing?
I do not believe so. For the test in question, here are the build options
reported in meson-log.txt:
Build Options: -Dlz4=enabled -Dplperl=enabled -Dplpython=enabled -Dpltcl=enabled -Dlibxml=enabled -Duuid=ossp -Dlibxslt=enabled -Ddebug=true -Dcassert=true -Dtap_tests=enabled -Dwerror=True
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-13 20:14 ` Andres Freund <[email protected]>
2023-03-13 20:46 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
1 sibling, 1 reply; 22+ messages in thread
From: Andres Freund @ 2023-03-13 20:14 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Nathan Bossart <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; pgsql-hackers
Hi,
On 2023-03-13 21:57:22 +0300, Nazir Bilal Yavuz wrote:
> On Mon, 13 Mar 2023 at 21:04, Nathan Bossart <[email protected]> wrote:
> >
> > On Mon, Mar 13, 2023 at 07:27:18AM +0100, Peter Eisentraut wrote:
> > > I have committed it like this.
> >
> > I noticed that after 6a30027, if you don't have the OpenSSL headers
> > installed, 'meson setup' will fail:
> >
> > meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
> >
> > Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
> > headers are not present?
>
> Yes, I tested again and it is working as expected on my end. It
> shouldn't fail like that unless the 'ssl' option is set to 'openssl'.
> Is it possible that it has been set to 'openssl' without you noticing?
It worked for the dependency() path, but not the cc.find_library() path. See
the patch I just sent.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-13 20:14 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
@ 2023-03-13 20:46 ` Nazir Bilal Yavuz <[email protected]>
2023-03-13 21:45 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Nazir Bilal Yavuz @ 2023-03-13 20:46 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Nathan Bossart <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; pgsql-hackers
Hi,
On Mon, 13 Mar 2023 at 23:14, Andres Freund <[email protected]> wrote:
>
> Hi,
>
> On 2023-03-13 21:57:22 +0300, Nazir Bilal Yavuz wrote:
> > On Mon, 13 Mar 2023 at 21:04, Nathan Bossart <[email protected]> wrote:
> > >
> > > On Mon, Mar 13, 2023 at 07:27:18AM +0100, Peter Eisentraut wrote:
> > > > I have committed it like this.
> > >
> > > I noticed that after 6a30027, if you don't have the OpenSSL headers
> > > installed, 'meson setup' will fail:
> > >
> > > meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
> > >
> > > Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
> > > headers are not present?
> >
> > Yes, I tested again and it is working as expected on my end. It
> > shouldn't fail like that unless the 'ssl' option is set to 'openssl'.
> > Is it possible that it has been set to 'openssl' without you noticing?
>
> It worked for the dependency() path, but not the cc.find_library() path. See
> the patch I just sent.
Thanks for the patch, I understand the problem now and your patch fixes this.
Regards,
Nazir Bilal Yavuz
Microsoft
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-13 20:14 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
2023-03-13 20:46 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
@ 2023-03-13 21:45 ` Andres Freund <[email protected]>
2023-03-13 22:32 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
0 siblings, 1 reply; 22+ messages in thread
From: Andres Freund @ 2023-03-13 21:45 UTC (permalink / raw)
To: Nazir Bilal Yavuz <[email protected]>; +Cc: Nathan Bossart <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; pgsql-hackers
Hi,
On 2023-03-13 23:46:41 +0300, Nazir Bilal Yavuz wrote:
> Thanks for the patch, I understand the problem now and your patch fixes this.
Pushed the patch.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-13 20:14 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
2023-03-13 20:46 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-13 21:45 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
@ 2023-03-13 22:32 ` Nathan Bossart <[email protected]>
0 siblings, 0 replies; 22+ messages in thread
From: Nathan Bossart @ 2023-03-13 22:32 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Nazir Bilal Yavuz <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; pgsql-hackers
On Mon, Mar 13, 2023 at 02:45:29PM -0700, Andres Freund wrote:
> Pushed the patch.
Thanks for the prompt fix.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
@ 2023-03-13 20:13 ` Andres Freund <[email protected]>
2023-03-13 20:25 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
1 sibling, 1 reply; 22+ messages in thread
From: Andres Freund @ 2023-03-13 20:13 UTC (permalink / raw)
To: Nathan Bossart <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Nazir Bilal Yavuz <[email protected]>; pgsql-hackers
Hi,
On 2023-03-13 11:04:32 -0700, Nathan Bossart wrote:
> On Mon, Mar 13, 2023 at 07:27:18AM +0100, Peter Eisentraut wrote:
> > I have committed it like this.
>
> I noticed that after 6a30027, if you don't have the OpenSSL headers
> installed, 'meson setup' will fail:
>
> meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
>
> Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
> headers are not present?
Yea. I found another thing: When dependency() found something, but the headers
weren't present, ssl_int wouldn't exist.
Maybe something like the attached?
Greetings,
Andres Freund
Attachments:
[text/x-diff] v1-0001-meson-fix-openssl-detection-issues-in-6a30027.patch (1.9K, ../../[email protected]/2-v1-0001-meson-fix-openssl-detection-issues-in-6a30027.patch)
download | inline diff:
From b8bd0200667bac16674e40e769a9fb4bc4f54306 Mon Sep 17 00:00:00 2001
From: Andres Freund <[email protected]>
Date: Mon, 13 Mar 2023 13:11:37 -0700
Subject: [PATCH v1] meson: fix openssl detection issues in 6a30027
Reported-by: Nathan Bossart <[email protected]>
Discussion: https://postgr.es/m/20230313180432.GA246741@nathanxps13
---
meson.build | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 8208815c96c..2ebdf914c1b 100644
--- a/meson.build
+++ b/meson.build
@@ -1189,23 +1189,29 @@ if sslopt in ['auto', 'openssl']
# via pkg-config et al
ssl = dependency('openssl', required: false)
+ # only meson >= 0.57 supports declare_dependency() in cc.has_function(), so
+ # we pass cc.find_library() results if necessary
+ ssl_int = []
# via library + headers
if not ssl.found()
ssl_lib = cc.find_library('ssl',
dirs: test_lib_d,
header_include_directories: postgres_inc,
- has_headers: ['openssl/ssl.h', 'openssl/err.h'])
+ has_headers: ['openssl/ssl.h', 'openssl/err.h'],
+ required: openssl_required)
crypto_lib = cc.find_library('crypto',
dirs: test_lib_d,
- header_include_directories: postgres_inc)
- ssl_int = [ssl_lib, crypto_lib]
-
- ssl = declare_dependency(dependencies: ssl_int,
- include_directories: postgres_inc)
+ required: openssl_required)
+ if ssl_lib.found() and crypto_lib.found()
+ ssl_int = [ssl_lib, crypto_lib]
+ ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)
+ endif
elif cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: openssl_required) and \
cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: openssl_required)
ssl_int = [ssl]
+ else
+ ssl = not_found_dep
endif
if ssl.found()
--
2.38.0
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: meson: Non-feature feature options
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Re: meson: Non-feature feature options Daniel Gustafsson <[email protected]>
2023-03-13 06:27 ` Re: meson: Non-feature feature options Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Re: meson: Non-feature feature options Nathan Bossart <[email protected]>
2023-03-13 20:13 ` Re: meson: Non-feature feature options Andres Freund <[email protected]>
@ 2023-03-13 20:25 ` Nathan Bossart <[email protected]>
0 siblings, 0 replies; 22+ messages in thread
From: Nathan Bossart @ 2023-03-13 20:25 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Nazir Bilal Yavuz <[email protected]>; pgsql-hackers
On Mon, Mar 13, 2023 at 01:13:31PM -0700, Andres Freund wrote:
> On 2023-03-13 11:04:32 -0700, Nathan Bossart wrote:
>> I noticed that after 6a30027, if you don't have the OpenSSL headers
>> installed, 'meson setup' will fail:
>>
>> meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
>>
>> Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
>> headers are not present?
>
> Yea. I found another thing: When dependency() found something, but the headers
> weren't present, ssl_int wouldn't exist.
>
> Maybe something like the attached?
> ssl_lib = cc.find_library('ssl',
> dirs: test_lib_d,
> header_include_directories: postgres_inc,
> - has_headers: ['openssl/ssl.h', 'openssl/err.h'])
> + has_headers: ['openssl/ssl.h', 'openssl/err.h'],
> + required: openssl_required)
> crypto_lib = cc.find_library('crypto',
> dirs: test_lib_d,
> - header_include_directories: postgres_inc)
> - ssl_int = [ssl_lib, crypto_lib]
> -
> - ssl = declare_dependency(dependencies: ssl_int,
> - include_directories: postgres_inc)
> + required: openssl_required)
> + if ssl_lib.found() and crypto_lib.found()
> + ssl_int = [ssl_lib, crypto_lib]
> + ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)
> + endif
I was just about to post a patch to set "required" like you have for
ssl_lib and crypto_lib. It seemed to work alright without the 'if
ssl_lib.found() and crypto_lib.found()' line, but I haven't worked with
these meson files very much, so what you have is probably better form.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* [PATCH v21 6/8] Row pattern recognition patch (docs).
@ 2024-08-26 04:32 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 22+ messages in thread
From: Tatsuo Ishii @ 2024-08-26 04:32 UTC (permalink / raw)
---
doc/src/sgml/advanced.sgml | 82 ++++++++++++++++++++++++++++++++++++
doc/src/sgml/func.sgml | 54 ++++++++++++++++++++++++
doc/src/sgml/ref/select.sgml | 38 ++++++++++++++++-
3 files changed, 172 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml
index 755c9f1485..b0b1d1c51e 100644
--- a/doc/src/sgml/advanced.sgml
+++ b/doc/src/sgml/advanced.sgml
@@ -537,6 +537,88 @@ WHERE pos < 3;
<literal>rank</literal> less than 3.
</para>
+ <para>
+ Row pattern common syntax can be used to perform row pattern recognition
+ in a query. The row pattern common syntax includes two sub
+ clauses: <literal>DEFINE</literal>
+ and <literal>PATTERN</literal>. <literal>DEFINE</literal> defines
+ definition variables along with an expression. The expression must be a
+ logical expression, which means it must
+ return <literal>TRUE</literal>, <literal>FALSE</literal>
+ or <literal>NULL</literal>. The expression may comprise column references
+ and functions. Window functions, aggregate functions and subqueries are
+ not allowed. An example of <literal>DEFINE</literal> is as follows.
+
+<programlisting>
+DEFINE
+ LOWPRICE AS price <= 100,
+ UP AS price > PREV(price),
+ DOWN AS price < PREV(price)
+</programlisting>
+
+ Note that <function>PREV</function> returns the price column in the
+ previous row if it's called in a context of row pattern recognition. Thus in
+ the second line the definition variable "UP" is <literal>TRUE</literal>
+ when the price column in the current row is greater than the price column
+ in the previous row. Likewise, "DOWN" is <literal>TRUE</literal> when when
+ the price column in the current row is lower than the price column in the
+ previous row.
+ </para>
+ <para>
+ Once <literal>DEFINE</literal> exists, <literal>PATTERN</literal> can be
+ used. <literal>PATTERN</literal> defines a sequence of rows that satisfies
+ certain conditions. For example following <literal>PATTERN</literal>
+ defines that a row starts with the condition "LOWPRICE", then one or more
+ rows satisfy "UP" and finally one or more rows satisfy "DOWN". Note that
+ "+" means one or more matches. Also you can use "*", which means zero or
+ more matches. If a sequence of rows which satisfies the PATTERN is found,
+ in the starting row of the sequence of rows all window functions and
+ aggregates are shown in the target list. Note that aggregations only look
+ into the matched rows, rather than whole frame. On the second or
+ subsequent rows all window functions are NULL. Aggregates are NULL or 0
+ (count case) depending on its aggregation definition. For rows that do not
+ match on the PATTERN, all window functions and aggregates are shown AS
+ NULL too, except count showing 0. This is because the rows do not match,
+ thus they are in an empty frame. Example of a <literal>SELECT</literal>
+ using the <literal>DEFINE</literal> and <literal>PATTERN</literal> clause
+ is as follows.
+
+<programlisting>
+SELECT company, tdate, price,
+ first_value(price) OVER w,
+ max(price) OVER w,
+ count(price) OVER w
+FROM stock
+ WINDOW w AS (
+ PARTITION BY company
+ ORDER BY tdate
+ ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
+ AFTER MATCH SKIP PAST LAST ROW
+ INITIAL
+ PATTERN (LOWPRICE UP+ DOWN+)
+ DEFINE
+ LOWPRICE AS price <= 100,
+ UP AS price > PREV(price),
+ DOWN AS price < PREV(price)
+);
+</programlisting>
+<screen>
+ company | tdate | price | first_value | max | count
+----------+------------+-------+-------------+-----+-------
+ company1 | 2023-07-01 | 100 | 100 | 200 | 4
+ company1 | 2023-07-02 | 200 | | | 0
+ company1 | 2023-07-03 | 150 | | | 0
+ company1 | 2023-07-04 | 140 | | | 0
+ company1 | 2023-07-05 | 150 | | | 0
+ company1 | 2023-07-06 | 90 | 90 | 130 | 4
+ company1 | 2023-07-07 | 110 | | | 0
+ company1 | 2023-07-08 | 130 | | | 0
+ company1 | 2023-07-09 | 120 | | | 0
+ company1 | 2023-07-10 | 130 | | | 0
+(10 rows)
+</screen>
+ </para>
+
<para>
When a query involves multiple window functions, it is possible to write
out each one with a separate <literal>OVER</literal> clause, but this is
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 461fc3f437..02ad2b0195 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -23258,6 +23258,7 @@ SELECT count(*) FROM sometable;
returns <literal>NULL</literal> if there is no such row.
</para></entry>
</row>
+
</tbody>
</tgroup>
</table>
@@ -23297,6 +23298,59 @@ SELECT count(*) FROM sometable;
Other frame specifications can be used to obtain other effects.
</para>
+ <para>
+ Row pattern recognition navigation functions are listed in
+ <xref linkend="functions-rpr-navigation-table"/>. These functions
+ can be used to describe DEFINE clause of Row pattern recognition.
+ </para>
+
+ <table id="functions-rpr-navigation-table">
+ <title>Row Pattern Navigation Functions</title>
+ <tgroup cols="1">
+ <thead>
+ <row>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para></entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry role="func_table_entry"><para role="func_signature">
+ <indexterm>
+ <primary>prev</primary>
+ </indexterm>
+ <function>prev</function> ( <parameter>value</parameter> <type>anyelement</type> )
+ <returnvalue>anyelement</returnvalue>
+ </para>
+ <para>
+ Returns the column value at the previous row;
+ returns NULL if there is no previous row in the window frame.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="func_table_entry"><para role="func_signature">
+ <indexterm>
+ <primary>next</primary>
+ </indexterm>
+ <function>next</function> ( <parameter>value</parameter> <type>anyelement</type> )
+ <returnvalue>anyelement</returnvalue>
+ </para>
+ <para>
+ Returns the column value at the next row;
+ returns NULL if there is no next row in the window frame.
+ </para></entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
<note>
<para>
The SQL standard defines a <literal>RESPECT NULLS</literal> or
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index d7089eac0b..7e1c9989ba 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -969,8 +969,8 @@ WINDOW <replaceable class="parameter">window_name</replaceable> AS ( <replaceabl
The <replaceable class="parameter">frame_clause</replaceable> can be one of
<synopsis>
-{ RANGE | ROWS | GROUPS } <replaceable>frame_start</replaceable> [ <replaceable>frame_exclusion</replaceable> ]
-{ RANGE | ROWS | GROUPS } BETWEEN <replaceable>frame_start</replaceable> AND <replaceable>frame_end</replaceable> [ <replaceable>frame_exclusion</replaceable> ]
+{ RANGE | ROWS | GROUPS } <replaceable>frame_start</replaceable> [ <replaceable>frame_exclusion</replaceable> ] [row_pattern_common_syntax]
+{ RANGE | ROWS | GROUPS } BETWEEN <replaceable>frame_start</replaceable> AND <replaceable>frame_end</replaceable> [ <replaceable>frame_exclusion</replaceable> ] [row_pattern_common_syntax]
</synopsis>
where <replaceable>frame_start</replaceable>
@@ -1077,6 +1077,40 @@ EXCLUDE NO OTHERS
a given peer group will be in the frame or excluded from it.
</para>
+ <para>
+ The
+ optional <replaceable class="parameter">row_pattern_common_syntax</replaceable>
+ defines the <firstterm>row pattern recognition condition</firstterm> for
+ this
+ window. <replaceable class="parameter">row_pattern_common_syntax</replaceable>
+ includes following subclauses. <literal>AFTER MATCH SKIP PAST LAST
+ ROW</literal> or <literal>AFTER MATCH SKIP TO NEXT ROW</literal> controls
+ how to proceed to next row position after a match
+ found. With <literal>AFTER MATCH SKIP PAST LAST ROW</literal> (the
+ default) next row position is next to the last row of previous match. On
+ the other hand, with <literal>AFTER MATCH SKIP TO NEXT ROW</literal> next
+ row position is always next to the last row of previous
+ match. <literal>DEFINE</literal> defines definition variables along with a
+ boolean expression. <literal>PATTERN</literal> defines a sequence of rows
+ that satisfies certain conditions using variables defined
+ in <literal>DEFINE</literal> clause. If the variable is not defined in
+ the <literal>DEFINE</literal> clause, it is implicitly assumed
+ following is defined in the <literal>DEFINE</literal> clause.
+
+<synopsis>
+<literal>variable_name</literal> AS TRUE
+</synopsis>
+
+ Note that the maximu number of variables defined
+ in <literal>DEFINE</literal> clause is 26.
+
+<synopsis>
+[ AFTER MATCH SKIP PAST LAST ROW | AFTER MATCH SKIP TO NEXT ROW ]
+PATTERN <replaceable class="parameter">pattern_variable_name</replaceable>[+] [, ...]
+DEFINE <replaceable class="parameter">definition_varible_name</replaceable> AS <replaceable class="parameter">expression</replaceable> [, ...]
+</synopsis>
+ </para>
+
<para>
The purpose of a <literal>WINDOW</literal> clause is to specify the
behavior of <firstterm>window functions</firstterm> appearing in the query's
--
2.25.1
----Next_Part(Mon_Aug_26_13_39_47_2024_878)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="v21-0007-Row-pattern-recognition-patch-tests.patch"
^ permalink raw reply [nested|flat] 22+ messages in thread
end of thread, other threads:[~2024-08-26 04:32 UTC | newest]
Thread overview: 22+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 13:01 Re: meson: Non-feature feature options Nazir Bilal Yavuz <[email protected]>
2023-03-01 15:52 ` Peter Eisentraut <[email protected]>
2023-03-02 10:41 ` Nazir Bilal Yavuz <[email protected]>
2023-03-03 09:16 ` Peter Eisentraut <[email protected]>
2023-03-03 10:01 ` Nazir Bilal Yavuz <[email protected]>
2023-03-09 13:45 ` Peter Eisentraut <[email protected]>
2023-03-09 13:54 ` Daniel Gustafsson <[email protected]>
2023-03-09 14:12 ` Nazir Bilal Yavuz <[email protected]>
2023-03-09 14:15 ` Daniel Gustafsson <[email protected]>
2023-03-09 14:18 ` Peter Eisentraut <[email protected]>
2023-03-09 14:40 ` Nazir Bilal Yavuz <[email protected]>
2023-03-13 06:27 ` Peter Eisentraut <[email protected]>
2023-03-13 18:04 ` Nathan Bossart <[email protected]>
2023-03-13 18:57 ` Nazir Bilal Yavuz <[email protected]>
2023-03-13 19:04 ` Nathan Bossart <[email protected]>
2023-03-13 20:14 ` Andres Freund <[email protected]>
2023-03-13 20:46 ` Nazir Bilal Yavuz <[email protected]>
2023-03-13 21:45 ` Andres Freund <[email protected]>
2023-03-13 22:32 ` Nathan Bossart <[email protected]>
2023-03-13 20:13 ` Andres Freund <[email protected]>
2023-03-13 20:25 ` Nathan Bossart <[email protected]>
2024-08-26 04:32 [PATCH v21 6/8] Row pattern recognition patch (docs). Tatsuo Ishii <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox