From 21414e1954dc120bef379f77580b435f22218e38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= <gael@xfce.org>
Date: Mon, 3 Feb 2025 11:38:14 +0100
Subject: [PATCH] meson-build: Update debug/optimization flag management

Related: xfce/xfce4-dev-tools!145
---
 meson.build | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/meson.build b/meson.build
index 199814b..65f5d9c 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,7 @@ project(
 version : '4.20.0-dev',
   license : 'GPL-2',
   meson_version : '>= 0.54.0',
-  default_options : ['c_std=gnu11', 'buildtype=debugoptimized', 'warning_level=2', 'b_ndebug=if-release']
+  default_options : ['c_std=gnu11', 'buildtype=debugoptimized', 'warning_level=2']
 )
 libxfce4util_soversion = '7.0.0'
 libxfce4util_soversion_major = libxfce4util_soversion.split('.')[0]
@@ -124,18 +124,15 @@ extra_cflags_check = [
   '-Wno-error=deprecated-declarations',
 ]
 
-buildtype = get_option('buildtype')
-if buildtype == 'debug' or buildtype == 'debugoptimized'
+optimization = get_option('optimization')
+if get_option('debug') and optimization in ['0', 'g']
   extra_cflags_check += '-fstack-protector-strong'
-  extra_cflags += '-DDEBUG=1'
-
-  if buildtype == 'debug'
-    extra_cflags += [
-      '-DG_ENABLE_DEBUG',
-      '-DDEBUG_TRACE=1',
-    ]
-  endif
-elif buildtype == 'minsize'
+  extra_cflags += [
+    '-DDEBUG=1',
+    '-DDEBUG_TRACE=1',
+    '-DG_ENABLE_DEBUG',
+  ]
+elif optimization in ['3', 'minsize']
   extra_cflags += [
     '-DNDEBUG',
     '-DG_DISABLE_CAST_CHECKS',
-- 
GitLab