The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / configure @ acbdabb7

History | View | Annotate | Download (20 KB)

1
#!/usr/bin/env python
2
import optparse
3
import os
4
import pprint
5
import re
6
import shlex
7
import subprocess
8
import sys
9

    
10
CC = os.environ.get('CC', 'cc')
11

    
12
root_dir = os.path.dirname(__file__)
13
sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib'))
14
from gyp.common import GetFlavor
15

    
16
# parse our options
17
parser = optparse.OptionParser()
18

    
19
parser.add_option("--debug",
20
    action="store_true",
21
    dest="debug",
22
    help="Also build debug build")
23

    
24
parser.add_option("--prefix",
25
    action="store",
26
    dest="prefix",
27
    help="Select the install prefix (defaults to /usr/local)")
28

    
29
parser.add_option("--without-npm",
30
    action="store_true",
31
    dest="without_npm",
32
    help="Don\'t install the bundled npm package manager")
33

    
34
parser.add_option("--without-ssl",
35
    action="store_true",
36
    dest="without_ssl",
37
    help="Build without SSL")
38

    
39
parser.add_option("--without-snapshot",
40
    action="store_true",
41
    dest="without_snapshot",
42
    help="Build without snapshotting V8 libraries. You might want to set"
43
         " this for cross-compiling. [Default: False]")
44

    
45
parser.add_option("--shared-v8",
46
    action="store_true",
47
    dest="shared_v8",
48
    help="Link to a shared V8 DLL instead of static linking")
49

    
50
parser.add_option("--shared-v8-includes",
51
    action="store",
52
    dest="shared_v8_includes",
53
    help="Directory containing V8 header files")
54

    
55
parser.add_option("--shared-v8-libpath",
56
    action="store",
57
    dest="shared_v8_libpath",
58
    help="A directory to search for the shared V8 DLL")
59

    
60
parser.add_option("--shared-v8-libname",
61
    action="store",
62
    dest="shared_v8_libname",
63
    help="Alternative lib name to link to (default: 'v8')")
64

    
65
parser.add_option("--shared-openssl",
66
    action="store_true",
67
    dest="shared_openssl",
68
    help="Link to a shared OpenSSl DLL instead of static linking")
69

    
70
parser.add_option("--shared-openssl-includes",
71
    action="store",
72
    dest="shared_openssl_includes",
73
    help="Directory containing OpenSSL header files")
74

    
75
parser.add_option("--shared-openssl-libpath",
76
    action="store",
77
    dest="shared_openssl_libpath",
78
    help="A directory to search for the shared OpenSSL DLLs")
79

    
80
parser.add_option("--shared-openssl-libname",
81
    action="store",
82
    dest="shared_openssl_libname",
83
    help="Alternative lib name to link to (default: 'crypto,ssl')")
84

    
85
# deprecated
86
parser.add_option("--openssl-use-sys",
87
    action="store_true",
88
    dest="shared_openssl",
89
    help=optparse.SUPPRESS_HELP)
90

    
91
# deprecated
92
parser.add_option("--openssl-includes",
93
    action="store",
94
    dest="shared_openssl_includes",
95
    help=optparse.SUPPRESS_HELP)
96

    
97
# deprecated
98
parser.add_option("--openssl-libpath",
99
    action="store",
100
    dest="shared_openssl_libpath",
101
    help=optparse.SUPPRESS_HELP)
102

    
103
# TODO document when we've decided on what the tracing API and its options will
104
# look like
105
parser.add_option("--systemtap-includes",
106
    action="store",
107
    dest="systemtap_includes",
108
    help=optparse.SUPPRESS_HELP)
109

    
110
parser.add_option("--no-ssl2",
111
    action="store_true",
112
    dest="no_ssl2",
113
    help="Disable OpenSSL v2")
114

    
115
parser.add_option("--shared-zlib",
116
    action="store_true",
117
    dest="shared_zlib",
118
    help="Link to a shared zlib DLL instead of static linking")
119

    
120
parser.add_option("--shared-zlib-includes",
121
    action="store",
122
    dest="shared_zlib_includes",
123
    help="Directory containing zlib header files")
124

    
125
parser.add_option("--shared-zlib-libpath",
126
    action="store",
127
    dest="shared_zlib_libpath",
128
    help="A directory to search for the shared zlib DLL")
