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