[libpeas] build: specify min/max glib versions in meson.build



commit f5532e6b7cf6472bd70d06332ebd55342ff362bc
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 24 14:35:32 2019 -0700

    build: specify min/max glib versions in meson.build
    
    This ensures that we don't use API that we cannot use, but also ensures
    that we don't need to litter the source code with begin/end ignore
    deprecations.

 libpeas/peas-engine.c                      |  8 --------
 libpeas/peas-extension-set.c               | 10 ----------
 libpeas/peas-object-module.c               |  4 ----
 libpeas/peas-plugin-loader-c.c             |  2 --
 libpeas/peas-plugin-loader.c               |  2 --
 libpeas/peas-utils.c                       |  2 --
 loaders/lua5.1/peas-plugin-loader-lua.c    |  2 --
 loaders/python/peas-plugin-loader-python.c |  2 --
 meson.build                                | 13 ++++++++++++-
 9 files changed, 12 insertions(+), 33 deletions(-)
---
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index e6c7455..b623738 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -1299,7 +1299,6 @@ peas_engine_provides_extension (PeasEngine     *engine,
   return peas_plugin_loader_provides_extension (loader, info, extension_type);
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 /**
  * peas_engine_create_extensionv: (skip)
  * @engine: A #PeasEngine.
@@ -1351,7 +1350,6 @@ peas_engine_create_extensionv (PeasEngine     *engine,
 
   return extension;
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 /**
  * peas_engine_create_extension_with_properties: (rename-to peas_engine_create_extension)
@@ -1384,8 +1382,6 @@ peas_engine_create_extension_with_properties (PeasEngine     *engine,
                                               const gchar   **prop_names,
                                               const GValue   *prop_values)
 {
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-
   PeasPluginLoader *loader;
   PeasExtension *extension;
   GParameter *parameters = NULL;
@@ -1430,8 +1426,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     }
 
   return extension;
-
-G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 /**
@@ -1462,9 +1456,7 @@ peas_engine_create_extension_valist (PeasEngine     *engine,
                                      const gchar    *first_property,
                                      va_list         var_args)
 {
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   GParameter *parameters;
-  G_GNUC_END_IGNORE_DEPRECATIONS
 
   PeasExtension *exten;
   guint n_parameters;
diff --git a/libpeas/peas-extension-set.c b/libpeas/peas-extension-set.c
index 8cda515..3bbeb09 100644
--- a/libpeas/peas-extension-set.c
+++ b/libpeas/peas-extension-set.c
@@ -91,9 +91,7 @@ struct _PeasExtensionSetPrivate {
   GType exten_type;
   guint n_parameters;
 
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   GParameter *parameters;
-  G_GNUC_END_IGNORE_DEPRECATIONS
 
   GQueue extensions;
 };
@@ -106,9 +104,7 @@ typedef struct {
 typedef struct {
   guint n_parameters;
 
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   GParameter *parameters;
-  G_GNUC_END_IGNORE_DEPRECATIONS
 } PeasParameterArray;
 
 /* Signals */
@@ -146,9 +142,7 @@ set_construct_properties (PeasExtensionSet   *set,
 
   priv->n_parameters = array->n_parameters;
 
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   priv->parameters = g_new0 (GParameter, array->n_parameters);
-  G_GNUC_END_IGNORE_DEPRECATIONS
 
   for (i = 0; i < array->n_parameters; i++)
     {
@@ -611,8 +605,6 @@ peas_extension_set_foreach (PeasExtensionSet            *set,
     }
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-
 /**
  * peas_extension_set_newv: (skip)
  * @engine: (allow-none): A #PeasEngine, or %NULL.
@@ -766,8 +758,6 @@ peas_extension_set_new_valist (PeasEngine  *engine,
   return set;
 }
 
-G_GNUC_END_IGNORE_DEPRECATIONS
-
 /**
  * peas_extension_set_new: (skip)
  * @engine: (allow-none): A #PeasEngine, or %NULL.
diff --git a/libpeas/peas-object-module.c b/libpeas/peas-object-module.c
index 53485b9..10e7d82 100644
--- a/libpeas/peas-object-module.c
+++ b/libpeas/peas-object-module.c
@@ -431,7 +431,6 @@ peas_object_module_new_embedded (const gchar *module_name,
                                            NULL));
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 /**
  * peas_object_module_create_object: (skip)
  * @module: A #PeasObjectModule.
@@ -472,7 +471,6 @@ peas_object_module_create_object (PeasObjectModule *module,
 
   return NULL;
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 /**
  * peas_object_module_provides_object: (skip)
@@ -624,7 +622,6 @@ peas_object_module_register_extension_factory (PeasObjectModule *module,
   g_debug ("Registered extension for type '%s'", g_type_name (exten_type));
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 static GObject *
 create_gobject_from_type (guint       n_parameters,
                           GParameter *parameters,
@@ -654,7 +651,6 @@ create_gobject_from_type (guint       n_parameters,
 
   return G_OBJECT (g_object_newv (impl_type, n_parameters, parameters));
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 /**
  * peas_object_module_register_extension_type:
diff --git a/libpeas/peas-plugin-loader-c.c b/libpeas/peas-plugin-loader-c.c
index 5395945..a476eb4 100644
--- a/libpeas/peas-plugin-loader-c.c
+++ b/libpeas/peas-plugin-loader-c.c
@@ -110,7 +110,6 @@ peas_plugin_loader_c_provides_extension  (PeasPluginLoader *loader,
   return peas_object_module_provides_object (info->loader_data, exten_type);
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 static PeasExtension *
 peas_plugin_loader_c_create_extension (PeasPluginLoader *loader,
                                        PeasPluginInfo   *info,
@@ -159,7 +158,6 @@ peas_plugin_loader_c_create_extension (PeasPluginLoader *loader,
 
   return instance;
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 static void
 peas_plugin_loader_c_init (PeasPluginLoaderC *cloader)
diff --git a/libpeas/peas-plugin-loader.c b/libpeas/peas-plugin-loader.c
index 7c1ed4b..29fd28f 100644
--- a/libpeas/peas-plugin-loader.c
+++ b/libpeas/peas-plugin-loader.c
@@ -114,7 +114,6 @@ peas_plugin_loader_provides_extension (PeasPluginLoader *loader,
   return klass->provides_extension (loader, info, ext_type);
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 PeasExtension *
 peas_plugin_loader_create_extension (PeasPluginLoader *loader,
                                      PeasPluginInfo   *info,
@@ -130,7 +129,6 @@ peas_plugin_loader_create_extension (PeasPluginLoader *loader,
   return klass->create_extension (loader, info, ext_type,
                                   n_parameters, parameters);
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 void
 peas_plugin_loader_garbage_collect (PeasPluginLoader *loader)
diff --git a/libpeas/peas-utils.c b/libpeas/peas-utils.c
index 31e9a55..ab8b540 100644
--- a/libpeas/peas-utils.c
+++ b/libpeas/peas-utils.c
@@ -180,7 +180,6 @@ find_param_spec_for_prerequisites (const gchar  *name,
   return pspec;
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 gboolean
 peas_utils_properties_array_to_parameter_list (GType          exten_type,
                                                guint          n_properties,
@@ -305,7 +304,6 @@ error:
   g_free (*params);
   return FALSE;
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 gint
 peas_utils_get_loader_id (const gchar *loader)
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index a3c9068..f0826f7 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -155,7 +155,6 @@ peas_plugin_loader_lua_provides_extension (PeasPluginLoader *loader,
   return the_type != G_TYPE_INVALID;
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 static PeasExtension *
 peas_plugin_loader_lua_create_extension (PeasPluginLoader *loader,
                                          PeasPluginInfo   *info,
@@ -196,7 +195,6 @@ out:
   thread_leave (lua_loader, info, &L);
   return object;
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 static gboolean
 peas_plugin_loader_lua_load (PeasPluginLoader *loader,
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 9ac1a77..6d7c582 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -101,7 +101,6 @@ peas_plugin_loader_python_provides_extension (PeasPluginLoader *loader,
   return the_type != G_TYPE_INVALID;
 }
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 static PeasExtension *
 peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
                                             PeasPluginInfo   *info,
@@ -153,7 +152,6 @@ out:
   PyGILState_Release (state);
   return object;
 }
-G_GNUC_END_IGNORE_DEPRECATIONS
 
 static gboolean
 peas_plugin_loader_python_load (PeasPluginLoader *loader,
diff --git a/meson.build b/meson.build
index 14dadf4..fae3e7f 100644
--- a/meson.build
+++ b/meson.build
@@ -83,7 +83,9 @@ config_h.set_quoted('GETTEXT_PACKAGE', package_string)
 # Dependencies
 cc = meson.get_compiler('c')
 
-glib_req = '>= 2.38.0'
+glib_req_version = '2.38.0'
+
+glib_req = '>= @0@'.format(glib_req_version)
 introspection_req = '>= 1.39.0'
 gtk_req = '>= 3.0.0'
 gtk_doc_req = '>= 1.11'
@@ -119,6 +121,15 @@ luajit_dep = dependency('luajit', version: luajit_req, required: false)
 luajit_prg = find_program('luajit', required: false)
 xmllint_prg = find_program('xmllint', required: false)
 
+glib_version_arr = glib_req_version.split('.')
+glib_major_version = glib_version_arr[0]
+glib_minor_version = glib_version_arr[1]
+
+add_project_arguments([
+  '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_@0@_@1@'.format(glib_major_version, glib_minor_version),
+  '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_@0@_@1@'.format(glib_major_version, glib_minor_version),
+], language: 'c')
+
 if build_machine.system() == 'darwin'
   config_h.set_quoted('OS_OSX', 1)
 endif


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