deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / build / standalone.gypi
1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are
4 # met:
5 #
6 #     * Redistributions of source code must retain the above copyright
7 #       notice, this list of conditions and the following disclaimer.
8 #     * Redistributions in binary form must reproduce the above
9 #       copyright notice, this list of conditions and the following
10 #       disclaimer in the documentation and/or other materials provided
11 #       with the distribution.
12 #     * Neither the name of Google Inc. nor the names of its
13 #       contributors may be used to endorse or promote products derived
14 #       from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 # Definitions to be used when building stand-alone V8 binaries.
29
30 {
31   # We need to include toolchain.gypi here for third-party sources that don't
32   # directly include it themselves.
33   'includes': ['toolchain.gypi'],
34   'variables': {
35     'component%': 'static_library',
36     'clang_dir%': 'third_party/llvm-build/Release+Asserts',
37     'clang_xcode%': 0,
38     'visibility%': 'hidden',
39     'v8_enable_backtrace%': 0,
40     'v8_enable_i18n_support%': 1,
41     'v8_deprecation_warnings': 1,
42     'msvs_multi_core_compile%': '1',
43     'mac_deployment_target%': '10.5',
44     'variables': {
45       'variables': {
46         'variables': {
47           'conditions': [
48             ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
49                OS=="netbsd" or OS=="mac" or OS=="qnx" or OS=="aix"', {
50               # This handles the Unix platforms we generally deal with.
51               # Anything else gets passed through, which probably won't work
52               # very well; such hosts should pass an explicit target_arch
53               # to gyp.
54               'host_arch%': '<!pymod_do_main(detect_v8_host_arch)',
55             }, {
56               # OS!="linux" and OS!="freebsd" and OS!="openbsd" and
57               # OS!="netbsd" and OS!="mac" and OS!="aix"
58               'host_arch%': 'ia32',
59             }],
60           ],
61         },
62         'host_arch%': '<(host_arch)',
63         'target_arch%': '<(host_arch)',
64       },
65       'host_arch%': '<(host_arch)',
66       'target_arch%': '<(target_arch)',
67       'v8_target_arch%': '<(target_arch)',
68
69       # goma settings.
70       # 1 to use goma.
71       # If no gomadir is set, it uses the default gomadir.
72       'use_goma%': 0,
73       'gomadir%': '',
74       'conditions': [
75         # Set default gomadir.
76         ['OS=="win"', {
77           'gomadir': 'c:\\goma\\goma-win',
78         }, {
79           'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
80         }],
81       ],
82     },
83     'host_arch%': '<(host_arch)',
84     'target_arch%': '<(target_arch)',
85     'v8_target_arch%': '<(v8_target_arch)',
86     'werror%': '-Werror',
87     'use_goma%': '<(use_goma)',
88     'gomadir%': '<(gomadir)',
89
90     # .gyp files or targets should set v8_code to 1 if they build V8 specific
91     # code, as opposed to external code.  This variable is used to control such
92     # things as the set of warnings to enable, and whether warnings are treated
93     # as errors.
94     'v8_code%': 0,
95
96     # Speeds up Debug builds:
97     # 0 - Compiler optimizations off (debuggable) (default). This may
98     #     be 5x slower than Release (or worse).
99     # 1 - Turn on optimizations and disable slow DCHECKs, but leave
100     #     V8_ENABLE_CHECKS and most other assertions enabled.  This may cause
101     #     some v8 tests to fail in the Debug configuration.  This roughly
102     #     matches the performance of a Release build and can be used by
103     #     embedders that need to build their own code as debug but don't want
104     #     or need a debug version of V8. This should produce near-release
105     #     speeds.
106     'v8_optimized_debug%': 0,
107
108     # Use external files for startup data blobs:
109     # the JS builtins sources and the start snapshot.
110     # Embedders that don't use standalone.gypi will need to add
111     # their own default value.
112     'v8_use_external_startup_data%': 0,
113
114     # Relative path to icu.gyp from this file.
115     'icu_gyp_path': '../third_party/icu/icu.gyp',
116
117     'conditions': [
118       ['(v8_target_arch=="arm" and host_arch!="arm") or \
119         (v8_target_arch=="arm64" and host_arch!="arm64") or \
120         (v8_target_arch=="mipsel" and host_arch!="mipsel") or \
121         (v8_target_arch=="mips64el" and host_arch!="mips64el") or \
122         (v8_target_arch=="x64" and host_arch!="x64") or \
123         (OS=="android" or OS=="qnx")', {
124         'want_separate_host_toolset': 1,
125       }, {
126         'want_separate_host_toolset': 0,
127       }],
128       ['OS == "win"', {
129         'os_posix%': 0,
130       }, {
131         'os_posix%': 1,
132       }],
133       ['OS=="win" and use_goma==1', {
134         # goma doesn't support pch yet.
135         'chromium_win_pch': 0,
136         # goma doesn't support PDB yet, so win_z7=1 or fastbuild=1.
137         'conditions': [
138           ['win_z7==0 and fastbuild==0', {
139             'fastbuild': 1,
140           }],
141         ],
142       }],
143       ['(v8_target_arch=="ia32" or v8_target_arch=="x64" or v8_target_arch=="x87") and \
144         (OS=="linux" or OS=="mac")', {
145         'v8_enable_gdbjit%': 1,
146       }, {
147         'v8_enable_gdbjit%': 0,
148       }],
149       ['(OS=="linux" or OS=="mac") and (target_arch=="ia32" or target_arch=="x64") and \
150         (v8_target_arch!="x87")', {
151         'clang%': 1,
152       }, {
153         'clang%': 0,
154       }],
155       ['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le"', {
156         'host_clang%': '1',
157       }, {
158         'host_clang%': '0',
159       }],
160     ],
161     # Default ARM variable settings.
162     'arm_version%': 'default',
163     'arm_fpu%': 'vfpv3',
164     'arm_float_abi%': 'default',
165     'arm_thumb': 'default',
166
167     # Default MIPS variable settings.
168     'mips_arch_variant%': 'r2',
169     # Possible values fp32, fp64, fpxx.
170     # fp32 - 32 32-bit FPU registers are available, doubles are placed in
171     #        register pairs.
172     # fp64 - 32 64-bit FPU registers are available.
173     # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime
174     #        detection
175     'mips_fpu_mode%': 'fp32',
176   },
177   'target_defaults': {
178     'variables': {
179       'v8_code%': '<(v8_code)',
180     },
181     'default_configuration': 'Debug',
182     'configurations': {
183       'DebugBaseCommon': {
184         'conditions': [
185           ['OS=="aix"', {
186             'cflags': [ '-g', '-Og', '-gxcoff' ],
187           }, {
188             'cflags': [ '-g', '-O0' ],
189           }],
190         ],
191       },
192       'Optdebug': {
193         'inherit_from': [ 'DebugBaseCommon', 'DebugBase1' ],
194       },
195       'Debug': {
196         # Xcode insists on this empty entry.
197       },
198       'Release': {
199         # Xcode insists on this empty entry.
200       },
201     },
202     'conditions':[
203       ['(clang==1 or host_clang==1) and OS!="win"', {
204         # This is here so that all files get recompiled after a clang roll and
205         # when turning clang on or off.
206         # (defines are passed via the command line, and build systems rebuild
207         # things when their commandline changes). Nothing should ever read this
208         # define.
209         'defines': ['CR_CLANG_REVISION=<!(<(DEPTH)/tools/clang/scripts/update.sh --print-revision)'],
210         'cflags+': [
211           '-Wno-format-pedantic',
212         ],
213       }],
214     ],
215     'target_conditions': [
216       ['v8_code == 0', {
217         'defines!': [
218           'DEBUG',
219         ],
220         'conditions': [
221           ['os_posix == 1 and OS != "mac"', {
222             # We don't want to get warnings from third-party code,
223             # so remove any existing warning-enabling flags like -Wall.
224             'cflags!': [
225               '-pedantic',
226               '-Wall',
227               '-Werror',
228               '-Wextra',
229             ],
230             'cflags+': [
231               # Clang considers the `register` keyword as deprecated, but
232               # ICU uses it all over the place.
233               '-Wno-deprecated-register',
234               # ICU uses its own deprecated functions.
235               '-Wno-deprecated-declarations',
236               # ICU prefers `a && b || c` over `(a && b) || c`.
237               '-Wno-logical-op-parentheses',
238               # ICU has some `unsigned < 0` checks.
239               '-Wno-tautological-compare',
240               # uresdata.c has switch(RES_GET_TYPE(x)) code. The
241               # RES_GET_TYPE macro returns an UResType enum, but some switch
242               # statement contains case values that aren't part of that
243               # enum (e.g. URES_TABLE32 which is in UResInternalType). This
244               # is on purpose.
245               '-Wno-switch',
246             ],
247             'cflags_cc!': [
248               '-Wnon-virtual-dtor',
249             ],
250           }],
251           ['OS == "mac"', {
252             'xcode_settings': {
253               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
254             },
255           }],
256           ['OS == "win"', {
257             'msvs_settings': {
258               'VCCLCompilerTool': {
259                 'WarnAsError': 'false',
260               },
261             },
262           }],
263         ],
264       }],
265     ],
266   },
267   'conditions': [
268     ['asan==1 and OS!="mac"', {
269       'target_defaults': {
270         'cflags_cc+': [
271           '-fno-omit-frame-pointer',
272           '-gline-tables-only',
273           '-fsanitize=address',
274           '-w',  # http://crbug.com/162783
275         ],
276         'cflags!': [
277           '-fomit-frame-pointer',
278         ],
279         'ldflags': [
280           '-fsanitize=address',
281         ],
282       },
283     }],
284     ['tsan==1 and OS!="mac"', {
285       'target_defaults': {
286         'cflags+': [
287           '-fno-omit-frame-pointer',
288           '-gline-tables-only',
289           '-fsanitize=thread',
290           '-fPIC',
291           '-Wno-c++11-extensions',
292         ],
293         'cflags!': [
294           '-fomit-frame-pointer',
295         ],
296         'ldflags': [
297           '-fsanitize=thread',
298           '-pie',
299         ],
300         'defines': [
301           'THREAD_SANITIZER',
302         ],
303       },
304     }],
305     ['asan==1 and OS=="mac"', {
306       'target_defaults': {
307         'xcode_settings': {
308           'OTHER_CFLAGS+': [
309             '-fno-omit-frame-pointer',
310             '-gline-tables-only',
311             '-fsanitize=address',
312             '-w',  # http://crbug.com/162783
313           ],
314           'OTHER_CFLAGS!': [
315             '-fomit-frame-pointer',
316           ],
317         },
318         'target_conditions': [
319           ['_type!="static_library"', {
320             'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
321           }],
322         ],
323         'dependencies': [
324           '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
325         ],
326       },
327     }],
328     ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
329        or OS=="netbsd" or OS=="aix"', {
330       'target_defaults': {
331         'cflags': [
332           '-Wall',
333           '<(werror)',
334           '-Wno-unused-parameter',
335           '-Wno-long-long',
336           '-pthread',
337           '-fno-exceptions',
338           '-pedantic',
339           # Don't warn about the "struct foo f = {0};" initialization pattern.
340           '-Wno-missing-field-initializers',
341         ],
342         'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
343         'ldflags': [ '-pthread', ],
344         'conditions': [
345           [ 'host_arch=="ppc64" and OS!="aix"', {
346             'cflags': [ '-mminimal-toc' ],
347           }],
348           [ 'visibility=="hidden" and v8_enable_backtrace==0', {
349             'cflags': [ '-fvisibility=hidden' ],
350           }],
351           [ 'component=="shared_library"', {
352             'cflags': [ '-fPIC', ],
353           }],
354         ],
355       },
356     }],
357     # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
358     #  or OS=="netbsd"'
359     ['OS=="qnx"', {
360       'target_defaults': {
361         'cflags': [
362           '-Wall',
363           '<(werror)',
364           '-Wno-unused-parameter',
365           '-fno-exceptions',
366           # Don't warn about the "struct foo f = {0};" initialization pattern.
367           '-Wno-missing-field-initializers',
368         ],
369         'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
370         'conditions': [
371           [ 'visibility=="hidden"', {
372             'cflags': [ '-fvisibility=hidden' ],
373           }],
374           [ 'component=="shared_library"', {
375             'cflags': [ '-fPIC' ],
376           }],
377         ],
378         'target_conditions': [
379           [ '_toolset=="host" and host_os=="linux"', {
380             'cflags': [ '-pthread' ],
381             'ldflags': [ '-pthread' ],
382             'libraries': [ '-lrt' ],
383           }],
384           [ '_toolset=="target"', {
385             'cflags': [ '-Wno-psabi' ],
386             'libraries': [ '-lbacktrace', '-lsocket', '-lm' ],
387           }],
388         ],
389       },
390     }],  # OS=="qnx"
391     ['OS=="win"', {
392       'target_defaults': {
393         'defines': [
394           '_CRT_SECURE_NO_DEPRECATE',
395           '_CRT_NONSTDC_NO_DEPRECATE',
396           '_USING_V110_SDK71_',
397         ],
398         'conditions': [
399           ['component=="static_library"', {
400             'defines': [
401               '_HAS_EXCEPTIONS=0',
402             ],
403           }],
404         ],
405         'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
406         'msvs_disabled_warnings': [4355, 4800],
407         'msvs_settings': {
408           'VCCLCompilerTool': {
409             'MinimalRebuild': 'false',
410             'BufferSecurityCheck': 'true',
411             'EnableFunctionLevelLinking': 'true',
412             'RuntimeTypeInfo': 'false',
413             'WarningLevel': '3',
414             'WarnAsError': 'true',
415             'DebugInformationFormat': '3',
416             'Detect64BitPortabilityProblems': 'false',
417             'conditions': [
418               [ 'msvs_multi_core_compile', {
419                 'AdditionalOptions': ['/MP'],
420               }],
421               ['component=="shared_library"', {
422                 'ExceptionHandling': '1',  # /EHsc
423               }, {
424                 'ExceptionHandling': '0',
425               }],
426             ],
427           },
428           'VCLibrarianTool': {
429             'AdditionalOptions': ['/ignore:4221'],
430             'conditions': [
431               ['v8_target_arch=="x64"', {
432                 'TargetMachine': '17',  # x64
433               }, {
434                 'TargetMachine': '1',  # ia32
435               }],
436             ],
437           },
438           'VCLinkerTool': {
439             'AdditionalDependencies': [
440               'ws2_32.lib',
441             ],
442             'GenerateDebugInformation': 'true',
443             'MapFileName': '$(OutDir)\\$(TargetName).map',
444             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
445             'FixedBaseAddress': '1',
446             # LinkIncremental values:
447             #   0 == default
448             #   1 == /INCREMENTAL:NO
449             #   2 == /INCREMENTAL
450             'LinkIncremental': '1',
451             # SubSystem values:
452             #   0 == not set
453             #   1 == /SUBSYSTEM:CONSOLE
454             #   2 == /SUBSYSTEM:WINDOWS
455             'SubSystem': '1',
456
457             'conditions': [
458               ['v8_enable_i18n_support==1', {
459                 'AdditionalDependencies': [
460                   'advapi32.lib',
461                 ],
462               }],
463               ['v8_target_arch=="x64"', {
464                 'MinimumRequiredVersion': '5.02',  # Server 2003.
465                 'TargetMachine': '17',  # x64
466               }, {
467                 'MinimumRequiredVersion': '5.01',  # XP.
468                 'TargetMachine': '1',  # ia32
469               }],
470             ],
471           },
472         },
473       },
474     }],  # OS=="win"
475     ['OS=="mac"', {
476       'xcode_settings': {
477         'SDKROOT': 'macosx',
478         'SYMROOT': '<(DEPTH)/xcodebuild',
479       },
480       'target_defaults': {
481         'xcode_settings': {
482           'ALWAYS_SEARCH_USER_PATHS': 'NO',
483           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
484           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
485           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
486                                                     # (Equivalent to -fPIC)
487           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
488           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
489           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
490           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
491           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
492           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
493           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
494           'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor
495           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
496           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
497           'PREBINDING': 'NO',                       # No -Wl,-prebind
498           'SYMROOT': '<(DEPTH)/xcodebuild',
499           'USE_HEADERMAP': 'NO',
500           'OTHER_CFLAGS': [
501             '-fno-strict-aliasing',
502           ],
503           'WARNING_CFLAGS': [
504             '-Wall',
505             '-Wendif-labels',
506             '-Wno-unused-parameter',
507             # Don't warn about the "struct foo f = {0};" initialization pattern.
508             '-Wno-missing-field-initializers',
509           ],
510         },
511         'conditions': [
512           ['werror==""', {
513             'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO'},
514           }, {
515             'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES'},
516           }],
517           ['clang==1', {
518             'xcode_settings': {
519               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
520               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',  # -std=gnu++0x
521             },
522           }],
523         ],
524         'target_conditions': [
525           ['_type!="static_library"', {
526             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
527           }],
528         ],  # target_conditions
529       },  # target_defaults
530     }],  # OS=="mac"
531     ['clang!=1 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"', {
532       'make_global_settings': [
533         ['CC.host', '../<(clang_dir)/bin/clang'],
534         ['CXX.host', '../<(clang_dir)/bin/clang++'],
535       ],
536     }],
537     ['clang==0 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"', {
538       'target_conditions': [
539         ['_toolset=="host"', {
540           'cflags_cc': [ '-std=gnu++11', ],
541         }],
542       ],
543       'target_defaults': {
544         'target_conditions': [
545           ['_toolset=="host"', { 'cflags!': [ '-Wno-unused-local-typedefs' ]}],
546         ],
547       },
548     }],
549     ['clang==1 and "<(GENERATOR)"=="ninja"', {
550       # See http://crbug.com/110262
551       'target_defaults': {
552         'cflags': [ '-fcolor-diagnostics' ],
553         'xcode_settings': { 'OTHER_CFLAGS': [ '-fcolor-diagnostics' ] },
554       },
555     }],
556     ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
557         'and OS!="win" and "<(GENERATOR)"=="make"', {
558       'make_global_settings': [
559         ['CC', '../<(clang_dir)/bin/clang'],
560         ['CXX', '../<(clang_dir)/bin/clang++'],
561         ['CC.host', '$(CC)'],
562         ['CXX.host', '$(CXX)'],
563       ],
564     }],
565     ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
566         'and OS!="win" and "<(GENERATOR)"=="ninja"', {
567       'make_global_settings': [
568         ['CC', '<(clang_dir)/bin/clang'],
569         ['CXX', '<(clang_dir)/bin/clang++'],
570         ['CC.host', '$(CC)'],
571         ['CXX.host', '$(CXX)'],
572       ],
573     }],
574     ['clang==1 and OS=="win"', {
575       'make_global_settings': [
576         # On Windows, gyp's ninja generator only looks at CC.
577         ['CC', '../<(clang_dir)/bin/clang-cl'],
578       ],
579     }],
580     # TODO(yyanagisawa): supports GENERATOR==make
581     #  make generator doesn't support CC_wrapper without CC
582     #  in make_global_settings yet.
583     ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
584       'make_global_settings': [
585        ['CC_wrapper', '<(gomadir)/gomacc'],
586        ['CXX_wrapper', '<(gomadir)/gomacc'],
587        ['CC.host_wrapper', '<(gomadir)/gomacc'],
588        ['CXX.host_wrapper', '<(gomadir)/gomacc'],
589       ],
590     }],
591   ],
592 }