[gjs: 1/45] [cairo] Add a module skeleton and build system



commit 01007bccbf95f98956291b6a8f2808412ac3b58f
Author: Johan Dahlin <johan gnome org>
Date:   Wed Feb 17 18:22:51 2010 -0200

    [cairo] Add a module skeleton and build system

 Makefile-modules.am |   20 +++++++++++++++++++-
 configure.ac        |    5 +++++
 modules/cairo.c     |   36 ++++++++++++++++++++++++++++++++++++
 modules/cairo.js    |   25 +++++++++++++++++++++++++
 4 files changed, 85 insertions(+), 1 deletions(-)
---
diff --git a/Makefile-modules.am b/Makefile-modules.am
index dceede4..f14088b 100644
--- a/Makefile-modules.am
+++ b/Makefile-modules.am
@@ -8,9 +8,10 @@ dist_gjsjs_DATA +=		\
 	modules/lang.js		\
 	modules/jsUnit.js	\
 	modules/signals.js	\
+	modules/cairo.js     \
 	modules/dbus.js
 
-gjsnative_LTLIBRARIES += console.la debugger.la gi.la langNative.la mainloop.la gettextNative.la dbusNative.la
+gjsnative_LTLIBRARIES += console.la debugger.la gi.la langNative.la mainloop.la gettextNative.la dbusNative.la cairoNative.la
 
 JS_NATIVE_MODULE_CFLAGS =	\
         $(AM_CFLAGS)		\
@@ -71,6 +72,23 @@ gettextNative_la_SOURCES =		\
 	modules/gettext-native.h	\
 	modules/gettext-native.c
 
+cairoNative_la_CFLAGS = 				\
+	$(JS_NATIVE_MODULE_CFLAGS)  \
+    $(GJS_CAIRO_CFLAGS)         \
+	$(GJS_GI_CFLAGS)
+cairoNative_la_LIBADD = \
+	libgjs-gi.la				\
+	$(JS_NATIVE_MODULE_LIBADD)		\
+	$(GJS_CAIRO_LIBS)               \
+	$(GJS_GI_LIBS)
+cairoNative_la_LDFLAGS = 				\
+	$(JS_NATIVE_MODULE_LDFLAGS)
+
+cairoNative_la_SOURCES =		\
+	modules/cairo.h	\
+	modules/cairo.c
+
+
 console_la_CFLAGS = 				\
 	$(JS_NATIVE_MODULE_CFLAGS)
 console_la_LIBADD = \
diff --git a/configure.ac b/configure.ac
index 3cca6cc..5f858c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,12 +196,14 @@ fi
 common_packages="gobject-2.0 >= gobject_required_version $JS_PACKAGE"
 gjs_packages="gmodule-2.0 gthread-2.0 $common_packages"
 gjs_gi_packages="gobject-introspection-1.0 >= 0.6.3 $common_packages"
+gjs_cairo_packages="cairo $common_packages"
 gjs_dbus_packages="dbus-glib-1 $common_packages"
 # gjs-tests links against everything
 gjstests_packages="$gjstests_packages $gjs_packages"
 
 PKG_CHECK_MODULES([GJS], [$gjs_packages])
 PKG_CHECK_MODULES([GJS_GI], [$gjs_gi_packages])
+PKG_CHECK_MODULES([GJS_CAIRO], [$gjs_cairo_packages])
 PKG_CHECK_MODULES([GJS_DBUS], [$gjs_dbus_packages])
 PKG_CHECK_MODULES([GJSTESTS], [$gjstests_packages])
 
@@ -212,6 +214,8 @@ if test x"$JS_PACKAGE" = x; then
     GJS_LIBS="$GJS_LIBS $JS_LIBS"
     GJS_GI_CFLAGS="$GJS_GI_CFLAGS $JS_CFLAGS"
     GJS_GI_LIBS="$GJS_GI_LIBS $JS_LIBS"
+    GJS_CAIRO_CFLAGS="$GJS_CAIRO_CFLAGS $JS_CFLAGS"
+    GJS_CAIRO_LIBS="$GJS_CAIRO_LIBS $JS_LIBS"
     GJS_DBUS_CFLAGS="$GJS_DBUS_CFLAGS $JS_CFLAGS"
     GJS_DBUS_LIBS="$GJS_DBUS_LIBS $JS_LIBS"
     GJSTESTS_CFLAGS="$GJSTESTS_CFLAGS $JS_CFLAGS"
@@ -220,6 +224,7 @@ fi
 
 GJS_CFLAGS="$GJS_CFLAGS $JS_EXTRA_CFLAGS"
 GJS_GI_CFLAGS="$GJS_GI_CFLAGS $JS_EXTRA_CFLAGS"
+GJS_CAIRO_CFLAGS="$GJS_CAIRO_CFLAGS $JS_EXTRA_CFLAGS"
 GJS_DBUS_CFLAGS="$GJS_DBUS_CFLAGS $JS_EXTRA_CFLAGS"
 GJSTESTS_CFLAGS="$GJSTESTS_CFLAGS $JS_EXTRA_CFLAGS"
 
diff --git a/modules/cairo.c b/modules/cairo.c
new file mode 100644
index 0000000..9f27940
--- /dev/null
+++ b/modules/cairo.c
@@ -0,0 +1,36 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* Copyright 2010 litl, LLC. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <gjs/gjs.h>
+#include <cairo.h>
+
+JSBool
+gjs_js_define_cairo_stuff(JSContext      *context,
+                          JSObject       *module_obj)
+{
+    return JS_TRUE;
+}
+
+GJS_REGISTER_NATIVE_MODULE("cairoNative", gjs_js_define_cairo_stuff)
+
diff --git a/modules/cairo.js b/modules/cairo.js
new file mode 100644
index 0000000..3ba2e3a
--- /dev/null
+++ b/modules/cairo.js
@@ -0,0 +1,25 @@
+// Copyright 2010 litl, LLC. All Rights Reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+const Lang = imports.lang;
+
+// Merge stuff defined in native code
+Lang.copyProperties(imports.cairoNative, this);
+



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