[gnome-settings-daemon/benzea/glib-dependency-fix: 2/2] meson: Enable GLib API version checking macros



commit db9cefd0fcea6909134e92c844f4f6b515eaf5a3
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Jul 13 16:15:14 2020 +0200

    meson: Enable GLib API version checking macros
    
    Hopefully this can catch issues again where we accidentally start to
    depend on a newer GLib version than we intended to.

 meson.build | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 851341d7..7fa3efe8 100644
--- a/meson.build
+++ b/meson.build
@@ -13,6 +13,11 @@ gsd_api_version_minor = 0
 gsd_api_version = '@0@.@1@'.format(gsd_major_version, gsd_api_version_minor)
 gsd_api_name = '@0@-@1@'.format(meson.project_name(), gsd_api_version)
 
+glib_min_version = '2.56'
+
+glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
+    glib_min_version.split('.')[0], glib_min_version.split('.')[1])
+
 gsd_prefix = get_option('prefix')
 gsd_bindir = join_paths(gsd_prefix, get_option('bindir'))
 gsd_datadir = join_paths(gsd_prefix, get_option('datadir'))
@@ -66,7 +71,9 @@ if gsd_buildtype.contains('debug')
     '-Wnested-externs',
     '-Wno-strict-aliasing',
     '-Wno-sign-compare',
-    '-Wpointer-arith'
+    '-Wpointer-arith',
+    '-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
+    '-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
   ]
 
   compiler_flags = cc.get_supported_arguments(test_cflags)
@@ -82,7 +89,7 @@ endif
 
 add_project_arguments(common_flags + compiler_flags, language: 'c')
 
-glib_dep = dependency('glib-2.0', version: '>= 2.56')
+glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
 colord_dep = dependency('colord', version: '>= 1.3.5')
 geocode_glib_dep = dependency('geocode-glib-1.0', version: '>= 3.10.0')
 gio_dep = dependency('gio-2.0', version: '>= 2.53.0')


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