blob: 2431ecb1c3de02f99e6bb22caf471d3aa53eb2b3 [file] [log] [blame]
Ryana3627c02009-05-27 14:29:551# /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 Dahlda004132010-01-20 19:28:3210VERSION="0.1.26"
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
18def set_options(opt):
19 # the gcc module provides a --debug-level option
20 opt.tool_options('compiler_cxx')
21 opt.tool_options('compiler_cc')
Ryan4d921992009-08-26 23:11:1622 opt.tool_options('misc')
Ryan29b528c2009-04-23 15:29:3123 opt.add_option( '--debug'
24 , action='store_true'
25 , default=False
26 , help='Build debug variant [Default: False]'
27 , dest='debug'
28 )
Ryan7bad9de2009-06-16 13:47:5729 opt.add_option( '--efence'
30 , action='store_true'
31 , default=False
32 , help='Build with -lefence for debugging [Default: False]'
33 , dest='efence'
34 )
Ryan1a126ed2009-04-04 12:50:1535
Ryan41d89f62009-07-28 10:29:1836def mkdir_p(dir):
37 if not os.path.exists (dir):
38 os.makedirs (dir)
39
Ryan Dahl18da8ff2009-09-28 20:39:0040# Copied from Python 2.6 because 2.4.4 at least is broken by not using
41# mkdirs
42# http://mail.python.org/pipermail/python-bugs-list/2005-January/027118.html
43def copytree(src, dst, symlinks=False, ignore=None):
44 names = os.listdir(src)
45 if ignore is not None:
46 ignored_names = ignore(src, names)
47 else:
48 ignored_names = set()
49
50 os.makedirs(dst)
51 errors = []
52 for name in names:
53 if name in ignored_names:
54 continue
Ryan Dahl53ebe752009-10-08 21:20:1455 srcname = join(src, name)
56 dstname = join(dst, name)
Ryan Dahl18da8ff2009-09-28 20:39:0057 try:
58 if symlinks and os.path.islink(srcname):
59 linkto = os.readlink(srcname)
60 os.symlink(linkto, dstname)
61 elif os.path.isdir(srcname):
62 copytree(srcname, dstname, symlinks, ignore)
63 else:
64 shutil.copy2(srcname, dstname)
65 # XXX What about devices, sockets etc.?
66 except (IOError, os.error), why:
67 errors.append((srcname, dstname, str(why)))
68 # catch the Error from the recursive copytree so that we can
69 # continue with other files
70 except Error, err:
71 errors.extend(err.args[0])
72 try:
73 shutil.copystat(src, dst)
74 except OSError, why:
75 if WindowsError is not None and isinstance(why, WindowsError):
76 # Copying file access times may fail on Windows
77 pass
78 else:
79 errors.extend((src, dst, str(why)))
80 if errors:
81 raise Error, errors
82
Ryan41d89f62009-07-28 10:29:1883def conf_subproject (conf, subdir, command=None):
84 print("---- %s ----" % subdir)
85 src = join(conf.srcdir, subdir)
Simon Cornelius P. Umacobe801f422009-12-09 12:36:1286 if not os.path.exists (src): conf.fatal("no such subproject " + subdir)
Ryan41d89f62009-07-28 10:29:1887
88 default_tgt = join(conf.blddir, "default", subdir)
89
90 if not os.path.exists(default_tgt):
Ryan Dahl18da8ff2009-09-28 20:39:0091 copytree(src, default_tgt, True)
Ryan41d89f62009-07-28 10:29:1892
93 if command:
94 if os.system("cd %s && %s" % (default_tgt, command)) != 0:
Simon Cornelius P. Umacobe801f422009-12-09 12:36:1295 conf.fatal("Configuring %s failed." % (subdir))
Ryan41d89f62009-07-28 10:29:1896
97 debug_tgt = join(conf.blddir, "debug", subdir)
98
99 if not os.path.exists(debug_tgt):
Ryan Dahl18da8ff2009-09-28 20:39:00100 copytree(default_tgt, debug_tgt, True)
Ryan41d89f62009-07-28 10:29:18101
Ryan1a126ed2009-04-04 12:50:15102def configure(conf):
103 conf.check_tool('compiler_cxx')
Ryan Dahlf379b772010-01-12 00:43:10104 if not conf.env.CXX: conf.fatal('c++ compiler not found')
Ryan1a126ed2009-04-04 12:50:15105 conf.check_tool('compiler_cc')
Ryan Dahlf379b772010-01-12 00:43:10106 if not conf.env.CC: conf.fatal('c compiler not found')
Ryana4593e32009-04-23 11:18:38107
Ryan8e7bbf22009-04-23 17:26:56108 conf.env["USE_DEBUG"] = Options.options.debug
Ryan1a126ed2009-04-04 12:50:15109
Ryan2b6d7242009-06-20 13:07:10110 conf.check(lib='dl', uselib_store='DL')
Ryan Dahl0c125542010-01-19 23:38:20111 if not sys.platform.startswith("sunos"):
112 conf.env.append_value("CCFLAGS", "-rdynamic")
113 conf.env.append_value("LINKFLAGS_DL", "-rdynamic")
Ryana97dce72009-08-31 09:14:34114
Vanilla Hsud22952b2010-01-07 07:37:27115 if sys.platform.startswith("freebsd"):
116 conf.check(lib='kvm', uselib_store='KVM')
117
Ryan8152f9c2009-09-01 12:15:29118 #if Options.options.debug:
119 # conf.check(lib='profiler', uselib_store='PROFILER')
Ryan7bad9de2009-06-16 13:47:57120
Ryan8152f9c2009-09-01 12:15:29121 #if Options.options.efence:
122 # conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
Ryana3627c02009-05-27 14:29:55123
Ryan Dahl8b62e862009-10-10 09:58:36124 if not conf.check(lib="execinfo", libpath=['/usr/lib', '/usr/local/lib'], uselib_store="EXECINFO"):
Rasmus Andersson6eb8bbc2009-12-15 22:37:49125 # Note on Darwin/OS X: This will fail, but will still be used as the
126 # execinfo stuff are part of the standard library.
Ryan Dahl8b62e862009-10-10 09:58:36127 if sys.platform.startswith("freebsd"):
Simon Cornelius P. Umacobe801f422009-12-09 12:36:12128 conf.fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.")
Ryana3627c02009-05-27 14:29:55129
Rhys Jonesb6dda612009-11-22 02:58:08130 if conf.check_cfg(package='gnutls',
131 args='--cflags --libs',
Ryan Dahl8a58e832009-11-28 14:25:10132 atleast_version='2.5.0',
Rhys Jonesb6dda612009-11-22 02:58:08133 #libpath=['/usr/lib', '/usr/local/lib'],
134 uselib_store='GNUTLS'):
135 if conf.check(lib='gpg-error',
Vanilla Hsud22952b2010-01-07 07:37:27136 libpath=['/usr/lib', '/usr/local/lib'],
Rhys Jonesb6dda612009-11-22 02:58:08137 uselib_store='GPGERROR'):
138 conf.env.append_value("CCFLAGS", "-DEVCOM_HAVE_GNUTLS=1")
139 conf.env.append_value("CXXFLAGS", "-DEVCOM_HAVE_GNUTLS=1")
140
Ryan Dahl0c125542010-01-19 23:38:20141 if sys.platform.startswith("sunos"):
142 if not conf.check(lib='socket', uselib_store="SOCKET"):
143 conf.fatal("Cannot find socket library")
144 if not conf.check(lib='nsl', uselib_store="NSL"):
145 conf.fatal("Cannot find nsl library")
146
Ryan1a126ed2009-04-04 12:50:15147 conf.sub_config('deps/libeio')
148 conf.sub_config('deps/libev')
149
Ryan Dahl0c125542010-01-19 23:38:20150 if sys.platform.startswith("sunos"):
151 conf_subproject(conf, 'deps/udns', 'LIBS="-lsocket -lnsl" ./configure')
152 else:
153 conf_subproject(conf, 'deps/udns', './configure')
Ryan41d89f62009-07-28 10:29:18154
Ryan1a126ed2009-04-04 12:50:15155 conf.define("HAVE_CONFIG_H", 1)
Ryanc62b1242009-04-22 17:55:08156
Ryan Dahl1beb8402009-12-30 08:01:28157 conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
Ryan427e3f52009-05-14 11:16:45158
Ryan Dahl2b743aa2009-10-27 11:05:38159 # LFS
160 conf.env.append_value('CCFLAGS', '-D_LARGEFILE_SOURCE')
161 conf.env.append_value('CXXFLAGS', '-D_LARGEFILE_SOURCE')
162 conf.env.append_value('CCFLAGS', '-D_FILE_OFFSET_BITS=64')
163 conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
164
Ryan Dahlf4811832009-11-02 23:21:00165 # platform
166 platform_def = '-DPLATFORM=' + sys.platform
167 conf.env.append_value('CCFLAGS', platform_def)
168 conf.env.append_value('CXXFLAGS', platform_def)
169
Ryan67af9582009-04-18 13:35:42170 # Split off debug variant before adding variant specific defines
Ryan7e1350f2009-04-16 09:37:44171 debug_env = conf.env.copy()
172 conf.set_env_name('debug', debug_env)
Ryan7e1350f2009-04-16 09:37:44173
Ryan67af9582009-04-18 13:35:42174 # Configure debug variant
175 conf.setenv('debug')
176 debug_env.set_variant('debug')
Ryan8ddf9302009-09-02 18:19:52177 debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
178 debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
Ryan67af9582009-04-18 13:35:42179 conf.write_config_header("config.h")
180
181 # Configure default variant
182 conf.setenv('default')
Ryan8ddf9302009-09-02 18:19:52183 conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-O3'])
184 conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-O3'])
Ryan67af9582009-04-18 13:35:42185 conf.write_config_header("config.h")
Ryan63a9cd32009-04-15 08:08:28186
Ryan41d89f62009-07-28 10:29:18187def build_udns(bld):
188 default_build_dir = bld.srcnode.abspath(bld.env_of_name("default"))
Ryan1a126ed2009-04-04 12:50:15189
Ryan41d89f62009-07-28 10:29:18190 default_dir = join(default_build_dir, "deps/udns")
191
192 static_lib = bld.env["staticlib_PATTERN"] % "udns"
193
194 rule = 'cd %s && make'
195
196 default = bld.new_task_gen(
197 target= join("deps/udns", static_lib),
198 rule= rule % default_dir,
199 before= "cxx",
200 install_path= None
201 )
202
203 bld.env["CPPPATH_UDNS"] = "deps/udns"
Ryan Dahlfc937aa2009-10-27 21:50:46204 t = join(bld.srcnode.abspath(bld.env_of_name("default")), default.target)
205 bld.env_of_name('default')["LINKFLAGS_UDNS"] = [t]
Ryan41d89f62009-07-28 10:29:18206
207 if bld.env["USE_DEBUG"]:
208 debug_build_dir = bld.srcnode.abspath(bld.env_of_name("debug"))
209 debug_dir = join(debug_build_dir, "deps/udns")
210 debug = default.clone("debug")
211 debug.rule = rule % debug_dir
Ryan Dahlfc937aa2009-10-27 21:50:46212 t = join(bld.srcnode.abspath(bld.env_of_name("debug")), debug.target)
213 bld.env_of_name('debug')["LINKFLAGS_UDNS"] = [t]
Ryan Dahl0c125542010-01-19 23:38:20214
Ryan Dahlbf0d2782009-10-03 20:42:03215 bld.install_files('${PREFIX}/include/node/', 'deps/udns/udns.h')
Ryan41d89f62009-07-28 10:29:18216
Ryan Dahl53ebe752009-10-08 21:20:14217def v8_cmd(bld, variant):
218 scons = join(cwd, 'tools/scons/scons.py')
Ryan1a126ed2009-04-04 12:50:15219 deps_src = join(bld.path.abspath(),"deps")
Ryan1a126ed2009-04-04 12:50:15220 v8dir_src = join(deps_src,"v8")
Ryan Dahl53ebe752009-10-08 21:20:14221
Ryan Dahlbc9b3432009-10-02 12:10:40222 # NOTE: We want to compile V8 to export its symbols. I.E. Do not want
223 # -fvisibility=hidden. When using dlopen() it seems that the loaded DSO
224 # cannot see symbols in the executable which are hidden, even if the
225 # executable is statically linked together...
Ryan8ddf9302009-09-02 18:19:52226
Ryan Dahl7d9d8812009-10-26 21:27:52227 # XXX Remove this when v8 defaults x86_64 to native builds
Ryan Dahld85724d2009-10-08 22:34:39228 arch = ""
Ryan Dahl7d9d8812009-10-26 21:27:52229 if bld.env['DEST_CPU'] == 'x86_64':
Ryan Dahld85724d2009-10-08 22:34:39230 arch = "arch=x64"
231
232 if variant == "default":
233 mode = "release"
234 else:
235 mode = "debug"
Ryana4593e32009-04-23 11:18:38236
Ryan Dahl53ebe752009-10-08 21:20:14237 cmd_R = 'python %s -C %s -Y %s visibility=default mode=%s %s library=static snapshot=on'
238
239 cmd = cmd_R % ( scons
240 , bld.srcnode.abspath(bld.env_of_name(variant))
241 , v8dir_src
242 , mode
243 , arch
244 )
245 return cmd
246
247
248def build_v8(bld):
Ryan1a126ed2009-04-04 12:50:15249 v8 = bld.new_task_gen(
Ryan Dahl59b7a1b2009-10-09 10:49:48250 source = 'deps/v8/SConstruct '
251 + bld.path.ant_glob('v8/include/*')
252 + bld.path.ant_glob('v8/src/*'),
Ryan Dahl53ebe752009-10-08 21:20:14253 target = bld.env["staticlib_PATTERN"] % "v8",
254 rule = v8_cmd(bld, "default"),
255 before = "cxx",
256 install_path = None
Ryan1a126ed2009-04-04 12:50:15257 )
Ryan Dahl8b62e862009-10-10 09:58:36258 v8.uselib = "EXECINFO"
Ryan1a126ed2009-04-04 12:50:15259 bld.env["CPPPATH_V8"] = "deps/v8/include"
Ryan Dahlfc937aa2009-10-27 21:50:46260 t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
Ryan Dahl0c125542010-01-19 23:38:20261 if sys.platform.startswith("sunos"):
262 bld.env_of_name('default')["LINKFLAGS_V8"] = ["-mt", t]
263 else:
264 bld.env_of_name('default')["LINKFLAGS_V8"] = ["-pthread", t]
Ryana4593e32009-04-23 11:18:38265
266 ### v8 debug
Ryan29b528c2009-04-23 15:29:31267 if bld.env["USE_DEBUG"]:
Ryan29b528c2009-04-23 15:29:31268 v8_debug = v8.clone("debug")
Ryan Dahl53ebe752009-10-08 21:20:14269 v8_debug.rule = v8_cmd(bld, "debug")
270 v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g"
Ryan Dahl8b62e862009-10-10 09:58:36271 v8_debug.uselib = "EXECINFO"
Ryan Dahlfc937aa2009-10-27 21:50:46272 t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
Ryan Dahl0c125542010-01-19 23:38:20273 if sys.platform.startswith("sunos"):
274 bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-mt", t]
275 else:
276 bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-pthread", t]
Ryan1a126ed2009-04-04 12:50:15277
Ryan Dahl53ebe752009-10-08 21:20:14278 bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
Ryan2b6d7242009-06-20 13:07:10279
Ryan41d89f62009-07-28 10:29:18280def build(bld):
281 bld.add_subdirs('deps/libeio deps/libev')
282
283 build_udns(bld)
284 build_v8(bld)
285
Ryan0fb0af32009-07-25 15:52:21286 ### evcom
Ryan Dahl122e74b2009-10-27 21:26:53287 evcom = bld.new_task_gen("cc")
Ryan0fb0af32009-07-25 15:52:21288 evcom.source = "deps/evcom/evcom.c"
289 evcom.includes = "deps/evcom/ deps/libev/"
290 evcom.name = "evcom"
291 evcom.target = "evcom"
Rhys Jonesb6dda612009-11-22 02:58:08292 evcom.uselib = "GPGERROR GNUTLS"
Ryan0fb0af32009-07-25 15:52:21293 evcom.install_path = None
Ryan29b528c2009-04-23 15:29:31294 if bld.env["USE_DEBUG"]:
Ryan0fb0af32009-07-25 15:52:21295 evcom.clone("debug")
Ryan Dahlbf0d2782009-10-03 20:42:03296 bld.install_files('${PREFIX}/include/node/', 'deps/evcom/evcom.h')
Ryan1a126ed2009-04-04 12:50:15297
Ryan5a071ad2009-05-03 12:09:16298 ### http_parser
Ryan Dahl122e74b2009-10-27 21:26:53299 http_parser = bld.new_task_gen("cc")
Ryan5a071ad2009-05-03 12:09:16300 http_parser.source = "deps/http_parser/http_parser.c"
301 http_parser.includes = "deps/http_parser/"
302 http_parser.name = "http_parser"
303 http_parser.target = "http_parser"
304 http_parser.install_path = None
Ryan29b528c2009-04-23 15:29:31305 if bld.env["USE_DEBUG"]:
Ryan5a071ad2009-05-03 12:09:16306 http_parser.clone("debug")
Ryan1a126ed2009-04-04 12:50:15307
Ryan17c6a672009-08-24 18:25:24308 ### coupling
Ryan Dahl122e74b2009-10-27 21:26:53309 coupling = bld.new_task_gen("cc")
Ryan17c6a672009-08-24 18:25:24310 coupling.source = "deps/coupling/coupling.c"
311 coupling.includes = "deps/coupling/"
312 coupling.name = "coupling"
313 coupling.target = "coupling"
314 coupling.install_path = None
315 if bld.env["USE_DEBUG"]:
316 coupling.clone("debug")
317
Ryan63a9cd32009-04-15 08:08:28318 ### src/native.cc
319 def javascript_in_c(task):
320 env = task.env
321 source = map(lambda x: x.srcpath(env), task.inputs)
322 targets = map(lambda x: x.srcpath(env), task.outputs)
323 js2c.JS2C(source, targets)
324
325 native_cc = bld.new_task_gen(
Ryan Dahld737a062009-11-07 13:37:22326 source='src/node.js',
Ryan Dahl53ebe752009-10-08 21:20:14327 target="src/node_natives.h",
Ryan63a9cd32009-04-15 08:08:28328 before="cxx"
329 )
Ryan8e7bbf22009-04-23 17:26:56330 native_cc.install_path = None
Ryan Dahl4bcb01c2009-10-16 20:53:44331
332 # Add the rule /after/ cloning the debug
333 # This is a work around for an error had in python 2.4.3 (I'll paste the
334 # error that was had into the git commit meessage. git-blame to find out
335 # where.)
Ryan29b528c2009-04-23 15:29:31336 if bld.env["USE_DEBUG"]:
Ryan Dahl4bcb01c2009-10-16 20:53:44337 native_cc_debug = native_cc.clone("debug")
338 native_cc_debug.rule = javascript_in_c
339 native_cc.rule = javascript_in_c
Ryan63a9cd32009-04-15 08:08:28340
Ryan2b6d7242009-06-20 13:07:10341 ### node lib
Ryan8152f9c2009-09-01 12:15:29342 node = bld.new_task_gen("cxx", "program")
343 node.name = "node"
344 node.target = "node"
345 node.source = """
Ryan1a126ed2009-04-04 12:50:15346 src/node.cc
Ryan Dahl630bb7a2009-12-13 07:42:45347 src/node_buffer.cc
Ryan Dahlc819abc2009-12-14 08:42:02348 src/node_net2.cc
Ryan Dahl42ee1692010-01-24 19:21:45349 src/node_http_parser.cc
Ryan Dahlf2199382009-12-13 14:43:58350 src/node_io_watcher.cc
Ryan Dahla5df0f62009-10-27 10:46:58351 src/node_child_process.cc
352 src/node_constants.cc
353 src/node_dns.cc
354 src/node_events.cc
355 src/node_file.cc
356 src/node_http.cc
357 src/node_net.cc
358 src/node_signal_handler.cc
Ryan Dahl8d2f9e82009-11-17 13:07:48359 src/node_stat.cc
Ryan17c6a672009-08-24 18:25:24360 src/node_stdio.cc
Ryan Dahla5df0f62009-10-27 10:46:58361 src/node_timer.cc
Ryan Dahlaeb7d6d2010-01-18 18:12:04362 src/node_idle_watcher.cc
Ryan1a126ed2009-04-04 12:50:15363 """
Ryan8152f9c2009-09-01 12:15:29364 node.includes = """
Ryan1a126ed2009-04-04 12:50:15365 src/
366 deps/v8/include
367 deps/libev
Ryan41d89f62009-07-28 10:29:18368 deps/udns
Ryan1a126ed2009-04-04 12:50:15369 deps/libeio
Ryan0fb0af32009-07-25 15:52:21370 deps/evcom
Ryan5a071ad2009-05-03 12:09:16371 deps/http_parser
Ryan17c6a672009-08-24 18:25:24372 deps/coupling
Ryan1a126ed2009-04-04 12:50:15373 """
Ryan Dahl122e74b2009-10-27 21:26:53374 node.add_objects = 'ev eio evcom http_parser coupling'
375 node.uselib_local = ''
Ryan Dahl0c125542010-01-19 23:38:20376 node.uselib = 'GNUTLS GPGERROR UDNS V8 EXECINFO DL KVM SOCKET NSL'
Rhys Jonesb6dda612009-11-22 02:58:08377
Ryan8152f9c2009-09-01 12:15:29378 node.install_path = '${PREFIX}/lib'
Ryan8e7bbf22009-04-23 17:26:56379 node.install_path = '${PREFIX}/bin'
380 node.chmod = 0755
381
Ryan4d921992009-08-26 23:11:16382 def subflags(program):
Ryan Dahld979ac92009-10-09 13:00:12383 if os.path.exists(join(cwd, ".git")):
Ryan Dahl962e9292009-10-09 14:16:27384 actual_version=cmd_output("git describe").strip()
Ryan Dahld979ac92009-10-09 13:00:12385 else:
386 actual_version=VERSION
387
Ryanb73264d2009-08-27 00:15:11388 x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
389 , 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
390 , 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
Ryan Dahld979ac92009-10-09 13:00:12391 , 'VERSION' : actual_version
Ryanb73264d2009-08-27 00:15:11392 , 'PREFIX' : program.env["PREFIX"]
Ryan4d921992009-08-26 23:11:16393 }
Ryan Dahlbf0d2782009-10-03 20:42:03394 return x
Ryan4d921992009-08-26 23:11:16395
Ryan4d921992009-08-26 23:11:16396 # process file.pc.in -> file.pc
Ryan Dahld979ac92009-10-09 13:00:12397
Ryanb73264d2009-08-27 00:15:11398 node_version = bld.new_task_gen('subst', before="cxx")
399 node_version.source = 'src/node_version.h.in'
400 node_version.target = 'src/node_version.h'
401 node_version.dict = subflags(node)
Ryana97dce72009-08-31 09:14:34402 node_version.install_path = '${PREFIX}/include/node'
Ryan4d921992009-08-26 23:11:16403
Ryan29b528c2009-04-23 15:29:31404 if bld.env["USE_DEBUG"]:
Ryan2b6d7242009-06-20 13:07:10405 node_g = node.clone("debug")
406 node_g.target = "node_g"
Ryan4d921992009-08-26 23:11:16407
Ryanb73264d2009-08-27 00:15:11408 node_version_g = node_version.clone("debug")
409 node_version_g.dict = subflags(node_g)
Ryana97dce72009-08-31 09:14:34410 node_version_g.install_path = None
Ryan4d921992009-08-26 23:11:16411
Ryana97dce72009-08-31 09:14:34412
413 bld.install_files('${PREFIX}/include/node/', """
414 config.h
415 src/node.h
Ryan Dahl5f466c82009-10-27 19:17:03416 src/node_object_wrap.h
417 src/node_events.h
418 src/node_net.h
Ryan Dahlbf0d2782009-10-03 20:42:03419 """)
420
421 # Only install the man page if it exists.
422 # Do 'make doc install' to build and install it.
423 if os.path.exists('doc/node.1'):
424 bld.install_files('${PREFIX}/share/man/man1/', 'doc/node.1')
425
426 bld.install_files('${PREFIX}/bin/', 'bin/*', chmod=0755)
Ryan Dahl6f17ca52009-10-03 17:08:05427
428 # Why am I using two lines? Because WAF SUCKS.
Ryan Dahlbf0d2782009-10-03 20:42:03429 bld.install_files('${PREFIX}/lib/node/wafadmin', 'tools/wafadmin/*.py')
430 bld.install_files('${PREFIX}/lib/node/wafadmin/Tools', 'tools/wafadmin/Tools/*.py')
Ryan Dahl6f17ca52009-10-03 17:08:05431
Ryan Dahlbf0d2782009-10-03 20:42:03432 bld.install_files('${PREFIX}/lib/node/libraries/', 'lib/*.js')
Ryan Dahl132d6852009-10-27 17:11:07433
434def shutdown():
435 Options.options.debug
436 # HACK to get binding.node out of build directory.
437 # better way to do this?
438 if not Options.commands['clean']:
439 if os.path.exists('build/default/node') and not os.path.exists('node'):
440 os.symlink('build/default/node', 'node')
441 if os.path.exists('build/debug/node_g') and not os.path.exists('node_g'):
442 os.symlink('build/debug/node_g', 'node_g')
443 else:
444 if os.path.exists('node'): os.unlink('node')
445 if os.path.exists('node_g'): os.unlink('node_g')