|
@ -3,6 +3,8 @@ import Options |
|
|
import sys |
|
|
import sys |
|
|
import os |
|
|
import os |
|
|
from os.path import join, dirname, abspath |
|
|
from os.path import join, dirname, abspath |
|
|
|
|
|
from logging import fatal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import js2c |
|
|
import js2c |
|
|
|
|
|
|
|
@ -17,22 +19,25 @@ def set_options(opt): |
|
|
opt.tool_options('compiler_cxx') |
|
|
opt.tool_options('compiler_cxx') |
|
|
opt.tool_options('compiler_cc') |
|
|
opt.tool_options('compiler_cc') |
|
|
opt.tool_options('ragel', tdir=".") |
|
|
opt.tool_options('ragel', tdir=".") |
|
|
opt.add_option( '--debug' |
|
|
# opt.add_option( '--debug' |
|
|
, action='store_true' |
|
|
# , action='store_true' |
|
|
, default=False |
|
|
# , default=False |
|
|
, help='Build debug variant [Default: False]' |
|
|
# , help='Build debug variant [Default: False]' |
|
|
, dest='debug' |
|
|
# , dest='debug' |
|
|
) |
|
|
# ) |
|
|
|
|
|
|
|
|
def configure(conf): |
|
|
def configure(conf): |
|
|
conf.check_tool('compiler_cxx') |
|
|
conf.check_tool('compiler_cxx') |
|
|
conf.check_tool('compiler_cc') |
|
|
conf.check_tool('compiler_cc') |
|
|
conf.check_tool('ragel', tooldir=".") |
|
|
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/libeio') |
|
|
conf.sub_config('deps/libev') |
|
|
conf.sub_config('deps/libev') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# needs to match the symbols found in libeio and libev |
|
|
# needs to match the symbols found in libeio and libev |
|
|
# __solaris |
|
|
# __solaris |
|
|
# __linux |
|
|
# __linux |
|
@ -67,34 +72,44 @@ def configure(conf): |
|
|
|
|
|
|
|
|
# Configure default variant |
|
|
# Configure default variant |
|
|
conf.setenv('default') |
|
|
conf.setenv('default') |
|
|
conf.env.append_value('CCFLAGS', ['-DDEBUG', '-O0', '-g']) |
|
|
conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-O2']) |
|
|
conf.env.append_value('CXXFLAGS', ['-DDEBUG', '-O0', '-g']) |
|
|
conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-O2']) |
|
|
conf.write_config_header("config.h") |
|
|
conf.write_config_header("config.h") |
|
|
|
|
|
|
|
|
def build(bld): |
|
|
def build(bld): |
|
|
# Use debug environment when --enable-debug is given |
|
|
|
|
|
|
|
|
|
|
|
bld.add_subdirs('deps/libeio deps/libev') |
|
|
bld.add_subdirs('deps/libeio deps/libev') |
|
|
|
|
|
|
|
|
### v8 |
|
|
### v8 |
|
|
deps_src = join(bld.path.abspath(),"deps") |
|
|
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_src = join(deps_src,"v8") |
|
|
v8dir_tgt = join(deps_tgt, "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( |
|
|
v8 = bld.new_task_gen( |
|
|
target=join("deps/v8",v8lib), |
|
|
target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8"), |
|
|
#rule='cp -rf %s %s && cd %s && python scons.py -Q mode=debug library=static snapshot=on' |
|
|
rule=v8rule % ( v8dir_src , deps_tgt , v8dir_tgt, "release"), |
|
|
rule='cp -rf %s %s && cd %s && python scons.py -Q library=static snapshot=on' |
|
|
|
|
|
% ( v8dir_src , deps_tgt , v8dir_tgt), |
|
|
|
|
|
before="cxx" |
|
|
before="cxx" |
|
|
) |
|
|
) |
|
|
bld.env["CPPPATH_V8"] = "deps/v8/include" |
|
|
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["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 |
|
|
oi = bld.new_task_gen("cc", "staticlib") |
|
|
oi = bld.new_task_gen("cc", "staticlib") |
|
@ -103,6 +118,7 @@ def build(bld): |
|
|
oi.name = "oi" |
|
|
oi.name = "oi" |
|
|
oi.target = "oi" |
|
|
oi.target = "oi" |
|
|
oi.uselib = "GNUTLS" |
|
|
oi.uselib = "GNUTLS" |
|
|
|
|
|
oi.clone("debug") |
|
|
|
|
|
|
|
|
### ebb |
|
|
### ebb |
|
|
ebb = bld.new_task_gen("cc", "staticlib") |
|
|
ebb = bld.new_task_gen("cc", "staticlib") |
|
@ -110,6 +126,7 @@ def build(bld): |
|
|
ebb.includes = "deps/libebb/" |
|
|
ebb.includes = "deps/libebb/" |
|
|
ebb.name = "ebb" |
|
|
ebb.name = "ebb" |
|
|
ebb.target = "ebb" |
|
|
ebb.target = "ebb" |
|
|
|
|
|
ebb.clone("debug") |
|
|
|
|
|
|
|
|
### src/native.cc |
|
|
### src/native.cc |
|
|
def javascript_in_c(task): |
|
|
def javascript_in_c(task): |
|
@ -124,7 +141,7 @@ def build(bld): |
|
|
rule=javascript_in_c, |
|
|
rule=javascript_in_c, |
|
|
before="cxx" |
|
|
before="cxx" |
|
|
) |
|
|
) |
|
|
|
|
|
native_cc.clone("debug") |
|
|
|
|
|
|
|
|
### node |
|
|
### node |
|
|
node = bld.new_task_gen("cxx", "program") |
|
|
node = bld.new_task_gen("cxx", "program") |
|
@ -147,7 +164,5 @@ def build(bld): |
|
|
""" |
|
|
""" |
|
|
node.uselib_local = "oi ev eio ebb" |
|
|
node.uselib_local = "oi ev eio ebb" |
|
|
node.uselib = "V8 RT" |
|
|
node.uselib = "V8 RT" |
|
|
|
|
|
node.clone("debug") |
|
|
|
|
|
|
|
|
if Options.options.debug: |
|
|
|
|
|
print "debug build!" |
|
|
|
|
|
bld.env = bld.env_of_name('debug') |
|
|
|
|
|