10 CC = os.environ.get('CC', 'cc')
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
17 parser = optparse.OptionParser()
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',
24 help='select the install prefix (defaults to /usr/local)')
26 parser.add_option('--debug',
29 help='also build debug build')
31 parser.add_option('--dest-cpu',
34 help='CPU architecture to build for. Valid values are: arm, ia32, x32, x64')
36 parser.add_option('--dest-os',
39 help='operating system to build for. Valid values are: '
40 'win, mac, solaris, freebsd, openbsd, linux, android')
42 parser.add_option('--gdb',
45 help='add gdb support')
47 parser.add_option('--ninja',
50 help='generate files for the ninja build system')
52 parser.add_option('--no-ifaddrs',
55 help='use on deprecated SunOS systems that do not support ifaddrs.h')
57 parser.add_option("--fully-static",
60 help="Generate an executable without external dynamic libraries. This "
61 "will not work on OSX when using default compilation environment")
63 parser.add_option("--openssl-no-asm",
65 dest="openssl_no_asm",
66 help="Do not build optimized assembly for OpenSSL")
69 parser.add_option('--openssl-includes',
71 dest='shared_openssl_includes',
72 help=optparse.SUPPRESS_HELP)
75 parser.add_option('--openssl-libpath',
77 dest='shared_openssl_libpath',
78 help=optparse.SUPPRESS_HELP)
81 parser.add_option('--openssl-use-sys',
83 dest='shared_openssl',
84 help=optparse.SUPPRESS_HELP)
86 parser.add_option('--shared-cares',
89 help='link to a shared cares DLL instead of static linking')
91 parser.add_option('--shared-cares-includes',
93 dest='shared_cares_includes',
94 help='directory containing cares header files')
96 parser.add_option('--shared-cares-libname',
98 dest='shared_cares_libname',
99 help='alternative lib name to link to (default: \'cares\')')
101 parser.add_option('--shared-cares-libpath',
103 dest='shared_cares_libpath',
104 help='a directory to search for the shared cares DLL')
106 parser.add_option('--shared-http-parser',
108 dest='shared_http_parser',
109 help='link to a shared http_parser DLL instead of static linking')
111 parser.add_option('--shared-http-parser-includes',
113 dest='shared_http_parser_includes',
114 help='directory containing http_parser header files')
116 parser.add_option('--shared-http-parser-libname',
118 dest='shared_http_parser_libname',
119 help='alternative lib name to link to (default: \'http_parser\')')
121 parser.add_option('--shared-http-parser-libpath',
123 dest='shared_http_parser_libpath',
124 help='a directory to search for the shared http_parser DLL')
126 parser.add_option('--shared-libuv',
129 help='link to a shared libuv DLL instead of static linking')
131 parser.add_option('--shared-libuv-includes',
133 dest='shared_libuv_includes',
134 help='directory containing libuv header files')
136 parser.add_option('--shared-libuv-libname',
138 dest='shared_libuv_libname',
139 help='alternative lib name to link to (default: \'uv\')')
141 parser.add_option('--shared-libuv-libpath',
143 dest='shared_libuv_libpath',
144 help='a directory to search for the shared libuv DLL')
146 parser.add_option('--shared-openssl',
148 dest='shared_openssl',
149 help='link to a shared OpenSSl DLL instead of static linking')
151 parser.add_option('--shared-openssl-includes',
153 dest='shared_openssl_includes',
154 help='directory containing OpenSSL header files')
156 parser.add_option('--shared-openssl-libname',
158 dest='shared_openssl_libname',
159 help='alternative lib name to link to (default: \'crypto,ssl\')')
161 parser.add_option('--shared-openssl-libpath',
163 dest='shared_openssl_libpath',
164 help='a directory to search for the shared OpenSSL DLLs')
166 parser.add_option('--shared-v8',
169 help='link to a shared V8 DLL instead of static linking')
171 parser.add_option('--shared-v8-includes',
173 dest='shared_v8_includes',
174 help='directory containing V8 header files')
176 parser.add_option('--shared-v8-libname',
178 dest='shared_v8_libname',
179 help='alternative lib name to link to (default: \'v8\')')
181 parser.add_option('--shared-v8-libpath',
183 dest='shared_v8_libpath',
184 help='a directory to search for the shared V8 DLL')
186 parser.add_option('--shared-zlib',
189 help='link to a shared zlib DLL instead of static linking')
191 parser.add_option('--shared-zlib-includes',
193 dest='shared_zlib_includes',
194 help='directory containing zlib header files')
196 parser.add_option('--shared-zlib-libname',
198 dest='shared_zlib_libname',
199 help='alternative lib name to link to (default: \'z\')')
201 parser.add_option('--shared-zlib-libpath',
203 dest='shared_zlib_libpath',
204 help='a directory to search for the shared zlib DLL')
206 # TODO document when we've decided on what the tracing API and its options will
208 parser.add_option('--systemtap-includes',
210 dest='systemtap_includes',
211 help=optparse.SUPPRESS_HELP)
213 parser.add_option('--tag',
216 help='custom build tag')
218 parser.add_option('--v8-options',
221 help='v8 options to pass, see `node --v8-options` for examples.')
223 parser.add_option('--with-arm-float-abi',
225 dest='arm_float_abi',
226 help='specifies which floating-point ABI to use. Valid values are: '
227 'soft, softfp, hard')
229 parser.add_option('--with-dtrace',
232 help='build with DTrace (default is true on sunos)')
234 parser.add_option('--with-etw',
237 help='build with ETW (default is true on Windows)')
239 parser.add_option('--with-icu-path',
241 dest='with_icu_path',
242 help='Path to icu.gyp (ICU i18n, Chromium version only.)')
244 parser.add_option('--with-intl',
247 help='Intl mode: none, full-icu, small-icu (default is none)')
249 parser.add_option('--with-perfctr',
252 help='build with performance counters (default is true on Windows)')
254 parser.add_option('--with-sslv2',
257 help='enable SSL v2')
259 parser.add_option('--without-dtrace',
261 dest='without_dtrace',
262 help='build without DTrace')
264 parser.add_option('--without-etw',
267 help='build without ETW')
269 parser.add_option('--without-npm',
272 help='don\'t install the bundled npm package manager')
274 parser.add_option('--without-perfctr',
276 dest='without_perfctr',
277 help='build without performance counters')
279 parser.add_option('--without-snapshot',
281 dest='without_snapshot',
282 help='build without snapshotting V8 libraries. You might want to set'
283 ' this for cross-compiling. [Default: False]')
285 parser.add_option('--without-ssl',
288 help='build without SSL')
290 parser.add_option('--xcode',
293 help='generate build files for use with xcode')
295 (options, args) = parser.parse_args()
299 """Returns the string 'true' if value is truthy, 'false' otherwise."""
307 cmd = os.popen('pkg-config --libs %s' % pkg, 'r')
308 libs = cmd.readline().strip()
310 if (ret): return None
312 cmd = os.popen('pkg-config --cflags %s' % pkg, 'r')
313 cflags = cmd.readline().strip()
315 if (ret): return None
317 return (libs, cflags)
321 """Checks predefined macros using the CC command."""
324 p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'],
325 stdin=subprocess.PIPE,
326 stdout=subprocess.PIPE,
327 stderr=subprocess.PIPE)
329 print '''Node.js configure error: No acceptable C compiler found!
331 Please make sure you have a C compiler installed on your system and/or
332 consider adjusting the CC environment variable if you installed
333 it in a non-standard prefix.
338 out = p.communicate()[0]
340 out = str(out).split('\n')
344 lst = shlex.split(line)
353 """Check for ARMv7 instructions"""
354 cc_macros_cache = cc_macros()
355 return ('__ARM_ARCH_7__' in cc_macros_cache or
356 '__ARM_ARCH_7A__' in cc_macros_cache or
357 '__ARM_ARCH_7R__' in cc_macros_cache or
358 '__ARM_ARCH_7M__' in cc_macros_cache)
362 """Check for ARMv6 instructions"""
363 cc_macros_cache = cc_macros()
364 return ('__ARM_ARCH_6__' in cc_macros_cache or
365 '__ARM_ARCH_6M__' in cc_macros_cache)
369 """Check for ARM NEON support"""
370 return '__ARM_NEON__' in cc_macros()
373 def is_arm_hard_float_abi():
374 """Check for hardfloat or softfloat eabi on ARM"""
375 # GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify
376 # the Floating Point ABI used (PCS stands for Procedure Call Standard).
377 # We use these as well as a couple of other defines to statically determine
379 # GCC versions 4.4 and below don't support hard-fp.
380 # GCC versions 4.5 may support hard-fp without defining __ARM_PCS or
383 if compiler_version() >= (4, 6, 0):
384 return '__ARM_PCS_VFP' in cc_macros()
385 elif compiler_version() < (4, 5, 0):
387 elif '__ARM_PCS_VFP' in cc_macros():
389 elif ('__ARM_PCS' in cc_macros() or
390 '__SOFTFP' in cc_macros() or
391 not '__VFP_FP__' in cc_macros()):
394 print '''Node.js configure error: Your version of GCC does not report
395 the Floating-Point ABI to compile for your hardware
397 Please manually specify which floating-point ABI to use with the
398 --with-arm-float-abi option.
404 """Host architecture check using the CC command."""
409 '__x86_64__' : 'x64',
415 rtn = 'ia32' # default
418 if i in k and k[i] != '0':
426 """Host architecture check using environ vars (better way to do this?)"""
428 observed_arch = os.environ.get('PROCESSOR_ARCHITECTURE', 'x86')
429 arch = os.environ.get('PROCESSOR_ARCHITEW6432', observed_arch)
438 return matchup.get(arch, 'ia32')
441 def compiler_version():
443 proc = subprocess.Popen(shlex.split(CC) + ['--version'],
444 stdout=subprocess.PIPE)
448 is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
450 proc = subprocess.Popen(shlex.split(CC) + ['-dumpversion'],
451 stdout=subprocess.PIPE)
452 version = tuple(map(int, proc.communicate()[0].split('.')))
454 return (version, is_clang)
457 def configure_arm(o):
458 if options.arm_float_abi:
459 arm_float_abi = options.arm_float_abi
460 elif is_arm_hard_float_abi():
461 arm_float_abi = 'hard'
463 arm_float_abi = 'default'
466 o['variables']['arm_version'] = '7'
467 elif is_arch_armv6():
468 o['variables']['arm_version'] = '6'
470 o['variables']['arm_version'] = 'default'
472 o['variables']['arm_fpu'] = 'vfpv3' # V8 3.18 no longer supports VFP2.
473 o['variables']['arm_neon'] = int(is_arm_neon())
474 o['variables']['arm_thumb'] = 0 # -marm
475 o['variables']['arm_float_abi'] = arm_float_abi
478 def configure_node(o):
479 if options.dest_os == 'android':
480 o['variables']['OS'] = 'android'
481 o['variables']['node_prefix'] = os.path.expanduser(options.prefix or '')
482 o['variables']['node_install_npm'] = b(not options.without_npm)
483 o['default_configuration'] = 'Debug' if options.debug else 'Release'
485 host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
486 target_arch = options.dest_cpu or host_arch
487 o['variables']['host_arch'] = host_arch
488 o['variables']['target_arch'] = target_arch
490 if target_arch != host_arch and not options.without_snapshot:
491 o['variables']['want_separate_host_toolset'] = 1
493 o['variables']['want_separate_host_toolset'] = 0
495 if target_arch == 'arm':
498 cc_version, is_clang = compiler_version()
499 o['variables']['clang'] = 1 if is_clang else 0
501 if not is_clang and cc_version != 0:
502 o['variables']['gcc_version'] = 10 * cc_version[0] + cc_version[1]
504 # clang has always supported -fvisibility=hidden, right?
505 if not is_clang and cc_version < (4,0,0):
506 o['variables']['visibility'] = ''
508 if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
509 use_dtrace = not options.without_dtrace
510 # Don't enable by default on linux and freebsd
511 if flavor in ('linux', 'freebsd'):
512 use_dtrace = options.with_dtrace
514 if flavor == 'linux':
515 if options.systemtap_includes:
516 o['include_dirs'] += [options.systemtap_includes]
517 o['variables']['node_use_dtrace'] = b(use_dtrace)
518 o['variables']['uv_use_dtrace'] = b(use_dtrace)
519 o['variables']['uv_parent_path'] = '/deps/uv/'
520 elif options.with_dtrace:
522 'DTrace is currently only supported on SunOS, MacOS or Linux systems.')
524 o['variables']['node_use_dtrace'] = 'false'
526 # if we're on illumos based systems wrap the helper library into the
528 if flavor == 'solaris':
529 o['variables']['node_use_mdb'] = 'true'
531 o['variables']['node_use_mdb'] = 'false'
533 if options.no_ifaddrs:
534 o['defines'] += ['SUNOS_NO_IFADDRS']
536 # By default, enable ETW on Windows.
538 o['variables']['node_use_etw'] = b(not options.without_etw)
539 elif options.with_etw:
540 raise Exception('ETW is only supported on Windows.')
542 o['variables']['node_use_etw'] = 'false'
544 # By default, enable Performance counters on Windows.
546 o['variables']['node_use_perfctr'] = b(not options.without_perfctr)
547 elif options.with_perfctr:
548 raise Exception('Performance counter is only supported on Windows.')
550 o['variables']['node_use_perfctr'] = 'false'
553 o['variables']['node_tag'] = '-' + options.tag
555 o['variables']['node_tag'] = ''
557 if options.v8_options:
558 o['variables']['node_v8_options'] = options.v8_options.replace('"', '\\"')
561 def configure_libz(o):
562 o['variables']['node_shared_zlib'] = b(options.shared_zlib)
564 # assume shared_zlib if one of these is set?
565 if options.shared_zlib_libpath:
566 o['libraries'] += ['-L%s' % options.shared_zlib_libpath]
567 if options.shared_zlib_libname:
568 o['libraries'] += ['-l%s' % options.shared_zlib_libname]
569 elif options.shared_zlib:
570 o['libraries'] += ['-lz']
571 if options.shared_zlib_includes:
572 o['include_dirs'] += [options.shared_zlib_includes]
575 def configure_http_parser(o):
576 o['variables']['node_shared_http_parser'] = b(options.shared_http_parser)
578 # assume shared http_parser if one of these is set?
579 if options.shared_http_parser_libpath:
580 o['libraries'] += ['-L%s' % options.shared_http_parser_libpath]
581 if options.shared_http_parser_libname:
582 o['libraries'] += ['-l%s' % options.shared_http_parser_libname]
583 elif options.shared_http_parser:
584 o['libraries'] += ['-lhttp_parser']
585 if options.shared_http_parser_includes:
586 o['include_dirs'] += [options.shared_http_parser_includes]
589 def configure_cares(o):
590 o['variables']['node_shared_cares'] = b(options.shared_cares)
592 # assume shared cares if one of these is set?
593 if options.shared_cares_libpath:
594 o['libraries'] += ['-L%s' % options.shared_cares_libpath]
595 if options.shared_cares_libname:
596 o['libraries'] += ['-l%s' % options.shared_cares_libname]
597 elif options.shared_cares:
598 o['libraries'] += ['-lcares']
599 if options.shared_cares_includes:
600 o['include_dirs'] += [options.shared_cares_includes]
603 def configure_libuv(o):
604 o['variables']['node_shared_libuv'] = b(options.shared_libuv)
606 # assume shared libuv if one of these is set?
607 if options.shared_libuv_libpath:
608 o['libraries'] += ['-L%s' % options.shared_libuv_libpath]
610 o['variables']['uv_library'] = 'static_library'
612 if options.shared_libuv_libname:
613 o['libraries'] += ['-l%s' % options.shared_libuv_libname]
614 elif options.shared_libuv:
615 o['libraries'] += ['-luv']
616 if options.shared_libuv_includes:
617 o['include_dirs'] += [options.shared_libuv_includes]
621 o['variables']['node_shared_v8'] = b(options.shared_v8)
622 o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
623 o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
624 o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds.
625 o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
626 o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
628 # assume shared_v8 if one of these is set?
629 if options.shared_v8_libpath:
630 o['libraries'] += ['-L%s' % options.shared_v8_libpath]
631 if options.shared_v8_libname:
632 o['libraries'] += ['-l%s' % options.shared_v8_libname]
633 elif options.shared_v8:
634 o['libraries'] += ['-lv8']
635 if options.shared_v8_includes:
636 o['include_dirs'] += [options.shared_v8_includes]
639 def configure_openssl(o):
640 o['variables']['node_use_openssl'] = b(not options.without_ssl)
641 o['variables']['node_shared_openssl'] = b(options.shared_openssl)
642 o['variables']['openssl_no_asm'] = (
643 1 if options.openssl_no_asm else 0)
645 if options.without_ssl:
648 # OpenSSL uses `#ifndef OPENSSL_NO_SSL2` checks so only define the
649 # macro when we want to _disable_ SSL2.
650 if not options.with_sslv2:
651 o['defines'] += ['OPENSSL_NO_SSL2=1']
653 if options.shared_openssl:
654 (libs, cflags) = pkg_config('openssl') or ('-lssl -lcrypto', '')
656 if options.shared_openssl_libpath:
657 o['libraries'] += ['-L%s' % options.shared_openssl_libpath]
659 if options.shared_openssl_libname:
660 libnames = options.shared_openssl_libname.split(',')
661 o['libraries'] += ['-l%s' % s for s in libnames]
663 o['libraries'] += libs.split()
665 if options.shared_openssl_includes:
666 o['include_dirs'] += [options.shared_openssl_includes]
668 o['cflags'] += cflags.split()
671 def configure_fullystatic(o):
672 if options.fully_static:
673 o['libraries'] += ['-static']
675 print("Generation of static executable will not work on OSX "
676 "when using default compilation environment")
679 def configure_winsdk(o):
683 winsdk_dir = os.environ.get('WindowsSdkDir')
685 if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\ctrpp.exe'):
686 print('Found ctrpp in WinSDK--will build generated files '
687 'into tools/msvs/genfiles.')
688 o['variables']['node_has_winsdk'] = 'true'
691 print('ctrpp not found in WinSDK path--using pre-gen files '
692 'from tools/msvs/genfiles.')
694 def write(filename, data):
695 filename = os.path.join(root_dir, filename)
696 print 'creating ', filename
697 f = open(filename, 'w+')
700 do_not_edit = '# Do not edit. Generated by the configure script.\n'
702 def glob_to_var(dir_base, dir_sub):
704 dir_all = os.path.join(dir_base, dir_sub)
705 files = os.walk(dir_all)
707 (path, dirs, files) = ent
709 if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'):
710 list.append('%s/%s' % (dir_sub, file))
714 def configure_intl(o):
718 icu_config_name = 'icu_config.gypi'
719 def write_config(data, name):
722 # write an empty file to start with
723 write(icu_config_name, do_not_edit +
724 pprint.pformat(icu_config, indent=2) + '\n')
726 # small ICU is off by default.
727 # always set icu_small, node.gyp depends on it being defined.
728 o['variables']['icu_small'] = b(False)
730 with_intl = options.with_intl
731 have_icu_path = bool(options.with_icu_path)
732 if have_icu_path and with_intl:
733 print 'Error: Cannot specify both --with-icu-path and --with-intl'
736 # Chromium .gyp mode: --with-icu-path
737 o['variables']['v8_enable_i18n_support'] = 1
739 o['variables']['icu_gyp_path'] = options.with_icu_path
741 # --with-intl=<with_intl>
742 if with_intl == 'none' or with_intl is None:
743 o['variables']['v8_enable_i18n_support'] = 0
745 elif with_intl == 'small-icu':
746 # small ICU (English only)
747 o['variables']['v8_enable_i18n_support'] = 1
748 o['variables']['icu_small'] = b(True)
749 elif with_intl == 'full-icu':
751 o['variables']['v8_enable_i18n_support'] = 1
752 elif with_intl == 'system-icu':
753 # ICU from pkg-config.
754 o['variables']['v8_enable_i18n_support'] = 1
755 pkgicu = pkg_config('icu-i18n')
757 print 'Error: could not load pkg-config data for "icu-i18n".'
758 print 'See above errors or the README.md.'
760 (libs, cflags) = pkgicu
761 o['libraries'] += libs.split()
762 o['cflags'] += cflags.split()
763 # use the "system" .gyp
764 o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp'
767 print 'Error: unknown value --with-intl=%s' % with_intl
769 # Note: non-ICU implementations could use other 'with_intl'
772 # ICU mode. (icu-generic.gyp)
773 byteorder = sys.byteorder
774 o['variables']['icu_gyp_path'] = 'tools/icu/icu-generic.gyp'
775 # ICU source dir relative to root
776 icu_full_path = os.path.join(root_dir, 'deps/icu')
777 o['variables']['icu_path'] = icu_full_path
778 if not os.path.isdir(icu_full_path):
779 print 'Error: ICU path is not a directory: %s' % (icu_full_path)
781 # Now, what version of ICU is it? We just need the "major", such as 54.
782 # uvernum.h contains it as a #define.
783 uvernum_h = os.path.join(icu_full_path, 'source/common/unicode/uvernum.h')
784 if not os.path.isfile(uvernum_h):
785 print 'Error: could not load %s - is ICU installed?' % uvernum_h
788 matchVerExp = r'^\s*#define\s+U_ICU_VERSION_SHORT\s+"([^"]*)".*'
789 match_version = re.compile(matchVerExp)
790 for line in open(uvernum_h).readlines():
791 m = match_version.match(line)
793 icu_ver_major = m.group(1)
794 if not icu_ver_major:
795 print 'Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h
797 icu_endianness = sys.byteorder[0]; # TODO(srl295): EBCDIC should be 'e'
798 o['variables']['icu_ver_major'] = icu_ver_major
799 o['variables']['icu_endianness'] = icu_endianness
800 icu_data_file_l = 'icudt%s%s.dat' % (icu_ver_major, 'l')
801 icu_data_file = 'icudt%s%s.dat' % (icu_ver_major, icu_endianness)
802 # relative to configure
803 icu_data_path = os.path.join(icu_full_path,
807 icu_data_in = os.path.join('../../deps/icu/source/data/in', icu_data_file_l)
808 if not os.path.isfile(icu_data_path) and icu_endianness != 'l':
809 # use host endianness
810 icu_data_path = os.path.join(icu_full_path,
814 icu_data_in = os.path.join('icu/source/data/in',
816 # this is the input '.dat' file to use .. icudt*.dat
817 # may be little-endian if from a icu-project.org tarball
818 o['variables']['icu_data_in'] = icu_data_in
819 # this is the icudt*.dat file which node will be using (platform endianness)
820 o['variables']['icu_data_file'] = icu_data_file
821 if not os.path.isfile(icu_data_path):
822 print 'Error: ICU prebuilt data file %s does not exist.' % icu_data_path
823 print 'See the README.md.'
824 # .. and we're not about to build it from .gyp!
826 # map from variable name to subdirs
828 'stubdata': 'stubdata',
832 'tools': 'tools/toolutil',
833 'genccode': 'tools/genccode',
834 'genrb': 'tools/genrb',
835 'icupkg': 'tools/icupkg',
837 # this creates a variable icu_src_XXX for each of the subdirs
838 # with a list of the src files to use
840 var = 'icu_src_%s' % i
841 path = '../../deps/icu/source/%s' % icu_src[i]
842 icu_config['variables'][var] = glob_to_var('tools/icu', path)
843 # write updated icu_config.gypi with a bunch of paths
844 write(icu_config_name, do_not_edit +
845 pprint.pformat(icu_config, indent=2) + '\n')
846 return # end of configure_intl
848 # determine the "flavor" (operating system) we're building for,
849 # leveraging gyp's GetFlavor function
851 if (options.dest_os):
852 flavor_params['flavor'] = options.dest_os
853 flavor = GetFlavor(flavor_params)
856 'variables': { 'python': sys.executable },
863 configure_node(output)
864 configure_libz(output)
865 configure_http_parser(output)
866 configure_cares(output)
867 configure_libuv(output)
869 configure_openssl(output)
870 configure_winsdk(output)
871 configure_intl(output)
872 configure_fullystatic(output)
874 # variables should be a root level element,
875 # move everything else to target_defaults
876 variables = output['variables']
877 del output['variables']
879 'variables': variables,
880 'target_defaults': output
882 pprint.pprint(output, indent=2)
884 write('config.gypi', do_not_edit +
885 pprint.pformat(output, indent=2) + '\n')
888 'BUILDTYPE': 'Debug' if options.debug else 'Release',
889 'USE_NINJA': str(int(options.use_ninja or 0)),
890 'USE_XCODE': str(int(options.use_xcode or 0)),
891 'PYTHON': sys.executable,
895 config['PREFIX'] = options.prefix
897 config = '\n'.join(map('='.join, config.iteritems())) + '\n'
900 '# Do not edit. Generated by the configure script.\n' + config)
902 gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel']
904 if options.use_ninja:
905 gyp_args += ['-f', 'ninja-' + flavor]
906 elif options.use_xcode:
907 gyp_args += ['-f', 'xcode']
908 elif flavor == 'win' and sys.platform != 'msys':
909 gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto']
911 gyp_args += ['-f', 'make-' + flavor]
915 subprocess.call(gyp_args)