blob: c338ad4b684b7c0b4c3ec4d6748f317e04c582b7 [file] [log] [blame]
Ryan Dahl7a251f32010-03-01 22:39:311#!/usr/bin/env python
Ryan8ddf9302009-09-02 18:19:522import re
Ryan1a126ed2009-04-04 12:50:153import Options
Ryan41d89f62009-07-28 10:29:184import sys, os, shutil
Ryan Dahld979ac92009-10-09 13:00:125from Utils import cmd_output
Ryan1a126ed2009-04-04 12:50:156from os.path import join, dirname, abspath
Ryana4593e32009-04-23 11:18:387from logging import fatal
8
Ryan Dahld979ac92009-10-09 13:00:129cwd = os.getcwd()
Ryan Dahl0c1aa362010-05-30 02:32:3310VERSION="0.1.97"
Ryan4d921992009-08-26 23:11:1611APPNAME="node.js"
12
Ryan63a9cd32009-04-15 08:08:2813import js2c
14
Ryan1a126ed2009-04-04 12:50:1515srcdir = '.'
16blddir = 'build'
17
Ryan Dahl311a62d2010-05-26 20:05:3118
Ryan Dahlef9f4042010-06-02 19:27:5319
Ryan Dahl311a62d2010-05-26 20:05:3120jobs=1
21if os.environ.has_key('JOBS'):
22 jobs = int(os.environ['JOBS'])
23
Ryan1a126ed2009-04-04 12:50:1524def set_options(opt):
25 # the gcc module provides a --debug-level option
26 opt.tool_options('compiler_cxx')
27 opt.tool_options('compiler_cc')
Ryan4d921992009-08-26 23:11:1628 opt.tool_options('misc')
Ryan29b528c2009-04-23 15:29:3129 opt.add_option( '--debug'
30 , action='store_true'
31 , default=False
32 , help='Build debug variant [Default: False]'
33 , dest='debug'
34 )
Ryan7bad9de2009-06-16 13:47:5735 opt.add_option( '--efence'
36 , action='store_true'
37 , default=False
38 , help='Build with -lefence for debugging [Default: False]'
39 , dest='efence'
40 )
Ryan Dahl501136b2010-06-02 16:15:5441 opt.add_option( '--system'
42 , action='store_true'
43 , default=False
44 , help='Build using system libraries and headers (like a debian build) [Default: False]'
45 , dest='system'
46 )
Ryan Dahla9b962a2010-05-14 23:34:4747 opt.add_option( '--without-ssl'
48 , action='store_true'
49 , default=False
50 , help='Build without SSL'
51 , dest='without_ssl'
52 )
Ryan1a126ed2009-04-04 12:50:1553
54def configure(conf):
55 conf.check_tool('compiler_cxx')
Ryan Dahlf379b772010-01-12 00:43:1056 if not conf.env.CXX: conf.fatal('c++ compiler not found')
Ryan1a126ed2009-04-04 12:50:1557 conf.check_tool('compiler_cc')
Ryan Dahlf379b772010-01-12 00:43:1058 if not conf.env.CC: conf.fatal('c compiler not found')
Ryana4593e32009-04-23 11:18:3859
Ryan Dahl501136b2010-06-02 16:15:5460 conf.env["USE_DEBUG"] = Options.options.debug
61 conf.env["USE_SYSTEM"] = Options.options.system
Ryan1a126ed2009-04-04 12:50:1562
Ryan2b6d7242009-06-20 13:07:1063 conf.check(lib='dl', uselib_store='DL')
Ryan Dahl0c125542010-01-19 23:38:2064 if not sys.platform.startswith("sunos"):
65 conf.env.append_value("CCFLAGS", "-rdynamic")
66 conf.env.append_value("LINKFLAGS_DL", "-rdynamic")
Ryana97dce72009-08-31 09:14:3467
Vanilla Hsud22952b2010-01-07 07:37:2768 if sys.platform.startswith("freebsd"):
69 conf.check(lib='kvm', uselib_store='KVM')
70
Ryan8152f9c2009-09-01 12:15:2971 #if Options.options.debug:
72 # conf.check(lib='profiler', uselib_store='PROFILER')
Ryan7bad9de2009-06-16 13:47:5773
Ryan Dahlb8c3d712010-01-27 02:34:4274 if Options.options.efence:
75 conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
Ryana3627c02009-05-27 14:29:5576
Vanilla Hsud7a45012010-04-06 16:07:1077 if not conf.check(lib="execinfo", includes=['/usr/include', '/usr/local/include'], libpath=['/usr/lib', '/usr/local/lib'], uselib_store="EXECINFO"):
Rasmus Andersson6eb8bbc2009-12-15 22:37:4978 # Note on Darwin/OS X: This will fail, but will still be used as the
79 # execinfo stuff are part of the standard library.
Ryan Dahl8b62e862009-10-10 09:58:3680 if sys.platform.startswith("freebsd"):
Simon Cornelius P. Umacobe801f422009-12-09 12:36:1281 conf.fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.")
Ryana3627c02009-05-27 14:29:5582
Ryan Dahla9b962a2010-05-14 23:34:4783 if not Options.options.without_ssl:
84 if conf.check_cfg(package='openssl',
85 args='--cflags --libs',
86 uselib_store='OPENSSL'):
Standa Opichalfa514a92010-04-18 16:24:0887 conf.env["USE_OPENSSL"] = True
88 conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
Ryan Dahla9b962a2010-05-14 23:34:4789 else:
90 libssl = conf.check_cc(lib='ssl',
91 header_name='openssl/ssl.h',
92 function_name='SSL_library_init',
93 libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'],
94 uselib_store='OPENSSL')
95 libcrypto = conf.check_cc(lib='crypto',
96 header_name='openssl/crypto.h',
97 uselib_store='OPENSSL')
98 if libcrypto and libssl:
99 conf.env["USE_OPENSSL"] = True
100 conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
Rhys Jonesfb3a9cd2010-04-02 23:11:53101
Ryan Dahle9a116f2010-04-06 10:41:32102 conf.check(lib='rt', uselib_store='RT')
103
Ryan Dahl0c125542010-01-19 23:38:20104 if sys.platform.startswith("sunos"):
105 if not conf.check(lib='socket', uselib_store="SOCKET"):
106 conf.fatal("Cannot find socket library")
107 if not conf.check(lib='nsl', uselib_store="NSL"):
108 conf.fatal("Cannot find nsl library")
109
Ryan1a126ed2009-04-04 12:50:15110 conf.sub_config('deps/libeio')
Ryan Dahl501136b2010-06-02 16:15:54111 if not Options.options.system:
Ryan Dahl75f0cf42010-06-02 03:16:42112 conf.sub_config('deps/libev')
Ryan Dahl501136b2010-06-02 16:15:54113 conf.sub_config('deps/c-ares')
114 else:
115 if not conf.check(lib='v8', uselib_store='V8'):
116 conf.fatal("Cannot find V8")
117 if not conf.check(lib='ev', uselib_store='EV'):
118 conf.fatal("Cannot find libev")
119 if not conf.check(lib='cares', uselib_store='CARES'):
120 conf.fatal("Cannot find c-ares")
Ryan41d89f62009-07-28 10:29:18121
Ryan1a126ed2009-04-04 12:50:15122 conf.define("HAVE_CONFIG_H", 1)
Ryanc62b1242009-04-22 17:55:08123
Ryan Dahl42797252010-03-31 20:36:20124 if sys.platform.startswith("sunos"):
125 conf.env.append_value ('CCFLAGS', '-threads')
126 conf.env.append_value ('CXXFLAGS', '-threads')
127 #conf.env.append_value ('LINKFLAGS', ' -threads')
128 else:
129 threadflags='-pthread'
130 conf.env.append_value ('CCFLAGS', threadflags)
131 conf.env.append_value ('CXXFLAGS', threadflags)
132 conf.env.append_value ('LINKFLAGS', threadflags)
133
Ryan Dahl1beb8402009-12-30 08:01:28134 conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
Ryan427e3f52009-05-14 11:16:45135
Ryan Dahl2b743aa2009-10-27 11:05:38136 # LFS
137 conf.env.append_value('CCFLAGS', '-D_LARGEFILE_SOURCE')
138 conf.env.append_value('CXXFLAGS', '-D_LARGEFILE_SOURCE')
139 conf.env.append_value('CCFLAGS', '-D_FILE_OFFSET_BITS=64')
140 conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
141
Andrew Johnston95996072010-03-22 07:25:24142 ## needed for node_file.cc fdatasync
143 ## Strangely on OSX 10.6 the g++ doesn't see fdatasync but gcc does?
144 code = """
145 #include <unistd.h>
146 int main(void)
147 {
148 int fd = 0;
149 fdatasync (fd);
150 return 0;
151 }
152 """
153 if conf.check_cxx(msg="Checking for fdatasync(2) with c++", fragment=code):
154 conf.env.append_value('CXXFLAGS', '-DHAVE_FDATASYNC=1')
155 else:
156 conf.env.append_value('CXXFLAGS', '-DHAVE_FDATASYNC=0')
157
Ryan Dahlf4811832009-11-02 23:21:00158 # platform
159 platform_def = '-DPLATFORM=' + sys.platform
160 conf.env.append_value('CCFLAGS', platform_def)
161 conf.env.append_value('CXXFLAGS', platform_def)
162
Ryan67af9582009-04-18 13:35:42163 # Split off debug variant before adding variant specific defines
Ryan7e1350f2009-04-16 09:37:44164 debug_env = conf.env.copy()
165 conf.set_env_name('debug', debug_env)
Ryan7e1350f2009-04-16 09:37:44166
Ryan67af9582009-04-18 13:35:42167 # Configure debug variant
168 conf.setenv('debug')
169 debug_env.set_variant('debug')
Ryan8ddf9302009-09-02 18:19:52170 debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
171 debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
Ryan67af9582009-04-18 13:35:42172 conf.write_config_header("config.h")
173
174 # Configure default variant
175 conf.setenv('default')
Ryan Dahl48d58f92010-05-03 01:20:02176 conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-g', '-O3'])
177 conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-g', '-O3'])
Ryan67af9582009-04-18 13:35:42178 conf.write_config_header("config.h")
Ryan63a9cd32009-04-15 08:08:28179
Ryan41d89f62009-07-28 10:29:18180
Ryan Dahl53ebe752009-10-08 21:20:14181def v8_cmd(bld, variant):
182 scons = join(cwd, 'tools/scons/scons.py')
Ryan1a126ed2009-04-04 12:50:15183 deps_src = join(bld.path.abspath(),"deps")
Ryan1a126ed2009-04-04 12:50:15184 v8dir_src = join(deps_src,"v8")
Ryan Dahl53ebe752009-10-08 21:20:14185
Ryan Dahlbc9b3432009-10-02 12:10:40186 # NOTE: We want to compile V8 to export its symbols. I.E. Do not want
187 # -fvisibility=hidden. When using dlopen() it seems that the loaded DSO
188 # cannot see symbols in the executable which are hidden, even if the
189 # executable is statically linked together...
Ryan8ddf9302009-09-02 18:19:52190
Ryan Dahl7d9d8812009-10-26 21:27:52191 # XXX Remove this when v8 defaults x86_64 to native builds
Ryan Dahld85724d2009-10-08 22:34:39192 arch = ""
Ryan Dahl7d9d8812009-10-26 21:27:52193 if bld.env['DEST_CPU'] == 'x86_64':
Ryan Dahld85724d2009-10-08 22:34:39194 arch = "arch=x64"
195
196 if variant == "default":
197 mode = "release"
198 else:
199 mode = "debug"
Ryana4593e32009-04-23 11:18:38200
Ryan Dahl23d680b2010-05-13 23:24:05201 cmd_R = 'python "%s" -j %d -C "%s" -Y "%s" visibility=default mode=%s %s library=static snapshot=on'
Ryan Dahl53ebe752009-10-08 21:20:14202
203 cmd = cmd_R % ( scons
Ryan Dahl23d680b2010-05-13 23:24:05204 , Options.options.jobs
Ryan Dahl53ebe752009-10-08 21:20:14205 , bld.srcnode.abspath(bld.env_of_name(variant))
206 , v8dir_src
207 , mode
208 , arch
209 )
210 return cmd
211
212
213def build_v8(bld):
Ryan1a126ed2009-04-04 12:50:15214 v8 = bld.new_task_gen(
Ryan Dahl501136b2010-06-02 16:15:54215 source = 'deps/v8/SConstruct '
216 + bld.path.ant_glob('v8/include/*')
Ryan Dahl59b7a1b2009-10-09 10:49:48217 + bld.path.ant_glob('v8/src/*'),
Ryan Dahl53ebe752009-10-08 21:20:14218 target = bld.env["staticlib_PATTERN"] % "v8",
219 rule = v8_cmd(bld, "default"),
220 before = "cxx",
221 install_path = None
Ryan1a126ed2009-04-04 12:50:15222 )
Ryan Dahl8b62e862009-10-10 09:58:36223 v8.uselib = "EXECINFO"
Ryan1a126ed2009-04-04 12:50:15224 bld.env["CPPPATH_V8"] = "deps/v8/include"
Ryan Dahlfc937aa2009-10-27 21:50:46225 t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
Ryan Dahl42797252010-03-31 20:36:20226 bld.env_of_name('default').append_value("LINKFLAGS_V8", t)
227
Ryana4593e32009-04-23 11:18:38228
229 ### v8 debug
Ryan29b528c2009-04-23 15:29:31230 if bld.env["USE_DEBUG"]:
Ryan29b528c2009-04-23 15:29:31231 v8_debug = v8.clone("debug")
Ryan Dahl53ebe752009-10-08 21:20:14232 v8_debug.rule = v8_cmd(bld, "debug")
233 v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g"
Ryan Dahl8b62e862009-10-10 09:58:36234 v8_debug.uselib = "EXECINFO"
Ryan Dahlfc937aa2009-10-27 21:50:46235 t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
Ryan Dahl42797252010-03-31 20:36:20236 bld.env_of_name('debug').append_value("LINKFLAGS_V8", t)
Ryan1a126ed2009-04-04 12:50:15237
Ryan Dahl53ebe752009-10-08 21:20:14238 bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
Ryan2b6d7242009-06-20 13:07:10239
Ryan41d89f62009-07-28 10:29:18240def build(bld):
Ryan Dahlef9f4042010-06-02 19:27:53241 ## This snippet is to show full commands as WAF executes
242 import Build
243 old = Build.BuildContext.exec_command
244 def exec_command(self, cmd, **kw):
245 if isinstance(cmd, list): print(" ".join(cmd))
246 return old(self, cmd, **kw)
247 Build.BuildContext.exec_command = exec_command
248
Ryan Dahl501136b2010-06-02 16:15:54249 Options.options.jobs=jobs
Ryan Dahlef9f4042010-06-02 19:27:53250
Ryan Dahl9ea8c9f2010-04-07 20:34:40251 print "DEST_OS: " + bld.env['DEST_OS']
252 print "DEST_CPU: " + bld.env['DEST_CPU']
Ryan Dahl23d680b2010-05-13 23:24:05253 print "Parallel Jobs: " + str(Options.options.jobs)
Ryan Dahl9ea8c9f2010-04-07 20:34:40254
Ryan Dahl501136b2010-06-02 16:15:54255 if not bld.env["USE_SYSTEM"]:
256 bld.add_subdirs('deps/libeio deps/libev deps/c-ares')
257 build_v8(bld)
258 else:
259 bld.add_subdirs('deps/libeio')
Ryan41d89f62009-07-28 10:29:18260
Jérémy Lalc93bab12010-03-11 21:15:32261
Ryan5a071ad2009-05-03 12:09:16262 ### http_parser
Ryan Dahl122e74b2009-10-27 21:26:53263 http_parser = bld.new_task_gen("cc")
Ryan5a071ad2009-05-03 12:09:16264 http_parser.source = "deps/http_parser/http_parser.c"
265 http_parser.includes = "deps/http_parser/"
266 http_parser.name = "http_parser"
267 http_parser.target = "http_parser"
268 http_parser.install_path = None
Ryan29b528c2009-04-23 15:29:31269 if bld.env["USE_DEBUG"]:
Ryan5a071ad2009-05-03 12:09:16270 http_parser.clone("debug")
Ryan1a126ed2009-04-04 12:50:15271
Ryan63a9cd32009-04-15 08:08:28272 ### src/native.cc
Zokab29f7872010-03-20 03:56:03273 def make_macros(loc, content):
274 f = open(loc, 'w')
275 f.write(content)
276 f.close
277
278 macros_loc_debug = join(
279 bld.srcnode.abspath(bld.env_of_name("debug")),
280 "macros.py"
281 )
282
283 macros_loc_default = join(
284 bld.srcnode.abspath(bld.env_of_name("default")),
285 "macros.py"
286 )
287
288 make_macros(macros_loc_debug, "") # leave debug(x) as is in debug build
289 # replace debug(x) with nothing in release build
290 make_macros(macros_loc_default, "macro debug(x) = ;\n")
291
Ryan63a9cd32009-04-15 08:08:28292 def javascript_in_c(task):
293 env = task.env
294 source = map(lambda x: x.srcpath(env), task.inputs)
295 targets = map(lambda x: x.srcpath(env), task.outputs)
Zokab29f7872010-03-20 03:56:03296 source.append(macros_loc_default)
297 js2c.JS2C(source, targets)
298
299 def javascript_in_c_debug(task):
300 env = task.env
301 source = map(lambda x: x.srcpath(env), task.inputs)
302 targets = map(lambda x: x.srcpath(env), task.outputs)
303 source.append(macros_loc_debug)
Ryan63a9cd32009-04-15 08:08:28304 js2c.JS2C(source, targets)
305
306 native_cc = bld.new_task_gen(
Ryan Dahl4ccdc502010-03-15 15:00:19307 source='src/node.js ' + bld.path.ant_glob('lib/*.js'),
Ryan Dahl53ebe752009-10-08 21:20:14308 target="src/node_natives.h",
Ryan Dahl4ccdc502010-03-15 15:00:19309 before="cxx",
310 install_path=None
Ryan63a9cd32009-04-15 08:08:28311 )
Ryan Dahl4bcb01c2009-10-16 20:53:44312
313 # Add the rule /after/ cloning the debug
314 # This is a work around for an error had in python 2.4.3 (I'll paste the
315 # error that was had into the git commit meessage. git-blame to find out
316 # where.)
Ryan29b528c2009-04-23 15:29:31317 if bld.env["USE_DEBUG"]:
Ryan Dahl4bcb01c2009-10-16 20:53:44318 native_cc_debug = native_cc.clone("debug")
Zokab29f7872010-03-20 03:56:03319 native_cc_debug.rule = javascript_in_c_debug
320
Ryan Dahl4bcb01c2009-10-16 20:53:44321 native_cc.rule = javascript_in_c
Ryan63a9cd32009-04-15 08:08:28322
Ryan2b6d7242009-06-20 13:07:10323 ### node lib
Ryan8152f9c2009-09-01 12:15:29324 node = bld.new_task_gen("cxx", "program")
325 node.name = "node"
326 node.target = "node"
327 node.source = """
Ryan1a126ed2009-04-04 12:50:15328 src/node.cc
Ryan Dahl630bb7a2009-12-13 07:42:45329 src/node_buffer.cc
Ryan Dahl42ee1692010-01-24 19:21:45330 src/node_http_parser.cc
Ryan Dahl78e49f12010-05-29 20:08:05331 src/node_net.cc
Ryan Dahlf2199382009-12-13 14:43:58332 src/node_io_watcher.cc
Ryan Dahla5df0f62009-10-27 10:46:58333 src/node_child_process.cc
334 src/node_constants.cc
Krishna Rajendrandc1f4eb2010-04-06 10:28:37335 src/node_cares.cc
Ryan Dahla5df0f62009-10-27 10:46:58336 src/node_events.cc
337 src/node_file.cc
Ryan Dahl8492c522010-03-15 21:05:18338 src/node_signal_watcher.cc
339 src/node_stat_watcher.cc
Ryan17c6a672009-08-24 18:25:24340 src/node_stdio.cc
Ryan Dahla5df0f62009-10-27 10:46:58341 src/node_timer.cc
Herbert Vojcikc2a06722010-04-17 15:18:15342 src/node_script.cc
Ryan1a126ed2009-04-04 12:50:15343 """
Ryan Dahl501136b2010-06-02 16:15:54344 if bld.env["USE_OPENSSL"]:
345 node.source += "src/node_crypto.cc"
Rhys Jonesfb3a9cd2010-04-02 23:11:53346
Ryan Dahl501136b2010-06-02 16:15:54347 if not bld.env["USE_SYSTEM"]:
348 node.includes = """
349 src/
350 deps/v8/include
351 deps/libev
352 deps/c-ares
353 deps/libeio
354 deps/http_parser
355 """
Ryan Dahle9a116f2010-04-06 10:41:32356
Ryan Dahl501136b2010-06-02 16:15:54357 node.includes += ' deps/c-ares/' + bld.env['DEST_OS'] + '-' + bld.env['DEST_CPU']
Vanilla Hsu067f4082010-04-07 16:05:37358
Ryan Dahle9a116f2010-04-06 10:41:32359
Ryan Dahl501136b2010-06-02 16:15:54360 node.add_objects = 'cares ev eio http_parser'
361 node.uselib_local = ''
362 node.uselib = 'RT OPENSSL V8 EXECINFO DL KVM SOCKET NSL'
363 else:
364 node.includes = """
365 src/
366 deps/libeio
367 deps/http_parser
368 """
369 node.add_objects = 'eio http_parser'
370 node.uselib_local = 'eio'
371 node.uselib = 'RT EV OPENSSL CARES V8 EXECINFO DL KVM SOCKET NSL'
372
373 node.install_path = '${PREFIX}/lib'
374 node.install_path = '${PREFIX}/bin'
375 node.chmod = 0755
Ryan8e7bbf22009-04-23 17:26:56376
Ryan4d921992009-08-26 23:11:16377 def subflags(program):
Ryan Dahld979ac92009-10-09 13:00:12378 if os.path.exists(join(cwd, ".git")):
Ryan Dahl962e9292009-10-09 14:16:27379 actual_version=cmd_output("git describe").strip()
Ryan Dahld979ac92009-10-09 13:00:12380 else:
381 actual_version=VERSION
382
Ryanb73264d2009-08-27 00:15:11383 x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
384 , 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
385 , 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
Ryan Dahld979ac92009-10-09 13:00:12386 , 'VERSION' : actual_version
Ryanb73264d2009-08-27 00:15:11387 , 'PREFIX' : program.env["PREFIX"]
Ryan4d921992009-08-26 23:11:16388 }
Ryan Dahlbf0d2782009-10-03 20:42:03389 return x
Ryan4d921992009-08-26 23:11:16390
Ryan4d921992009-08-26 23:11:16391 # process file.pc.in -> file.pc
Ryan Dahld979ac92009-10-09 13:00:12392
Ryanb73264d2009-08-27 00:15:11393 node_version = bld.new_task_gen('subst', before="cxx")
394 node_version.source = 'src/node_version.h.in'
395 node_version.target = 'src/node_version.h'
396 node_version.dict = subflags(node)
Ryana97dce72009-08-31 09:14:34397 node_version.install_path = '${PREFIX}/include/node'
Ryan4d921992009-08-26 23:11:16398
Ryan29b528c2009-04-23 15:29:31399 if bld.env["USE_DEBUG"]:
Ryan2b6d7242009-06-20 13:07:10400 node_g = node.clone("debug")
401 node_g.target = "node_g"
Ryan Dahl501136b2010-06-02 16:15:54402
Ryanb73264d2009-08-27 00:15:11403 node_version_g = node_version.clone("debug")
404 node_version_g.dict = subflags(node_g)
Ryana97dce72009-08-31 09:14:34405 node_version_g.install_path = None
Ryan4d921992009-08-26 23:11:16406
Ryana97dce72009-08-31 09:14:34407
408 bld.install_files('${PREFIX}/include/node/', """
409 config.h
410 src/node.h
Ryan Dahl5f466c82009-10-27 19:17:03411 src/node_object_wrap.h
Ryan Dahld2415942010-05-06 21:14:52412 src/node_buffer.h
Ryan Dahl5f466c82009-10-27 19:17:03413 src/node_events.h
Ryan Dahlbf0d2782009-10-03 20:42:03414 """)
415
Ryan Dahlef9f4042010-06-02 19:27:53416 # Only install the man page if it exists.
Ryan Dahlbf0d2782009-10-03 20:42:03417 # Do 'make doc install' to build and install it.
418 if os.path.exists('doc/node.1'):
419 bld.install_files('${PREFIX}/share/man/man1/', 'doc/node.1')
420
421 bld.install_files('${PREFIX}/bin/', 'bin/*', chmod=0755)
Ryan Dahlbf0d2782009-10-03 20:42:03422 bld.install_files('${PREFIX}/lib/node/wafadmin', 'tools/wafadmin/*.py')
423 bld.install_files('${PREFIX}/lib/node/wafadmin/Tools', 'tools/wafadmin/Tools/*.py')
Ryan Dahl6f17ca52009-10-03 17:08:05424
Ryan Dahl132d6852009-10-27 17:11:07425def shutdown():
426 Options.options.debug
427 # HACK to get binding.node out of build directory.
428 # better way to do this?
429 if not Options.commands['clean']:
430 if os.path.exists('build/default/node') and not os.path.exists('node'):
431 os.symlink('build/default/node', 'node')
432 if os.path.exists('build/debug/node_g') and not os.path.exists('node_g'):
433 os.symlink('build/debug/node_g', 'node_g')
434 else:
435 if os.path.exists('node'): os.unlink('node')
436 if os.path.exists('node_g'): os.unlink('node_g')