public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nazir Bilal Yavuz <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: meson: Non-feature feature options
Date: Tue, 14 Mar 2023 17:07:15 +0300
Message-ID: <CAN55FZ0srpj+=E1e6ryTP8avb6HW24M18yct-JoZHMmRtM-ACA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAN55FZ2Bz5P_sd2+1KBwWa9v4vDByM2UX7rKfzQs7yj6buojsg@mail.gmail.com>
<[email protected]>
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.
I tried to implement what we did for ssl to uuid as well, do you have
any comments?
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
[text/x-diff] v1-0001-meson-Make-auto-the-default-of-the-uuid-option.patch (5.5K, ../CAN55FZ0srpj+=E1e6ryTP8avb6HW24M18yct-JoZHMmRtM-ACA@mail.gmail.com/2-v1-0001-meson-Make-auto-the-default-of-the-uuid-option.patch)
download | inline diff:
From 0e92050c15ca6e9ebeddaafad229eee53fc9e7b0 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <[email protected]>
Date: Tue, 14 Mar 2023 16:38:02 +0300
Subject: [PATCH v1] meson: Make auto the default of the uuid option
---
.cirrus.yml | 5 +--
meson.build | 80 ++++++++++++++++++++++++++-------------
meson_options.txt | 4 +-
src/makefiles/meson.build | 2 +-
4 files changed, 59 insertions(+), 32 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 505c50f3285..1ccb14c6340 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 2ebdf914c1b..7955ae42d03 100644
--- a/meson.build
+++ b/meson.build
@@ -1282,34 +1282,61 @@ endif
###############################################################
uuidopt = get_option('uuid')
+uuid_library = 'none'
+uuid = not_found_dep
+if uuidopt == 'auto' and auto_features.disabled()
+ uuidopt = 'none'
+endif
+
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 = 'uuid.h'
- else
- error('huh')
- endif
- if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid)
- error('uuid library @0@ missing required function @1@'.format(uuidopt, uuidfunc))
- endif
- cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1)
+ uuids = {
+ 'e2fs': {
+ 'uuiddep': 'uuid',
+ 'uuidfunc': 'uuid_generate',
+ 'uuidheader': 'uuid/uuid.h',
+ },
+ 'bsd': {
+ 'uuiddep': '',
+ 'uuidfunc': 'uuid_to_string',
+ 'uuidheader': 'uuid.h',
+ },
+ 'ossp': {
+ 'uuiddep': 'ossp-uuid',
+ 'uuidfunc': 'uuid_export',
+ 'uuidheader': 'uuid.h',
+ }
+ }
- 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
+ foreach uuidname, uuid_values : uuids
+ if uuidopt != 'auto' and uuidname != uuidopt
+ continue
+ endif
+ uuid_required = (uuidname == uuidopt)
+ uuiddep = uuid_values['uuiddep']
+ uuidheader = uuid_values['uuidheader']
+ uuidfunc = uuid_values['uuidfunc']
+
+ # libc should have uuid function
+ uuid = uuiddep != '' ? dependency(uuiddep, required: uuid_required) : \
+ declare_dependency()
+
+ if uuid.found() and cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args,
+ dependencies: uuid, required: uuid_required)
+ uuidname_upper = uuidname.to_upper()
+ uuid_library = uuidname
+ cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1)
+ cdata.set('HAVE_UUID_@0@'.format(uuidname_upper), 1,
+ description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname_upper))
+ break
+ else
+ uuid = not_found_dep
+ endif
+ endforeach
+endif
+
+if uuidopt == 'auto' and auto_features.enabled() and not uuid.found()
+ error('no UUID library found')
endif
@@ -3302,11 +3329,12 @@ if meson.version().version_compare('>=0.57')
'readline': readline,
'selinux': selinux,
'systemd': systemd,
- 'uuid': uuid,
+ 'uuid': uuid.found() ? [uuid, '(@0@)'.format(uuid_library)] : uuid,
'zlib': zlib,
'zstd': zstd,
},
section: 'External libraries',
+ list_sep: ', ',
)
endif
diff --git a/meson_options.txt b/meson_options.txt
index 4402dd4299d..3ffe6fb758d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -137,8 +137,8 @@ option('ssl', type : 'combo', choices : ['auto', 'none', 'openssl'],
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',
diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build
index 7635771c5ae..25e2a54a6bb 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_library,
- 'with_uuid': uuidopt,
+ 'with_uuid': uuid_library,
'default_port': get_option('pgport'),
'with_system_tzdata': get_option('system_tzdata'),
--
2.39.2
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: meson: Non-feature feature options
In-Reply-To: <CAN55FZ0srpj+=E1e6ryTP8avb6HW24M18yct-JoZHMmRtM-ACA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox