Merge remote-tracking branch 'ry/v0.8' into v0.8-merge
[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
11     # Enable V8's post-mortem debugging only on unix flavors.
12     'conditions': [
13       ['OS != "win"', {
14         'v8_postmortem_support': 'true'
15       }]
16     ],
17   },
18
19   'target_defaults': {
20     'default_configuration': 'Release',
21     'configurations': {
22       'Debug': {
23         'defines': [ 'DEBUG', '_DEBUG' ],
24         'cflags': [ '-g', '-O0' ],
25         'conditions': [
26           ['target_arch=="x64"', {
27             'msvs_configuration_platform': 'x64',
28           }],
29         ],
30         'msvs_settings': {
31           'VCCLCompilerTool': {
32             'RuntimeLibrary': 1, # static debug
33             'Optimization': 0, # /Od, no optimization
34             'MinimalRebuild': 'false',
35             'OmitFramePointers': 'false',
36             'BasicRuntimeChecks': 3, # /RTC1
37           },
38           'VCLinkerTool': {
39             'LinkIncremental': 2, # enable incremental linking
40           },
41         },
42       },
43       'Release': {
44         # Do *NOT* enable -ffunction-sections or -fdata-sections again.
45         # We don't link with -Wl,--gc-sections so they're effectively no-ops.
46         # Worse, they trigger very nasty bugs in some versions of gcc, notably
47         # v4.4.6 on x86_64-redhat-linux (i.e. RHEL and CentOS).
48         'cflags!': [ '-ffunction-sections', '-fdata-sections' ],
49         'cflags': [ '-O3' ],
50         'conditions': [
51           ['target_arch=="x64"', {
52             'msvs_configuration_platform': 'x64',
53           }],
54           ['OS=="solaris"', {
55             'cflags': [ '-fno-omit-frame-pointer' ],
56             # pull in V8's postmortem metadata
57             'ldflags': [ '-Wl,-z,allextract' ]
58           }],
59         ],
60         'msvs_settings': {
61           'VCCLCompilerTool': {
62             'RuntimeLibrary': 0, # static release
63             'Optimization': 3, # /Ox, full optimization
64             'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
65             'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
66             'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
67             'OmitFramePointers': 'true',
68             'EnableFunctionLevelLinking': 'true',
69             'EnableIntrinsicFunctions': 'true',
70             'RuntimeTypeInfo': 'false',
71             'ExceptionHandling': '0',
72             'AdditionalOptions': [
73               '/MP', # compile across multiple CPUs
74             ],
75           },
76           'VCLibrarianTool': {
77             'AdditionalOptions': [
78               '/LTCG', # link time code generation
79             ],
80           },
81           'VCLinkerTool': {
82             'LinkTimeCodeGeneration': 1, # link-time code generation
83             'OptimizeReferences': 2, # /OPT:REF
84             'EnableCOMDATFolding': 2, # /OPT:ICF
85             'LinkIncremental': 1, # disable incremental linking
86           },
87         },
88       }
89     },
90     'msvs_settings': {
91       'VCCLCompilerTool': {
92         'StringPooling': 'true', # pool string literals
93         'DebugInformationFormat': 3, # Generate a PDB
94         'WarningLevel': 3,
95         'BufferSecurityCheck': 'true',
96         'ExceptionHandling': 1, # /EHsc
97         'SuppressStartupBanner': 'true',
98         'WarnAsError': 'false',
99       },
100       'VCLibrarianTool': {
101       },
102       'VCLinkerTool': {
103         'conditions': [
104           ['target_arch=="x64"', {
105             'TargetMachine' : 17 # /MACHINE:X64
106           }],
107         ],
108         'GenerateDebugInformation': 'true',
109         'RandomizedBaseAddress': 2, # enable ASLR
110         'DataExecutionPrevention': 2, # enable DEP
111         'AllowIsolation': 'true',
112         'SuppressStartupBanner': 'true',
113         'target_conditions': [
114           ['_type=="executable"', {
115             'SubSystem': 1, # console executable
116           }],
117         ],
118       },
119     },
120     'conditions': [
121       ['OS == "win"', {
122         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
123         'defines': [
124           'WIN32',
125           # we don't really want VC++ warning us about
126           # how dangerous C functions are...
127           '_CRT_SECURE_NO_DEPRECATE',
128           # ... or that C implementations shouldn't use
129           # POSIX names
130           '_CRT_NONSTDC_NO_DEPRECATE',
131           'BUILDING_V8_SHARED=1',
132           'BUILDING_UV_SHARED=1',
133         ],
134       }, {
135         'defines': [
136           '_LARGEFILE_SOURCE',
137           '_FILE_OFFSET_BITS=64',
138         ],
139       }],
140       [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
141         'cflags': [ '-Wall', '-pthread', ],
142         'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
143         'ldflags': [ '-pthread', ],
144         'conditions': [
145           [ 'target_arch=="ia32"', {
146             'cflags': [ '-m32' ],
147             'ldflags': [ '-m32' ],
148           }],
149           [ 'target_arch=="x64"', {
150             'cflags': [ '-m64' ],
151             'ldflags': [ '-m64' ],
152           }],
153           [ 'OS=="linux"', {
154             'ldflags': [ '-rdynamic' ],
155           }],
156           [ 'OS=="solaris"', {
157             'cflags': [ '-pthreads' ],
158             'ldflags': [ '-pthreads' ],
159             'cflags!': [ '-pthread' ],
160             'ldflags!': [ '-pthread' ],
161           }],
162         ],
163       }],
164       ['OS=="mac"', {
165         'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
166         'xcode_settings': {
167           'ALWAYS_SEARCH_USER_PATHS': 'NO',
168           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
169           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
170                                                     # (Equivalent to -fPIC)
171           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
172           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
173           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
174           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
175           'GCC_VERSION': '4.2',
176           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
177           'PREBINDING': 'NO',                       # No -Wl,-prebind
178           'MACOSX_DEPLOYMENT_TARGET': '10.5',       # -mmacosx-version-min=10.5
179           'USE_HEADERMAP': 'NO',
180           'OTHER_CFLAGS': [
181             '-fno-strict-aliasing',
182           ],
183           'WARNING_CFLAGS': [
184             '-Wall',
185             '-Wendif-labels',
186             '-W',
187             '-Wno-unused-parameter',
188           ],
189         },
190         'target_conditions': [
191           ['_type!="static_library"', {
192             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
193           }],
194         ],
195         'conditions': [
196           ['target_arch=="ia32"', {
197             'xcode_settings': {'ARCHS': ['i386']},
198           }],
199           ['target_arch=="x64"', {
200             'xcode_settings': {'ARCHS': ['x86_64']},
201           }],
202         ],
203       }],
204     ],
205   }
206 }