Hi, I added SSL and UUID patches. UUID patch has two different fixes:
1 - v1-0002-meson-Refactor-UUID-option.patch: Adding 'auto' choice to 'uuid' combo option.
2 - v1-0002-meson-Refactor-UUID-option-with-uuid_library.patch: Making 'uuid' feature option and adding new 'uuid_library' combo option with ['auto', 'bsd', 'e2fs', 'ossp'] choices. If 'uuid_library' is set other than 'auto' and it can't be found, build throws an error.
What do you think? Regards, Nazir Bilal Yavuz Microsoft
From e607f8e6de8bdd65cbaede200e184d7f908991c5 Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz <byavu...@gmail.com> 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
From 0d94e30facc9e1bbd489afa563fd57c9ed002bba Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz <byavu...@gmail.com> Date: Mon, 13 Feb 2023 15:22:05 +0300 Subject: [PATCH v1 2/2] meson: Refactor UUID option --- .cirrus.yml | 5 ++-- meson.build | 60 ++++++++++++++++++++++++++++++----------------- meson_options.txt | 4 ++-- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index aaf4066366..d696d5dc48 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -181,7 +181,7 @@ task: su postgres <<-EOF meson setup \ --buildtype=debug \ - -Dcassert=true -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \ + -Dcassert=true -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 - -Duuid=e2fs task: @@ -496,7 +495,7 @@ task: -Dextra_include_dirs=${brewpath}/include \ -Dextra_lib_dirs=${brewpath}/lib \ -Dcassert=true \ - -Duuid=e2fs -Ddtrace=auto \ + -Ddtrace=auto \ -Dsegsize_blocks=6 \ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ build diff --git a/meson.build b/meson.build index 563589ac48..26f48a4c12 100644 --- a/meson.build +++ b/meson.build @@ -1259,31 +1259,49 @@ endif uuidopt = get_option('uuid') if uuidopt != 'none' - uuidname = uuidopt.to_upper() - if uuidopt == 'e2fs' - uuid = dependency('uuid', required: true) - uuidfunc = 'uuid_generate' - uuidheader = 'uuid/uuid.h' - elif uuidopt == 'bsd' - # libc should have uuid function - uuid = declare_dependency() - uuidfunc = 'uuid_to_string' - uuidheader = 'uuid.h' - elif uuidopt == 'ossp' - uuid = dependency('ossp-uuid', required: true) - uuidfunc = 'uuid_export' - uuidheader = 'ossp/uuid.h' - else - error('huh') - endif - if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid) + uuidtypes = { + 'e2fs': { + 'uuiddep': 'uuid', + 'uuidfunc': 'uuid_generate', + 'uuidheader': 'uuid/uuid.h', + }, + 'bsd': { + # libc should have uuid function + 'uuiddep': '', + 'uuidfunc': 'uuid_to_string', + 'uuidheader': 'uuid.h', + }, + 'ossp': { + 'uuiddep':'ossp-uuid', + 'uuidfunc': 'uuid_export', + 'uuidheader': 'ossp/uuid.h', + }, + } + + uuidfound = false + foreach uuidname, uuidelements : uuidtypes + if uuidopt == 'auto' or uuidopt == uuidname + uuiddep = uuidelements['uuiddep'] + uuid = uuiddep != '' ? dependency(uuiddep, required: false) : declare_dependency() + uuidfunc = uuidelements['uuidfunc'] + uuidheader = uuidelements['uuidheader'] + + if cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid) + uuidfound = true + uuidname = uuidname.to_upper() + cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1) + cdata.set('HAVE_UUID_@0@'.format(uuidname), 1, + description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname)) + break + endif + endif + endforeach + + if not uuidfound and uuidopt != 'auto' error('uuid library @0@ missing required function @1@'.format(uuidopt, uuidfunc)) endif - cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1) - cdata.set('HAVE_UUID_@0@'.format(uuidname), 1, - description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname)) else uuid = not_found_dep endif diff --git a/meson_options.txt b/meson_options.txt index 9c74cc6512..9b7768a8e2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -133,8 +133,8 @@ option('ssl', type : 'feature', value : 'auto', option('systemd', type : 'feature', value: 'auto', description: 'build with systemd support') -option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'], - value : 'none', +option('uuid', type : 'combo', choices : ['auto', 'none', 'bsd', 'e2fs', 'ossp'], + value : 'auto', description: 'build contrib/uuid-ossp using LIB') option('zlib', type : 'feature', value: 'auto', -- 2.25.1
From d0c30b6dad4769e75cbf012f1387bb54c3447f8b Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz <byavu...@gmail.com> Date: Mon, 13 Feb 2023 15:22:05 +0300 Subject: [PATCH v1] meson: Refactor UUID option with uuid_library --- .cirrus.yml | 5 ++- meson.build | 67 ++++++++++++++++++++++++++------------- meson_options.txt | 9 ++++-- src/makefiles/meson.build | 2 +- 4 files changed, 54 insertions(+), 29 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index aaf4066366..d696d5dc48 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -181,7 +181,7 @@ task: su postgres <<-EOF meson setup \ --buildtype=debug \ - -Dcassert=true -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \ + -Dcassert=true -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 - -Duuid=e2fs task: @@ -496,7 +495,7 @@ task: -Dextra_include_dirs=${brewpath}/include \ -Dextra_lib_dirs=${brewpath}/lib \ -Dcassert=true \ - -Duuid=e2fs -Ddtrace=auto \ + -Ddtrace=auto \ -Dsegsize_blocks=6 \ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ build diff --git a/meson.build b/meson.build index 563589ac48..8f4bbc979b 100644 --- a/meson.build +++ b/meson.build @@ -1257,33 +1257,56 @@ endif # Library: uuid ############################################################### +uuid_type = 'none' uuidopt = get_option('uuid') -if uuidopt != 'none' - uuidname = uuidopt.to_upper() - if uuidopt == 'e2fs' - uuid = dependency('uuid', required: true) - uuidfunc = 'uuid_generate' - uuidheader = 'uuid/uuid.h' - elif uuidopt == 'bsd' - # libc should have uuid function - uuid = declare_dependency() - uuidfunc = 'uuid_to_string' - uuidheader = 'uuid.h' - elif uuidopt == 'ossp' - uuid = dependency('ossp-uuid', required: true) - uuidfunc = 'uuid_export' - uuidheader = 'ossp/uuid.h' - else - error('huh') - endif +if not uuidopt.disabled() + uuid_library = get_option('uuid_library') + + uuidtypes = { + 'e2fs': { + 'uuiddep': 'uuid', + 'uuidfunc': 'uuid_generate', + 'uuidheader': 'uuid/uuid.h', + }, + 'bsd': { + # libc should have uuid function + 'uuiddep': '', + 'uuidfunc': 'uuid_to_string', + 'uuidheader': 'uuid.h', + }, + 'ossp': { + 'uuiddep':'ossp-uuid', + 'uuidfunc': 'uuid_export', + 'uuidheader': 'ossp/uuid.h', + }, + } + + uuidfound = false + foreach uuidname, uuidelements : uuidtypes + if uuid_library == 'auto' or uuid_library == uuidname + uuiddep = uuidelements['uuiddep'] + uuid = uuiddep != '' ? dependency(uuiddep, required: false) : declare_dependency() + uuidfunc = uuidelements['uuidfunc'] + uuidheader = uuidelements['uuidheader'] + + if cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid) + uuidfound = true + uuid_type = uuidname + uuidname = uuidname.to_upper() + cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1) + cdata.set('HAVE_UUID_@0@'.format(uuidname), 1, + description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname)) + break + endif + endif + endforeach - if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid) + # if uuid is enabled or uuid_library is set other than auto, + # and couldn't found any library throw an error + if not uuidfound and (uuidopt.enabled() or uuid_library != 'auto') error('uuid library @0@ missing required function @1@'.format(uuidopt, uuidfunc)) endif - cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1) - cdata.set('HAVE_UUID_@0@'.format(uuidname), 1, - description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname)) else uuid = not_found_dep endif diff --git a/meson_options.txt b/meson_options.txt index 9c74cc6512..88493d5a9b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -133,9 +133,12 @@ option('ssl', type : 'feature', value : 'auto', option('systemd', type : 'feature', value: 'auto', description: 'build with systemd support') -option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'], - value : 'none', - description: 'build contrib/uuid-ossp using LIB') +option('uuid', type : 'feature', value : 'auto', + description: 'whether to use uuid') + +option('uuid_library', type : 'combo', choices : ['auto', 'bsd', 'e2fs', 'ossp'], + value : 'auto', + description: 'specify uuid library') option('zlib', type : 'feature', value: 'auto', description: 'whether to use zlib') diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build index 2b73a9e5dd..e03b721b13 100644 --- a/src/makefiles/meson.build +++ b/src/makefiles/meson.build @@ -67,7 +67,7 @@ pgxs_kv = { # want the chosen option, rather than the library 'with_ssl' : ssl_type, - 'with_uuid': uuidopt, + 'with_uuid': uuid_type, 'default_port': get_option('pgport'), 'with_system_tzdata': get_option('system_tzdata'), -- 2.25.1