[gnome-maps/wip/binary] Make gnome-maps a binary
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/binary] Make gnome-maps a binary
- Date: Tue, 21 Jan 2014 08:51:48 +0000 (UTC)
commit 0330cecd50e6ecfe1eb732bd13974bb6ebbf419d
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Tue Jan 21 06:50:12 2014 +0100
Make gnome-maps a binary
configure.ac | 8 ++++-
src/Makefile-js.am | 38 +++++++-------------
src/Makefile.am | 53 +++++++++++++++++----------
src/application.js | 3 --
src/gnome-maps.c | 70 +++++++++++++++++++++++++++++++++++++
src/gnome-maps.data.gresource.xml | 15 ++++++++
src/gnome-maps.gresource.xml | 15 --------
src/gnome-maps.in | 18 ---------
src/gnome-maps.js.gresource.xml | 21 +++++++++++
9 files changed, 159 insertions(+), 82 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6d475b6..5e21f67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AC_INIT([gnome-maps],
[gnome-maps])
AC_CONFIG_HEADERS([config/config.h])
-AC_CONFIG_SRCDIR([src/main.js])
+AC_CONFIG_SRCDIR([src/gnome-maps.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
@@ -22,6 +22,12 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext d
IT_PROG_INTLTOOL(0.40.0)
PKG_PROG_PKG_CONFIG([0.22])
+SHARED_PCS="gtk+-3.0 >= 3.11.4
+ gjs-internals-1.0 >= 1.39.0
+ gobject-introspection-1.0 >= 0.10.1"
+
+PKG_CHECK_MODULES(GNOME_MAPS, $SHARED_PCS)
+
# no stupid static libraries
AM_DISABLE_STATIC
# enable libtool
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index a7055f5..bd2092a 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -1,21 +1,3 @@
-jsdir = $(pkgdatadir)/js/
-dist_js_DATA = \
- application.js \
- main.js \
- mainWindow.js \
- mapLocation.js \
- mapView.js \
- path.js \
- sidebar.js \
- settings.js \
- utils.js \
- userLocation.js \
- geoclue.js \
- zoomControl.js \
- searchPopup.js \
- contextMenu.js \
- placeStore.js
-
BUILT_SOURCES += \
path.js \
config.js
@@ -25,13 +7,19 @@ path.js: Makefile path.js.in
config.js: Makefile config.js.in
$(AM_V_GEN) $(do_subst) $(srcdir)/config.js.in > $@
-nodist_js_DATA = \
- path.js \
- config.js
+js_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies
$(srcdir)/gnome-maps.js.gresource.xml)
+gnome-maps-js.h: gnome-maps.js.gresource.xml $(js_files) path.js config.js
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir)
--generate --c-name gnome_maps_js $<
+gnome-maps-js.c: gnome-maps.js.gresource.xml $(js_files) path.js config.js
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir)
--generate --c-name gnome_maps_js $<
+
+js_built_sources = gnome-maps-js.c gnome-maps-js.h
+
+BUILT_SOURCES += $(js_built_sources)
-CLEANFILES += \
- $(BUILT_SOURCES)
+CLEANFILES += $(js_built_sources)
-EXTRA_DIST += \
- path.js.in \
+EXTRA_DIST += \
+ gnome-maps.js.gresource.xml \
+ path.js.in \
config.js.in
diff --git a/src/Makefile.am b/src/Makefile.am
index b5dbbc0..16ab883 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,23 +20,36 @@ do_subst = sed -e 's|@abs_top_srcdir[ ]|$(abs_top_srcdir)|g' \
include $(INTROSPECTION_MAKEFILE)
include Makefile-js.am
-resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies
$(srcdir)/gnome-maps.gresource.xml)
-gnome-maps.gresource: gnome-maps.gresource.xml $(resource_files)
- $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $<
-EXTRA_DIST += gnome-maps.gresource.xml $(resource_files)
-
-resourcedir = $(pkgdatadir)
-resource_DATA = gnome-maps.gresource
-
-CLEANFILES += gnome-maps.gresource
-
-bin_SCRIPTS = gnome-maps
-
-gnome-maps: gnome-maps.in
- $(AM_V_GEN) $(do_subst) $< > $@
- chmod +x $@
-
-CLEANFILES += \
- gnome-maps
-EXTRA_DIST += \
- gnome-maps.in
+data_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(datadir) --generate-dependencies
$(srcdir)/gnome-maps.data.gresource.xml)
+gnome-maps-data.h: gnome-maps.data.gresource.xml $(data_files)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir)
--generate --c-name gnome_maps_data $<
+gnome-maps-data.c: gnome-maps.data.gresource.xml $(data_files)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir)
--generate --c-name gnome_maps_data $<
+
+EXTRA_DIST += gnome-maps.data.gresource.xml $(resource_files)
+
+data_built_sources = gnome-maps-data.c gnome-maps-data.h
+
+BUILT_SOURCES += $(data_built_sources)
+
+bin_PROGRAMS = gnome-maps
+
+CLEANFILES += \
+ gnome-maps \
+ $(data_built_sources)
+
+gnome_maps_SOURCES = gnome-maps.c \
+ $(NULL)
+nodist_gnome_maps_SOURCES = \
+ $(top_builddir)/src/gnome-maps-data.c \
+ $(top_builddir)/src/gnome-maps-data.h \
+ $(top_builddir)/src/gnome-maps-js.c \
+ $(top_builddir)/src/gnome-maps-js.h \
+ $(NULL)
+
+gnome_maps_CPPFLAGS = \
+ $(GNOME_MAPS_CFLAGS) \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DGNOME_MAPS_PKGLIBDIR=\"$(pkglibdir)\"
+gnome_maps_LDADD = \
+ $(GNOME_MAPS_LIBS)
diff --git a/src/application.js b/src/application.js
index 3a67dc6..de4cdfc 100644
--- a/src/application.js
+++ b/src/application.js
@@ -75,9 +75,6 @@ const Application = new Lang.Class({
GtkClutter.init(null);
- let resource = Gio.Resource.load(Path.RESOURCE_DIR + '/gnome-maps.gresource');
- resource._register();
-
Utils.loadStyleSheet(Gio.file_new_for_uri('resource:///org/gnome/maps/application.css'));
application = this;
diff --git a/src/gnome-maps.c b/src/gnome-maps.c
new file mode 100644
index 0000000..b2bb1ac
--- /dev/null
+++ b/src/gnome-maps.c
@@ -0,0 +1,70 @@
+/* -*- Mode: C; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * GNOME Maps 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.
+ *
+ * GNOME Maps 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 GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Florian Müllner <fmuellner gnome org>
+ * Mattias Bengtsson <mattias jc bengtsson gmail com>
+ */
+
+#include "config.h"
+
+#include <girepository.h>
+#include <gjs/gjs.h>
+
+int
+main (int argc, char *argv)
+{
+ const char *search_path[] = { "resource:///org/gnome/maps", NULL };
+ GError *error = NULL;
+ GjsContext *context;
+ int status;
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ g_irepository_prepend_search_path (GNOME_MAPS_PKGLIBDIR);
+
+ context = g_object_new (GJS_TYPE_CONTEXT,
+ "search-path", search_path,
+ NULL);
+
+ if (!gjs_context_define_string_array(context, "ARGV",
+ argc - 1, (const char**)argv + 1,
+ &error))
+ {
+ g_message("Failed to defined ARGV: %s", error->message);
+ g_error_free (error);
+
+ return 1;
+ }
+
+
+ if (!gjs_context_eval (context,
+ "const Main = imports.main; Main.start();",
+ -1,
+ "<main>",
+ &status,
+ &error))
+ {
+ g_message ("Execution of main.js threw exception: %s", error->message);
+ g_error_free (error);
+
+ return status;
+ }
+
+ return 0;
+}
diff --git a/src/gnome-maps.data.gresource.xml b/src/gnome-maps.data.gresource.xml
new file mode 100644
index 0000000..b56e35f
--- /dev/null
+++ b/src/gnome-maps.data.gresource.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/maps">
+ <file preprocess="xml-stripblanks">app-menu.ui</file>
+ <file preprocess="xml-stripblanks">main-window.ui</file>
+ <file preprocess="xml-stripblanks">zoom-control.ui</file>
+ <file preprocess="xml-stripblanks">search-popup.ui</file>
+ <file preprocess="xml-stripblanks">context-menu.ui</file>
+ <file alias="application.css">../data/gnome-maps.css</file>
+ <file alias="zoom-in.png">../data/media/zoom-in.png</file>
+ <file alias="zoom-out.png">../data/media/zoom-out.png</file>
+ <file alias="zoom-in-insensitive.png">../data/media/zoom-in-insensitive.png</file>
+ <file alias="zoom-out-insensitive.png">../data/media/zoom-out-insensitive.png</file>
+ </gresource>
+</gresources>
diff --git a/src/gnome-maps.js.gresource.xml b/src/gnome-maps.js.gresource.xml
new file mode 100644
index 0000000..cb9a57c
--- /dev/null
+++ b/src/gnome-maps.js.gresource.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/maps">
+ <file>application.js</file>
+ <file>config.js</file>
+ <file>contextMenu.js</file>
+ <file>geoclue.js</file>
+ <file>main.js</file>
+ <file>mainWindow.js</file>
+ <file>mapLocation.js</file>
+ <file>mapView.js</file>
+ <file>path.js</file>
+ <file>placeStore.js</file>
+ <file>searchPopup.js</file>
+ <file>settings.js</file>
+ <file>sidebar.js</file>
+ <file>userLocation.js</file>
+ <file>utils.js</file>
+ <file>zoomControl.js</file>
+ </gresource>
+</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]