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 @ f230a1cf

History | View | Annotate | Download (20.2 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
# Options should be in alphabetical order but keep --prefix at the top,
20
# that's arguably the one people will be looking for most.
21
parser.add_option('--prefix',
22
    action='store',
23
    dest='prefix',
24
    help='select the install prefix (defaults to /usr/local)')
25

    
26
parser.add_option('--debug',
27
    action='store_true',
28
    dest='debug',
29
    help='also build debug build')
30

    
31
parser.add_option('--dest-cpu',
32
    action='store',
33
    dest='dest_cpu',
34
    help='CPU architecture to build for. Valid values are: arm, ia32, x64')
35

    
36
parser.add_option('--dest-os',
37
    action='store',
38
    dest='dest_os',
39
    help='operating system to build for. Valid values are: '
40
         'win, mac, solaris, freebsd, openbsd, linux, android')
41

    
42
parser.add_option('--gdb',
43
    action='store_true',
44
    dest='gdb',
45
    help='add gdb support')
46

    
47
parser.add_option('--ninja',
48
    action='store_true',
49
    dest='use_ninja',
50
    help='generate files for the ninja build system')
51

    
52
parser.add_option('--no-ifaddrs',
53
    action='store_true',
54
    dest='no_ifaddrs',
55
    help='use on deprecated SunOS systems that do not support ifaddrs.h')
56

    
57
# deprecated
58
parser.add_option('--openssl-includes',
59
    action='store',
60
    dest='shared_openssl_includes',
61
    help=optparse.SUPPRESS_HELP)
62

    
63
# deprecated
64
parser.add_option('--openssl-libpath',
65
    action='store',
66
    dest='shared_openssl_libpath',
67
    help=optparse.SUPPRESS_HELP)
68

    
69
# deprecated
70
parser.add_option('--openssl-use-sys',
71
    action='store_true',
72
    dest='shared_openssl',
73
    help=optparse.SUPPRESS_HELP)
74

    
75
parser.add_option('--shared-cares',
76
    action='store_true',
77
    dest='shared_cares',
78
    help='link to a shared cares DLL instead of static linking')
79

    
80
parser.add_option('--shared-cares-includes',
81
    action='store',
82
    dest='shared_cares_includes',
83
    help='directory containing cares header files')
84

    
85
parser.add_option('--shared-cares-libname',
86
    action='store',
87
    dest='shared_cares_libname',
88
    help='alternative lib name to link to (default: \'cares\')')
89

    
90
parser.add_option('--shared-cares-libpath',
91
    action='store',
92
    dest='shared_cares_libpath',
93
    help='a directory to search for the shared cares DLL')
94

    
95
parser.add_option('--shared-http-parser',
96
    action='store_true',
97
    dest='shared_http_parser',
98
    help='link to a shared http_parser DLL instead of static linking')
99

    
100
parser.add_option('--shared-http-parser-includes',
101
    action='store',
102
    dest='shared_http_parser_includes',
103
    help='directory containing http_parser header files')
104

    
105
parser.add_option('--shared-http-parser-libname',
106
    action='store',
107
    dest='shared_http_parser_libname',
108
    help='alternative lib name to link to (default: \'http_parser\')')
109

    
110
parser.add_option('--shared-http-parser-libpath',
111
    action='store',
112
    dest='shared_http_parser_libpath',
113
    help='a directory to search for the shared http_parser DLL')
114

    
115
parser.add_option('--shared-libuv',
116
    action='store_true',
117
    dest='shared_libuv',
118
    help='link to a shared libuv DLL instead of static linking')
119

    
120
parser.add_option('--shared-libuv-includes',
121
    action='store',
122
    dest='shared_libuv_includes',
123
    help='directory containing libuv header files')
124

    
125
parser.add_option('--shared-libuv-libname',
126
    action='store',
127
    dest='shared_libuv_libname',
128
    help='alternative lib name to link to (default: \'uv\')')
129

    
130
parser.add_option('--shared-libuv-libpath',
131
    action='store',
132
    dest='shared_libuv_libpath',
133
    help='a directory to search for the shared libuv DLL')
134

    
135
parser.add_option('--shared-openssl',
136
    action='store_true',
137
    dest='shared_openssl',
138
    help='link to a shared OpenSSl DLL instead of static linking')
139

    
140
parser.add_option('--shared-openssl-includes',
141
    action='store',
142
    dest='shared_openssl_includes',
143
    help='directory containing OpenSSL header files')
144

    
145
parser.add_option('--shared-openssl-libname',
146
    action='store',
147
    dest='shared_openssl_libname',
148
    help='alternative lib name to link to (default: \'crypto,ssl\')')
149

    
150
parser.add_option('--shared-openssl-libpath',
151
    action='store',
152
    dest='shared_openssl_libpath',
153
    help='a directory to search for the shared OpenSSL DLLs')
154

    
155
parser.add_option('--shared-v8',
156
    action='store_true',
157
    dest='shared_v8',
158
    help='link to a shared V8 DLL instead of static linking')
159

    
160
parser.add_option('--shared-v8-includes',
161
    action='store',
162
    dest='shared_v8_includes',
163
    help='directory containing V8 header files')
164

    
165
parser.add_option('--shared-v8-libname',
166
    action='store',
167
    dest='shared_v8_libname',
168
    help='alternative lib name to link to (default: \'v8\')')
169

    
170
parser.add_option('--shared-v8-libpath',
171
    action='store',
172
    dest='shared_v8_libpath',
173
    help='a directory to search for the shared V8 DLL')
174

    
175
parser.add_option('--shared-zlib',
176
    action='store_true',
177
    dest='shared_zlib',
178
    help='link to a shared zlib DLL instead of static linking')
179

    
180
parser.add_option('--shared-zlib-includes',
181
    action='store',
182
    dest='shared_zlib_includes',
183
    help='directory containing zlib header files')
184

    
185
parser.add_option('--shared-zlib-libname',
186
    action='store',
187
    dest='shared_zlib_libname',
188
    help='alternative lib name to link to (default: \'z\')')
189

    
190
parser.add_option('--shared-zlib-libpath',
191
    action='store',
192
    dest='shared_zlib_libpath',
193
    help='a directory to search for the shared zlib DLL')
194

    
195
# TODO document when we've decided on what the tracing API and its options will
196
# look like
197
parser.add_option('--systemtap-includes',
198
    action='store',
199
    dest='systemtap_includes',
200
    help=optparse.SUPPRESS_HELP)
201

    
202
parser.add_option('--tag',
203
    action='store',
204
    dest='tag',
205
    help='custom build tag')
206

    
207
parser.add_option('--with-arm-float-abi',
208
    action='store',
209
    dest='arm_float_abi',
210
    help='specifies which floating-point ABI to use. Valid values are: '
211
         'soft, softfp, hard')
212

    
213
parser.add_option('--with-dtrace',
214
    action='store_true',
215
    dest='with_dtrace',
216
    help='build with DTrace (default is true on sunos)')
217

    
218
parser.add_option('--with-etw',
219
    action='store_true',
220
    dest='with_etw',
221
    help='build with ETW (default is true on Windows)')
222

    
223
parser.add_option('--with-perfctr',
224
    action='store_true',
225
    dest='with_perfctr',
226
    help='build with performance counters (default is true on Windows)')
227

    
228
parser.add_option('--with-sslv2',
229
    action='store_true',
230
    dest='with_sslv2',
231
    help='enable SSL v2')
232

    
233
parser.add_option('--without-dtrace',
234
    action='store_true',
235
    dest='without_dtrace',
236
    help='build without DTrace')
237

    
238
parser.add_option('--without-etw',
239
    action='store_true',
240
    dest='without_etw',
241
    help='build without ETW')
242

    
243
parser.add_option('--without-npm',
244
    action='store_true',
245
    dest='without_npm',
246
    help='don\'t install the bundled npm package manager')
247

    
248
parser.add_option('--without-perfctr',
249
    action='store_true',
250
    dest='without_perfctr',
251
    help='build without performance counters')
252

    
253
parser.add_option('--without-snapshot',
254
    action='store_true',
255
    dest='without_snapshot',
256
    help='build without snapshotting V8 libraries. You might want to set'
257
         ' this for cross-compiling. [Default: False]')
258

    
259
parser.add_option('--without-ssl',
260
    action='store_true',
261
    dest='without_ssl',
262
    help='build without SSL')
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
(options, args) = parser.parse_args()
270

    
271

    
272
def b(value):
273
  """Returns the string 'true' if value is truthy, 'false' otherwise."""
274
  if value:
275
    return 'true'
276
  else:
277
    return 'false'
278

    
279

    
280
def pkg_config(pkg):
281
  cmd = os.popen('pkg-config --libs %s' % pkg, 'r')
282
  libs = cmd.readline().strip()
283
  ret = cmd.close()
284
  if (ret): return None
285

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

    
291
  return (libs, cflags)
292

    
293

    
294
def cc_macros():
295
  """Checks predefined macros using the CC command."""
296

    
297
  try:
298
    p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'],
299
                         stdin=subprocess.PIPE,
300
                         stdout=subprocess.PIPE,
301
                         stderr=subprocess.PIPE)
302
  except OSError:
303
    print '''Node.js configure error: No acceptable C compiler found!
304

    
305
        Please make sure you have a C compiler installed on your system and/or
306
        consider adjusting the CC environment variable if you installed
307
        it in a non-standard prefix.
308
        '''
309
    sys.exit()
310

    
311
  p.stdin.write('\n')
312
  out = p.communicate()[0]
313

    
314
  out = str(out).split('\n')
315

    
316
  k = {}
317
  for line in out:
318
    lst = shlex.split(line)
319
    if len(lst) > 2:
320
      key = lst[1]
321
      val = lst[2]
322
      k[key] = val
323
  return k
324

    
325

    
326
def is_arch_armv7():
327
  """Check for ARMv7 instructions"""
328
  cc_macros_cache = cc_macros()
329
  return ('__ARM_ARCH_7__' in cc_macros_cache or
330
          '__ARM_ARCH_7A__' in cc_macros_cache or
331
          '__ARM_ARCH_7R__' in cc_macros_cache or
332
          '__ARM_ARCH_7M__' in cc_macros_cache)
333

    
334

    
335
def is_arm_neon():
336
  """Check for ARM NEON support"""
337
  return '__ARM_NEON__' in cc_macros()
338

    
339

    
340
def is_arm_hard_float_abi():
341
  """Check for hardfloat or softfloat eabi on ARM"""
