[mutter] meta: Add generated meta-version.h



commit 8734477d526b5a5d9ac08685b5fc02f204fc55e3
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Jun 5 14:05:16 2014 +0200

    meta: Add generated meta-version.h
    
    Avoid populating *_VERSION constants through cflags in pkg-config-file
    which could be overridden by the project using it. Properly prefix the
    defines with META_ to make gi-scanner happy.

 .gitignore                         |    1 +
 configure.ac                       |    1 +
 src/Makefile.am                    |   21 +++++++++++++++------
 src/compositor/meta-module.c       |    3 ++-
 src/compositor/plugins/Makefile.am |    5 +----
 src/libmutter.pc.in                |    7 +------
 src/meta/meta-plugin.h             |    9 +++++----
 src/meta/meta-version.h.in         |   28 ++++++++++++++++++++++++++++
 8 files changed, 54 insertions(+), 21 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index c2b89a4..eaec113 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,6 +75,7 @@ src/xdg-shell-protocol.c
 src/xdg-shell-server-protocol.h
 src/xserver-protocol.c
 src/xserver-server-protocol.h
+src/meta/meta-version.h
 doc/reference/*.args
 doc/reference/*.bak
 doc/reference/*.hierarchy
diff --git a/configure.ac b/configure.ac
index ead3257..35a8c3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -387,6 +387,7 @@ doc/reference/meta-docs.sgml
 src/Makefile
 src/libmutter.pc
 src/compositor/plugins/Makefile
+src/meta/meta-version.h
 po/Makefile.in
 ])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index fdd0334..7bebe04 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,7 @@ AM_CPPFLAGS = \
        -DCOGL_ENABLE_EXPERIMENTAL_2_0_API                              \
        $(MUTTER_CFLAGS)                                                \
        $(MUTTER_NATIVE_BACKEND_CFLAGS)                                 \
+       -I$(builddir)                                                   \
        -I$(srcdir)                                                     \
        -I$(srcdir)/backends                                            \
        -I$(srcdir)/core                                                \
@@ -23,10 +24,6 @@ AM_CPPFLAGS = \
        -DMUTTER_DATADIR=\"$(datadir)\"                                 \
        -DG_LOG_DOMAIN=\"mutter\"                                       \
        -DSN_API_NOT_YET_FROZEN=1                                       \
-       -DMUTTER_MAJOR_VERSION=$(MUTTER_MAJOR_VERSION)                  \
-       -DMUTTER_MINOR_VERSION=$(MUTTER_MINOR_VERSION)                  \
-       -DMUTTER_MICRO_VERSION=$(MUTTER_MICRO_VERSION)                  \
-       -DMUTTER_PLUGIN_API_VERSION=$(MUTTER_PLUGIN_API_VERSION)        \
        -DMUTTER_PKGLIBDIR=\"$(pkglibdir)\"                             \
        -DMUTTER_PLUGIN_DIR=\"$(MUTTER_PLUGIN_DIR)\"                    \
        -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"                        \
@@ -36,6 +33,7 @@ mutter_built_sources = \
        $(dbus_idle_built_sources)              \
        $(dbus_display_config_built_sources)    \
        $(dbus_login1_built_sources)            \
+       meta/meta-version.h                     \
        mutter-enum-types.h                     \
        mutter-enum-types.c                     \
        gtk-shell-protocol.c                    \
@@ -257,7 +255,7 @@ libmutter_la_LIBADD  = $(MUTTER_LIBS) $(MUTTER_NATIVE_BACKEND_LIBS)
 
 # Headers installed for plugins; introspected information will
 # be extracted into Mutter-<version>.gir
-libmutterinclude_base_headers =                \
+libmutterinclude_headers =                     \
        meta/barrier.h                          \
        meta/boxes.h                            \
        meta/common.h                           \
@@ -286,6 +284,13 @@ libmutterinclude_base_headers =            \
        meta/window.h                           \
        meta/workspace.h
 
+libmutterinclude_built_headers =               \
+       meta/meta-version.h
+
+libmutterinclude_base_headers =                        \
+       $(libmutterinclude_headers)             \
+       $(libmutterinclude_built_headers)
+
 # Excluded from scanning for introspection but installed
 # atomnames.h: macros cause problems for scanning process
 libmutterinclude_extra_headers =               \
@@ -294,9 +299,12 @@ libmutterinclude_extra_headers =           \
 libmutterincludedir = $(includedir)/mutter/meta
 
 libmutterinclude_HEADERS =                     \
-       $(libmutterinclude_base_headers)        \
+       $(libmutterinclude_headers)             \
        $(libmutterinclude_extra_headers)
 
+nodist_libmutterinclude_HEADERS =              \
+       $(libmutterinclude_built_headers)
+
 bin_PROGRAMS=mutter
 
 mutter_SOURCES = core/mutter.c
@@ -349,6 +357,7 @@ dbus_idle_built_sources = meta-dbus-idle-monitor.c meta-dbus-idle-monitor.h
 
 CLEANFILES =                                   \
        $(mutter_built_sources)                 \
+       $(libmutterinclude_built_headers)       \
        $(typelib_DATA)                         \
        $(gir_DATA)
 
diff --git a/src/compositor/meta-module.c b/src/compositor/meta-module.c
index 1369b80..c78bef7 100644
--- a/src/compositor/meta-module.c
+++ b/src/compositor/meta-module.c
@@ -20,6 +20,7 @@
  */
 
 #include <meta/meta-plugin.h>
