blob: 6b0b8735e4c724bcea22d5f666d2861816332c93 [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
19jobs=1
20if os.environ.has_key('JOBS'):
21 jobs = int(os.environ['JOBS'])
22
Ryan1a126ed2009-04-04 12:50:1523def set_options(opt):
24 # the gcc module provides a --debug-level option
25 opt.tool_options('compiler_cxx')
26 opt.tool_options('compiler_cc')
Ryan4d921992009-08-26 23:11:1627 opt.tool_options('misc')
Ryan29b528c2009-04-23 15:29:3128 opt.add_option( '--debug'
29 , action='store_true'
30 , default=False
31 , help='Build debug variant [Default: False]'
32 , dest='debug'
33 )
Ryan7bad9de2009-06-16 13:47:5734 opt.add_option( '--efence'
35 , action='store_true'
36 , default=False
37 , help='Build with -lefence for debugging [Default: False]'
38 , dest='efence'
39 )
Jérémy Lalc93bab12010-03-11 21:15:3240 opt.add_option( '--system'
41 , action='store_true'
42 , default=False
43 , help='Build using system libraries and headers (like a debian build) [Default: False]'
44 , dest='system'
45 )
Ryan Dahla9b962a2010-05-14 23:34:4746 opt.add_option( '--without-ssl'
47 , action='store_true'
48 , default=False
49 , help='Build without SSL'
50 , dest='without_ssl'
51 )
Ryan1a126ed2009-04-04 12:50:1552
53def configure(conf):
54 conf.check_tool('compiler_cxx')
Ryan Dahlf379b772010-01-12 00:43:1055 if not conf.env.CXX: conf.fatal('c++ compiler not found')
Ryan1a126ed2009-04-04 12:50:1556 conf.check_tool('compiler_cc')
Ryan Dahlf379b772010-01-12 00:43:1057 if not conf.env.CC: conf.fatal('c compiler not found')
Ryana4593e32009-04-23 11:18:3858
Ryan8e7bbf22009-04-23 17:26:5659 conf.env["USE_DEBUG"] = Options.options.debug
Jérémy Lalc93bab12010-03-11 21:15:3260 conf.env["USE_SYSTEM"] = Options.options.system
Ryan1a126ed2009-04-04 12:50:1561
Ryan2b6d7242009-06-20 13:07:1062 conf.check(lib='dl', uselib_store='DL')
Ryan Dahl0c125542010-01-19 23:38:2063 if not sys.platform.startswith("sunos"):
64 conf.env.append_value("CCFLAGS", "-rdynamic")
65 conf.env.append_value("LINKFLAGS_DL", "-rdynamic")
Ryana97dce72009-08-31 09:14:3466
Vanilla Hsud22952b2010-01-07 07:37:2767 if sys.platform.startswith("freebsd"):
68 conf.check(lib='kvm', uselib_store='KVM')
69
Ryan8152f9c2009-09-01 12:15:2970 #if Options.options.debug:
71 # conf.check(lib='profiler', uselib_store='PROFILER')
Ryan7bad9de2009-06-16 13:47:5772
Ryan Dahlb8c3d712010-01-27 02:34:4273 if Options.options.efence:
74 conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
Ryana3627c02009-05-27 14:29:5575
Vanilla Hsud7a45012010-04-06 16:07:1076 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:4977 # Note on Darwin/OS X: This will fail, but will still be used as the
78 # execinfo stuff are part of the standard library.
Ryan Dahl8b62e862009-10-10 09:58:3679 if sys.platform.startswith("freebsd"):
Simon Cornelius P. Umacobe801f422009-12-09 12:36:1280 conf.fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.")
Ryana3627c02009-05-27 14:29:5581
Ryan Dahla9b962a2010-05-14 23:34:4782 if not Options.options.without_ssl:
83 if conf.check_cfg(package='openssl',
84 args='--cflags --libs',
85 uselib_store='OPENSSL'):
Standa Opichalfa514a92010-04-18 16:24:0886 conf.env["USE_OPENSSL"] = True
87 conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
Ryan Dahla9b962a2010-05-14 23:34:4788 else:
89 libssl = conf.check_cc(lib='ssl',
90 header_name='openssl/ssl.h',
91 function_name='SSL_library_init',
92 libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'],
93 uselib_store='OPENSSL')
94 libcrypto = conf.check_cc(lib='crypto',
95 header_name='openssl/crypto.h',
96 uselib_store='OPENSSL')
97 if libcrypto and libssl:
98 conf.env["USE_OPENSSL"] = True
99 conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
Rhys Jonesfb3a9cd2010-04-02 23:11:53100
Ryan Dahle9a116f2010-04-06 10:41:32101 conf.check(lib='rt', uselib_store='RT')
102
Ryan Dahl0c125542010-01-19 23:38:20103 if sys.platform.startswith("sunos"):
104 if not conf.check(lib='socket', uselib_store="SOCKET"):
105 conf.fatal("Cannot find socket library")
106 if not conf.check(lib='nsl', uselib_store="NSL"):
107 conf.fatal("Cannot find nsl library")
108
Ryan1a126ed2009-04-04 12:50:15109 conf.sub_config('deps/libeio')
Jérémy Lalc93bab12010-03-11 21:15:32110 if not Options.options.system:
111 conf.sub_config('deps/libev')
Ryan Dahle9a116f2010-04-06 10:41:32112 conf.sub_config('deps/c-ares')
Ryan Dahl0c125542010-01-19 23:38:20113 else:
Jérémy Lalc93bab12010-03-11 21:15:32114 if not conf.check(lib='v8', uselib_store='V8'):
115 conf.fatal("Cannot find V8")
116 if not conf.check(lib='ev', uselib_store='EV'):
117 conf.fatal("Cannot find libev")
Ryan Dahle9a116f2010-04-06 10:41:32118 if not conf.check(lib='cares', uselib_store='CARES'):
119 conf.fatal("Cannot find c-ares")
Ryan41d89f62009-07-28 10:29:18120
Ryan1a126ed2009-04-04 12:50:15121 conf.define("HAVE_CONFIG_H", 1)
Ryanc62b1242009-04-22 17:55:08122
Ryan Dahl42797252010-03-31 20:36:20123 if sys.platform.startswith("sunos"):
124 conf.env.append_value ('CCFLAGS', '-threads')
125 conf.env.append_value ('CXXFLAGS', '-threads')
126 #conf.env.append_value ('LINKFLAGS', ' -threads')
127 else:
128 threadflags='-pthread'
129 conf.env.append_value ('CCFLAGS', threadflags)
130 conf.env.append_value ('CXXFLAGS', threadflags)
131 conf.env.append_value ('LINKFLAGS', threadflags)
132
Ryan Dahl1beb8402009-12-30 08:01:28133 conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
Ryan427e3f52009-05-14 11:16:45134
Ryan Dahl2b743aa2009-10-27 11:05:38135 # LFS
136 conf.env.append_value('CCFLAGS', '-D_LARGEFILE_SOURCE')
137 conf.env.append_value('CXXFLAGS', '-D_LARGEFILE_SOURCE')
138 conf.env.append_value('CCFLAGS', '-D_FILE_OFFSET_BITS=64')
139 conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
140
Andrew Johnston95996072010-03-22 07:25:24141 ## needed for node_file.cc fdatasync
142 ## Strangely on OSX 10.6 the g++ doesn't see fdatasync but gcc does?
143 code = """
144 #include <unistd.h>
145 int main(void)
146 {
147 int fd = 0;
148 fdatasync (fd);
149 return 0;
150 }
151 """
152 if conf.check_cxx(msg="Checking for fdatasync(2) with c++", fragment=code):
153 conf.env.append_value('CXXFLAGS', '-DHAVE_FDATASYNC=1')
154 else:
155 conf.env.append_value('CXXFLAGS', '-DHAVE_FDATASYNC=0')
156
Ryan Dahlf4811832009-11-02 23:21:00157 # platform
158 platform_def = '-DPLATFORM=' + sys.platform
159 conf.env.append_value('CCFLAGS', platform_def)
160 conf.env.append_value('CXXFLAGS', platform_def)
161
Ryan67af9582009-04-18 13:35:42162 # Split off debug variant before adding variant specific defines
Ryan7e1350f2009-04-16 09:37:44163 debug_env = conf.env.copy()
164 conf.set_env_name('debug', debug_env)
Ryan7e1350f2009-04-16 09:37:44165
Ryan67af9582009-04-18 13:35:42166 # Configure debug variant
167 conf.setenv('debug')
168 debug_env.set_variant('debug')
Ryan8ddf9302009-09-02 18:19:52169 debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
170 debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
Ryan67af9582009-04-18 13:35:42171 conf.write_config_header("config.h")
172
173 # Configure default variant
174 conf.setenv('default')
Ryan Dahl48d58f92010-05-03 01:20:02175 conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-g', '-O3'])
176 conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-g', '-O3'])
Ryan67af9582009-04-18 13:35:42177 conf.write_config_header("config.h")
Ryan63a9cd32009-04-15 08:08:28178
Ryan41d89f62009-07-28 10:29:18179
Ryan Dahl53ebe752009-10-08 21:20:14180def v8_cmd(bld, variant):
181 scons = join(cwd, 'tools/scons/scons.py')
Ryan1a126ed2009-04-04 12:50:15182 deps_src = join(bld.path.abspath(),"deps")
Ryan1a126ed2009-04-04 12:50:15183 v8dir_src = join(deps_src,"v8")
Ryan Dahl53ebe752009-10-08 21:20:14184
Ryan Dahlbc9b3432009-10-02 12:10:40185 # NOTE: We want to compile V8 to export its symbols. I.E. Do not want
186 # -fvisibility=hidden. When using dlopen() it seems that the loaded DSO
187 # cannot see symbols in the executable which are hidden, even if the
188 # executable is statically linked together...
Ryan8ddf9302009-09-02 18:19:52189
Ryan Dahl7d9d8812009-10-26 21:27:52190 # XXX Remove this when v8 defaults x86_64 to native builds
Ryan Dahld85724d2009-10-08 22:34:39191 arch = ""
Ryan Dahl7d9d8812009-10-26 21:27:52192 if bld.env['DEST_CPU'] == 'x86_64':
Ryan Dahld85724d2009-10-08 22:34:39193 arch = "arch=x64"
194
195 if variant == "default":
196 mode = "release"
197 else:
198 mode = "debug"
Ryana4593e32009-04-23 11:18:38199
Ryan Dahl23d680b2010-05-13 23:24:05200 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:14201
202 cmd = cmd_R % ( scons
Ryan Dahl23d680b2010-05-13 23:24:05203 , Options.options.jobs
Ryan Dahl53ebe752009-10-08 21:20:14204 , bld.srcnode.abspath(bld.env_of_name(variant))
205 , v8dir_src
206 , mode
207 , arch
208 )
209 return cmd
210
211
212def build_v8(bld):
Ryan1a126ed2009-04-04 12:50:15213 v8 = bld.new_task_gen(
Ryan Dahl59b7a1b2009-10-09 10:49:48214 source = 'deps/v8/SConstruct '
215 + bld.path.ant_glob('v8/include/*')
216 + bld.path.ant_glob('v8/src/*'),
Ryan Dahl53ebe752009-10-08 21:20:14217 target = bld.env["staticlib_PATTERN"] % "v8",
218 rule = v8_cmd(bld, "default"),
219 before = "cxx",
220 install_path = None
Ryan1a126ed2009-04-04 12:50:15221 )
Ryan Dahl8b62e862009-10-10 09:58:36222 v8.uselib = "EXECINFO"
Ryan1a126ed2009-04-04 12:50:15223 bld.env["CPPPATH_V8"] = "deps/v8/include"
Ryan Dahlfc937aa2009-10-27 21:50:46224 t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
Ryan Dahl42797252010-03-31 20:36:20225 bld.env_of_name('default').append_value("LINKFLAGS_V8", t)
226
Ryana4593e32009-04-23 11:18:38227
228 ### v8 debug
Ryan29b528c2009-04-23 15:29:31229 if bld.env["USE_DEBUG"]:
Ryan29b528c2009-04-23 15:29:31230 v8_debug = v8.clone("debug")
Ryan Dahl53ebe752009-10-08 21:20:14231 v8_debug.rule = v8_cmd(bld, "debug")
232 v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g"
Ryan Dahl8b62e862009-10-10 09:58:36233 v8_debug.uselib = "EXECINFO"
Ryan Dahlfc937aa2009-10-27 21:50:46234 t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
Ryan Dahl42797252010-03-31 20:36:20235 bld.env_of_name('debug').append_value("LINKFLAGS_V8", t)
Ryan1a126ed2009-04-04 12:50:15236
Ryan Dahl53ebe752009-10-08 21:20:14237 bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
Ryan2b6d7242009-06-20 13:07:10238
Ryan41d89f62009-07-28 10:29:18239def build(bld):
Ryan Dahl311a62d2010-05-26 20:05:31240 Options.options.jobs=jobs
Ryan Dahl9ea8c9f2010-04-07 20:34:40241 print "DEST_OS: " + bld.env['DEST_OS']
242 print "DEST_CPU: " + bld.env['DEST_CPU']
Ryan Dahl23d680b2010-05-13 23:24:05243 print "Parallel Jobs: " + str(Options.options.jobs)
Ryan Dahl9ea8c9f2010-04-07 20:34:40244
Jérémy Lalc93bab12010-03-11 21:15:32245 if not bld.env["USE_SYSTEM"]:
Ryan Dahle9a116f2010-04-06 10:41:32246 bld.add_subdirs('deps/libeio deps/libev deps/c-ares')
Jérémy Lalc93bab12010-03-11 21:15:32247 build_v8(bld)
248 else:
249 bld.add_subdirs('deps/libeio')
Ryan41d89f62009-07-28 10:29:18250
Jérémy Lalc93bab12010-03-11 21:15:32251
Ryan5a071ad2009-05-03 12:09:16252 ### http_parser
Ryan Dahl122e74b2009-10-27 21:26:53253 http_parser = bld.new_task_gen("cc")
Ryan5a071ad2009-05-03 12:09:16254 http_parser.source = "deps/http_parser/http_parser.c"
255 http_parser.includes = "deps/http_parser/"
256 http_parser.name = "http_parser"
257 http_parser.target = "http_parser"
258 http_parser.install_path = None
Ryan29b528c2009-04-23 15:29:31259 if bld.env["USE_DEBUG"]:
Ryan5a071ad2009-05-03 12:09:16260 http_parser.clone("debug")
Ryan1a126ed2009-04-04 12:50:15261
Ryan63a9cd32009-04-15 08:08:28262 ### src/native.cc
Zokab29f7872010-03-20 03:56:03263 def make_macros(loc, content):
264 f = open(loc, 'w')
265 f.write(content)
266 f.close
267
268 macros_loc_debug = join(
269 bld.srcnode.abspath(bld.env_of_name("debug")),
270 "macros.py"
271 )
272
273 macros_loc_default = join(
274 bld.srcnode.abspath(bld.env_of_name("default")),
275 "macros.py"
276 )
277
278 make_macros(macros_loc_debug, "") # leave debug(x) as is in debug build
279 # replace debug(x) with nothing in release build
280 make_macros(macros_loc_default, "macro debug(x) = ;\n")
281
Ryan63a9cd32009-04-15 08:08:28282 def javascript_in_c(task):
283 env = task.env
284 source = map(lambda x: x.srcpath(env), task.inputs)
285 targets = map(lambda x: x.srcpath(env), task.outputs)
Zokab29f7872010-03-20 03:56:03286 source.append(macros_loc_default)
287 js2c.JS2C(source, targets)
288
289 def javascript_in_c_debug(task):
290 env = task.env
291 source = map(lambda x: x.srcpath(env), task.inputs)
292 targets = map(lambda x: x.srcpath(env), task.outputs)
293 source.append(macros_loc_debug)
Ryan63a9cd32009-04-15 08:08:28294 js2c.JS2C(source, targets)
295
296 native_cc = bld.new_task_gen(
Ryan Dahl4ccdc502010-03-15 15:00:19297 source='src/node.js ' + bld.path.ant_glob('lib/*.js'),
Ryan Dahl53ebe752009-10-08 21:20:14298 target="src/node_natives.h",
Ryan Dahl4ccdc502010-03-15 15:00:19299 before="cxx",
300 install_path=None
Ryan63a9cd32009-04-15 08:08:28301 )
Ryan Dahl4bcb01c2009-10-16 20:53:44302
303 # Add the rule /after/ cloning the debug
304 # This is a work around for an error had in python 2.4.3 (I'll paste the
305 # error that was had into the git commit meessage. git-blame to find out
306 # where.)
Ryan29b528c2009-04-23 15:29:31307 if bld.env["USE_DEBUG"]:
Ryan Dahl4bcb01c2009-10-16 20:53:44308 native_cc_debug = native_cc.clone("debug")
Zokab29f7872010-03-20 03:56:03309 native_cc_debug.rule = javascript_in_c_debug
310
Ryan Dahl4bcb01c2009-10-16 20:53:44311 native_cc.rule = javascript_in_c
Ryan63a9cd32009-04-15 08:08:28312
Ryan2b6d7242009-06-20 13:07:10313 ### node lib
Ryan8152f9c2009-09-01 12:15:29314 node = bld.new_task_gen("cxx", "program")
315 node.name = "node"
316 node.target = "node"
317 node.source = """
Ryan1a126ed2009-04-04 12:50:15318 src/node.cc
Ryan Dahl630bb7a2009-12-13 07:42:45319 src/node_buffer.cc
Ryan Dahl42ee1692010-01-24 19:21:45320 src/node_http_parser.cc
Ryan Dahl78e49f12010-05-29 20:08:05321 src/node_net.cc
Ryan Dahlf2199382009-12-13 14:43:58322 src/node_io_watcher.cc
Ryan Dahla5df0f62009-10-27 10:46:58323 src/node_child_process.cc
324 src/node_constants.cc
Krishna Rajendrandc1f4eb2010-04-06 10:28:37325 src/node_cares.cc
Ryan Dahla5df0f62009-10-27 10:46:58326 src/node_events.cc
327 src/node_file.cc
Ryan Dahl8492c522010-03-15 21:05:18328 src/node_signal_watcher.cc
329 src/node_stat_watcher.cc
Ryan17c6a672009-08-24 18:25:24330 src/node_stdio.cc
Ryan Dahla5df0f62009-10-27 10:46:58331 src/node_timer.cc
Herbert Vojcikc2a06722010-04-17 15:18:15332 src/node_script.cc
Ryan1a126ed2009-04-04 12:50:15333 """
Rhys Jonesfb3a9cd2010-04-02 23:11:53334 if bld.env["USE_OPENSSL"]:
335 node.source += "src/node_crypto.cc"
336
Jérémy Lalc93bab12010-03-11 21:15:32337 if not bld.env["USE_SYSTEM"]:
338 node.includes = """
339 src/
340 deps/v8/include
341 deps/libev
Ryan Dahle9a116f2010-04-06 10:41:32342 deps/c-ares
Jérémy Lalc93bab12010-03-11 21:15:32343 deps/libeio
Jérémy Lalc93bab12010-03-11 21:15:32344 deps/http_parser
Jérémy Lalc93bab12010-03-11 21:15:32345 """
Ryan Dahle9a116f2010-04-06 10:41:32346
Ryan Dahl9ea8c9f2010-04-07 20:34:40347 node.includes += ' deps/c-ares/' + bld.env['DEST_OS'] + '-' + bld.env['DEST_CPU']
Vanilla Hsu067f4082010-04-07 16:05:37348
Ryan Dahle9a116f2010-04-06 10:41:32349
Felix Geisendörfer20356122010-04-20 08:46:54350 node.add_objects = 'cares ev eio http_parser'
Jérémy Lalc93bab12010-03-11 21:15:32351 node.uselib_local = ''
Jérémy Lal610faf72010-04-24 07:37:46352 node.uselib = 'RT OPENSSL V8 EXECINFO DL KVM SOCKET NSL'
Jérémy Lalc93bab12010-03-11 21:15:32353 else:
354 node.includes = """
355 src/
356 deps/libeio
Jérémy Lalc93bab12010-03-11 21:15:32357 deps/http_parser
Jérémy Lalc93bab12010-03-11 21:15:32358 """
Felix Geisendörfer20356122010-04-20 08:46:54359 node.add_objects = 'eio http_parser'
Jérémy Lalc93bab12010-03-11 21:15:32360 node.uselib_local = 'eio'
Jérémy Lal610faf72010-04-24 07:37:46361 node.uselib = 'RT EV OPENSSL CARES V8 EXECINFO DL KVM SOCKET NSL'
Rhys Jonesb6dda612009-11-22 02:58:08362
Ryan8152f9c2009-09-01 12:15:29363 node.install_path = '${PREFIX}/lib'
Ryan8e7bbf22009-04-23 17:26:56364 node.install_path = '${PREFIX}/bin'
365 node.chmod = 0755
366
Ryan4d921992009-08-26 23:11:16367 def subflags(program):
Ryan Dahld979ac92009-10-09 13:00:12368 if os.path.exists(join(cwd, ".git")):
Ryan Dahl962e9292009-10-09 14:16:27369 actual_version=cmd_output("git describe").strip()
Ryan Dahld979ac92009-10-09 13:00:12370 else:
371 actual_version=VERSION
372
Ryanb73264d2009-08-27 00:15:11373 x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
374 , 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
375 , 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
Ryan Dahld979ac92009-10-09 13:00:12376 , 'VERSION' : actual_version
Ryanb73264d2009-08-27 00:15:11377 , 'PREFIX' : program.env["PREFIX"]
Ryan4d921992009-08-26 23:11:16378 }
Ryan Dahlbf0d2782009-10-03 20:42:03379 return x
Ryan4d921992009-08-26 23:11:16380
Ryan4d921992009-08-26 23:11:16381 # process file.pc.in -> file.pc
Ryan Dahld979ac92009-10-09 13:00:12382
Ryanb73264d2009-08-27 00:15:11383 node_version = bld.new_task_gen('subst', before="cxx")
384 node_version.source = 'src/node_version.h.in'
385 node_version.target = 'src/node_version.h'
386 node_version.dict = subflags(node)
Ryana97dce72009-08-31 09:14:34387 node_version.install_path = '${PREFIX}/include/node'
Ryan4d921992009-08-26 23:11:16388
Ryan29b528c2009-04-23 15:29:31389 if bld.env["USE_DEBUG"]:
Ryan2b6d7242009-06-20 13:07:10390 node_g = node.clone("debug")
391 node_g.target = "node_g"
Ryan4d921992009-08-26 23:11:16392
Ryanb73264d2009-08-27 00:15:11393 node_version_g = node_version.clone("debug")
394 node_version_g.dict = subflags(node_g)
Ryana97dce72009-08-31 09:14:34395 node_version_g.install_path = None
Ryan4d921992009-08-26 23:11:16396
Ryana97dce72009-08-31 09:14:34397
398 bld.install_files('${PREFIX}/include/node/', """
399 config.h
400 src/node.h
Ryan Dahl5f466c82009-10-27 19:17:03401 src/node_object_wrap.h
Ryan Dahld2415942010-05-06 21:14:52402 src/node_buffer.h
Ryan Dahl5f466c82009-10-27 19:17:03403 src/node_events.h
Ryan Dahlbf0d2782009-10-03 20:42:03404 """)
405
406 # Only install the man page if it exists.
407 # Do 'make doc install' to build and install it.
408 if os.path.exists('doc/node.1'):
409 bld.install_files('${PREFIX}/share/man/man1/', 'doc/node.1')
410
411 bld.install_files('${PREFIX}/bin/', 'bin/*', chmod=0755)
Ryan Dahl6f17ca52009-10-03 17:08:05412
413 # Why am I using two lines? Because WAF SUCKS.
Ryan Dahlbf0d2782009-10-03 20:42:03414 bld.install_files('${PREFIX}/lib/node/wafadmin', 'tools/wafadmin/*.py')
415 bld.install_files('${PREFIX}/lib/node/wafadmin/Tools', 'tools/wafadmin/Tools/*.py')
Ryan Dahl6f17ca52009-10-03 17:08:05416
Ryan Dahl132d6852009-10-27 17:11:07417def shutdown():
418 Options.options.debug
419 # HACK to get binding.node out of build directory.
420 # better way to do this?
421 if not Options.commands['clean']:
422 if os.path.exists('build/default/node') and not os.path.exists('node'):
423 os.symlink('build/default/node', 'node')
424 if os.path.exists('build/debug/node_g') and not os.path.exists('node_g'):
425 os.symlink('build/debug/node_g', 'node_g')
426 else:
427 if os.path.exists('node'): os.unlink('node')
428 if os.path.exists('node_g'): os.unlink('node_g')