From 42c38c4639fdf66a35b08299374d979440bb1f29 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Wed, 2 Jul 2025 17:30:59 +0300
Subject: [PATCH v5 3/3] ci: meson: Store common Postgres configuration options
 in one variable

This helps to keep things aligned.

Suggested-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/CAN55FZ0aO8d_jkyRijcGP8qO%3DXH09qG%3Dpw0ZZDvB4LMzuXYU1w%40mail.gmail.com
---
 .cirrus.tasks.yml | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index ef51aca32f6..33f1005dee8 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -31,6 +31,10 @@ env:
   TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
   PG_TEST_EXTRA: kerberos ldap ssl libpq_encryption load_balance oauth
 
+  # Postgres config args for the meson builds, shared between all meson tasks
+  # except the 'SanityCheck' task
+  MESON_COMMON_PG_CONFIG_ARGS: -Dcassert=true -Dinjection_points=true
+
   # Meson feature flags shared by all meson tasks, except:
   # SanityCheck: uses almost no dependencies.
   # Windows - VS: has fewer dependencies than listed here, so defines its own.
@@ -226,8 +230,8 @@ task:
   configure_script: |
     su postgres <<-EOF
       meson setup \
+        ${MESON_COMMON_PG_CONFIG_ARGS} \
         --buildtype=debug \
-        -Dcassert=true -Dinjection_points=true \
         -Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
         ${MESON_COMMON_FEATURES} ${MESON_FEATURES} \
         build
@@ -355,9 +359,9 @@ task:
   configure_script: |
     su postgres <<-EOF
       meson setup \
+        ${MESON_COMMON_PG_CONFIG_ARGS} \
         --buildtype=debugoptimized \
         --pkg-config-path ${PKGCONFIG_PATH} \
-        -Dcassert=true -Dinjection_points=true \
         ${MESON_COMMON_FEATURES} ${MESON_FEATURES} \
         build
     EOF
@@ -543,8 +547,8 @@ task:
       configure_script: |
         su postgres <<-EOF
           meson setup \
+            ${MESON_COMMON_PG_CONFIG_ARGS} \
             --buildtype=debug \
-            -Dcassert=true -Dinjection_points=true \
             ${LINUX_MESON_FEATURES} -Dllvm=enabled \
             build
         EOF
@@ -555,8 +559,8 @@ task:
         su postgres <<-EOF
           export CC='ccache gcc -m32'
           meson setup \
+            ${MESON_COMMON_PG_CONFIG_ARGS} \
             --buildtype=debug \
-            -Dcassert=true -Dinjection_points=true \
             --pkg-config-path /usr/lib/i386-linux-gnu/pkgconfig/ \
             -DPERL=perl5.36-i386-linux-gnu \
             ${LINUX_MESON_FEATURES} -Dlibnuma=disabled \
@@ -700,10 +704,10 @@ task:
   configure_script: |
     export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig/"
     meson setup \
+      ${MESON_COMMON_PG_CONFIG_ARGS} \
       --buildtype=debug \
       -Dextra_include_dirs=/opt/local/include \
       -Dextra_lib_dirs=/opt/local/lib \
-      -Dcassert=true -Dinjection_points=true \
       ${MESON_COMMON_FEATURES} ${MESON_FEATURES} \
       build
 
@@ -784,7 +788,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 -Dinjection_points=true -Db_pch=true -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% %MESON_FEATURES% build
+    meson setup --backend ninja %MESON_COMMON_PG_CONFIG_ARGS% --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Db_pch=true -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% %MESON_FEATURES% build
 
   build_script: |
     vcvarsall x64
@@ -844,7 +848,7 @@ task:
 
   # -Dnls need to be disabled as the number of files it creates cause a noticable slowdown
   configure_script: |
-    %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Dinjection_points=true -Db_pch=true %MESON_COMMON_FEATURES% -DTAR=%TAR% build"
+    %BASH% -c "meson setup %MESON_COMMON_PG_CONFIG_ARGS%  -Ddebug=true -Doptimization=g -Db_pch=true %MESON_COMMON_FEATURES% -DTAR=%TAR% build"
 
   build_script: |
     %BASH% -c "ninja -C build ${MBUILD_TARGET}"
-- 
2.50.0

