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