~ubuntu-branches/ubuntu/natty/nodejs/natty

« back to all changes in this revision

Viewing changes to .pc/no-v8-debug-lib.patch/wscript

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, Jérémy Lal, Jonas Smedegaard
  • Date: 2011-02-07 23:39:40 UTC
  • mfrom: (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110207233940-ctxh80ux4u7xfybh
Tags: 0.2.6-4
[ Jérémy Lal ]
* Disable simple/test-buffer Buffer.unpack test that fails on ARM.
  The pack/unpack functions are deprecated, and not documented.

[ Jonas Smedegaard ]
* Drop done items from TODO.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
import re
3
 
import Options
4
 
import sys, os, shutil
5
 
from Utils import cmd_output
6
 
from os.path import join, dirname, abspath
7
 
from logging import fatal
8
 
 
9
 
cwd = os.getcwd()
10
 
APPNAME="node.js"
11
 
 
12
 
import js2c
13
 
 
14
 
srcdir = '.'
15
 
blddir = 'build'
16
 
 
17
 
 
18
 
jobs=1
19
 
if os.environ.has_key('JOBS'):
20
 
  jobs = int(os.environ['JOBS'])
21
 
else:
22
 
  try:
23
 
    import multiprocessing
24
 
    jobs = multiprocessing.cpu_count()
25
 
  except:
26
 
    pass
27
 
 
28
 
def set_options(opt):
29
 
  # the gcc module provides a --debug-level option
30
 
  opt.tool_options('compiler_cxx')
31
 
  opt.tool_options('compiler_cc')
32
 
  opt.tool_options('misc')
33
 
  opt.add_option( '--debug'
34
 
                , action='store_true'
35
 
                , default=False
36
 
                , help='Build debug variant [Default: False]'
37
 
                , dest='debug'
38
 
                )
39
 
  opt.add_option( '--efence'
40
 
                , action='store_true'
41
 
                , default=False
42
 
                , help='Build with -lefence for debugging [Default: False]'
43
 
                , dest='efence'
44
 
                )
45
 
 
46
 
  opt.add_option( '--without-snapshot'
47
 
                , action='store_true'
48
 
                , default=False
49
 
                , help='Build without snapshotting V8 libraries. You might want to set this for cross-compiling. [Default: False]'
50
 
                , dest='without_snapshot'
51
 
                )
52
 
 
53
 
  opt.add_option( '--without-ssl'
54
 
                , action='store_true'
55
 
                , default=False
56
 
                , help='Build without SSL'
57
 
                , dest='without_ssl'
58
 
                )
59
 
 
60
 
 
61
 
  opt.add_option('--shared-v8'
62
 
                , action='store_true'
63
 
                , default=False
64
 
                , help='Link to a shared V8 DLL instead of static linking'
65
 
                , dest='shared_v8'
66
 
                )
67
 
 
68
 
  opt.add_option( '--shared-v8-includes'
69
 
                , action='store'
70
 
                , default=False
71
 
                , help='Directory containing V8 header files'
72
 
                , dest='shared_v8_includes'
73
 
                )
74
 
 
75
 
  opt.add_option( '--shared-v8-libpath'
76
 
                , action='store'
77
 
                , default=False
78
 
                , help='A directory to search for the shared V8 DLL'
79
 
                , dest='shared_v8_libpath'
80
 
                )
81
 
 
82
 
  opt.add_option( '--shared-v8-libname'
83
 
                , action='store'
84
 
                , default=False
85
 
                , help="Alternative lib name to link to (default: 'v8')"
86
 
                , dest='shared_v8_libname'
87
 
                )
88
 
 
89
 
 
90
 
  opt.add_option('--shared-cares'
91
 
                , action='store_true'
92
 
                , default=False
93
 
                , help='Link to a shared C-Ares DLL instead of static linking'
94
 
                , dest='shared_cares'
95
 
                )
96
 
 
97
 
  opt.add_option( '--shared-cares-includes'
98
 
                , action='store'
99
 
                , default=False
100
 
                , help='Directory containing C-Ares header files'
101
 
                , dest='shared_cares_includes'
102
 
                )
103
 
 
104
 
  opt.add_option( '--shared-cares-libpath'
105
 
                , action='store'
106
 
                , default=False
107
 
                , help='A directory to search for the shared C-Ares DLL'
108
 
                , dest='shared_cares_libpath'
109
 
                )
110
 
 
111
 
 
112
 
  opt.add_option('--shared-libev'
113
 
                , action='store_true'
114
 
                , default=False
115
 
                , help='Link to a shared libev DLL instead of static linking'
116
 
                , dest='shared_libev'
117
 
                )
118
 
 
119
 
  opt.add_option( '--shared-libev-includes'
120
 
                , action='store'
121
 
                , default=False
122
 
                , help='Directory containing libev header files'
123
 
                , dest='shared_libev_includes'
124
 
                )
125
 
 
126
 
  opt.add_option( '--shared-libev-libpath'
127
 
                , action='store'
128
 
                , default=False
129
 
                , help='A directory to search for the shared libev DLL'
130
 
                , dest='shared_libev_libpath'
131
 
                )
132
 
 
133
 
 
134
 
 
135
 
 
136
 
def configure(conf):
137
 
  conf.check_tool('compiler_cxx')
138
 
  if not conf.env.CXX: conf.fatal('c++ compiler not found')
139
 
  conf.check_tool('compiler_cc')
140
 
  if not conf.env.CC: conf.fatal('c compiler not found')
141
 
 
142
 
  o = Options.options
143
 
 
144
 
  conf.env["USE_DEBUG"] = o.debug
145
 
  conf.env["SNAPSHOT_V8"] = not o.without_snapshot
146
 
 
147
 
  conf.env["USE_SHARED_V8"] = o.shared_v8 or o.shared_v8_includes or o.shared_v8_libpath or o.shared_v8_libname
148
 
  conf.env["USE_SHARED_CARES"] = o.shared_cares or o.shared_cares_includes or o.shared_cares_libpath
149
 
  conf.env["USE_SHARED_LIBEV"] = o.shared_libev or o.shared_libev_includes or o.shared_libev_libpath
150
 
 
151
 
  conf.check(lib='dl', uselib_store='DL')
152
 
  if not sys.platform.startswith("sunos") and not sys.platform.startswith("cygwin"):
153
 
    conf.env.append_value("CCFLAGS", "-rdynamic")
154
 
    conf.env.append_value("LINKFLAGS_DL", "-rdynamic")
155
 
 
156
 
  if sys.platform.startswith("freebsd"):
157
 
    conf.check(lib='kvm', uselib_store='KVM')
158
 
 
159
 
  #if Options.options.debug:
160
 
  #  conf.check(lib='profiler', uselib_store='PROFILER')
161
 
 
162
 
  if Options.options.efence:
163
 
    conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
164
 
 
165
 
  if not conf.check(lib="execinfo", includes=['/usr/include', '/usr/local/include'], libpath=['/usr/lib', '/usr/local/lib'], uselib_store="EXECINFO"):
166
 
    # Note on Darwin/OS X: This will fail, but will still be used as the
167
 
    # execinfo stuff are part of the standard library.
168
 
    if sys.platform.startswith("freebsd"):
169
 
      conf.fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.")
170
 
 
171
 
  if not Options.options.without_ssl:
172
 
    if conf.check_cfg(package='openssl',
173
 
                      args='--cflags --libs',
174
 
                      uselib_store='OPENSSL'):
175
 
      Options.options.use_openssl = conf.env["USE_OPENSSL"] = True
176
 
      conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
177
 
    else:
178
 
      libssl = conf.check_cc(lib='ssl',
179
 
                             header_name='openssl/ssl.h',
180
 
                             function_name='SSL_library_init',
181
 
                             libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'],
182
 
                             uselib_store='OPENSSL')
183
 
      libcrypto = conf.check_cc(lib='crypto',
184
 
                                header_name='openssl/crypto.h',
185
 
                                uselib_store='OPENSSL')
186
 
      if libcrypto and libssl:
187
 
        conf.env["USE_OPENSSL"] = Options.options.use_openssl = True
188
 
        conf.env.append_value("CXXFLAGS", "-DHAVE_OPENSSL=1")
189
 
 
190
 
  conf.check(lib='rt', uselib_store='RT')
191
 
 
192
 
  if sys.platform.startswith("sunos"):
193
 
    if not conf.check(lib='socket', uselib_store="SOCKET"):
194
 
      conf.fatal("Cannot find socket library")
195
 
    if not conf.check(lib='nsl', uselib_store="NSL"):
196
 
      conf.fatal("Cannot find nsl library")
197
 
 
198
 
  conf.sub_config('deps/libeio')
199
 
 
200
 
  if conf.env['USE_SHARED_V8']:
201
 
    v8_includes = [];
202
 
    if o.shared_v8_includes: v8_includes.append(o.shared_v8_includes);
203
 
 
204
 
    v8_libpath = [];
205
 
    if o.shared_v8_libpath: v8_libpath.append(o.shared_v8_libpath);
206
 
 
207
 
    if not o.shared_v8_libname: o.shared_v8_libname = 'v8'
208
 
 
209
 
    if not conf.check_cxx(lib=o.shared_v8_libname, header_name='v8.h',
210
 
                          uselib_store='V8',
211
 
                          includes=v8_includes,
212
 
                          libpath=v8_libpath):
213
 
      conf.fatal("Cannot find v8")
214
 
 
215
 
    if o.debug:
216
 
      if not conf.check_cxx(lib=o.shared_v8_libname + '_g', header_name='v8.h',
217
 
                            uselib_store='V8_G',
218
 
                            includes=v8_includes,
219
 
                            libpath=v8_libpath):
220
 
        conf.fatal("Cannot find v8_g")
221
 
 
222
 
  if conf.env['USE_SHARED_CARES']:
223
 
    cares_includes = [];
224
 
    if o.shared_cares_includes: cares_includes.append(o.shared_cares_includes);
225
 
    cares_libpath = [];
226
 
    if o.shared_cares_libpath: cares_libpath.append(o.shared_cares_libpath);
227
 
    if not conf.check_cxx(lib='cares',
228
 
                          header_name='ares.h',
229
 
                          uselib_store='CARES',
230
 
                          includes=cares_includes,
231
 
                          libpath=cares_libpath):
232
 
      conf.fatal("Cannot find c-ares")
233
 
  else:
234
 
    conf.sub_config('deps/c-ares')
235
 
 
236
 
 
237
 
  if conf.env['USE_SHARED_LIBEV']:
238
 
    libev_includes = [];
239
 
    if o.shared_libev_includes: libev_includes.append(o.shared_libev_includes);
240
 
    libev_libpath = [];
241
 
    if o.shared_libev_libpath: libev_libpath.append(o.shared_libev_libpath);
242
 
    if not conf.check_cxx(lib='ev', header_name='ev.h',
243
 
                          uselib_store='EV',
244
 
                          includes=libev_includes,
245
 
                          libpath=libev_libpath):
246
 
      conf.fatal("Cannot find libev")
247
 
  else:
248
 
    conf.sub_config('deps/libev')
249
 
 
250
 
 
251
 
 
252
 
  conf.define("HAVE_CONFIG_H", 1)
253
 
 
254
 
  if sys.platform.startswith("sunos"):
255
 
    conf.env.append_value ('CCFLAGS', '-threads')
256
 
    conf.env.append_value ('CXXFLAGS', '-threads')
257
 
    #conf.env.append_value ('LINKFLAGS', ' -threads')
258
 
  elif not sys.platform.startswith("cygwin"):
259
 
    threadflags='-pthread'
260
 
    conf.env.append_value ('CCFLAGS', threadflags)
261
 
    conf.env.append_value ('CXXFLAGS', threadflags)
262
 
    conf.env.append_value ('LINKFLAGS', threadflags)
263
 
  if sys.platform.startswith("darwin"):
264
 
    # used by platform_darwin_*.cc
265
 
    conf.env.append_value('LINKFLAGS', ['-framework','Carbon'])
266
 
 
267
 
  conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
268
 
 
269
 
  # LFS
270
 
  conf.env.append_value('CCFLAGS',  '-D_LARGEFILE_SOURCE')
271
 
  conf.env.append_value('CXXFLAGS', '-D_LARGEFILE_SOURCE')
272
 
  conf.env.append_value('CCFLAGS',  '-D_FILE_OFFSET_BITS=64')
273
 
  conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
274
 
 
275
 
  ## needed for node_file.cc fdatasync
276
 
  ## Strangely on OSX 10.6 the g++ doesn't see fdatasync but gcc does?
277
 
  code =  """
278
 
    #include <unistd.h>
279
 
    int main(void)
280
 
    {
281
 
       int fd = 0;
282
 
       fdatasync (fd);
283
 
       return 0;
284
 
    }
285
 
  """
286
 
  if conf.check_cxx(msg="Checking for fdatasync(2) with c++", fragment=code):
287
 
    conf.env.append_value('CXXFLAGS', '-DHAVE_FDATASYNC=1')
288
 
  else:
289
 
    conf.env.append_value('CXXFLAGS', '-DHAVE_FDATASYNC=0')
290
 
 
291
 
  # platform
292
 
  platform_def = '-DPLATFORM="' + conf.env['DEST_OS'] + '"'
293
 
  conf.env.append_value('CCFLAGS', platform_def)
294
 
  conf.env.append_value('CXXFLAGS', platform_def)
295
 
 
296
 
  # Split off debug variant before adding variant specific defines
297
 
  debug_env = conf.env.copy()
298
 
  conf.set_env_name('debug', debug_env)
299
 
 
300
 
  # Configure debug variant
301
 
  conf.setenv('debug')
302
 
  debug_env.set_variant('debug')
303
 
  debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
304
 
  debug_env.append_value('CXXFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
305
 
  conf.write_config_header("config.h")
306
 
 
307
 
  # Configure default variant
308
 
  conf.setenv('default')
309
 
  conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-g', '-O3'])
310
 
  conf.env.append_value('CXXFLAGS', ['-DNDEBUG', '-g', '-O3'])
311
 
  conf.write_config_header("config.h")
312
 
 
313
 
 
314
 
def v8_cmd(bld, variant):
315
 
  scons = join(cwd, 'tools/scons/scons.py')
316
 
  deps_src = join(bld.path.abspath(),"deps")
317
 
  v8dir_src = join(deps_src,"v8")
318
 
 
319
 
  # NOTE: We want to compile V8 to export its symbols. I.E. Do not want
320
 
  # -fvisibility=hidden. When using dlopen() it seems that the loaded DSO
321
 
  # cannot see symbols in the executable which are hidden, even if the
322
 
  # executable is statically linked together...
323
 
 
324
 
  # XXX Remove this when v8 defaults x86_64 to native builds
325
 
  arch = ""
326
 
  if bld.env['DEST_CPU'] == 'x86_64':
327
 
    arch = "arch=x64"
328
 
 
329
 
  if variant == "default":
330
 
    mode = "release"
331
 
  else:
332
 
    mode = "debug"
333
 
 
334
 
  if bld.env["SNAPSHOT_V8"]:
335
 
    snapshot = "snapshot=on"
336
 
  else:
337
 
    snapshot = ""
338
 
 
339
 
  cmd_R = 'python "%s" -j %d -C "%s" -Y "%s" visibility=default mode=%s %s library=static %s'
340
 
 
341
 
  cmd = cmd_R % ( scons
342
 
                , Options.options.jobs
343
 
                , bld.srcnode.abspath(bld.env_of_name(variant))
344
 
                , v8dir_src
345
 
                , mode
346
 
                , arch
347
 
                , snapshot
348
 
                )
349
 
  
350
 
  return ("echo '%s' && " % cmd) + cmd
351
 
 
352
 
 
353
 
def build_v8(bld):
354
 
  v8 = bld.new_task_gen(
355
 
    source        = 'deps/v8/SConstruct '
356
 
                    + bld.path.ant_glob('v8/include/*')
357
 
                    + bld.path.ant_glob('v8/src/*'),
358
 
    target        = bld.env["staticlib_PATTERN"] % "v8",
359
 
    rule          = v8_cmd(bld, "default"),
360
 
    before        = "cxx",
361
 
    install_path  = None)
362
 
  v8.uselib = "EXECINFO"
363
 
  bld.env["CPPPATH_V8"] = "deps/v8/include"
364
 
  t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
365
 
  bld.env_of_name('default').append_value("LINKFLAGS_V8", t)
366
 
 
367
 
 
368
 
  ### v8 debug
369
 
  if bld.env["USE_DEBUG"]:
370
 
    v8_debug = v8.clone("debug")
371
 
    v8_debug.rule   = v8_cmd(bld, "debug")
372
 
    v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g"
373
 
    v8_debug.uselib = "EXECINFO"
374
 
    bld.env["CPPPATH_V8_G"] = "deps/v8/include"
375
 
    t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
376
 
    bld.env_of_name('debug').append_value("LINKFLAGS_V8_G", t)
377
 
 
378
 
  bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
379
 
 
380
 
 
381
 
def build(bld):
382
 
  ## This snippet is to show full commands as WAF executes
383
 
  import Build
384
 
  old = Build.BuildContext.exec_command
385
 
  def exec_command(self, cmd, **kw):
386
 
    if isinstance(cmd, list): print(" ".join(cmd))
387
 
    return old(self, cmd, **kw)
388
 
  Build.BuildContext.exec_command = exec_command
389
 
 
390
 
  Options.options.jobs=jobs
391
 
 
392
 
  print "DEST_OS: " + bld.env['DEST_OS']
393
 
  print "DEST_CPU: " + bld.env['DEST_CPU']
394
 
  print "Parallel Jobs: " + str(Options.options.jobs)
395
 
 
396
 
  bld.add_subdirs('deps/libeio')
397
 
 
398
 
  if not bld.env['USE_SHARED_V8']: build_v8(bld)
399
 
  if not bld.env['USE_SHARED_LIBEV']: bld.add_subdirs('deps/libev')
400
 
  if not bld.env['USE_SHARED_CARES']: bld.add_subdirs('deps/c-ares')
401
 
 
402
 
 
403
 
  ### http_parser
404
 
  http_parser = bld.new_task_gen("cc")
405
 
  http_parser.source = "deps/http_parser/http_parser.c"
406
 
  http_parser.includes = "deps/http_parser/"
407
 
  http_parser.name = "http_parser"
408
 
  http_parser.target = "http_parser"
409
 
  http_parser.install_path = None
410
 
  if bld.env["USE_DEBUG"]:
411
 
    http_parser.clone("debug")
412
 
 
413
 
  ### src/native.cc
414
 
  def make_macros(loc, content):
415
 
    f = open(loc, 'w')
416
 
    f.write(content)
417
 
    f.close
418
 
 
419
 
  macros_loc_debug   = join(
420
 
     bld.srcnode.abspath(bld.env_of_name("debug")),
421
 
     "macros.py"
422
 
  )
423
 
 
424
 
  macros_loc_default = join(
425
 
    bld.srcnode.abspath(bld.env_of_name("default")),
426
 
    "macros.py"
427
 
  )
428
 
 
429
 
  make_macros(macros_loc_debug, "")  # leave debug(x) as is in debug build
430
 
  # replace debug(x) with nothing in release build
431
 
  make_macros(macros_loc_default, "macro debug(x) = ;\n")
432
 
 
433
 
  def javascript_in_c(task):
434
 
    env = task.env
435
 
    source = map(lambda x: x.srcpath(env), task.inputs)
436
 
    targets = map(lambda x: x.srcpath(env), task.outputs)
437
 
    source.append(macros_loc_default)
438
 
    js2c.JS2C(source, targets)
439
 
 
440
 
  def javascript_in_c_debug(task):
441
 
    env = task.env
442
 
    source = map(lambda x: x.srcpath(env), task.inputs)
443
 
    targets = map(lambda x: x.srcpath(env), task.outputs)
444
 
    source.append(macros_loc_debug)
445
 
    js2c.JS2C(source, targets)
446
 
 
447
 
  native_cc = bld.new_task_gen(
448
 
    source='src/node.js ' + bld.path.ant_glob('lib/*.js'),
449
 
    target="src/node_natives.h",
450
 
    before="cxx",
451
 
    install_path=None
452
 
  )
453
 
 
454
 
  # Add the rule /after/ cloning the debug
455
 
  # This is a work around for an error had in python 2.4.3 (I'll paste the
456
 
  # error that was had into the git commit meessage. git-blame to find out
457
 
  # where.)
458
 
  if bld.env["USE_DEBUG"]:
459
 
    native_cc_debug = native_cc.clone("debug")
460
 
    native_cc_debug.rule = javascript_in_c_debug
461
 
 
462
 
  native_cc.rule = javascript_in_c
463
 
 
464
 
  ### node lib
465
 
  node = bld.new_task_gen("cxx", "program")
466
 
  node.name         = "node"
467
 
  node.target       = "node"
468
 
  node.uselib = 'RT EV OPENSSL CARES EXECINFO DL KVM SOCKET NSL'
469
 
  node.add_objects = 'eio http_parser'
470
 
  node.install_path = '${PREFIX}/lib'
471
 
  node.install_path = '${PREFIX}/bin'
472
 
  node.chmod = 0755
473
 
  node.source = """
474
 
    src/node.cc
475
 
    src/node_buffer.cc
476
 
    src/node_extensions.cc
477
 
    src/node_http_parser.cc
478
 
    src/node_net.cc
479
 
    src/node_io_watcher.cc
480
 
    src/node_child_process.cc
481
 
    src/node_constants.cc
482
 
    src/node_cares.cc
483
 
    src/node_events.cc
484
 
    src/node_file.cc
485
 
    src/node_signal_watcher.cc
486
 
    src/node_stat_watcher.cc
487
 
    src/node_stdio.cc
488
 
    src/node_timer.cc
489
 
    src/node_script.cc
490
 
  """
491
 
 
492
 
  platform_file = "src/platform_%s.cc" % bld.env['DEST_OS']
493
 
  if os.path.exists(join(cwd, platform_file)):
494
 
    node.source += platform_file
495
 
  else:
496
 
    node.source += "src/platform_none.cc "
497
 
 
498
 
 
499
 
  if bld.env["USE_OPENSSL"]: node.source += " src/node_crypto.cc "
500
 
 
501
 
  node.includes = """
502
 
    src/
503
 
    deps/libeio
504
 
    deps/http_parser
505
 
  """
506
 
 
507
 
  if not bld.env["USE_SHARED_V8"]: node.includes += ' deps/v8/include '
508
 
 
509
 
  if not bld.env["USE_SHARED_LIBEV"]:
510
 
    node.add_objects += ' ev '
511
 
    node.includes += ' deps/libev '
512
 
 
513
 
  if not bld.env["USE_SHARED_CARES"]:
514
 
    node.add_objects += ' cares '
515
 
    node.includes += '  deps/c-ares deps/c-ares/' + bld.env['DEST_OS'] + '-' + bld.env['DEST_CPU']
516
 
 
517
 
  if sys.platform.startswith('cygwin'):
518
 
    bld.env.append_value('LINKFLAGS', '-Wl,--export-all-symbols')
519
 
    bld.env.append_value('LINKFLAGS', '-Wl,--out-implib,default/libnode.dll.a')
520
 
    bld.env.append_value('LINKFLAGS', '-Wl,--output-def,default/libnode.def')
521
 
    bld.install_files('${PREFIX}/lib', "build/default/libnode.*")
522
 
 
523
 
  def subflags(program):
524
 
    x = { 'CCFLAGS'   : " ".join(program.env["CCFLAGS"]).replace('"', '\\"')
525
 
        , 'CPPFLAGS'  : " ".join(program.env["CPPFLAGS"]).replace('"', '\\"')
526
 
        , 'LIBFLAGS'  : " ".join(program.env["LIBFLAGS"]).replace('"', '\\"')
527
 
        , 'PREFIX'    : program.env["PREFIX"]
528
 
        }
529
 
    return x
530
 
 
531
 
  # process file.pc.in -> file.pc
532
 
 
533
 
  node_conf = bld.new_task_gen('subst', before="cxx")
534
 
  node_conf.source = 'src/node_config.h.in'
535
 
  node_conf.target = 'src/node_config.h'
536
 
  node_conf.dict = subflags(node)
537
 
  node_conf.install_path = '${PREFIX}/include/node'
538
 
 
539
 
  if bld.env["USE_DEBUG"]:
540
 
    node_g = node.clone("debug")
541
 
    node_g.target = "node_g"
542
 
    node_g.uselib += ' V8_G'
543
 
 
544
 
    node_conf_g = node_conf.clone("debug")
545
 
    node_conf_g.dict = subflags(node_g)
546
 
    node_conf_g.install_path = None
547
 
 
548
 
  # After creating the debug clone, append the V8 dep
549
 
  node.uselib += ' V8'
550
 
 
551
 
  bld.install_files('${PREFIX}/include/node/', """
552
 
    config.h
553
 
    src/node.h
554
 
    src/node_object_wrap.h
555
 
    src/node_buffer.h
556
 
    src/node_events.h
557
 
    src/node_version.h
558
 
  """)
559
 
 
560
 
  # Only install the man page if it exists.
561
 
  # Do 'make doc install' to build and install it.
562
 
  if os.path.exists('doc/nodejs.1'):
563
 
    bld.install_files('${PREFIX}/share/man/man1/', 'doc/nodejs.1')
564
 
 
565
 
  bld.install_files('${PREFIX}/bin/', 'bin/*', chmod=0755)
566
 
  bld.install_files('${PREFIX}/share/nodejs/wafadmin', 'tools/wafadmin/*.py')
567
 
  bld.install_files('${PREFIX}/share/nodejs/wafadmin/Tools', 'tools/wafadmin/Tools/*.py')
568
 
 
569
 
def shutdown():
570
 
  Options.options.debug
571
 
  # HACK to get binding.node out of build directory.
572
 
  # better way to do this?
573
 
  if Options.commands['configure']:
574
 
    if not Options.options.use_openssl:
575
 
      print "WARNING WARNING WARNING"
576
 
      print "OpenSSL not found. Will compile Node without crypto support!"
577
 
  elif not Options.commands['clean']:
578
 
    if os.path.exists('build/default/node') and not os.path.exists('node'):
579
 
      os.symlink('build/default/node', 'node')
580
 
    if os.path.exists('build/debug/node_g') and not os.path.exists('node_g'):
581
 
      os.symlink('build/debug/node_g', 'node_g')
582
 
  else:
583
 
    if os.path.exists('node'): os.unlink('node')
584
 
    if os.path.exists('node_g'): os.unlink('node_g')