diff --git a/src/node_http.cc b/src/http.cc similarity index 99% rename from src/node_http.cc rename to src/http.cc index 92f66da7e5..de934143e4 100644 --- a/src/node_http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ -#include "node_http.h" #include "node.h" +#include "http.h" #include #include @@ -651,7 +651,7 @@ newHTTPServer (const Arguments& args) } void -Init_http (Handle target) +NodeInit_http (Handle target) { HandleScope scope; diff --git a/src/node_http.h b/src/http.h similarity index 55% rename from src/node_http.h rename to src/http.h index 68a9df7430..83367ab4f6 100644 --- a/src/node_http.h +++ b/src/http.h @@ -3,6 +3,6 @@ #include -void Init_http (v8::Handle target); +void NodeInit_http (v8::Handle target); #endif diff --git a/src/node.cc b/src/node.cc index 700a5529a4..35b4d2bf40 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3,8 +3,8 @@ //#include "net.h" #include "file.h" #include "process.h" -#include "node_http.h" -#include "node_timer.h" +#include "http.h" +#include "timers.h" #include "natives.h" @@ -247,11 +247,11 @@ main (int argc, char *argv[]) g->Set(String::New("ARGV"), arguments); // BUILT-IN MODULES - Init_timer(g); //NodeInit_net(g); + NodeInit_timers(g); NodeInit_process(g); NodeInit_file(g); - Init_http(g); + NodeInit_http(g); // NATIVE JAVASCRIPT MODULES TryCatch try_catch; diff --git a/src/node_timer.h b/src/node_timer.h deleted file mode 100644 index e1bc032786..0000000000 --- a/src/node_timer.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef node_timer_h -#define node_timer_h - -#include - -void Init_timer (v8::Handle target); - -#endif // node_timer_h diff --git a/src/node_timer.cc b/src/timers.cc similarity index 98% rename from src/node_timer.cc rename to src/timers.cc index 184dbf2793..90b0cdcf39 100644 --- a/src/node_timer.cc +++ b/src/timers.cc @@ -1,5 +1,5 @@ #include "node.h" -#include "node_timer.h" +#include "timers.h" #include using namespace v8; @@ -188,7 +188,7 @@ static Handle setInterval } void -Init_timer (Handle target) +NodeInit_timers (Handle target) { HandleScope scope; diff --git a/src/timers.h b/src/timers.h new file mode 100644 index 0000000000..ba0a4a495c --- /dev/null +++ b/src/timers.h @@ -0,0 +1,8 @@ +#ifndef node_timers_h +#define node_timers_h + +#include + +void NodeInit_timers (v8::Handle target); + +#endif // node_timers_h diff --git a/wscript b/wscript index 70f90336f3..dd87bff0bc 100644 --- a/wscript +++ b/wscript @@ -17,6 +17,12 @@ def set_options(opt): opt.tool_options('compiler_cxx') opt.tool_options('compiler_cc') opt.tool_options('ragel', tdir=".") + opt.add_option( '--debug' + , action='store_true' + , default=False + , help='Build debug variant [Default: False]' + , dest='debug' + ) def configure(conf): conf.check_tool('compiler_cxx') @@ -43,15 +49,27 @@ def configure(conf): conf.define("HAVE_GNUTLS", 1) conf.define("HAVE_CONFIG_H", 1) - conf.write_config_header('config.h') - conf.env.append_value('CXXFLAGS', '-g') + # Split off debug variant before adding variant specific defines debug_env = conf.env.copy() conf.set_env_name('debug', debug_env) + + # Configure debug variant conf.setenv('debug') + debug_env.set_variant('debug') + debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra']) + debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra']) + conf.write_config_header("config.h") + # Configure default variant + conf.setenv('default') + conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-O2']) + conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-O2']) + conf.write_config_header("config.h") def build(bld): + # Use debug environment when --enable-debug is given + bld.add_subdirs('deps/libeio deps/libev') ### v8 @@ -65,10 +83,7 @@ def build(bld): target=join("deps/v8",v8lib), rule='cp -rf %s %s && cd %s && scons -Q mode=debug library=static snapshot=on' #rule='cp -rf %s %s && cd %s && scons -Q library=static snapshot=on' - % ( v8dir_src - , deps_tgt - , v8dir_tgt - ), + % ( v8dir_src , deps_tgt , v8dir_tgt), before="cxx" ) bld.env["CPPPATH_V8"] = "deps/v8/include" @@ -112,10 +127,10 @@ def build(bld): node.target = 'node' node.source = """ src/node.cc - src/node_http.cc + src/http.cc src/process.cc src/file.cc - src/node_timer.cc + src/timers.cc """ node.includes = """ src/ @@ -127,3 +142,7 @@ def build(bld): """ node.uselib_local = "oi ev eio ebb" node.uselib = "V8" + + if Options.options.debug: + print "debug build!" + bld.env = bld.env_of_name('debug')