342
  # GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify
343
  # the Floating Point ABI used (PCS stands for Procedure Call Standard).
344
  # We use these as well as a couple of other defines to statically determine
345
  # what FP ABI used.
346
  # GCC versions 4.4 and below don't support hard-fp.
347
  # GCC versions 4.5 may support hard-fp without defining __ARM_PCS or
348
  # __ARM_PCS_VFP.
349

    
350
  if compiler_version() >= (4, 6, 0):
351
    return '__ARM_PCS_VFP' in cc_macros()
352
  elif compiler_version() < (4, 5, 0):
353
    return False
354
  elif '__ARM_PCS_VFP' in cc_macros():
355
    return True
356
  elif ('__ARM_PCS' in cc_macros() or
357
        '__SOFTFP' in cc_macros() or
358
        not '__VFP_FP__' in cc_macros()):
359
    return False
360
  else:
361
    print '''Node.js configure error: Your version of GCC does not report
362
      the Floating-Point ABI to compile for your hardware
363

    
364
      Please manually specify which floating-point ABI to use with the
365
      --with-arm-float-abi option.
366
      '''
367
    sys.exit()
368

    
369

    
370
def host_arch_cc():
371
  """Host architecture check using the CC command."""
372

    
373
  k = cc_macros()
374

    
375
  matchup = {
376
    '__x86_64__'  : 'x64',
377
    '__i386__'    : 'ia32',
378
    '__arm__'     : 'arm',
379
    '__mips__'    : 'mips',
380
  }
381

    
382
  rtn = 'ia32' # default
383

    
384
  for i in matchup:
385
    if i in k and k[i] != '0':
386
      rtn = matchup[i]
387
      break
388

    
389
  return rtn
390

    
391

    
392
def host_arch_win():
393
  """Host architecture check using environ vars (better way to do this?)"""
394

    
395
  arch = os.environ.get('PROCESSOR_ARCHITECTURE', 'x86')
396

    
397
  matchup = {
398
    'AMD64'  : 'x64',
399
    'x86'    : 'ia32',
400
    'arm'    : 'arm',
401
    'mips'   : 'mips',
402
  }
403

    
404
  return matchup.get(arch, 'ia32')
405

    
406

    
407
def compiler_version():
408
  try:
409
    proc = subprocess.Popen(shlex.split(CC) + ['--version'],
410
                            stdout=subprocess.PIPE)
411
  except WindowsError:
412
    return (0, False)
413

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

    
416
  proc = subprocess.Popen(shlex.split(CC) + ['-dumpversion'],
417
                          stdout=subprocess.PIPE)
418
  version = tuple(map(int, proc.communicate()[0].split('.')))
419

    
420
  return (version, is_clang)
421

    
422

    
423
def configure_arm(o):
424
  if options.arm_float_abi:
425
    arm_float_abi = options.arm_float_abi
426
  else:
427
    arm_float_abi = 'hard' if is_arm_hard_float_abi() else 'default'
428
  o['variables']['armv7'] = int(is_arch_armv7())
429
  o['variables']['arm_fpu'] = 'vfpv3'  # V8 3.18 no longer supports VFP2.
430
  o['variables']['arm_neon'] = int(is_arm_neon())
431
  o['variables']['arm_thumb'] = 0      # -marm
432
  o['variables']['arm_float_abi'] = arm_float_abi
433

    
434

    
435
def configure_node(o):
436
  if options.dest_os == 'android':
437
    o['variables']['OS'] = 'android'
438
  o['variables']['node_prefix'] = os.path.expanduser(options.prefix or '')
439
  o['variables']['node_install_npm'] = b(not options.without_npm)
440
  o['default_configuration'] = 'Debug' if options.debug else 'Release'
441

    
442
  host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
443
  target_arch = options.dest_cpu or host_arch
444
  o['variables']['host_arch'] = host_arch
445
  o['variables']['target_arch'] = target_arch
446

    
447
  if target_arch == 'arm':
448
    configure_arm(o)
449

    
450
  cc_version, is_clang = compiler_version()
451
  o['variables']['clang'] = 1 if is_clang else 0
452

    
453
  if not is_clang and cc_version != 0:
454
    o['variables']['gcc_version'] = 10 * cc_version[0] + cc_version[1]
455

    
456
  # clang has always supported -fvisibility=hidden, right?
457
  if not is_clang and cc_version < (4,0,0):
458
    o['variables']['visibility'] = ''
459

    
460
  if flavor in ('solaris', 'mac', 'linux'):
461
    use_dtrace = not options.without_dtrace
462
    # Don't enable by default on linux, it needs the sdt-devel package.
463
    if flavor == 'linux':
464
      if options.systemtap_includes:
465
        o['include_dirs'] += [options.systemtap_includes]
466
      use_dtrace = options.with_dtrace
467
    o['variables']['node_use_dtrace'] = b(use_dtrace)
468
    o['variables']['uv_use_dtrace'] = b(use_dtrace)
469
    o['variables']['uv_parent_path'] = '/deps/uv/'
470
  elif options.with_dtrace:
471
    raise Exception(
472
       'DTrace is currently only supported on SunOS, MacOS or Linux systems.')
473
  else:
474
    o['variables']['node_use_dtrace'] = 'false'
475

    
476
  # if we're on illumos based systems wrap the helper library into the
477
  # executable
478
  if flavor == 'solaris':
479
    o['variables']['node_use_mdb'] = 'true'
480
  else:
481
    o['variables']['node_use_mdb'] = 'false'
482

    
483
  if options.no_ifaddrs:
484
    o['defines'] += ['SUNOS_NO_IFADDRS']
485

    
486
  # By default, enable ETW on Windows.
487
  if flavor == 'win':
488
    o['variables']['node_use_etw'] = b(not options.without_etw)
489
  elif options.with_etw:
490
    raise Exception('ETW is only supported on Windows.')
491
  else:
492
    o['variables']['node_use_etw'] = 'false'
493

    
494
  # By default, enable Performance counters on Windows.
495
  if flavor == 'win':
496
    o['variables']['node_use_perfctr'] = b(not options.without_perfctr)
497
  elif options.with_perfctr:
498
    raise Exception('Performance counter is only supported on Windows.')
499
  else:
500
    o['variables']['node_use_perfctr'] = 'false'
501

    
502
  if options.tag:
503
    o['variables']['node_tag'] = '-' + options.tag
504
  else:
505
    o['variables']['node_tag'] = ''
506

    
507

    
508
def configure_libz(o):
509
  o['variables']['node_shared_zlib'] = b(options.shared_zlib)
510

    
511
  # assume shared_zlib if one of these is set?
512
  if options.shared_zlib_libpath:
513
    o['libraries'] += ['-L%s' % options.shared_zlib_libpath]
514
  if options.shared_zlib_libname:
515
    o['libraries'] += ['-l%s' % options.shared_zlib_libname]
516
  elif options.shared_zlib:
517
    o['libraries'] += ['-lz']
518
  if options.shared_zlib_includes:
519
    o['include_dirs'] += [options.shared_zlib_includes]
520

    
521

    
522
def configure_http_parser(o):
523
    o['variables']['node_shared_http_parser'] = b(options.shared_http_parser)
524

    
525
    # assume shared http_parser if one of these is set?
526
    if options.shared_http_parser_libpath:
527
        o['libraries'] += ['-L%s' % options.shared_http_parser_libpath]
528
    if options.shared_http_parser_libname:
529
        o['libraries'] += ['-l%s' % options.shared_http_parser_libname]
530
    elif options.shared_http_parser:
531
        o['libraries'] += ['-lhttp_parser']
532
    if options.shared_http_parser_includes:
533
        o['include_dirs'] += [options.shared_http_parser_includes]
534

    
535

    
536
def configure_cares(o):
537
    o['variables']['node_shared_cares'] = b(options.shared_cares)
538

    
539
    # assume shared cares if one of these is set?
540
    if options.shared_cares_libpath:
541
        o['libraries'] += ['-L%s' % options.shared_cares_libpath]
542
    if options.shared_cares_libname:
543
        o['libraries'] += ['-l%s' % options.shared_cares_libname]
544
    elif options.shared_cares:
545
        o['libraries'] += ['-lcares']
546
    if options.shared_cares_includes:
547
        o['include_dirs'] += [options.shared_cares_includes]
548

    
549

    
550
def configure_libuv(o):
551
  o['variables']['node_shared_libuv'] = b(options.shared_libuv)
552

    
553
  # assume shared libuv if one of these is set?
554
  if options.shared_libuv_libpath:
555
    o['libraries'] += ['-L%s' % options.shared_libuv_libpath]
556
  if options.shared_libuv_libname:
557
    o['libraries'] += ['-l%s' % options.shared_libuv_libname]
558
  elif options.shared_libuv:
559
    o['libraries'] += ['-luv']
560
  if options.shared_libuv_includes:
561
    o['include_dirs'] += [options.shared_libuv_includes]
562

    
563

    
564
def configure_v8(o):
565
  o['variables']['node_shared_v8'] = b(options.shared_v8)
566
  o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
567
  o['variables']['v8_enable_i18n_support'] = 0  # Don't require libicu.
568
  o['variables']['v8_no_strict_aliasing'] = 1  # Work around compiler bugs.
569
  o['variables']['v8_optimized_debug'] = 0  # Compile with -O0 in debug builds.
570
  o['variables']['v8_random_seed'] = 0  # Use a random seed for hash tables.
571
  o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
572

    
573
  # assume shared_v8 if one of these is set?
574
  if options.shared_v8_libpath:
575
    o['libraries'] += ['-L%s' % options.shared_v8_libpath]
576
  if options.shared_v8_libname:
577
    o['libraries'] += ['-l%s' % options.shared_v8_libname]
578
  elif options.shared_v8:
579
    o['libraries'] += ['-lv8']
580
  if options.shared_v8_includes:
581
    o['include_dirs'] += [options.shared_v8_includes]
582

    
583

    
584
def configure_openssl(o):
585
  o['variables']['node_use_openssl'] = b(not options.without_ssl)
586
  o['variables']['node_shared_openssl'] = b(options.shared_openssl)
587

    
588
  if options.without_ssl:
589
    return
590

    
591
  # OpenSSL uses `#ifndef OPENSSL_NO_SSL2` checks so only define the
592
  # macro when we want to _disable_ SSL2.
593
  if not options.with_sslv2:
594
    o['defines'] += ['OPENSSL_NO_SSL2=1']
595

    
596
  if options.shared_openssl:
597
    (libs, cflags) = pkg_config('openssl') or ('-lssl -lcrypto', '')
598

    
599
    if options.shared_openssl_libpath:
600
      o['libraries'] += ['-L%s' % options.shared_openssl_libpath]
601

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

    
608
    if options.shared_openssl_includes:
609
      o['include_dirs'] += [options.shared_openssl_includes]
610
    else:
611
      o['cflags'] += cflags.split()
612

    
613

    
614
def configure_winsdk(o):
615
  if flavor != 'win':
616
    return
617

    
618
  winsdk_dir = os.environ.get('WindowsSdkDir')
619

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

    
626
  print('ctrpp not found in WinSDK path--using pre-gen files '
627
        'from tools/msvs/genfiles.')
628

    
629

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

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

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

    
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

    
681
if options.prefix:
682
  config['PREFIX'] = options.prefix
683

    
684
config = '\n'.join(map('='.join, config.iteritems())) + '\n'
685

    
686
write('config.mk',
687
      '# Do not edit. Generated by the configure script.\n' + config)
688

    
689
if options.use_ninja:
690
  gyp_args = ['-f', 'ninja-' + flavor]
691
elif options.use_xcode:
692
  gyp_args = ['-f', 'xcode']
693
elif flavor == 'win':
694
  gyp_args = ['-f', 'msvs', '-G', 'msvs_version=auto']
695
else:
696
  gyp_args = ['-f', 'make-' + flavor]
697

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