# HG changeset patch # User Thinker K.F. Li # Date 1275661766 -28800 # Node ID 16f4f8305c8f3c486247fc4ce80b1ad8fe8c8d90 # Parent 7630dac0a104c48eb2cff190900073103e25f14d Start MadButterfly nodejs plugin diff -r 7630dac0a104 -r 16f4f8305c8f configure.ac --- 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]) diff -r 7630dac0a104 -r 16f4f8305c8f nodejs/Makefile.am --- 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 diff -r 7630dac0a104 -r 16f4f8305c8f nodejs/hello.cc --- /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 + +using namespace v8; + +extern "C" void +init(Handle target) { + HandleScope scope; + + target->Set(String::New("Hello"), String::New("World")); +} diff -r 7630dac0a104 -r 16f4f8305c8f nodejs/wscript --- /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