public inbox for [email protected]  
help / color / mirror / Atom feed
Minor cleanup of Meson files given that we require 0.57
4+ messages / 3 participants
[nested] [flat]

* Minor cleanup of Meson files given that we require 0.57
@ 2026-04-01 15:34  Andreas Karlsson <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Andreas Karlsson @ 2026-04-01 15:34 UTC (permalink / raw)
  To: pgsql-hackers

Hi,

I found a couple of comments about features not supported in meson 
versions previous to 0.57 but since we know do require 0.57.2 we can 
safely fix them.

The issue fixed is that check_header() previously did not support 
dependencies declared with declare_dependency() which seems like an easy 
fix which improves code quality a bit.

I also found a comment with a typo which claimed a feature requires 
0.56, but str.replace() actually requires 0.58.

-- 
Andreas Karlsson
Percona


Attachments:

  [text/x-patch] v1-0001-Meson-Fix-todos-about-check_header-with-virtual-d.patch (4.3K, 2-v1-0001-Meson-Fix-todos-about-check_header-with-virtual-d.patch)
  download | inline diff:
From 2963c314640c422f2e8291834d38648b04222c63 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <[email protected]>
Date: Wed, 1 Apr 2026 17:26:19 +0200
Subject: [PATCH v1 1/2] Meson: Fix todos about check_header() with virtual
 declare_dependency()

Now that we require Meson 0.57 there is no reason we cannot use the result of
declare_dependency() which checking for headers so fix the two places where
we had to work around that we could not do so.
---
 meson.build | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/meson.build b/meson.build
index 8b134b28a69..295ec6f857b 100644
--- a/meson.build
+++ b/meson.build
@@ -758,9 +758,7 @@ if not gssapiopt.disabled()
   gssapi = dependency('krb5-gssapi', required: false)
   have_gssapi = gssapi.found()
 
-  if have_gssapi
-      gssapi_deps = [gssapi]
-  elif not have_gssapi
+  if not have_gssapi
     # Hardcoded lookup for gssapi. This is necessary as gssapi on windows does
     # not install neither pkg-config nor cmake dependency information.
     if host_system == 'windows'
@@ -784,18 +782,15 @@ if not gssapiopt.disabled()
     endforeach
 
     if have_gssapi
-      # Meson before 0.57.0 did not support using check_header() etc with
-      # declare_dependency(). Thus the tests below use the library looked up
-      # above.  Once we require a newer meson version, we can simplify.
       gssapi = declare_dependency(dependencies: gssapi_deps)
     endif
   endif
 
   if not have_gssapi
