changeset 544:16f4f8305c8f Android_Skia

Start MadButterfly nodejs plugin
author Thinker K.F. Li <thinker@branda.to>
date Fri, 04 Jun 2010 22:29:26 +0800
parents 7630dac0a104
children 49f8f57f184a
files configure.ac nodejs/Makefile.am nodejs/hello.cc nodejs/wscript
diffstat 4 files changed, 44 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Fri Jun 04 22:29:08 2010 +0800
+++ b/configure.ac	Fri Jun 04 22:29:26 2010 +0800
@@ -94,6 +94,7 @@
   *) AC_MSG_ERROR([bad value ${enableval} for --enable-nodejs]) ;;
 esac],[nodejs=false])
 [if [ x"${nodejs}" = xtrue ]; then ]
+  AC_PATH_PROG([NODE_WAF], [node-waf])
   AC_CHECK_PROG([has_node], [node], [true], [false])
 [fi]
 AM_CONDITIONAL([NODEJS], [test x"${nodejs}-${has_node}" = xtrue-true])
--- a/nodejs/Makefile.am	Fri Jun 04 22:29:08 2010 +0800
+++ b/nodejs/Makefile.am	Fri Jun 04 22:29:26 2010 +0800
@@ -1,1 +1,13 @@
-# empty
+
+mbfly_node_SRCS = hello.cc
+
+all: mbfly.node
+clean: clean-mbfly-node
+
+mbfly.node: wscript $(mbfly_node_SRCS)
+	cd $(srcdir); \
+	WAFLOCK=$(abs_builddir)/.lock-wscript $(NODE_WAF) \
+		configure build --blddir=$(abs_builddir)
+
+clean-mbfly-node:
+	$(NODE_WAF) clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nodejs/hello.cc	Fri Jun 04 22:29:26 2010 +0800
@@ -0,0 +1,10 @@
+#include <v8.h>
+
+using namespace v8;
+
+extern "C" void
+init(Handle<Object> target) {
+    HandleScope scope;
+
+    target->Set(String::New("Hello"), String::New("World"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nodejs/wscript	Fri Jun 04 22:29:26 2010 +0800
@@ -0,0 +1,20 @@
+srcdir = '.'
+blddir = 'build'
+VERSION = '0.0.1'
+
+def set_options(opt):
+    opt.tool_options('compiler_cxx')
+    pass
+
+def configure(conf):
+    import Options
+    conf.check_tool('compiler_cxx')
+    conf.check_tool('node_addon')
+    conf.env.SRCDIR = Options.options.srcdir
+    pass
+
+def build(conf):
+    obj = conf.new_task_gen('cxx', 'shlib', 'node_addon')
+    obj.target = 'mbfly'
+    obj.source = 'hello.cc'
+    pass