+#include <meta/meta-version.h>
 #include "meta-module.h"
 
 #include <gmodule.h>
@@ -68,7 +69,7 @@ meta_module_load (GTypeModule *gmodule)
                       (gpointer *)(void *)&register_type) &&
       info && register_type)
     {
-      if (info->version_api != MUTTER_PLUGIN_API_VERSION)
+      if (info->version_api != META_PLUGIN_API_VERSION)
        g_warning ("Plugin API mismatch for [%s]", priv->path);
       else
         {
diff --git a/src/compositor/plugins/Makefile.am b/src/compositor/plugins/Makefile.am
index 3658245..0725991 100644
--- a/src/compositor/plugins/Makefile.am
+++ b/src/compositor/plugins/Makefile.am
@@ -3,6 +3,7 @@ pkglibdir = $(MUTTER_PLUGIN_DIR)
 
 AM_CPPFLAGS = \
        $(MUTTER_CFLAGS)                                                \
+       -I$(top_builddir)/src                                           \
        -I$(top_srcdir)/src                                             \
        -DMUTTER_LIBEXECDIR=\"$(libexecdir)\"                           \
        -DMUTTER_LOCALEDIR=\"$(localedir)\"                             \
@@ -10,10 +11,6 @@ AM_CPPFLAGS = \
        -DMUTTER_DATADIR=\"$(datadir)\"                                 \
        -DG_LOG_DOMAIN=\"mutter\"                                       \
        -DSN_API_NOT_YET_FROZEN=1                                       \
-       -DMUTTER_MAJOR_VERSION=$(MUTTER_MAJOR_VERSION)                  \
-       -DMUTTER_MINOR_VERSION=$(MUTTER_MINOR_VERSION)                  \
-       -DMUTTER_MICRO_VERSION=$(MUTTER_MICRO_VERSION)                  \
-       -DMUTTER_PLUGIN_API_VERSION=$(MUTTER_PLUGIN_API_VERSION)        \
        -DMUTTER_PLUGIN_DIR=\"$(MUTTER_PLUGIN_DIR)\"
 
 default_la_CFLAGS   = -fPIC
diff --git a/src/libmutter.pc.in b/src/libmutter.pc.in
index 1f819af..3fea36d 100644
--- a/src/libmutter.pc.in
+++ b/src/libmutter.pc.in
@@ -5,14 +5,9 @@ includedir= includedir@
 girdir= libdir@/mutter
 typelibdir= libdir@/mutter
 
-mutter_major_version= MUTTER_MAJOR_VERSION@
-mutter_minor_version= MUTTER_MINOR_VERSION@
-mutter_micro_version= MUTTER_MICRO_VERSION@
-mutter_plugin_api_version= MUTTER_PLUGIN_API_VERSION@
-
 Name: libmutter
 Description: Mutter window manager library
 Requires: gsettings-desktop-schemas gtk+-3.0 @CLUTTER_PACKAGE@ x11
 Version: @VERSION@
 Libs: -L${libdir} -lmutter
-Cflags: -I${includedir}/mutter -DMUTTER_MAJOR_VERSION=${mutter_major_version} 
-DMUTTER_MINOR_VERSION=${mutter_minor_version} -DMUTTER_MICRO_VERSION=${mutter_micro_version} 
-DMUTTER_PLUGIN_API_VERSION=${mutter_plugin_api_version}
+Cflags: -I${includedir}/mutter
diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h
index d1089e5..55887b4 100644
--- a/src/meta/meta-plugin.h
+++ b/src/meta/meta-plugin.h
@@ -25,6 +25,7 @@
 #include <meta/types.h>
 #include <meta/compositor.h>
 #include <meta/compositor-mutter.h>
+#include <meta/meta-version.h>
 
 #include <clutter/clutter.h>
 #include <X11/extensions/Xfixes.h>
@@ -299,10 +300,10 @@ struct _MetaPluginVersion
 #define META_PLUGIN_DECLARE(ObjectName, object_name)                    \
   G_MODULE_EXPORT MetaPluginVersion meta_plugin_version =               \
     {                                                                   \
-      MUTTER_MAJOR_VERSION,                                             \
-      MUTTER_MINOR_VERSION,                                             \
-      MUTTER_MICRO_VERSION,                                             \
-      MUTTER_PLUGIN_API_VERSION                                         \
+      META_MAJOR_VERSION,                                               \
+      META_MINOR_VERSION,                                               \
+      META_MICRO_VERSION,                                               \
+      META_PLUGIN_API_VERSION                                           \
     };                                                                  \
                                                                         \
   static GType g_define_type_id = 0;                                    \
diff --git a/src/meta/meta-version.h.in b/src/meta/meta-version.h.in
new file mode 100644
index 0000000..bf977cf
--- /dev/null
+++ b/src/meta/meta-version.h.in
@@ -0,0 +1,28 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2014 Rico Tzschichholz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef META_VERSION_H
+#define META_VERSION_H
+
+#define META_MAJOR_VERSION @MUTTER_MAJOR_VERSION@
+#define META_MINOR_VERSION @MUTTER_MINOR_VERSION@
+#define META_MICRO_VERSION @MUTTER_MICRO_VERSION@
+#define META_PLUGIN_API_VERSION @MUTTER_PLUGIN_API_VERSION@
+
+#endif


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