-  elif cc.check_header('gssapi/gssapi.h', dependencies: gssapi_deps, required: false,
+  elif cc.check_header('gssapi/gssapi.h', dependencies: [gssapi], required: false,
       args: test_c_args, include_directories: postgres_inc)
     cdata.set('HAVE_GSSAPI_GSSAPI_H', 1)
-  elif cc.check_header('gssapi.h', dependencies: gssapi_deps, required: gssapiopt,
+  elif cc.check_header('gssapi.h', dependencies: [gssapi], required: gssapiopt,
       args: test_c_args, include_directories: postgres_inc)
     cdata.set('HAVE_GSSAPI_H', 1)
   else
@@ -803,10 +798,10 @@ if not gssapiopt.disabled()
   endif
 
   if not have_gssapi
-  elif cc.check_header('gssapi/gssapi_ext.h', dependencies: gssapi_deps, required: false,
+  elif cc.check_header('gssapi/gssapi_ext.h', dependencies: [gssapi], required: false,
       args: test_c_args, include_directories: postgres_inc)
     cdata.set('HAVE_GSSAPI_GSSAPI_EXT_H', 1)
-  elif cc.check_header('gssapi_ext.h', dependencies: gssapi_deps, required: gssapiopt,
+  elif cc.check_header('gssapi_ext.h', dependencies: [gssapi], required: gssapiopt,
       args: test_c_args, include_directories: postgres_inc)
     cdata.set('HAVE_GSSAPI_EXT_H', 1)
   else
@@ -814,7 +809,7 @@ if not gssapiopt.disabled()
   endif
 
   if not have_gssapi
-  elif cc.has_function('gss_store_cred_into', dependencies: gssapi_deps,
+  elif cc.has_function('gss_store_cred_into', dependencies: [gssapi],
       args: test_c_args, include_directories: postgres_inc)
     cdata.set('ENABLE_GSS', 1)
 
@@ -1563,17 +1558,6 @@ Use -Dreadline=disabled to disable readline support.'''.format(readline_dep))
       'rl_filename_quoting_function',
     ]
 
-    foreach var : check_vars
-      cdata.set('HAVE_' + var.to_upper(),
-        cc.has_header_symbol(readline_h, var,
-          args: test_c_args, include_directories: postgres_inc,
-          prefix: '#include <stdio.h>',
-          dependencies: [readline]) ? 1 : false)
-    endforeach
-
-    # If found via cc.find_library() ensure headers are found when using the
-    # dependency. On meson < 0.57 one cannot do compiler checks using the
-    # dependency returned by declare_dependency(), so we can't do this above.
     if readline.type_name() == 'library'
       readline = declare_dependency(dependencies: readline,
         include_directories: postgres_inc)
@@ -1585,6 +1569,14 @@ Use -Dreadline=disabled to disable readline support.'''.format(readline_dep))
       readline = declare_dependency(dependencies: readline,
         link_args: '-Wl,--enable-auto-import')
     endif
+
+    foreach var : check_vars
+      cdata.set('HAVE_' + var.to_upper(),
+        cc.has_header_symbol(readline_h, var,
+          args: test_c_args, include_directories: postgres_inc,
+          prefix: '#include <stdio.h>',
+          dependencies: [readline]) ? 1 : false)
+    endforeach
   endif
 
   # XXX: Figure out whether to implement mingw warning equivalent
-- 
2.47.3



  [text/x-patch] v1-0002-Meson-Fix-version-number-in-todo-comment-about-st.patch (972B, 3-v1-0002-Meson-Fix-version-number-in-todo-comment-about-st.patch)
  download | inline diff:
From d90e1b5c2b3acaa007eea7571d6258faec5cce76 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <[email protected]>
Date: Wed, 1 Apr 2026 17:28:58 +0200
Subject: [PATCH v1 2/2] Meson: Fix version number in todo comment about
 str.replace in

The str.replace() function was added in Meson 0.58, not in 0.56 as the
comment claimed.
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 295ec6f857b..b17f4a3b086 100644
--- a/meson.build
+++ b/meson.build
@@ -3669,7 +3669,7 @@ endforeach
 # find and report conflicting files
 foreach build_path : potentially_conflicting_files
   build_path = host_system == 'windows' ? fs.as_posix(build_path) : build_path
-  # str.replace is in 0.56
+  # str.replace is in meson 0.58
   src_path = meson.current_source_dir() / build_path.split(meson.current_build_dir() / '')[1]
   if fs.exists(src_path) or fs.is_symlink(src_path)
     conflicting_files += src_path
-- 
2.47.3



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Minor cleanup of Meson files given that we require 0.57
@ 2026-04-15 21:33  Tristan Partin <[email protected]>
  parent: Andreas Karlsson <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Tristan Partin @ 2026-04-15 21:33 UTC (permalink / raw)
  To: Andreas Karlsson <[email protected]>; pgsql-hackers

Both patches look good to me!

-- 
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Minor cleanup of Meson files given that we require 0.57
@ 2026-04-17 22:00  Michael Paquier <[email protected]>
  parent: Tristan Partin <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Michael Paquier @ 2026-04-17 22:00 UTC (permalink / raw)
  To: Tristan Partin <[email protected]>; +Cc: Andreas Karlsson <[email protected]>; pgsql-hackers

On Wed, Apr 15, 2026 at 09:33:41PM +0000, Tristan Partin wrote:
> Both patches look good to me!

I have skimmed through the patches quickly, and they sound rather
correct (need to double-check in depth).  Anyway, asking before doing
anything..  Would there be any objections to this simplification on
HEAD, now that we require 0.57.2?
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Minor cleanup of Meson files given that we require 0.57
@ 2026-04-20 03:38  Michael Paquier <[email protected]>
  parent: Michael Paquier <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2026-04-20 03:38 UTC (permalink / raw)
  To: Tristan Partin <[email protected]>; +Cc: Andreas Karlsson <[email protected]>; pgsql-hackers

On Sat, Apr 18, 2026 at 07:00:42AM +0900, Michael Paquier wrote:
> I have skimmed through the patches quickly, and they sound rather
> correct (need to double-check in depth).  Anyway, asking before doing
> anything..  Would there be any objections to this simplification on
> HEAD, now that we require 0.57.2?

Hearing nothing, done.  I have tweaked the comment for str.replace()
to mention 0.58.0 rather than 0.58, to be more precise.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-04-20 03:38 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-01 15:34 Minor cleanup of Meson files given that we require 0.57 Andreas Karlsson <[email protected]>
2026-04-15 21:33 ` Tristan Partin <[email protected]>
2026-04-17 22:00   ` Michael Paquier <[email protected]>
2026-04-20 03:38     ` Michael Paquier <[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