129

    
130
parser.add_option("--shared-zlib-libname",
131
    action="store",
132
    dest="shared_zlib_libname",
133
    help="Alternative lib name to link to (default: 'z')")
134

    
135
parser.add_option("--shared-http-parser",
136
    action="store_true",
137
    dest="shared_http_parser",
138
    help="Link to a shared http_parser DLL instead of static linking")
139

    
140
parser.add_option("--shared-http-parser-includes",
141
    action="store",
142
    dest="shared_http_parser_includes",
143
    help="Directory containing http_parser header files")
144

    
145
parser.add_option("--shared-http-parser-libpath",
146
    action="store",
147
    dest="shared_http_parser_libpath",
148
    help="A directory to search for the shared http_parser DLL")
149

    
150
parser.add_option("--shared-http-parser-libname",
151
    action="store",
152
    dest="shared_http_parser_libname",
153
    help="Alternative lib name to link to (default: 'http_parser')")
154

    
155
parser.add_option("--shared-cares",
156
    action="store_true",
157
    dest="shared_cares",
158
    help="Link to a shared cares DLL instead of static linking")
159

    
160
parser.add_option("--shared-cares-includes",
161
    action="store",
162
    dest="shared_cares_includes",
163
    help="Directory containing cares header files")
164

    
165
parser.add_option("--shared-cares-libpath",
166
    action="store",
167
    dest="shared_cares_libpath",
168
    help="A directory to search for the shared cares DLL")
169

    
170
parser.add_option("--shared-cares-libname",
171
    action="store",
172
    dest="shared_cares_libname",
173
    help="Alternative lib name to link to (default: 'cares')")
174

    
175
parser.add_option("--shared-libuv",
176
    action="store_true",
177
    dest="shared_libuv",
178
    help="Link to a shared libuv DLL instead of static linking")
179

    
180
parser.add_option("--shared-libuv-includes",
181
    action="store",
182
    dest="shared_libuv_includes",
183
    help="Directory containing libuv header files")
184

    
185
parser.add_option("--shared-libuv-libpath",
186
    action="store",
187
    dest="shared_libuv_libpath",
188
    help="A directory to search for the shared libuv DLL")
189

    
190
parser.add_option("--shared-libuv-libname",
191
    action="store",
192
    dest="shared_libuv_libname",
193
    help="Alternative lib name to link to (default: 'uv')")
194

    
195
parser.add_option("--with-dtrace",
196
    action="store_true",
197
    dest="with_dtrace",
198
    help="Build with DTrace (default is true on sunos)")
199

    
200
parser.add_option("--without-dtrace",
201
    action="store_true",
202
    dest="without_dtrace",
203
    help="Build without DTrace")
204

    
205
parser.add_option("--with-etw",
206
    action="store_true",
207
    dest="with_etw",
208
    help="Build with ETW (default is true on Windows)")
209

    
210
parser.add_option("--without-etw",
211
    action="store_true",
212
    dest="without_etw",
213
    help="Build without ETW")
214

    
215
parser.add_option("--with-perfctr",
216
    action="store_true",
217
    dest="with_perfctr",
218
    help="Build with performance counters (default is true on Windows)")
219

    
220
parser.add_option("--without-perfctr",
221
    action="store_true",
222
    dest="without_perfctr",
223
    help="Build without performance counters")
224

    
225
# CHECKME does this still work with recent releases of V8?
226
parser.add_option("--gdb",
227
    action="store_true",
228
    dest="gdb",
229
    help="add gdb support")
230

    
231
parser.add_option("--dest-cpu",
232
    action="store",
233
    dest="dest_cpu",
234
    help="CPU architecture to build for. Valid values are: arm, ia32, x64")
235

    
236
parser.add_option("--dest-os",
237
    action="store",
238
    dest="dest_os",
239
    help="Operating system to build for. Valid values are: "
240
         "win, mac, solaris, freebsd, openbsd, linux")
241

    
242
parser.add_option("--no-ifaddrs",
243
    action="store_true",
244
    dest="no_ifaddrs",
245
    help="Use on deprecated SunOS systems that do not support ifaddrs.h")
246

    
247
parser.add_option("--with-arm-float-abi",
248
    action="store",
249
    dest="arm_float_abi",
250
    help="Specifies which floating-point ABI to use. Valid values are: "
251
         "soft, softfp, hard")
