Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 187 lines (157 sloc) 5.404 kb
a3627c0 @ry Change to build on FreeBSD
ry authored
1 # /usr/bin/env python
1a126ed @ry use the WAF build system
ry authored
2 import Options
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
3 import sys
1a126ed @ry use the WAF build system
ry authored
4 import os
5 from os.path import join, dirname, abspath
a4593e3 @ry WAF: fix the debug variant.
ry authored
6 from logging import fatal
7
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
8 import js2c
9
fbe0be1 @ry bump version
ry authored
10 VERSION='0.0.6'
1a126ed @ry use the WAF build system
ry authored
11 APPNAME='node'
12
13 srcdir = '.'
14 blddir = 'build'
115c494 @ry Create tools directory
ry authored
15 cwd = os.getcwd()
1a126ed @ry use the WAF build system
ry authored
16
17 def set_options(opt):
18 # the gcc module provides a --debug-level option
19 opt.tool_options('compiler_cxx')
20 opt.tool_options('compiler_cc')
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
21 opt.add_option( '--debug'
22 , action='store_true'
23 , default=False
24 , help='Build debug variant [Default: False]'
25 , dest='debug'
26 )
7bad9de @ry Add electric fence option to configure process
ry authored
27 opt.add_option( '--efence'
28 , action='store_true'
29 , default=False
30 , help='Build with -lefence for debugging [Default: False]'
31 , dest='efence'
32 )
1a126ed @ry use the WAF build system
ry authored
33
34 def configure(conf):
35 conf.check_tool('compiler_cxx')
36 conf.check_tool('compiler_cc')
a4593e3 @ry WAF: fix the debug variant.
ry authored
37
8e7bbf2 @ry get 'make install' working
ry authored
38 conf.env["USE_DEBUG"] = Options.options.debug
1a126ed @ry use the WAF build system
ry authored
39
7bad9de @ry Add electric fence option to configure process
ry authored
40 if Options.options.debug:
41 conf.check(lib='profiler', uselib_store='PROFILER')
42
43 if Options.options.efence:
44 conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
a3627c0 @ry Change to build on FreeBSD
ry authored
45
46 if sys.platform.startswith("freebsd"):
47 if not conf.check(lib="execinfo", libpath=['/usr/lib', '/usr/local/lib'], uselib_store="EXECINFO"):
7bad9de @ry Add electric fence option to configure process
ry authored
48 fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.")
a3627c0 @ry Change to build on FreeBSD
ry authored
49
1a126ed @ry use the WAF build system
ry authored
50 conf.sub_config('deps/libeio')
51 conf.sub_config('deps/libev')
52
452d3f1 @ry comment out gnutls check in wscript until it's used
ry authored
53 # Not using TLS yet
54 # if conf.check_cfg(package='gnutls', args='--cflags --libs', uselib_store="GNUTLS"):
55 # conf.define("HAVE_GNUTLS", 1)
1a126ed @ry use the WAF build system
ry authored
56
57 conf.define("HAVE_CONFIG_H", 1)
c62b124 @ry add scons local for v8. check for librt in wscript
ry authored
58
7703ad5 @ry update eio. add EIO_STACKSIZE define for getaddrinfo problem
ry authored
59 conf.env.append_value("CCFLAGS", "-DEIO_STACKSIZE=%d" % (4096*8))
427e3f5 @ry Introduce NODE_SET_PROTOTYPE_METHOD which properly sets the signature.
ry authored
60
67af958 @ry rename a few files to remove node_ prefix
ry authored
61 # Split off debug variant before adding variant specific defines
7e1350f @ry add file.write()
ry authored
62 debug_env = conf.env.copy()
63 conf.set_env_name('debug', debug_env)
67af958 @ry rename a few files to remove node_ prefix
ry authored
64
65 # Configure debug variant
7e1350f @ry add file.write()
ry authored
66 conf.setenv('debug')
67af958 @ry rename a few files to remove node_ prefix
ry authored
67 debug_env.set_variant('debug')
a623d76 @ry Add -m32 flags for compiling on 64bit machines.
ry authored
68 debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra', '-m32'])
69 debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra', '-m32'])
67af958 @ry rename a few files to remove node_ prefix
ry authored
70 conf.write_config_header("config.h")
7e1350f @ry add file.write()
ry authored
71
67af958 @ry rename a few files to remove node_ prefix
ry authored
72 # Configure default variant
73 conf.setenv('default')
a623d76 @ry Add -m32 flags for compiling on 64bit machines.
ry authored
74 conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-O3', '-m32'])
75 conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-O3', '-m32'])
67af958 @ry rename a few files to remove node_ prefix
ry authored
76 conf.write_config_header("config.h")
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
77
1a126ed @ry use the WAF build system
ry authored
78 def build(bld):
79 bld.add_subdirs('deps/libeio deps/libev')
80
81 ### v8
82 deps_src = join(bld.path.abspath(),"deps")
a4593e3 @ry WAF: fix the debug variant.
ry authored
83 deps_tgt = join(bld.srcnode.abspath(bld.env_of_name("default")),"deps")
1a126ed @ry use the WAF build system
ry authored
84 v8dir_src = join(deps_src,"v8")
85 v8dir_tgt = join(deps_tgt, "v8")
115c494 @ry Create tools directory
ry authored
86 scons = os.path.join(cwd, 'tools/scons/scons.py')
a4593e3 @ry WAF: fix the debug variant.
ry authored
87
88 v8rule = 'cp -rf %s %s && ' \
89 'cd %s && ' \
115c494 @ry Create tools directory
ry authored
90 'python %s -Q mode=%s library=static snapshot=on'
a4593e3 @ry WAF: fix the debug variant.
ry authored
91
1a126ed @ry use the WAF build system
ry authored
92 v8 = bld.new_task_gen(
a4593e3 @ry WAF: fix the debug variant.
ry authored
93 target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8"),
115c494 @ry Create tools directory
ry authored
94 rule=v8rule % ( v8dir_src , deps_tgt , v8dir_tgt, scons, "release"),
8e7bbf2 @ry get 'make install' working
ry authored
95 before="cxx",
96 install_path = None
1a126ed @ry use the WAF build system
ry authored
97 )
98 bld.env["CPPPATH_V8"] = "deps/v8/include"
a623d76 @ry Add -m32 flags for compiling on 64bit machines.
ry authored
99 bld.env["LINKFLAGS_V8"] = ["-pthread", "-m32"]
a4593e3 @ry WAF: fix the debug variant.
ry authored
100 bld.env_of_name('default')["STATICLIB_V8"] = "v8"
101 bld.env_of_name('default')["LIBPATH_V8"] = v8dir_tgt
102
103 ### v8 debug
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
104 if bld.env["USE_DEBUG"]:
105 deps_tgt = join(bld.srcnode.abspath(bld.env_of_name("debug")),"deps")
106 v8dir_tgt = join(deps_tgt, "v8")
a4593e3 @ry WAF: fix the debug variant.
ry authored
107
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
108 v8_debug = v8.clone("debug")
109 bld.env_of_name('debug')["STATICLIB_V8"] = "v8_g"
110 bld.env_of_name('debug')["LIBPATH_V8"] = v8dir_tgt
a623d76 @ry Add -m32 flags for compiling on 64bit machines.
ry authored
111 bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-pthread", "-m32"]
115c494 @ry Create tools directory
ry authored
112 v8_debug.rule = v8rule % ( v8dir_src , deps_tgt , v8dir_tgt, scons, "debug")
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
113 v8_debug.target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8_g")
1a126ed @ry use the WAF build system
ry authored
114
115 ### oi
116 oi = bld.new_task_gen("cc", "staticlib")
3045038 @ry update oi_socket - modify node code to match
ry authored
117 oi.source = "deps/liboi/oi_socket.c"
94a182a @ry liboi should include libev
ry authored
118 oi.includes = "deps/liboi/ deps/libev/"
1a126ed @ry use the WAF build system
ry authored
119 oi.name = "oi"
120 oi.target = "oi"
452d3f1 @ry comment out gnutls check in wscript until it's used
ry authored
121 # oi.uselib = "GNUTLS"
8e7bbf2 @ry get 'make install' working
ry authored
122 oi.install_path = None
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
123 if bld.env["USE_DEBUG"]:
124 oi.clone("debug")
1a126ed @ry use the WAF build system
ry authored
125
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
126 ### http_parser
127 http_parser = bld.new_task_gen("cc", "staticlib")
128 http_parser.source = "deps/http_parser/http_parser.c"
129 http_parser.includes = "deps/http_parser/"
130 http_parser.name = "http_parser"
131 http_parser.target = "http_parser"
132 http_parser.install_path = None
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
133 if bld.env["USE_DEBUG"]:
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
134 http_parser.clone("debug")
1a126ed @ry use the WAF build system
ry authored
135
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
136 ### src/native.cc
137 def javascript_in_c(task):
138 env = task.env
139 source = map(lambda x: x.srcpath(env), task.inputs)
140 targets = map(lambda x: x.srcpath(env), task.outputs)
141 js2c.JS2C(source, targets)
142
143 native_cc = bld.new_task_gen(
2ecd7ff @ry in the middle putting in event code. broken.
ry authored
144 source = """
145 src/events.js
146 src/http.js
147 src/file.js
148 src/node.js
149 """,
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
150 target="src/natives.h",
151 rule=javascript_in_c,
152 before="cxx"
153 )
8e7bbf2 @ry get 'make install' working
ry authored
154 native_cc.install_path = None
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
155 if bld.env["USE_DEBUG"]:
156 native_cc.clone("debug")
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
157
1a126ed @ry use the WAF build system
ry authored
158 ### node
159 node = bld.new_task_gen("cxx", "program")
160 node.target = 'node'
161 node.source = """
162 src/node.cc
2ecd7ff @ry in the middle putting in event code. broken.
ry authored
163 src/events.cc
67af958 @ry rename a few files to remove node_ prefix
ry authored
164 src/http.cc
707f244 @ry begin clean up of Socket
ry authored
165 src/net.cc
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
166 src/file.cc
f213a27 @ry Refactor setTimeout to be a Timer object.
ry authored
167 src/timer.cc
83cb156 @ry skelton of node.Process
ry authored
168 src/process.cc
b260a91 @ry Add errno constants. Move all constants to `node.constants` namespace.
ry authored
169 src/constants.cc
1a126ed @ry use the WAF build system
ry authored
170 """
171 node.includes = """
172 src/
173 deps/v8/include
174 deps/libev
175 deps/libeio
40c0f75 @ry import full versions of dependency libraries!
ry authored
176 deps/liboi
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
177 deps/http_parser
1a126ed @ry use the WAF build system
ry authored
178 """
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
179 node.uselib_local = "oi ev eio http_parser"
7bad9de @ry Add electric fence option to configure process
ry authored
180 node.uselib = "V8 EXECINFO PROFILER EFENCE"
8e7bbf2 @ry get 'make install' working
ry authored
181 node.install_path = '${PREFIX}/bin'
182 node.chmod = 0755
183
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
184 if bld.env["USE_DEBUG"]:
185 node.clone("debug")
67af958 @ry rename a few files to remove node_ prefix
ry authored
186
Something went wrong with that request. Please try again.