[gjs] build: don't generate modules.gresource.xml



commit 7b4d0926ac4c9ecc37351bfb78aabdc2010ea053
Author: Giovanni Campagna <gcampagna gnome org>
Date:   Tue Mar 4 17:29:36 2014 +0100

    build: don't generate modules.gresource.xml
    
    Doing so breaks distcheck, because it tries to write to $(srcdir).
    Instead, always include the Gtk override in the modules, but
    make it do nothing if gtk is not enabled.

 .gitignore                                         |    1 -
 Makefile-modules.am                                |   10 +---------
 Makefile.am                                        |    4 ++--
 libgjs-private/gjs-gtk-util.h                      |   10 ++++++++++
 ...ules.gresource.xml.in => modules.gresource.xml} |    2 +-
 modules/overrides/Gtk.js                           |    3 +++
 6 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a16d1fb..85de3e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,7 +44,6 @@ jsunit
 jsunit.test
 testSystemExit.test
 modules-resources.[ch]
-modules.gresource.xml
 mock-js-resources.[ch]
 *.gcda
 *.gcno
diff --git a/Makefile-modules.am b/Makefile-modules.am
index ef922a9..07860f4 100644
--- a/Makefile-modules.am
+++ b/Makefile-modules.am
@@ -14,21 +14,13 @@ JS_NATIVE_MODULE_CFLAGS =   \
 JS_NATIVE_MODULE_LIBADD =      \
         $(GJS_LIBS)
 
-if ENABLE_GTK
-gtk_override = <file>modules/overrides/Gtk.js</file>
-endif
-
-$(srcdir)/modules/modules.gresource.xml: $(srcdir)/modules/modules.gresource.xml.in Makefile
-       $(AM_V_GEN) sed -e 's|@GTK_OVERRIDE[ ]|$(gtk_override)|g' $< > $@
-
 modules_resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/modules/modules.gresource.xml)
 modules-resources.h: $(srcdir)/modules/modules.gresource.xml $(modules_resource_files)
        $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name modules_resources $<
 modules-resources.c: $(srcdir)/modules/modules.gresource.xml $(modules_resource_files)
        $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name modules_resources $<
 
-EXTRA_DIST += $(modules_resource_files) $(srcdir)/modules/modules.gresource.xml.in
-CLEANFILES += $(srcdir)/modules/modules.gresource.xml
+EXTRA_DIST += $(modules_resource_files) $(srcdir)/modules/modules.gresource.xml
 
 nodist_libmodules_resources_la_SOURCES = modules-resources.c modules-resources.h
 libmodules_resources_la_CPPFLAGS = $(JS_NATIVE_MODULE_CFLAGS)
diff --git a/Makefile.am b/Makefile.am
index f87125e..6b6bc54 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -157,12 +157,12 @@ libgjs_private_source_files = \
        libgjs-private/gjs-gdbus-wrapper.cpp    \
        libgjs-private/gjs-gdbus-wrapper.h      \
        libgjs-private/gjs-util.cpp             \
-       libgjs-private/gjs-util.h
+       libgjs-private/gjs-util.h               \
+       libgjs-private/gjs-gtk-util.h
 
 if ENABLE_GTK
 libgjs_private_source_files +=                         \
        libgjs-private/gjs-gtk-util.c           \
-       libgjs-private/gjs-gtk-util.h           \
        $(NULL)
 endif
 
diff --git a/libgjs-private/gjs-gtk-util.h b/libgjs-private/gjs-gtk-util.h
index b47971b..987d589 100644
--- a/libgjs-private/gjs-gtk-util.h
+++ b/libgjs-private/gjs-gtk-util.h
@@ -23,10 +23,14 @@
 #ifndef __GJS_PRIVATE_GTK_UTIL_H__
 #define __GJS_PRIVATE_GTK_UTIL_H__
 
+#ifdef ENABLE_GTK
+
 #include <gtk/gtk.h>
 
 G_BEGIN_DECLS
 
+#define GJS_ENABLE_GTK 1
+
 void gjs_gtk_container_child_set_property (GtkContainer *container,
                                            GtkWidget    *child,
                                            const gchar  *property,
@@ -34,4 +38,10 @@ void gjs_gtk_container_child_set_property (GtkContainer *container,
 
 G_END_DECLS
 
+#else
+
+#define GJS_ENABLE_GTK 0
+
+#endif
+
 #endif /* __GJS_PRIVATE_GTK_UTIL_H__ */
diff --git a/modules/modules.gresource.xml.in b/modules/modules.gresource.xml
similarity index 94%
rename from modules/modules.gresource.xml.in
rename to modules/modules.gresource.xml
index 30aab0c..16a91c6 100644
--- a/modules/modules.gresource.xml.in
+++ b/modules/modules.gresource.xml
@@ -8,7 +8,7 @@
     <file>modules/overrides/GLib.js</file>
     <file>modules/overrides/Gio.js</file>
     <file>modules/overrides/GObject.js</file>
-    @GTK_OVERRIDE@
+    <file>modules/overrides/Gtk.js</file>
 
     <file>modules/cairo.js</file>
     <file>modules/coverage.js</file>
diff --git a/modules/overrides/Gtk.js b/modules/overrides/Gtk.js
index c73de88..45c10db 100644
--- a/modules/overrides/Gtk.js
+++ b/modules/overrides/Gtk.js
@@ -4,6 +4,9 @@ var Gtk;
 function _init() {
     Gtk = this;
 
+    if (!GjsPrivate.ENABLE_GTK)
+       return;
+
     Gtk.Container.prototype.child_set_property = function(child, property, value) {
         GjsPrivate.gtk_container_child_set_property(this, child, property, value);
     };


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