252

    
253
parser.add_option("--ninja",
254
    action="store_true",
255
    dest="use_ninja",
256
    help="Generate files for the ninja build system")
257

    
258
# Using --unsafe-optimizations voids your warranty.
259
parser.add_option("--unsafe-optimizations",
260
    action="store_true",
261
    dest="unsafe_optimizations",
262
    help=optparse.SUPPRESS_HELP)
263

    
264
parser.add_option("--xcode",
265
    action="store_true",
266
    dest="use_xcode",
267
    help="Generate build files for use with xcode")
268

    
269
parser.add_option("--tag",
270
    action="store",
271
    dest="tag",
272
    help="Custom build tag")
273

    
274
(options, args) = parser.parse_args()
275

    
276

    
277
def b(value):
278
  """Returns the string 'true' if value is truthy, 'false' otherwise."""
279
  if value:
280
    return 'true'
281
  else:
282
    return 'false'
283

    
284

    
285
def pkg_config(pkg):
286
  cmd = os.popen('pkg-config --libs %s' % pkg, 'r')
287
  libs = cmd.readline().strip()
288
  ret = cmd.close()
289
  if (ret): return None
290

    
291
  cmd = os.popen('pkg-config --cflags %s' % pkg, 'r')
292
  cflags = cmd.readline().strip()
293
  ret = cmd.close()
294
  if (ret): return None
295

    
296
  return (libs, cflags)
297

    
298

    
299
def cc_macros(cc=None):
300
  """Checks predefined macros using the C compiler command."""
301

    
302
  if cc is None:
303
    cc = CC
304

    
305
  try:
306
    p = subprocess.Popen(shlex.split(cc) + ['-dM', '-E', '-'],
307
                         stdin=subprocess.PIPE,
308
                         stdout=subprocess.PIPE,
309
                         stderr=subprocess.PIPE)
310
  except OSError:
311
    print '''Node.js configure error: No acceptable C compiler found!
312

    
313
        Please make sure you have a C compiler installed on your system and/or
314
        consider adjusting the CC environment variable if you installed
315
        it in a non-standard prefix.
316
        '''
317
    sys.exit()
318

    
319
  p.stdin.write('\n')
320
  out = p.communicate()[0]
321

    
322
  out = str(out).split('\n')
323

    
324
  k = {}
325
  for line in out:
326
    lst = shlex.split(line)
327
    if len(lst) > 2:
328
      key = lst[1]
329
      val = lst[2]
330
      k[key] = val
331
  return k
332

    
333

    
334
def is_arch_armv7():
335
  """Check for ARMv7 instructions"""
336
  cc_macros_cache = cc_macros()
337
  return ('__ARM_ARCH_7__' in cc_macros_cache or
338
          '__ARM_ARCH_7A__' in cc_macros_cache or
339
          '__ARM_ARCH_7R__' in cc_macros_cache or
340
          '__ARM_ARCH_7M__' in cc_macros_cache)
341

    
342

    
343
def is_arm_neon():
344
  """Check for ARM NEON support"""
345
  return '__ARM_NEON__' in cc_macros()
346

    
347

    
348
def arm_hard_float_abi():
349
  """Check for hardfloat or softfloat eabi on ARM"""
350
  # GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify
351
  # the Floating Point ABI used (PCS stands for Procedure Call Standard).
352
  # We use these as well as a couple of other defines to statically determine
353
  # what FP ABI used.
354
  # GCC versions 4.4 and below don't support hard-fp.
355
  # GCC versions 4.5 may support hard-fp without defining __ARM_PCS or
356
  # __ARM_PCS_VFP.
357

    
358
  if compiler_version() >= (4, 6, 0):
359
    return '__ARM_PCS_VFP' in cc_macros()
360
  elif compiler_version() < (4, 5, 0):
361
    return False
362
  elif '__ARM_PCS_VFP' in cc_macros():
363
    return True
364
  elif ('__ARM_PCS' in cc_macros() or
365
        '__SOFTFP' in cc_macros() or
366
        not '__VFP_FP__' in cc_macros()):
367
    return False
368
  else:
369
    print '''Node.js configure error: Your version of GCC does not report
370
      the Floating-Point ABI to compile for your hardware
371

    
372
      Please manually specify which floating-point ABI to use with the
373
      --with-arm-float-abi option.
374
      '''
375
    sys.exit()
376

    
377

    
378
def host_arch_cc():
379
  """Host architecture check using the CC command."""
380

    
381
  # use 'cc', as CC may be set to a target arch compiler command
382
  # in case of cross-compilation
383
  k = cc_macros('cc')
384

    
385
  matchup = {
386
    '__x86_64__'  : 'x64',
387
    '__i386__'    : 'ia32',
388
    '__arm__'     : 'arm',
389
    '__mips__'    : 'mips',
390
  }
391

    
392
  rtn = 'ia32' # default
393

    
394
  for i in matchup:
395
    if i in k and k[i] != '0':
396
      rtn = matchup[i]
397
      break
398

    
399
  return rtn
400

    
401

    
402
def host_arch_win():
403
  """Host architecture check using environ vars (better way to do this?)"""
404

    
405
  arch = os.environ.get('PROCESSOR_ARCHITECTURE', 'x86')
406

    
407
  matchup = {
408
    'AMD64'  : 'x64',
409
    'x86'    : 'ia32',
410
    'arm'    : 'arm',
411
    'mips'   : 'mips',
412
  }
413

    
414
  return matchup.get(arch, 'ia32')
415

    
416

    
417
def compiler_version():
418
  try:
419
    proc = subprocess.Popen(shlex.split(CC) + ['--version'], stdout=subprocess.PIPE)
420
  except WindowsError:
421
    return (0, False)
422

    
423
  is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
424

    
425
  proc = subprocess.Popen(shlex.split(CC) + ['-dumpversion'], stdout=subprocess.PIPE)
426
  version = tuple(map(int, proc.communicate()[0].split('.')))
427

    
428
  return (version, is_clang)
429

    
430

    
431
def configure_arm(o):
432
  # V8 on ARM requires that armv7 is set. CPU Model detected by
433
  # the presence of __ARM_ARCH_7__ and the like defines in compiler
434
  if options.arm_float_abi:
435
    hard_float = options.arm_float_abi == 'hard'
436
  else:
437
    hard_float = arm_hard_float_abi()
438

    
439
  armv7 = is_arch_armv7()
440
  # CHECKME VFPv3 implies ARMv7+ but is the reverse true as well?
441
  fpu = 'vfpv3' if armv7 else 'vfpv2'
442

    
443
  o['variables']['armv7'] = int(armv7)
444
  o['variables']['arm_fpu'] = fpu
445
  o['variables']['arm_neon'] = int(is_arm_neon())
446
  o['variables']['v8_use_arm_eabi_hardfloat'] = b(hard_float)
447

    
448

    
449
def configure_node(o):
450
  o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
451
  o['variables']['v8_no_strict_aliasing'] = 1 # work around compiler bugs
452
  o['variables']['node_prefix'] = os.path.expanduser(options.prefix or '')
453
  o['variables']['node_install_npm'] = b(not options.without_npm)
454
  o['variables']['node_unsafe_optimizations'] = (
455
    1 if options.unsafe_optimizations else 0)
456
  o['default_configuration'] = 'Debug' if options.debug else 'Release'
457

    
458
  host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
459
  target_arch = options.dest_cpu or host_arch
460
  o['variables']['host_arch'] = host_arch
461
  o['variables']['target_arch'] = target_arch
462

    
463
  if target_arch == 'arm':
464
    configure_arm(o)
465

    
466
  cc_version, is_clang = compiler_version()
467
  o['variables']['clang'] = 1 if is_clang else 0
468

    
469
  if not is_clang and cc_version != 0:
470
    o['variables']['gcc_version'] = 10 * cc_version[0] + cc_version[1]
471

    
472
  # clang has always supported -fvisibility=hidden, right?
473
  if not is_clang and cc_version < (4,0,0):
474
    o['variables']['visibility'] = ''
475

    
476
  # By default, enable DTrace on SunOS systems. Don't allow it on other
477
  # systems, since it won't work.  (The MacOS build process is different than
478
  # SunOS, and we haven't implemented it.)
479
  if flavor in ('solaris', 'mac'):
480
    o['variables']['node_use_dtrace'] = b(not options.without_dtrace)
