From e607f8e6de8bdd65cbaede200e184d7f908991c5 Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz Date: Mon, 13 Feb 2023 15:21:32 +0300 Subject: [PATCH v1 1/2] meson: Refactor SSL option --- .cirrus.yml | 7 +++---- meson.build | 6 +++++- meson_options.txt | 3 +-- src/interfaces/libpq/meson.build | 2 +- src/makefiles/meson.build | 2 +- src/test/modules/ssl_passphrase_callback/meson.build | 2 +- src/test/ssl/meson.build | 2 +- 7 files changed, 13 insertions(+), 11 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 f534704452..563589ac48 100644 --- a/meson.build +++ b/meson.build @@ -1171,7 +1171,9 @@ cdata.set('USE_SYSTEMD', systemd.found() ? 1 : false) # Library: SSL ############################################################### -if get_option('ssl') == 'openssl' +ssl_type = 'none' +sslopt = get_option('ssl') +if not sslopt.disabled() # 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 @@ -1239,6 +1241,8 @@ if get_option('ssl') == 'openssl' endif endforeach + ssl_type = 'openssl' + cdata.set('USE_OPENSSL', 1, description: 'Define to 1 to build with OpenSSL support. (-Dssl=openssl)') cdata.set('OPENSSL_API_COMPAT', '0x10001000L', diff --git a/meson_options.txt b/meson_options.txt index 9d3ef4aa20..9c74cc6512 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -127,8 +127,7 @@ 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 : 'feature', 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..f62dc3ac52 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_type}, }, } diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build index bf7303dc99..2b73a9e5dd 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_type, 'with_uuid': uuidopt, 'default_port': get_option('pgport'), diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build index de016b0280..0d2d8804fa 100644 --- a/src/test/modules/ssl_passphrase_callback/meson.build +++ b/src/test/modules/ssl_passphrase_callback/meson.build @@ -54,6 +54,6 @@ tests += { 'tests': [ 't/001_testfunc.pl', ], - 'env': {'with_ssl': 'openssl'}, + 'env': {'with_ssl': ssl_type}, }, } diff --git a/src/test/ssl/meson.build b/src/test/ssl/meson.build index a8d9a5424d..4612416da3 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_type, 'OPENSSL': openssl.path(), }, 'tests': [ -- 2.25.1