test: add test-npm-install to parallel tests suite
[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           ['OS=="aix"', {
68             'cflags': [ '-gxcoff' ],
69             'ldflags': [ '-Wl,-bbigtoc' ],
70           }],
71         ],
72         'msvs_settings': {
73           'VCCLCompilerTool': {
74             'RuntimeLibrary': 1, # static debug
75             'Optimization': 0, # /Od, no optimization
76             'MinimalRebuild': 'false',
77             'OmitFramePointers': 'false',
78             'BasicRuntimeChecks': 3, # /RTC1
79           },
80           'VCLinkerTool': {
81             'LinkIncremental': 2, # enable incremental linking
82           },
83         },
84         'xcode_settings': {
85           'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
86         },
87       },
88       'Release': {
89         'variables': {
90           'v8_enable_handle_zapping': 0,
91         },
92         'cflags': [ '-O3', '-ffunction-sections', '-fdata-sections' ],
93         'conditions': [
94           ['target_arch=="x64"', {
95             'msvs_configuration_platform': 'x64',
96           }],
97           ['OS=="solaris"', {
98             # pull in V8's postmortem metadata
99             'ldflags': [ '-Wl,-z,allextract' ]
100           }],
101           ['OS!="mac" and OS!="win"', {
102             'cflags': [ '-fno-omit-frame-pointer' ],
103           }],
104         ],
105         'msvs_settings': {
106           'VCCLCompilerTool': {
107             'RuntimeLibrary': 0, # static release
108             'Optimization': 3, # /Ox, full optimization
109             'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
110             'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
111             'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
112             'OmitFramePointers': 'true',
113             'EnableFunctionLevelLinking': 'true',
114             'EnableIntrinsicFunctions': 'true',
115             'RuntimeTypeInfo': 'false',
116             'AdditionalOptions': [
117               '/MP', # compile across multiple CPUs
118             ],
119           },
120           'VCLibrarianTool': {
121             'AdditionalOptions': [
122               '/LTCG', # link time code generation
123             ],
124           },
125           'VCLinkerTool': {
126             'LinkTimeCodeGeneration': 1, # link-time code generation
127             'OptimizeReferences': 2, # /OPT:REF
128             'EnableCOMDATFolding': 2, # /OPT:ICF
129             'LinkIncremental': 1, # disable incremental linking
130           },
131         },
132       }
133     },
134     # Forcibly disable -Werror.  We support a wide range of compilers, it's
135     # simply not feasible to squelch all warnings, never mind that the
136     # libraries in deps/ are not under our control.
137     'cflags!': ['-Werror'],
138     'msvs_settings': {
139       'VCCLCompilerTool': {
140         'StringPooling': 'true', # pool string literals
141         'DebugInformationFormat': 3, # Generate a PDB
142         'WarningLevel': 3,
143         'BufferSecurityCheck': 'true',
144         'ExceptionHandling': 0, # /EHsc
145         'SuppressStartupBanner': 'true',
146         'WarnAsError': 'false',
147       },
148       'VCLibrarianTool': {
149       },
150       'VCLinkerTool': {
151         'conditions': [
152           ['target_arch=="ia32"', {
153             'TargetMachine' : 1, # /MACHINE:X86
154             'target_conditions': [
155               ['_type=="executable"', {
156                 'AdditionalOptions': [ '/SubSystem:Console,"5.01"' ],
157               }],
158             ],
159           }],
160           ['target_arch=="x64"', {
161             'TargetMachine' : 17, # /MACHINE:AMD64
162             'target_conditions': [
163               ['_type=="executable"', {
164                 'AdditionalOptions': [ '/SubSystem:Console,"5.02"' ],
165               }],
166             ],
167           }],
168         ],
169         'GenerateDebugInformation': 'true',
170         'GenerateMapFile': 'true', # /MAP
171         'MapExports': 'true', # /MAPINFO:EXPORTS
172         'RandomizedBaseAddress': 2, # enable ASLR
173         'DataExecutionPrevention': 2, # enable DEP
174         'AllowIsolation': 'true',
175         'SuppressStartupBanner': 'true',
176       },
177     },
178     'msvs_disabled_warnings': [4351, 4355, 4800],
179     'conditions': [
180       ['asan == 1 and OS != "mac"', {
181         'cflags+': [
182           '-fno-omit-frame-pointer',
183           '-fsanitize=address',
184           '-DLEAK_SANITIZER'
185         ],
186         'cflags!': [ '-fomit-frame-pointer' ],
187         'ldflags': [ '-fsanitize=address' ],
188       }],
189       ['asan == 1 and OS == "mac"', {
190         'xcode_settings': {
191           'OTHER_CFLAGS+': [
192             '-fno-omit-frame-pointer',
193             '-gline-tables-only',
194             '-fsanitize=address',
195             '-DLEAK_SANITIZER'
196           ],
197           'OTHER_CFLAGS!': [
198             '-fomit-frame-pointer',
199           ],
200         },
201         'target_conditions': [
202           ['_type!="static_library"', {
203             'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
204           }],
205         ],
206       }],
207       ['OS == "win"', {
208         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
209         'defines': [
210           'WIN32',
211           # we don't really want VC++ warning us about
212           # how dangerous C functions are...
213           '_CRT_SECURE_NO_DEPRECATE',
214           # ... or that C implementations shouldn't use
215           # POSIX names
216           '_CRT_NONSTDC_NO_DEPRECATE',
217           # Make sure the STL doesn't try to use exceptions
218           '_HAS_EXCEPTIONS=0',
219           'BUILDING_V8_SHARED=1',
220           'BUILDING_UV_SHARED=1',
221         ],
222       }],
223       [ 'OS in "linux freebsd openbsd solaris aix"', {
224         'cflags': [ '-pthread', ],
225         'ldflags': [ '-pthread' ],
226       }],
227       [ 'OS in "linux freebsd openbsd solaris android aix"', {
228         'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
229         'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ],
230         'ldflags': [ '-rdynamic' ],
231         'target_conditions': [
232           ['_type=="static_library"', {
233             'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
234           }],
235         ],
236         'conditions': [
237           [ 'target_arch=="ia32"', {
238             'cflags': [ '-m32' ],
239             'ldflags': [ '-m32' ],
240           }],
241           [ 'target_arch=="x32"', {
242             'cflags': [ '-mx32' ],
243             'ldflags': [ '-mx32' ],
244           }],
245           [ 'target_arch=="x64"', {
246             'cflags': [ '-m64' ],
247             'ldflags': [ '-m64' ],
248           }],
249           [ 'target_arch=="ppc" and OS!="aix"', {
250             'cflags': [ '-m32' ],
251             'ldflags': [ '-m32' ],
252           }],
253           [ 'target_arch=="ppc64" and OS!="aix"', {
254             'cflags': [ '-m64', '-mminimal-toc' ],
255             'ldflags': [ '-m64' ],
256            }],
257           [ 'OS=="solaris"', {
258             'cflags': [ '-pthreads' ],
259             'ldflags': [ '-pthreads' ],
260             'cflags!': [ '-pthread' ],
261             'ldflags!': [ '-pthread' ],
262           }],
263           [ 'OS=="aix"', {
264             'conditions': [
265               [ 'target_arch=="ppc"', {
266                 'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
267               }],
268               [ 'target_arch=="ppc64"', {
269                 'cflags': [ '-maix64' ],
270                 'ldflags': [ '-maix64' ],
271               }],
272             ],
273             'ldflags!': [ '-rdynamic' ],
274           }],
275         ],
276       }],
277       [ 'OS=="android"', {
278         'defines': ['_GLIBCXX_USE_C99_MATH'],
279         'libraries': [ '-llog' ],
280       }],
281       ['OS=="mac"', {
282         'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
283         'xcode_settings': {
284           'ALWAYS_SEARCH_USER_PATHS': 'NO',
285           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
286           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
287                                                     # (Equivalent to -fPIC)
288           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
289           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
290           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
291           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
292           'PREBINDING': 'NO',                       # No -Wl,-prebind
293           'MACOSX_DEPLOYMENT_TARGET': '10.5',       # -mmacosx-version-min=10.5
294           'USE_HEADERMAP': 'NO',
295           'OTHER_CFLAGS': [
296             '-fno-strict-aliasing',
297           ],
298           'WARNING_CFLAGS': [
299             '-Wall',
300             '-Wendif-labels',
301             '-W',
302             '-Wno-unused-parameter',
303           ],
304         },
305         'target_conditions': [
306           ['_type!="static_library"', {
307             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
308           }],
309         ],
310         'conditions': [
311           ['target_arch=="ia32"', {
312             'xcode_settings': {'ARCHS': ['i386']},
313           }],
314           ['target_arch=="x64"', {
315             'xcode_settings': {'ARCHS': ['x86_64']},
316           }],
317           ['clang==1', {
318             'xcode_settings': {
319               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
320               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',  # -std=gnu++0x
321             },
322           }],
323         ],
324       }],
325       ['OS=="freebsd" and node_use_dtrace=="true"', {
326         'libraries': [ '-lelf' ],
327       }],
328       ['OS=="freebsd"', {
329         'ldflags': [
330           '-Wl,--export-dynamic',
331         ],
332       }]
333     ],
334   }
335 }