481
  elif flavor == 'linux':
482
    o['variables']['node_use_dtrace'] = 'false'
483
    o['variables']['node_use_systemtap'] = b(options.with_dtrace)
484
    if options.systemtap_includes:
485
      o['include_dirs'] += [options.systemtap_includes]
486
  elif options.with_dtrace:
487
    raise Exception(
488
       'DTrace is currently only supported on SunOS, MacOS or Linux systems.')
489
  else:
490
    o['variables']['node_use_dtrace'] = 'false'
491
    o['variables']['node_use_systemtap'] = 'false'
492

    
493
  if options.no_ifaddrs:
494
    o['defines'] += ['SUNOS_NO_IFADDRS']
495

    
496
  # By default, enable ETW on Windows.
497
  if flavor == 'win':
498
    o['variables']['node_use_etw'] = b(not options.without_etw);
499
  elif options.with_etw:
500
    raise Exception('ETW is only supported on Windows.')
501
  else:
502
    o['variables']['node_use_etw'] = 'false'
503

    
504
  # By default, enable Performance counters on Windows.
505
  if flavor == 'win':
506
    o['variables']['node_use_perfctr'] = b(not options.without_perfctr);
507
  elif options.with_perfctr:
508
    raise Exception('Performance counter is only supported on Windows.')
509
  else:
510
    o['variables']['node_use_perfctr'] = 'false'
511

    
512
  if options.tag:
513
    o['variables']['node_tag'] = '-' + options.tag
514
  else:
515
    o['variables']['node_tag'] = ''
516

    
517

    
518
def configure_libz(o):
519
  o['variables']['node_shared_zlib'] = b(options.shared_zlib)
520

    
521
  # assume shared_zlib if one of these is set?
522
  if options.shared_zlib_libpath:
523
    o['libraries'] += ['-L%s' % options.shared_zlib_libpath]
524
  if options.shared_zlib_libname:
525
    o['libraries'] += ['-l%s' % options.shared_zlib_libname]
526
  elif options.shared_zlib:
527
    o['libraries'] += ['-lz']
528
  if options.shared_zlib_includes:
529
    o['include_dirs'] += [options.shared_zlib_includes]
530

    
531

    
532
def configure_http_parser(o):
533
    o['variables']['node_shared_http_parser'] = b(options.shared_http_parser)
534

    
535
    # assume shared http_parser if one of these is set?
536
    if options.shared_http_parser_libpath:
537
        o['libraries'] += ['-L%s' % options.shared_http_parser_libpath]
538
    if options.shared_http_parser_libname:
539
        o['libraries'] += ['-l%s' % options.shared_http_parser_libname]
540
    elif options.shared_http_parser:
541
        o['libraries'] += ['-lhttp_parser']
542
    if options.shared_http_parser_includes:
543
        o['include_dirs'] += [options.shared_http_parser_includes]
544

    
545

    
546
def configure_cares(o):
547
    o['variables']['node_shared_cares'] = b(options.shared_cares)
548

    
549
    # assume shared cares if one of these is set?
550
    if options.shared_cares_libpath:
551
        o['libraries'] += ['-L%s' % options.shared_cares_libpath]
552
    if options.shared_cares_libname:
553
        o['libraries'] += ['-l%s' % options.shared_cares_libname]
554
    elif options.shared_cares:
555
        o['libraries'] += ['-lcares']
556
    if options.shared_cares_includes:
557
        o['include_dirs'] += [options.shared_cares_includes]
558

    
559

    
560
def configure_libuv(o):
561
  o['variables']['node_shared_libuv'] = b(options.shared_libuv)
562

    
563
  # assume shared libuv if one of these is set?
564
  if options.shared_libuv_libpath:
565
    o['libraries'] += ['-L%s' % options.shared_libuv_libpath]
566
  if options.shared_libuv_libname:
567
    o['libraries'] += ['-l%s' % options.shared_libuv_libname]
568
  elif options.shared_libuv:
569
    o['libraries'] += ['-luv']
570
  if options.shared_libuv_includes:
571
    o['include_dirs'] += [options.shared_libuv_includes]
572

    
573

    
574
def configure_v8(o):
575
  o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
576
  o['variables']['node_shared_v8'] = b(options.shared_v8)
577

    
578
  # assume shared_v8 if one of these is set?
