From a4593e3ebd0492edd7302b30f260b7fd211d1fca Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 23 Apr 2009 13:18:38 +0200 Subject: [PATCH] WAF: fix the debug variant. problem is they both build by default. need a way to disable the debug variant. --- deps/libeio/wscript | 1 + deps/libev/wscript | 1 + test/test-file-open.js | 1 + wscript | 65 ++++++++++++++++++++++++++---------------- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/deps/libeio/wscript b/deps/libeio/wscript index 0390d7c76e..b168ec3bcb 100644 --- a/deps/libeio/wscript +++ b/deps/libeio/wscript @@ -117,4 +117,5 @@ def build(bld): libeio.target = 'eio' libeio.name = 'eio' libeio.includes = '. ../..' + libeio.clone("debug"); diff --git a/deps/libev/wscript b/deps/libev/wscript index d484a7f24f..8ca38cc8a3 100644 --- a/deps/libev/wscript +++ b/deps/libev/wscript @@ -52,4 +52,5 @@ def build(bld): libev.target = 'ev' libev.name = 'ev' libev.includes = '. ../..' + libev.clone("debug"); diff --git a/test/test-file-open.js b/test/test-file-open.js index 68cd7cbd9f..6c1f6012bf 100644 --- a/test/test-file-open.js +++ b/test/test-file-open.js @@ -10,5 +10,6 @@ function onLoad () { file.open(x, "r", function (status) { assertTrue(status == 0); assert_count += 1; + file.close(); }); }; diff --git a/wscript b/wscript index 308a3cab5b..d7b6ab5f69 100644 --- a/wscript +++ b/wscript @@ -3,6 +3,8 @@ import Options import sys import os from os.path import join, dirname, abspath +from logging import fatal + import js2c @@ -17,22 +19,25 @@ 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' - ) +# 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') conf.check_tool('compiler_cc') conf.check_tool('ragel', tooldir=".") + if not conf.env['RAGEL']: + fatal('ragel not found') + exit(1) + conf.sub_config('deps/libeio') conf.sub_config('deps/libev') - # needs to match the symbols found in libeio and libev # __solaris # __linux @@ -67,34 +72,44 @@ def configure(conf): # Configure default variant conf.setenv('default') - conf.env.append_value('CCFLAGS', ['-DDEBUG', '-O0', '-g']) - conf.env.append_value('CXXFLAGS', ['-DDEBUG', '-O0', '-g']) + 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 deps_src = join(bld.path.abspath(),"deps") - deps_tgt = join(bld.srcnode.abspath(bld.env),"deps") + deps_tgt = join(bld.srcnode.abspath(bld.env_of_name("default")),"deps") v8dir_src = join(deps_src,"v8") v8dir_tgt = join(deps_tgt, "v8") - #v8lib = bld.env["staticlib_PATTERN"] % "v8_g" - v8lib = bld.env["staticlib_PATTERN"] % "v8" + + v8rule = 'cp -rf %s %s && ' \ + 'cd %s && ' \ + 'python scons.py -Q mode=%s library=static snapshot=on' + + v8 = bld.new_task_gen( - target=join("deps/v8",v8lib), - #rule='cp -rf %s %s && cd %s && python scons.py -Q mode=debug library=static snapshot=on' - rule='cp -rf %s %s && cd %s && python scons.py -Q library=static snapshot=on' - % ( v8dir_src , deps_tgt , v8dir_tgt), + target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8"), + rule=v8rule % ( v8dir_src , deps_tgt , v8dir_tgt, "release"), before="cxx" ) bld.env["CPPPATH_V8"] = "deps/v8/include" - bld.env["STATICLIB_V8"] = "v8" - #bld.env["STATICLIB_V8"] = "v8_g" - bld.env["LIBPATH_V8"] = v8dir_tgt bld.env["LINKFLAGS_V8"] = "-pthread" + bld.env_of_name('default')["STATICLIB_V8"] = "v8" + bld.env_of_name('default')["LIBPATH_V8"] = v8dir_tgt + + ### v8 debug + deps_tgt = join(bld.srcnode.abspath(bld.env_of_name("debug")),"deps") + v8dir_tgt = join(deps_tgt, "v8") + + v8_debug = v8.clone("debug") + bld.env_of_name('debug')["STATICLIB_V8"] = "v8_g" + bld.env_of_name('debug')["LIBPATH_V8"] = v8dir_tgt + bld.env_of_name('debug')["LINKFLAGS_V8"] = "-pthread" + v8_debug.rule = v8rule % ( v8dir_src , deps_tgt , v8dir_tgt, "debug") + v8_debug.target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8_g") ### oi oi = bld.new_task_gen("cc", "staticlib") @@ -103,6 +118,7 @@ def build(bld): oi.name = "oi" oi.target = "oi" oi.uselib = "GNUTLS" + oi.clone("debug") ### ebb ebb = bld.new_task_gen("cc", "staticlib") @@ -110,6 +126,7 @@ def build(bld): ebb.includes = "deps/libebb/" ebb.name = "ebb" ebb.target = "ebb" + ebb.clone("debug") ### src/native.cc def javascript_in_c(task): @@ -124,7 +141,7 @@ def build(bld): rule=javascript_in_c, before="cxx" ) - + native_cc.clone("debug") ### node node = bld.new_task_gen("cxx", "program") @@ -147,7 +164,5 @@ def build(bld): """ node.uselib_local = "oi ev eio ebb" node.uselib = "V8 RT" + node.clone("debug") - if Options.options.debug: - print "debug build!" - bld.env = bld.env_of_name('debug')