child_process: check execFile and fork args
[platform/upstream/nodejs.git] / common.gypi
1 {
2   'variables': {
3     'asan%': 0,
4     'werror': '',                     # Turn off -Werror in V8 build.
5     'visibility%': 'hidden',          # V8's visibility setting
6     'target_arch%': 'ia32',           # set v8's target architecture
7     'host_arch%': 'ia32',             # set v8's host architecture
8     'want_separate_host_toolset%': 0, # V8 should not build target and host
9     'library%': 'static_library',     # allow override to 'shared_library' for DLL/.so builds
10     'component%': 'static_library',   # NB. these names match with what V8 expects
11     'msvs_multi_core_compile': '0',   # we do enable multicore compiles, but not using the V8 way
12     'python%': 'python',
13
14     'node_tag%': '',
15     'uv_library%': 'static_library',
16
17     # Default to -O0 for debug builds.
18     'v8_optimized_debug%': 0,
19
20     # Enable disassembler for `--print-code` v8 options
21     'v8_enable_disassembler': 1,
22
23     # Don't bake anything extra into the snapshot.
24     'v8_use_external_startup_data%': 0,
25
26     'conditions': [
27       ['OS == "win"', {
28         'os_posix': 0,
29         'v8_postmortem_support%': 'false',
30       }, {
31         'os_posix': 1,
32         'v8_postmortem_support%': 'true',
33       }],
34       ['GENERATOR == "ninja" or OS== "mac"', {
35         'OBJ_DIR': '<(PRODUCT_DIR)/obj',
36         'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
37       }, {
38         'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
39         'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.a',
40       }],
41       ['openssl_fips != ""', {
42         'OPENSSL_PRODUCT': 'libcrypto.a',
43       }, {
44         'OPENSSL_PRODUCT': 'libopenssl.a',
45       }],
46       ['OS=="mac"', {
47         'clang%': 1,
48       }, {
49         'clang%': 0,
50       }],
51     ],
52   },
53
54   'target_defaults': {
55     'default_configuration': 'Release',
56     'configurations': {
57       'Debug': {
58         'variables': {
59           'v8_enable_handle_zapping%': 1,
60         },
61         'defines': [ 'DEBUG', '_DEBUG' ],
62         'cflags': [ '-g', '-O0' ],
63         'conditions': [
64           ['target_arch=="x64"', {
65             'msvs_configuration_platform': 'x64',
66           }],
67         ],
68         'msvs_settings': {
69           'VCCLCompilerTool': {
70             'RuntimeLibrary': 1, # static debug
71             'Optimization': 0, # /Od, no optimization
72             'MinimalRebuild': 'false',
73             'OmitFramePointers': 'false',
74             'BasicRuntimeChecks': 3, # /RTC1
75           },
76           'VCLinkerTool': {
77             'LinkIncremental': 2, # enable incremental linking
78           },
79         },
80         'xcode_settings': {
81           'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
82         },
83       },
84       'Release': {
85         'variables': {
86           'v8_enable_handle_zapping%': 0,
87         },
88         'cflags': [ '-O3', '-ffunction-sections', '-fdata-sections' ],
89         'conditions': [
90           ['target_arch=="x64"', {
91             'msvs_configuration_platform': 'x64',
92           }],
93           ['OS=="solaris"', {
94             # pull in V8's postmortem metadata
95             'ldflags': [ '-Wl,-z,allextract' ]
96           }],
97           ['OS!="mac" and OS!="win"', {
98             'cflags': [ '-fno-omit-frame-pointer' ],
99           }],
100         ],
101         'msvs_settings': {
102           'VCCLCompilerTool': {
103             'RuntimeLibrary': 0, # static release
104             'Optimization': 3, # /Ox, full optimization
105             'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
106             'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
107             'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
108             'OmitFramePointers': 'true',
109             'EnableFunctionLevelLinking': 'true',
110             'EnableIntrinsicFunctions': 'true',
111             'RuntimeTypeInfo': 'false',
112             'AdditionalOptions': [
113               '/MP', # compile across multiple CPUs
114             ],
115           },
116           'VCLibrarianTool': {
117             'AdditionalOptions': [
118               '/LTCG', # link time code generation
119             ],
120           },
121           'VCLinkerTool': {
122             'LinkTimeCodeGeneration': 1, # link-time code generation
123             'OptimizeReferences': 2, # /OPT:REF
124             'EnableCOMDATFolding': 2, # /OPT:ICF
125             'LinkIncremental': 1, # disable incremental linking
126           },
127         },
128       }
129     },
130     # Forcibly disable -Werror.  We support a wide range of compilers, it's
131     # simply not feasible to squelch all warnings, never mind that the
132     # libraries in deps/ are not under our control.
133     'cflags!': ['-Werror'],
134     'msvs_settings': {
135       'VCCLCompilerTool': {
136         'StringPooling': 'true', # pool string literals
137         'DebugInformationFormat': 3, # Generate a PDB
138         'WarningLevel': 3,
139         'BufferSecurityCheck': 'true',
140         'ExceptionHandling': 0, # /EHsc
141         'SuppressStartupBanner': 'true',
142         'WarnAsError': 'false',
143       },
144       'VCLibrarianTool': {
145       },
146       'VCLinkerTool': {
147         'conditions': [
148           ['target_arch=="ia32"', {
149             'TargetMachine' : 1, # /MACHINE:X86
150             'target_conditions': [
151               ['_type=="executable"', {
152                 'AdditionalOptions': [ '/SubSystem:Console,"5.01"' ],
153               }],
154             ],
155           }],
156           ['target_arch=="x64"', {
157             'TargetMachine' : 17, # /MACHINE:AMD64
158             'target_conditions': [
159               ['_type=="executable"', {
160                 'AdditionalOptions': [ '/SubSystem:Console,"5.02"' ],
161               }],
162             ],
163           }],
164         ],
165         'GenerateDebugInformation': 'true',
166         'GenerateMapFile': 'true', # /MAP
167         'MapExports': 'true', # /MAPINFO:EXPORTS
168         'RandomizedBaseAddress': 2, # enable ASLR
169         'DataExecutionPrevention': 2, # enable DEP
170         'AllowIsolation': 'true',
171         'SuppressStartupBanner': 'true',
172       },
173     },
174     'msvs_disabled_warnings': [4351, 4355, 4800],
175     'conditions': [
176       ['asan != 0', {
177         'cflags+': [
178           '-fno-omit-frame-pointer',
179           '-fsanitize=address',
180           '-w',  # http://crbug.com/162783
181         ],
182         'cflags_cc+': [ '-gline-tables-only' ],
183         'cflags!': [ '-fomit-frame-pointer' ],
184         'ldflags': [ '-fsanitize=address' ],
185       }],
186       ['OS == "win"', {
187         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
188         'defines': [
189           'WIN32',
190           # we don't really want VC++ warning us about
191           # how dangerous C functions are...
192           '_CRT_SECURE_NO_DEPRECATE',
193           # ... or that C implementations shouldn't use
194           # POSIX names
195           '_CRT_NONSTDC_NO_DEPRECATE',
196           # Make sure the STL doesn't try to use exceptions
197           '_HAS_EXCEPTIONS=0',
198           'BUILDING_V8_SHARED=1',
199           'BUILDING_UV_SHARED=1',
200         ],
201       }],
202       [ 'OS in "linux freebsd openbsd solaris"', {
203         'cflags': [ '-pthread', ],
204         'ldflags': [ '-pthread' ],
205       }],
206       [ 'OS in "linux freebsd openbsd solaris android"', {
207         'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
208         'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ],
209         'ldflags': [ '-rdynamic' ],
210         'target_conditions': [
211           ['_type=="static_library"', {
212             'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
213           }],
214         ],
215         'conditions': [
216           [ 'target_arch=="ia32"', {
217             'cflags': [ '-m32' ],
218             'ldflags': [ '-m32' ],
219           }],
220           [ 'target_arch=="x32"', {
221             'cflags': [ '-mx32' ],
222             'ldflags': [ '-mx32' ],
223           }],
224           [ 'target_arch=="x64"', {
225             'cflags': [ '-m64' ],
226             'ldflags': [ '-m64' ],
227           }],
228           [ 'target_arch=="ppc"', {
229             'cflags': [ '-m32' ],
230             'ldflags': [ '-m32' ],
231           }],
232           [ 'target_arch=="ppc64"', {
233             'cflags': [ '-m64', '-mminimal-toc' ],
234             'ldflags': [ '-m64' ],
235            }],
236           [ 'OS=="solaris"', {
237             'cflags': [ '-pthreads' ],
238             'ldflags': [ '-pthreads' ],
239             'cflags!': [ '-pthread' ],
240             'ldflags!': [ '-pthread' ],
241           }],
242         ],
243       }],
244       [ 'OS=="android"', {
245         'defines': ['_GLIBCXX_USE_C99_MATH'],
246         'libraries': [ '-llog' ],
247       }],
248       ['OS=="mac"', {
249         'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
250         'xcode_settings': {
251           'ALWAYS_SEARCH_USER_PATHS': 'NO',
252           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
253           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
254                                                     # (Equivalent to -fPIC)
255           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
256           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
257           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
258           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
259           'PREBINDING': 'NO',                       # No -Wl,-prebind
260           'MACOSX_DEPLOYMENT_TARGET': '10.5',       # -mmacosx-version-min=10.5
261           'USE_HEADERMAP': 'NO',
262           'OTHER_CFLAGS': [
263             '-fno-strict-aliasing',
264           ],
265           'WARNING_CFLAGS': [
266             '-Wall',
267             '-Wendif-labels',
268             '-W',
269             '-Wno-unused-parameter',
270           ],
271         },
272         'target_conditions': [
273           ['_type!="static_library"', {
274             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
275           }],
276         ],
277         'conditions': [
278           ['target_arch=="ia32"', {
279             'xcode_settings': {'ARCHS': ['i386']},
280           }],
281           ['target_arch=="x64"', {
282             'xcode_settings': {'ARCHS': ['x86_64']},
283           }],
284           ['clang==1', {
285             'xcode_settings': {
286               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
287               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',  # -std=gnu++0x
288             },
289           }],
290         ],
291       }],
292       ['OS=="freebsd" and node_use_dtrace=="true"', {
293         'libraries': [ '-lelf' ],
294       }],
295       ['OS=="freebsd"', {
296         'ldflags': [
297           '-Wl,--export-dynamic',
298         ],
299       }]
300     ],
301   }
302 }