579
  if options.shared_v8_libpath:
580
    o['libraries'] += ['-L%s' % options.shared_v8_libpath]
581
  if options.shared_v8_libname:
582
    o['libraries'] += ['-l%s' % options.shared_v8_libname]
583
  elif options.shared_v8:
584
    o['libraries'] += ['-lv8']
585
  if options.shared_v8_includes:
586
    o['include_dirs'] += [options.shared_v8_includes]
587

    
588

    
589
def configure_openssl(o):
590
  o['variables']['node_use_openssl'] = b(not options.without_ssl)
591
  o['variables']['node_shared_openssl'] = b(options.shared_openssl)
592

    
593
  if options.without_ssl:
594
    return
595

    
596
  if options.no_ssl2:
597
    o['defines'] += ['OPENSSL_NO_SSL2=1']
598

    
599
  if options.shared_openssl:
600
    (libs, cflags) = pkg_config('openssl') or ('-lssl -lcrypto', '')
601

    
602
    if options.shared_openssl_libpath:
603
      o['libraries'] += ['-L%s' % options.shared_openssl_libpath]
604

    
605
    if options.shared_openssl_libname:
606
      libnames = options.shared_openssl_libname.split(',')
607
      o['libraries'] += ['-l%s' % s for s in libnames]
608
    else:
609
      o['libraries'] += libs.split()
610

    
611
    if options.shared_openssl_includes:
612
      o['include_dirs'] += [options.shared_openssl_includes]
613
    else:
614
      o['cflags'] += cflags.split()
615

    
616

    
617
def configure_winsdk(o):
618
  if flavor != 'win':
619
    return
620

    
621
  winsdk_dir = os.environ.get("WindowsSdkDir")
622

    
623
  if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\ctrpp.exe'):
624
    print "Found ctrpp in WinSDK--will build generated files into tools/msvs/genfiles."
625
    o['variables']['node_has_winsdk'] = 'true'
626
    return
627

    
628
  print "ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles."
629

    
630

    
631
# determine the "flavor" (operating system) we're building for,
632
# leveraging gyp's GetFlavor function
633
flavor_params = {};
634
if (options.dest_os):
635
  flavor_params['flavor'] = options.dest_os;
636
flavor = GetFlavor(flavor_params);
637

    
638
output = {
639
  'variables': { 'python': sys.executable },
640
  'include_dirs': [],
641
  'libraries': [],
642
  'defines': [],
643
  'cflags': [],
644
}
645

    
646
configure_node(output)
647
configure_libz(output)
648
configure_http_parser(output)
649
configure_cares(output)
650
configure_libuv(output)
651
configure_v8(output)
652
configure_openssl(output)
653
configure_winsdk(output)
654

    
655
# variables should be a root level element,
656
# move everything else to target_defaults
657
variables = output['variables']
658
del output['variables']
659
output = {
660
  'variables': variables,
661
  'target_defaults': output
662
}
663
pprint.pprint(output, indent=2)
664

    
665
def write(filename, data):
666
  filename = os.path.join(root_dir, filename)
667
  print "creating ", filename
668
  f = open(filename, 'w+')
669
  f.write(data)
670

    
671
write('config.gypi', "# Do not edit. Generated by the configure script.\n" +
672
  pprint.pformat(output, indent=2) + "\n")
673

    
674
config = {
675
  'BUILDTYPE': 'Debug' if options.debug else 'Release',
676
  'USE_NINJA': str(int(options.use_ninja or 0)),
677
  'USE_XCODE': str(int(options.use_xcode or 0)),
678
  'PYTHON': sys.executable,
679
}
680
config = '\n'.join(map('='.join, config.iteritems())) + '\n'
681

    
682
write('config.mk',
683
      '# Do not edit. Generated by the configure script.\n' + config)
684

    
685
if options.use_ninja:
686
  gyp_args = ['-f', 'ninja-' + flavor]
687
elif options.use_xcode:
688
  gyp_args = ['-f', 'xcode']
689
elif flavor == 'win':
690
  gyp_args = ['-f', 'msvs', '-G', 'msvs_version=auto']
691
else:
692
  gyp_args = ['-f', 'make-' + flavor]
693

    
694
subprocess.call([sys.executable, 'tools/gyp_node'] + gyp_args)