src: enable v8 deprecation warnings and fix them
[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 == 1 and OS != "mac"', {
177         'cflags+': [
178           '-fno-omit-frame-pointer',
179           '-fsanitize=address',
180           '-DLEAK_SANITIZER'
181         ],
182         'cflags_cc+': [ '-gline-tables-only' ],
183         'cflags!': [ '-fomit-frame-pointer' ],
184         'ldflags': [ '-fsanitize=address' ],
185       }],
186       ['asan == 1 and OS == "mac"', {
187         'xcode_settings': {
188           'OTHER_CFLAGS+': [
189             '-fno-omit-frame-pointer',
190             '-gline-tables-only',
191             '-fsanitize=address',
192             '-DLEAK_SANITIZER'
193           ],
194           'OTHER_CFLAGS!': [
195             '-fomit-frame-pointer',
196           ],
197         },
198         'target_conditions': [
199           ['_type!="static_library"', {
200             'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
201           }],
202         ],
203       }],
204       ['OS == "win"', {
205         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
206         'defines': [
207           'WIN32',
208           # we don't really want VC++ warning us about
209           # how dangerous C functions are...
210           '_CRT_SECURE_NO_DEPRECATE',
211           # ... or that C implementations shouldn't use
212           # POSIX names
213           '_CRT_NONSTDC_NO_DEPRECATE',
214           # Make sure the STL doesn't try to use exceptions
215           '_HAS_EXCEPTIONS=0',
216           'BUILDING_V8_SHARED=1',
217           'BUILDING_UV_SHARED=1',
218         ],
219       }],
220       [ 'OS in "linux freebsd openbsd solaris"', {
221         'cflags': [ '-pthread', ],
222         'ldflags': [ '-pthread' ],
223       }],
224       [ 'OS in "linux freebsd openbsd solaris android"', {
225         'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
226         'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ],
227         'ldflags': [ '-rdynamic' ],
228         'target_conditions': [
229           ['_type=="static_library"', {
230             'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
231           }],
232         ],
233         'conditions': [
234           [ 'target_arch=="ia32"', {
235             'cflags': [ '-m32' ],
236             'ldflags': [ '-m32' ],
237           }],
238           [ 'target_arch=="x32"', {
239             'cflags': [ '-mx32' ],
240             'ldflags': [ '-mx32' ],
241           }],
242           [ 'target_arch=="x64"', {
243             'cflags': [ '-m64' ],
244             'ldflags': [ '-m64' ],
245           }],
246           [ 'target_arch=="ppc"', {
247             'cflags': [ '-m32' ],
248             'ldflags': [ '-m32' ],
249           }],
250           [ 'target_arch=="ppc64"', {
251             'cflags': [ '-m64', '-mminimal-toc' ],
252             'ldflags': [ '-m64' ],
253            }],
254           [ 'OS=="solaris"', {
255             'cflags': [ '-pthreads' ],
256             'ldflags': [ '-pthreads' ],
257             'cflags!': [ '-pthread' ],
258             'ldflags!': [ '-pthread' ],
259           }],
260         ],
261       }],
262       [ 'OS=="android"', {
263         'defines': ['_GLIBCXX_USE_C99_MATH'],
264         'libraries': [ '-llog' ],
265       }],
266       ['OS=="mac"', {
267         'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
268         'xcode_settings': {
269           'ALWAYS_SEARCH_USER_PATHS': 'NO',
270           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
271           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
272                                                     # (Equivalent to -fPIC)
273           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
274           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
275           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
276           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
277           'PREBINDING': 'NO',                       # No -Wl,-prebind
278           'MACOSX_DEPLOYMENT_TARGET': '10.5',       # -mmacosx-version-min=10.5
279           'USE_HEADERMAP': 'NO',
280           'OTHER_CFLAGS': [
281             '-fno-strict-aliasing',
282           ],
283           'WARNING_CFLAGS': [
284             '-Wall',
285             '-Wendif-labels',
286             '-W',
287             '-Wno-unused-parameter',
288           ],
289         },
290         'target_conditions': [
291           ['_type!="static_library"', {
292             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
293           }],
294         ],
295         'conditions': [
296           ['target_arch=="ia32"', {
297             'xcode_settings': {'ARCHS': ['i386']},
298           }],
299           ['target_arch=="x64"', {
300             'xcode_settings': {'ARCHS': ['x86_64']},
301           }],
302           ['clang==1', {
303             'xcode_settings': {
304               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
305               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',  # -std=gnu++0x
306             },
307           }],
308         ],
309       }],
310       ['OS=="freebsd" and node_use_dtrace=="true"', {
311         'libraries': [ '-lelf' ],
312       }],
313       ['OS=="freebsd"', {
314         'ldflags': [
315           '-Wl,--export-dynamic',
316         ],
317       }]
318     ],
319   }
320 }