Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 463 lines (387 sloc) 14.909 kB
7a251f3 @ry Fix shebang in wscript
ry authored
1 #!/usr/bin/env python
8ddf930 @ry Build natively on x64.
ry authored
2 import re
1a126ed @ry use the WAF build system
ry authored
3 import Options
41d89f6 @ry Add DNS API.
ry authored
4 import sys, os, shutil
d979ac9 @ry Put git revision into version string
ry authored
5 from Utils import cmd_output
1a126ed @ry use the WAF build system
ry authored
6 from os.path import join, dirname, abspath
a4593e3 @ry WAF: fix the debug variant.
ry authored
7 from logging import fatal
8
d979ac9 @ry Put git revision into version string
ry authored
9 cwd = os.getcwd()
f711d53 @ry bump version
ry authored
10 VERSION="0.1.94"
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
11 APPNAME="node.js"
12
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
13 import js2c
14
1a126ed @ry use the WAF build system
ry authored
15 srcdir = '.'
16 blddir = 'build'
17
18 def set_options(opt):
19 # the gcc module provides a --debug-level option
20 opt.tool_options('compiler_cxx')
21 opt.tool_options('compiler_cc')
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
22 opt.tool_options('misc')
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
23 opt.add_option( '--debug'
24 , action='store_true'
25 , default=False
26 , help='Build debug variant [Default: False]'
27 , dest='debug'
28 )
7bad9de @ry Add electric fence option to configure process
ry authored
29 opt.add_option( '--efence'
30 , action='store_true'
31 , default=False
32 , help='Build with -lefence for debugging [Default: False]'
33 , dest='efence'
34 )
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
35 opt.add_option( '--system'
36 , action='store_true'
37 , default=False
38 , help='Build using system libraries and headers (like a debian build) [Default: False]'
39 , dest='system'
40 )
1a126ed @ry use the WAF build system
ry authored
41
41d89f6 @ry Add DNS API.
ry authored
42 def mkdir_p(dir):
43 if not os.path.exists (dir):
44 os.makedirs (dir)
45
18da8ff @ry Copy Python's shutil.copytree into wscript.
ry authored
46 # Copied from Python 2.6 because 2.4.4 at least is broken by not using
47 # mkdirs
48 # http://mail.python.org/pipermail/python-bugs-list/2005-January/027118.html
49 def copytree(src, dst, symlinks=False, ignore=None):
50 names = os.listdir(src)
51 if ignore is not None:
52 ignored_names = ignore(src, names)
53 else:
54 ignored_names = set()
55
56 os.makedirs(dst)
57 errors = []
58 for name in names:
59 if name in ignored_names:
60 continue
53ebe75 @ry Improve build for V8
ry authored
61 srcname = join(src, name)
62 dstname = join(dst, name)
18da8ff @ry Copy Python's shutil.copytree into wscript.
ry authored
63 try:
64 if symlinks and os.path.islink(srcname):
65 linkto = os.readlink(srcname)
66 os.symlink(linkto, dstname)
67 elif os.path.isdir(srcname):
68 copytree(srcname, dstname, symlinks, ignore)
69 else:
70 shutil.copy2(srcname, dstname)
71 # XXX What about devices, sockets etc.?
72 except (IOError, os.error), why:
73 errors.append((srcname, dstname, str(why)))
74 # catch the Error from the recursive copytree so that we can
75 # continue with other files
76 except Error, err:
77 errors.extend(err.args[0])
78 try:
79 shutil.copystat(src, dst)
80 except OSError, why:
81 if WindowsError is not None and isinstance(why, WindowsError):
82 # Copying file access times may fail on Windows
83 pass
84 else:
85 errors.extend((src, dst, str(why)))
86 if errors:
87 raise Error, errors
88
41d89f6 @ry Add DNS API.
ry authored
89 def conf_subproject (conf, subdir, command=None):
90 print("---- %s ----" % subdir)
91 src = join(conf.srcdir, subdir)
e801f42 @simoncpu Use conf.fatal() instead of fatal() in order to abort the configure s…
simoncpu authored
92 if not os.path.exists (src): conf.fatal("no such subproject " + subdir)
41d89f6 @ry Add DNS API.
ry authored
93
94 default_tgt = join(conf.blddir, "default", subdir)
95
96 if not os.path.exists(default_tgt):
18da8ff @ry Copy Python's shutil.copytree into wscript.
ry authored
97 copytree(src, default_tgt, True)
41d89f6 @ry Add DNS API.
ry authored
98
99 if command:
3337e9d @masuidrive Build system: support spaces in directory names
masuidrive authored
100 if os.system("cd \"%s\" && %s" % (default_tgt, command)) != 0:
e801f42 @simoncpu Use conf.fatal() instead of fatal() in order to abort the configure s…
simoncpu authored
101 conf.fatal("Configuring %s failed." % (subdir))
41d89f6 @ry Add DNS API.
ry authored
102
103 debug_tgt = join(conf.blddir, "debug", subdir)
104
105 if not os.path.exists(debug_tgt):
18da8ff @ry Copy Python's shutil.copytree into wscript.
ry authored
106 copytree(default_tgt, debug_tgt, True)
41d89f6 @ry Add DNS API.
ry authored
107
1a126ed @ry use the WAF build system
ry authored
108 def configure(conf):
109 conf.check_tool('compiler_cxx')
f379b77 @ry Error out when no compiler found
ry authored
110 if not conf.env.CXX: conf.fatal('c++ compiler not found')
1a126ed @ry use the WAF build system
ry authored
111 conf.check_tool('compiler_cc')
f379b77 @ry Error out when no compiler found
ry authored
112 if not conf.env.CC: conf.fatal('c compiler not found')
a4593e3 @ry WAF: fix the debug variant.
ry authored
113
8e7bbf2 @ry get 'make install' working
ry authored
114 conf.env["USE_DEBUG"] = Options.options.debug
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
115 conf.env["USE_SYSTEM"] = Options.options.system
1a126ed @ry use the WAF build system
ry authored
116
2b6d724 @ry First attempt at node.dlopen
ry authored
117 conf.check(lib='dl', uselib_store='DL')
0c12554 @ry Initial Solaris support
ry authored
118 if not sys.platform.startswith("sunos"):
119 conf.env.append_value("CCFLAGS", "-rdynamic")
120 conf.env.append_value("LINKFLAGS_DL", "-rdynamic")
a97dce7 @ry Build static executable.
ry authored
121
d22952b getmem for freebsd
Vanilla Hsu authored
122 if sys.platform.startswith("freebsd"):
123 conf.check(lib='kvm', uselib_store='KVM')
124
8152f9c @ry Revert static library build.
ry authored
125 #if Options.options.debug:
126 # conf.check(lib='profiler', uselib_store='PROFILER')
7bad9de @ry Add electric fence option to configure process
ry authored
127
b8c3d71 @ry use efence again
ry authored
128 if Options.options.efence:
129 conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
a3627c0 @ry Change to build on FreeBSD
ry authored
130
d7a4501 freebsd install execinfo's header to /usr/local, add it to include path.
Vanilla Hsu authored
131 if not conf.check(lib="execinfo", includes=['/usr/include', '/usr/local/include'], libpath=['/usr/lib', '/usr/local/lib'], uselib_store="EXECINFO"):
6eb8bbc @rsms note about why execinfo detection fails on Darwin even though it exists
rsms authored
132 # Note on Darwin/OS X: This will fail, but will still be used as the
133 # execinfo stuff are part of the standard library.
8b62e86 @ry Fix tabs in changelog
ry authored
134 if sys.platform.startswith("freebsd"):
e801f42 @simoncpu Use conf.fatal() instead of fatal() in order to abort the configure s…
simoncpu authored
135 conf.fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.")
a3627c0 @ry Change to build on FreeBSD
ry authored
136
fb3a9cd @waveto Initial openssl support for net2
waveto authored
137 if conf.check_cfg(package='openssl',
138 args='--cflags --libs',
139 uselib_store='OPENSSL'):
140 conf.env["USE_OPENSSL"] = True
141 conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
fa514a9 @opichals Do a manual check for openssl if 'pkg-config openssl' fails.
opichals authored
142 else:
27ec33a @ry Add some libpaths for SSL
ry authored
143 libssl = conf.check_cc(lib='ssl',
144 header_name='openssl/ssl.h',
145 function_name='SSL_library_init',
146 libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'],
147 uselib_store='OPENSSL')
148 libcrypto = conf.check_cc(lib='crypto',
149 header_name='openssl/crypto.h',
150 uselib_store='OPENSSL')
fa514a9 @opichals Do a manual check for openssl if 'pkg-config openssl' fails.
opichals authored
151 if libcrypto and libssl:
152 conf.env["USE_OPENSSL"] = True
153 conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
fb3a9cd @waveto Initial openssl support for net2
waveto authored
154
e9a116f @ry Include c-ares in deps/
ry authored
155 conf.check(lib='rt', uselib_store='RT')
156
0c12554 @ry Initial Solaris support
ry authored
157 if sys.platform.startswith("sunos"):
158 if not conf.check(lib='socket', uselib_store="SOCKET"):
159 conf.fatal("Cannot find socket library")
160 if not conf.check(lib='nsl', uselib_store="NSL"):
161 conf.fatal("Cannot find nsl library")
162
1a126ed @ry use the WAF build system
ry authored
163 conf.sub_config('deps/libeio')
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
164 if not Options.options.system:
165 conf.sub_config('deps/libev')
e9a116f @ry Include c-ares in deps/
ry authored
166 conf.sub_config('deps/c-ares')
0c12554 @ry Initial Solaris support
ry authored
167 else:
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
168 if not conf.check(lib='v8', uselib_store='V8'):
169 conf.fatal("Cannot find V8")
170 if not conf.check(lib='ev', uselib_store='EV'):
171 conf.fatal("Cannot find libev")
e9a116f @ry Include c-ares in deps/
ry authored
172 if not conf.check(lib='cares', uselib_store='CARES'):
173 conf.fatal("Cannot find c-ares")
41d89f6 @ry Add DNS API.
ry authored
174
1a126ed @ry use the WAF build system
ry authored
175 conf.define("HAVE_CONFIG_H", 1)
c62b124 @ry add scons local for v8. check for librt in wscript
ry authored
176
4279725 @ry Fix thread flags on Solaris
ry authored
177 if sys.platform.startswith("sunos"):
178 conf.env.append_value ('CCFLAGS', '-threads')
179 conf.env.append_value ('CXXFLAGS', '-threads')
180 #conf.env.append_value ('LINKFLAGS', ' -threads')
181 else:
182 threadflags='-pthread'
183 conf.env.append_value ('CCFLAGS', threadflags)
184 conf.env.append_value ('CXXFLAGS', threadflags)
185 conf.env.append_value ('LINKFLAGS', threadflags)
186
1beb840 @ry Back to 64kb stack size - enlarging it was a typo
ry authored
187 conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
427e3f5 @ry Introduce NODE_SET_PROTOTYPE_METHOD which properly sets the signature.
ry authored
188
2b743aa @ry Enable large file support.
ry authored
189 # LFS
190 conf.env.append_value('CCFLAGS', '-D_LARGEFILE_SOURCE')
191 conf.env.append_value('CXXFLAGS', '-D_LARGEFILE_SOURCE')
192 conf.env.append_value('CCFLAGS', '-D_FILE_OFFSET_BITS=64')
193 conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
194
f481183 @ry Add process.platform
ry authored
195 # platform
196 platform_def = '-DPLATFORM=' + sys.platform
197 conf.env.append_value('CCFLAGS', platform_def)
198 conf.env.append_value('CXXFLAGS', platform_def)
199
67af958 @ry rename a few files to remove node_ prefix
ry authored
200 # Split off debug variant before adding variant specific defines
7e1350f @ry add file.write()
ry authored
201 debug_env = conf.env.copy()
202 conf.set_env_name('debug', debug_env)
67af958 @ry rename a few files to remove node_ prefix
ry authored
203
204 # Configure debug variant
7e1350f @ry add file.write()
ry authored
205 conf.setenv('debug')
67af958 @ry rename a few files to remove node_ prefix
ry authored
206 debug_env.set_variant('debug')
8ddf930 @ry Build natively on x64.
ry authored
207 debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
208 debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
67af958 @ry rename a few files to remove node_ prefix
ry authored
209 conf.write_config_header("config.h")
7e1350f @ry add file.write()
ry authored
210
67af958 @ry rename a few files to remove node_ prefix
ry authored
211 # Configure default variant
212 conf.setenv('default')
48d58f9 @ry Add symbols to release build
ry authored
213 conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-g', '-O3'])
214 conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-g', '-O3'])
67af958 @ry rename a few files to remove node_ prefix
ry authored
215 conf.write_config_header("config.h")
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
216
41d89f6 @ry Add DNS API.
ry authored
217
53ebe75 @ry Improve build for V8
ry authored
218 def v8_cmd(bld, variant):
219 scons = join(cwd, 'tools/scons/scons.py')
1a126ed @ry use the WAF build system
ry authored
220 deps_src = join(bld.path.abspath(),"deps")
221 v8dir_src = join(deps_src,"v8")
53ebe75 @ry Improve build for V8
ry authored
222
bc9b343 @ry Add note about symbol visibility in V8 to wscript
ry authored
223 # NOTE: We want to compile V8 to export its symbols. I.E. Do not want
224 # -fvisibility=hidden. When using dlopen() it seems that the loaded DSO
225 # cannot see symbols in the executable which are hidden, even if the
226 # executable is statically linked together...
8ddf930 @ry Build natively on x64.
ry authored
227
7d9d881 @ry Correctly guess x64 architecture
ry authored
228 # XXX Remove this when v8 defaults x86_64 to native builds
d85724d @ry Fix wscript for python 2.4
ry authored
229 arch = ""
7d9d881 @ry Correctly guess x64 architecture
ry authored
230 if bld.env['DEST_CPU'] == 'x86_64':
d85724d @ry Fix wscript for python 2.4
ry authored
231 arch = "arch=x64"
232
233 if variant == "default":
234 mode = "release"
235 else:
236 mode = "debug"
a4593e3 @ry WAF: fix the debug variant.
ry authored
237
3337e9d @masuidrive Build system: support spaces in directory names
masuidrive authored
238 cmd_R = 'python "%s" -C "%s" -Y "%s" visibility=default mode=%s %s library=static snapshot=on'
53ebe75 @ry Improve build for V8
ry authored
239
240 cmd = cmd_R % ( scons
241 , bld.srcnode.abspath(bld.env_of_name(variant))
242 , v8dir_src
243 , mode
244 , arch
245 )
246 return cmd
247
248
249 def build_v8(bld):
1a126ed @ry use the WAF build system
ry authored
250 v8 = bld.new_task_gen(
59b7a1b @ry More updates to wscripts v8 building.
ry authored
251 source = 'deps/v8/SConstruct '
252 + bld.path.ant_glob('v8/include/*')
253 + bld.path.ant_glob('v8/src/*'),
53ebe75 @ry Improve build for V8
ry authored
254 target = bld.env["staticlib_PATTERN"] % "v8",
255 rule = v8_cmd(bld, "default"),
256 before = "cxx",
257 install_path = None
1a126ed @ry use the WAF build system
ry authored
258 )
8b62e86 @ry Fix tabs in changelog
ry authored
259 v8.uselib = "EXECINFO"
1a126ed @ry use the WAF build system
ry authored
260 bld.env["CPPPATH_V8"] = "deps/v8/include"
fc937aa @ry Use full path to link to libv8.a and libudns.a
ry authored
261 t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
4279725 @ry Fix thread flags on Solaris
ry authored
262 bld.env_of_name('default').append_value("LINKFLAGS_V8", t)
263
a4593e3 @ry WAF: fix the debug variant.
ry authored
264
265 ### v8 debug
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
266 if bld.env["USE_DEBUG"]:
267 v8_debug = v8.clone("debug")
53ebe75 @ry Improve build for V8
ry authored
268 v8_debug.rule = v8_cmd(bld, "debug")
269 v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g"
8b62e86 @ry Fix tabs in changelog
ry authored
270 v8_debug.uselib = "EXECINFO"
fc937aa @ry Use full path to link to libv8.a and libudns.a
ry authored
271 t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
4279725 @ry Fix thread flags on Solaris
ry authored
272 bld.env_of_name('debug').append_value("LINKFLAGS_V8", t)
1a126ed @ry use the WAF build system
ry authored
273
53ebe75 @ry Improve build for V8
ry authored
274 bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
2b6d724 @ry First attempt at node.dlopen
ry authored
275
41d89f6 @ry Add DNS API.
ry authored
276 def build(bld):
9ea8c9f @ry Clean up c-ares platform includes, add support for a few more
ry authored
277 print "DEST_OS: " + bld.env['DEST_OS']
278 print "DEST_CPU: " + bld.env['DEST_CPU']
279
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
280 if not bld.env["USE_SYSTEM"]:
e9a116f @ry Include c-ares in deps/
ry authored
281 bld.add_subdirs('deps/libeio deps/libev deps/c-ares')
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
282 build_v8(bld)
283 else:
284 bld.add_subdirs('deps/libeio')
285
41d89f6 @ry Add DNS API.
ry authored
286
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
287 ### http_parser
122e74b @ry Link to objects instead of shlibs for evcom, http_parser, coupling
ry authored
288 http_parser = bld.new_task_gen("cc")
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
289 http_parser.source = "deps/http_parser/http_parser.c"
290 http_parser.includes = "deps/http_parser/"
291 http_parser.name = "http_parser"
292 http_parser.target = "http_parser"
293 http_parser.install_path = None
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
294 if bld.env["USE_DEBUG"]:
5a071ad @ry Begin refactor of http.cc. Remove libebb add http_parser.
ry authored
295 http_parser.clone("debug")
1a126ed @ry use the WAF build system
ry authored
296
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
297 ### src/native.cc
b29f787 @zoka Eliminate debug(x) statements from src/node.js and lib/*.js for relea…
zoka authored
298 def make_macros(loc, content):
299 f = open(loc, 'w')
300 f.write(content)
301 f.close
302
303 macros_loc_debug = join(
304 bld.srcnode.abspath(bld.env_of_name("debug")),
305 "macros.py"
306 )
307
308 macros_loc_default = join(
309 bld.srcnode.abspath(bld.env_of_name("default")),
310 "macros.py"
311 )
312
313 make_macros(macros_loc_debug, "") # leave debug(x) as is in debug build
314 # replace debug(x) with nothing in release build
315 make_macros(macros_loc_default, "macro debug(x) = ;\n")
316
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
317 def javascript_in_c(task):
318 env = task.env
319 source = map(lambda x: x.srcpath(env), task.inputs)
320 targets = map(lambda x: x.srcpath(env), task.outputs)
b29f787 @zoka Eliminate debug(x) statements from src/node.js and lib/*.js for relea…
zoka authored
321 source.append(macros_loc_default)
322 js2c.JS2C(source, targets)
323
324 def javascript_in_c_debug(task):
325 env = task.env
326 source = map(lambda x: x.srcpath(env), task.inputs)
327 targets = map(lambda x: x.srcpath(env), task.outputs)
328 source.append(macros_loc_debug)
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
329 js2c.JS2C(source, targets)
330
331 native_cc = bld.new_task_gen(
4ccdc50 @ry Include lib/ directory in node executable. Compile on demand.
ry authored
332 source='src/node.js ' + bld.path.ant_glob('lib/*.js'),
53ebe75 @ry Improve build for V8
ry authored
333 target="src/node_natives.h",
4ccdc50 @ry Include lib/ directory in node executable. Compile on demand.
ry authored
334 before="cxx",
335 install_path=None
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
336 )
4bcb01c @ry Add work-around for configure --debug with Python 2.4.3
ry authored
337
338 # Add the rule /after/ cloning the debug
339 # This is a work around for an error had in python 2.4.3 (I'll paste the
340 # error that was had into the git commit meessage. git-blame to find out
341 # where.)
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
342 if bld.env["USE_DEBUG"]:
4bcb01c @ry Add work-around for configure --debug with Python 2.4.3
ry authored
343 native_cc_debug = native_cc.clone("debug")
b29f787 @zoka Eliminate debug(x) statements from src/node.js and lib/*.js for relea…
zoka authored
344 native_cc_debug.rule = javascript_in_c_debug
345
4bcb01c @ry Add work-around for configure --debug with Python 2.4.3
ry authored
346 native_cc.rule = javascript_in_c
63a9cd3 @ry everything is changed. i've waited much too long to commit.
ry authored
347
2b6d724 @ry First attempt at node.dlopen
ry authored
348 ### node lib
8152f9c @ry Revert static library build.
ry authored
349 node = bld.new_task_gen("cxx", "program")
350 node.name = "node"
351 node.target = "node"
352 node.source = """
1a126ed @ry use the WAF build system
ry authored
353 src/node.cc
630bb7a @ry Rename blob to buffer.
ry authored
354 src/node_buffer.cc
42ee169 @ry Implement new http-parser binding using Buffer
ry authored
355 src/node_http_parser.cc
bf803f4 @ry Reimplment Buffers
ry authored
356 src/node_net2.cc
f219938 @ry add io watcher
ry authored
357 src/node_io_watcher.cc
a5df0f6 @ry Prefix all source files with node_
ry authored
358 src/node_child_process.cc
359 src/node_constants.cc
dc1f4eb @blazzy c-ares based dns module
blazzy authored
360 src/node_cares.cc
a5df0f6 @ry Prefix all source files with node_
ry authored
361 src/node_events.cc
362 src/node_file.cc
8492c52 @ry Use uniform watcher names
ry authored
363 src/node_signal_watcher.cc
364 src/node_stat_watcher.cc
17c6a67 @ry Introduce node.stdio
ry authored
365 src/node_stdio.cc
a5df0f6 @ry Prefix all source files with node_
ry authored
366 src/node_timer.cc
c2a0672 @herby Script class with eval-function-family in binding('evals') plus tests.
herby authored
367 src/node_script.cc
1a126ed @ry use the WAF build system
ry authored
368 """
fb3a9cd @waveto Initial openssl support for net2
waveto authored
369 if bld.env["USE_OPENSSL"]:
370 node.source += "src/node_crypto.cc"
371
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
372 if not bld.env["USE_SYSTEM"]:
373 node.includes = """
374 src/
375 deps/v8/include
376 deps/libev
e9a116f @ry Include c-ares in deps/
ry authored
377 deps/c-ares
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
378 deps/libeio
379 deps/http_parser
380 """
e9a116f @ry Include c-ares in deps/
ry authored
381
9ea8c9f @ry Clean up c-ares platform includes, add support for a few more
ry authored
382 node.includes += ' deps/c-ares/' + bld.env['DEST_OS'] + '-' + bld.env['DEST_CPU']
067f408 add c-ares' freebsd support.
Vanilla Hsu authored
383
e9a116f @ry Include c-ares in deps/
ry authored
384
2035612 @felixge Remove coupling dep
felixge authored
385 node.add_objects = 'cares ev eio http_parser'
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
386 node.uselib_local = ''
610faf7 @kapouer Drop UDNS from node.uselib. Add CARES for --system.
kapouer authored
387 node.uselib = 'RT OPENSSL V8 EXECINFO DL KVM SOCKET NSL'
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
388 else:
389 node.includes = """
390 src/
391 deps/libeio
392 deps/http_parser
393 """
2035612 @felixge Remove coupling dep
felixge authored
394 node.add_objects = 'eio http_parser'
c93bab1 @kapouer Add --system option to configure, so make uses V8, EV, UDNS system li…
kapouer authored
395 node.uselib_local = 'eio'
610faf7 @kapouer Drop UDNS from node.uselib. Add CARES for --system.
kapouer authored
396 node.uselib = 'RT EV OPENSSL CARES V8 EXECINFO DL KVM SOCKET NSL'
b6dda61 @waveto Initial TLS support
waveto authored
397
8152f9c @ry Revert static library build.
ry authored
398 node.install_path = '${PREFIX}/lib'
8e7bbf2 @ry get 'make install' working
ry authored
399 node.install_path = '${PREFIX}/bin'
400 node.chmod = 0755
401
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
402 def subflags(program):
d979ac9 @ry Put git revision into version string
ry authored
403 if os.path.exists(join(cwd, ".git")):
962e929 @ry 'git-describe' to 'git describe'
ry authored
404 actual_version=cmd_output("git describe").strip()
d979ac9 @ry Put git revision into version string
ry authored
405 else:
406 actual_version=VERSION
407
b73264d @ry Add command line arguments for accessing build flags.
ry authored
408 x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
409 , 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
410 , 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
d979ac9 @ry Put git revision into version string
ry authored
411 , 'VERSION' : actual_version
b73264d @ry Add command line arguments for accessing build flags.
ry authored
412 , 'PREFIX' : program.env["PREFIX"]
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
413 }
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
414 return x
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
415
416 # process file.pc.in -> file.pc
d979ac9 @ry Put git revision into version string
ry authored
417
b73264d @ry Add command line arguments for accessing build flags.
ry authored
418 node_version = bld.new_task_gen('subst', before="cxx")
419 node_version.source = 'src/node_version.h.in'
420 node_version.target = 'src/node_version.h'
421 node_version.dict = subflags(node)
a97dce7 @ry Build static executable.
ry authored
422 node_version.install_path = '${PREFIX}/include/node'
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
423
29b528c @ry fix the waf configure --debug options. seems to work now.
ry authored
424 if bld.env["USE_DEBUG"]:
2b6d724 @ry First attempt at node.dlopen
ry authored
425 node_g = node.clone("debug")
426 node_g.target = "node_g"
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
427
b73264d @ry Add command line arguments for accessing build flags.
ry authored
428 node_version_g = node_version.clone("debug")
429 node_version_g.dict = subflags(node_g)
a97dce7 @ry Build static executable.
ry authored
430 node_version_g.install_path = None
431
4d92199 @ry Add pkgconfig files to help with dll builds.
ry authored
432
a97dce7 @ry Build static executable.
ry authored
433 bld.install_files('${PREFIX}/include/node/', """
434 config.h
435 src/node.h
5f466c8 @ry fix make install (was broken from node_ prefix change)
ry authored
436 src/node_object_wrap.h
437 src/node_events.h
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
438 """)
439
440 # Only install the man page if it exists.
441 # Do 'make doc install' to build and install it.
442 if os.path.exists('doc/node.1'):
443 bld.install_files('${PREFIX}/share/man/man1/', 'doc/node.1')
444
445 bld.install_files('${PREFIX}/bin/', 'bin/*', chmod=0755)
6f17ca5 @ry Install wafadmin into $PREFIX/lib/node/wafadmin
ry authored
446
447 # Why am I using two lines? Because WAF SUCKS.
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
448 bld.install_files('${PREFIX}/lib/node/wafadmin', 'tools/wafadmin/*.py')
449 bld.install_files('${PREFIX}/lib/node/wafadmin/Tools', 'tools/wafadmin/Tools/*.py')
6f17ca5 @ry Install wafadmin into $PREFIX/lib/node/wafadmin
ry authored
450
132d685 @ry Add symlinks in root directory to executables after build.
ry authored
451 def shutdown():
452 Options.options.debug
453 # HACK to get binding.node out of build directory.
454 # better way to do this?
455 if not Options.commands['clean']:
456 if os.path.exists('build/default/node') and not os.path.exists('node'):
457 os.symlink('build/default/node', 'node')
458 if os.path.exists('build/debug/node_g') and not os.path.exists('node_g'):
459 os.symlink('build/debug/node_g', 'node_g')
460 else:
461 if os.path.exists('node'): os.unlink('node')
462 if os.path.exists('node_g'): os.unlink('node_g')
Something went wrong with that request. Please try again.