The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / wscript @ 63a9cd38
History | View | Annotate | Download (2.74 KB)
1 |
#! /usr/bin/env python |
---|---|
2 |
import Options |
3 |
import sys |
4 |
import os |
5 |
from os.path import join, dirname, abspath |
6 |
|
7 |
import js2c |
8 |
|
9 |
VERSION='0.0.1' |
10 |
APPNAME='node' |
11 |
|
12 |
srcdir = '.' |
13 |
blddir = 'build' |
14 |
|
15 |
def set_options(opt): |
16 |
# the gcc module provides a --debug-level option |
17 |
opt.tool_options('compiler_cxx') |
18 |
opt.tool_options('compiler_cc') |
19 |
opt.tool_options('ragel', tdir=".") |
20 |
|
21 |
def configure(conf): |
22 |
conf.check_tool('compiler_cxx') |
23 |
conf.check_tool('compiler_cc') |
24 |
conf.check_tool('ragel', tooldir=".") |
25 |
|
26 |
conf.sub_config('deps/libeio') |
27 |
conf.sub_config('deps/libev') |
28 |
|
29 |
# needs to match the symbols found in libeio and libev |
30 |
# __solaris |
31 |
# __linux |
32 |
# __freebsd |
33 |
# __hpux |
34 |
# __solaris |
35 |
platform_string = "__" + Options.platform |
36 |
if Options.platform == "linux2": |
37 |
platform_string = "__linux" |
38 |
conf.define(platform_string, 1) |
39 |
|
40 |
# liboi config |
41 |
print "--- liboi ---" |
42 |
if conf.check_cfg(package='gnutls', args='--cflags --libs', uselib_store="GNUTLS"): |
43 |
conf.define("HAVE_GNUTLS", 1) |
44 |
|
45 |
conf.define("HAVE_CONFIG_H", 1) |
46 |
conf.write_config_header('config.h') |
47 |
|
48 |
|
49 |
def build(bld): |
50 |
bld.add_subdirs('deps/libeio deps/libev') |
51 |
|
52 |
### v8 |
53 |
deps_src = join(bld.path.abspath(),"deps") |
54 |
deps_tgt = join(bld.srcnode.abspath(bld.env),"deps") |
55 |
v8dir_src = join(deps_src,"v8") |
56 |
v8dir_tgt = join(deps_tgt, "v8") |
57 |
v8lib = bld.env["staticlib_PATTERN"] % "v8" |
58 |
v8 = bld.new_task_gen( |
59 |
target=join("deps/v8",v8lib), |
60 |
rule='cp -rf %s %s && cd %s && scons -Q library=static snapshot=on' |
61 |
% ( v8dir_src |
62 |
, deps_tgt |
63 |
, v8dir_tgt |
64 |
), |
65 |
before="cxx" |
66 |
) |
67 |
bld.env["CPPPATH_V8"] = "deps/v8/include" |
68 |
bld.env["STATICLIB_V8"] = "v8" |
69 |
bld.env["LIBPATH_V8"] = v8dir_tgt |
70 |
bld.env["LINKFLAGS_V8"] = "-pthread" |
71 |
|
72 |
### oi |
73 |
oi = bld.new_task_gen("cc", "staticlib") |
74 |
oi.source = "deps/oi/oi_socket.c deps/oi/oi_buf.c" |
75 |
oi.includes = "deps/oi/" |
76 |
oi.name = "oi" |
77 |
oi.target = "oi" |
78 |
oi.uselib = "GNUTLS" |
79 |
|
80 |
### ebb |
81 |
ebb = bld.new_task_gen("cc", "staticlib") |
82 |
ebb.source = "deps/ebb/ebb_request_parser.rl" |
83 |
ebb.includes = "deps/ebb/" |
84 |
ebb.name = "ebb" |
85 |
ebb.target = "ebb" |
86 |
|
87 |
### src/native.cc |
88 |
def javascript_in_c(task): |
89 |
env = task.env |
90 |
source = map(lambda x: x.srcpath(env), task.inputs) |
91 |
targets = map(lambda x: x.srcpath(env), task.outputs) |
92 |
js2c.JS2C(source, targets) |
93 |
|
94 |
native_cc = bld.new_task_gen( |
95 |
source="src/main.js", |
96 |
target="src/natives.h", |
97 |
rule=javascript_in_c, |
98 |
before="cxx" |
99 |
) |
100 |
|
101 |
|
102 |
### node |
103 |
node = bld.new_task_gen("cxx", "program") |
104 |
node.target = 'node' |
105 |
node.source = """ |
106 |
src/node.cc |
107 |
src/node_http.cc |
108 |
src/process.cc |
109 |
src/file.cc |
110 |
src/node_timer.cc |
111 |
""" |
112 |
node.includes = """ |
113 |
src/ |
114 |
deps/v8/include |
115 |
deps/libev |
116 |
deps/libeio |
117 |
deps/oi |
118 |
deps/ebb |
119 |
""" |
120 |
node.uselib_local = "oi ev eio ebb" |
121 |
node.uselib = "V8" |