[gnome-terminal] build: Move version defines from config.h to meson cpp_args



commit 17f4ad7909c819f0fe574d723de119dc10ec397f
Author: Christian Persch <chpe src gnome org>
Date:   Thu Jul 28 23:19:49 2022 +0200

    build: Move version defines from config.h to meson cpp_args
    
    The nautilus extension will need to build with gtk4 while the rest is
    still gtk3, so these defines must not be set while compiling the
    nautilus extension.

 meson.build              | 24 ++++++++++++++++--------
 src/meson.build          |  6 +++---
 src/terminal-nautilus.cc |  2 --
 3 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/meson.build b/meson.build
index 7876cf86..05756726 100644
--- a/meson.build
+++ b/meson.build
@@ -162,17 +162,25 @@ config_h.set('ENABLE_SEARCH_PROVIDER', get_option('search_provider'))
 # FIXME AC_USE_SYSTEM_EXTENSIONS also supported non-gnu systems
 config_h.set10('_GNU_SOURCE', true)
 
+# Min/max version requirement flags
 
-ver = glib_min_req_version.split('.')
-config_h.set('GLIB_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
-ver = glib_max_allowed_version.split('.')
-config_h.set('GLIB_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+minver = glib_min_req_version.split('.')
+maxver = glib_max_allowed_version.split('.')
 
-ver = gtk_min_req_version.split('.')
-config_h.set('GDK_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+glib_version_cxxflags = [
+  '-DGLIB_VERSION_MIN_REQUIRED=(G_ENCODE_VERSION(' + minver[0] + ',' + minver[1] + '))',
+  '-DGLIB_VERSION_MAX_ALLOWED=(G_ENCODE_VERSION(' + maxver[0] + ',' + maxver[1] + '))',
+]
+
+minver = gtk_min_req_version.split('.')
+maxver = gtk_max_allowed_version.split('.')
+
+gtk_version_cxxflags = [
+  '-DGDK_VERSION_MIN_REQUIRED=(G_ENCODE_VERSION(' + minver[0] + ',' + minver[1] + '))',
+  '-DGDK_VERSION_MAX_ALLOWED=(G_ENCODE_VERSION(' + maxver[0] + ',' + maxver[1] + '))',
+]
 
-ver = gtk_max_allowed_version.split('.')
-config_h.set('GDK_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
+version_cxxflags = glib_version_cxxflags + gtk_version_cxxflags
 
 # Compiler flags
 
diff --git a/src/meson.build b/src/meson.build
index 0a142c55..99f47f82 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -204,7 +204,7 @@ server_incs = [
   src_inc,
 ]
 
-server_cxxflags = [
+server_cxxflags = version_cxxflags + [
   '-DTERMINAL_COMPILATION',
   '-DVTE_DISABLE_DEPRECATION_WARNINGS',
   '-DTERM_LOCALEDIR="@0@"'.format(gt_prefix / gt_localedir),
@@ -288,7 +288,7 @@ client_incs = [
   src_inc,
 ]
 
-client_cxxflags = [
+client_cxxflags = version_cxxflags + [
   '-DTERMINAL_COMPILATION',
   '-DTERMINAL_CLIENT',
   '-DTERM_DATADIR="@0@"'.format(gt_prefix / gt_datadir),
@@ -357,7 +357,7 @@ if get_option('nautilus_extension')
     src_inc,
   ]
 
-  nautilus_cxxflags = [
+  nautilus_cxxflags = glib_version_cxxflags + [
     '-DTERM_LOCALEDIR="@0@"'.format(gt_prefix / gt_localedir),
   ]
 
diff --git a/src/terminal-nautilus.cc b/src/terminal-nautilus.cc
index 71ab3136..4b4bbd8d 100644
--- a/src/terminal-nautilus.cc
+++ b/src/terminal-nautilus.cc
@@ -18,8 +18,6 @@
  */
 
 #include "config.h"
-#undef GDK_VERSION_MIN_REQUIRED
-#undef GDK_VERSION_MAX_ALLOWED
 
 #include <glib.h>
 #include <glib/gi18n-lib.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]