deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / build / android.gypi
1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are
4 # met:
5 #
6 #     * Redistributions of source code must retain the above copyright
7 #       notice, this list of conditions and the following disclaimer.
8 #     * Redistributions in binary form must reproduce the above
9 #       copyright notice, this list of conditions and the following
10 #       disclaimer in the documentation and/or other materials provided
11 #       with the distribution.
12 #     * Neither the name of Google Inc. nor the names of its
13 #       contributors may be used to endorse or promote products derived
14 #       from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 # Definitions for building standalone V8 binaries to run on Android.
29 # This is mostly excerpted from:
30 # http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi
31
32 {
33   'variables': {
34     # Location of Android NDK.
35     'variables': {
36       'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
37       'android_toolchain%': '<!(/bin/echo -n $ANDROID_TOOLCHAIN)',
38     },
39     'conditions': [
40       ['android_ndk_root==""', {
41         'variables': {
42           'android_sysroot': '<(android_toolchain)/sysroot/',
43           'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/',
44         },
45         'android_include': '<(android_sysroot)/usr/include',
46         'conditions': [
47           ['target_arch=="x64"', {
48             'android_lib': '<(android_sysroot)/usr/lib64',
49           }, {
50             'android_lib': '<(android_sysroot)/usr/lib',
51           }],
52         ],
53         'android_stlport_include': '<(android_stlport)/stlport',
54         'android_stlport_libs': '<(android_stlport)/libs',
55       }, {
56         'variables': {
57           'android_sysroot': '<(android_ndk_root)/platforms/android-<(android_target_platform)/arch-<(android_target_arch)',
58           'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/',
59         },
60         'android_include': '<(android_sysroot)/usr/include',
61         'conditions': [
62           ['target_arch=="x64"', {
63             'android_lib': '<(android_sysroot)/usr/lib64',
64           }, {
65             'android_lib': '<(android_sysroot)/usr/lib',
66           }],
67         ],
68         'android_stlport_include': '<(android_stlport)/stlport',
69         'android_stlport_libs': '<(android_stlport)/libs',
70       }],
71     ],
72     # Enable to use the system stlport, otherwise statically
73     # link the NDK one?
74     'use_system_stlport%': '<(android_webview_build)',
75     'android_stlport_library': 'stlport_static',
76   },  # variables
77   'target_defaults': {
78     'defines': [
79       'ANDROID',
80       'V8_ANDROID_LOG_STDOUT',
81     ],
82     'configurations': {
83       'Release': {
84         'cflags': [
85           '-fomit-frame-pointer',
86         ],
87       },  # Release
88     },  # configurations
89     'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter'],
90     'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions',
91                    # Note: Using -std=c++0x will define __STRICT_ANSI__, which
92                    # in turn will leave out some template stuff for 'long
93                    # long'.  What we want is -std=c++11, but this is not
94                    # supported by GCC 4.6 or Xcode 4.2
95                    '-std=gnu++0x' ],
96     'target_conditions': [
97       ['_toolset=="target"', {
98         'cflags!': [
99           '-pthread',  # Not supported by Android toolchain.
100         ],
101         'cflags': [
102           '-ffunction-sections',
103           '-funwind-tables',
104           '-fstack-protector',
105           '-fno-short-enums',
106           '-finline-limit=64',
107           '-Wa,--noexecstack',
108           # Note: This include is in cflags to ensure that it comes after
109           # all of the includes.
110           '-I<(android_include)',
111         ],
112         'cflags_cc': [
113           '-Wno-error=non-virtual-dtor',  # TODO(michaelbai): Fix warnings.
114         ],
115         'defines': [
116           'ANDROID',
117           #'__GNU_SOURCE=1',  # Necessary for clone()
118           'USE_STLPORT=1',
119           '_STLP_USE_PTR_SPECIALIZATIONS=1',
120           'HAVE_OFF64_T',
121           'HAVE_SYS_UIO_H',
122           'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize.
123         ],
124         'ldflags!': [
125           '-pthread',  # Not supported by Android toolchain.
126         ],
127         'ldflags': [
128           '-nostdlib',
129           '-Wl,--no-undefined',
130         ],
131         'libraries!': [
132             '-lrt',  # librt is built into Bionic.
133             # Not supported by Android toolchain.
134             # Where do these come from?  Can't find references in
135             # any Chromium gyp or gypi file.  Maybe they come from
136             # gyp itself?
137             '-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', '-lplds4', '-lplc4', '-lnspr4',
138           ],
139           'libraries': [
140             '-l<(android_stlport_library)',
141             # Manually link the libgcc.a that the cross compiler uses.
142             '<!($CC -print-libgcc-file-name)',
143             '-lc',
144             '-ldl',
145             '-lstdc++',
146             '-lm',
147         ],
148         'conditions': [
149           ['android_webview_build==0', {
150             'ldflags': [
151               '-Wl,-rpath-link=<(android_lib)',
152               '-L<(android_lib)',
153             ],
154           }],
155           ['target_arch == "arm"', {
156             'ldflags': [
157               # Enable identical code folding to reduce size.
158               '-Wl,--icf=safe',
159             ],
160           }],
161           ['target_arch=="arm" and arm_version==7', {
162             'cflags': [
163               '-march=armv7-a',
164               '-mtune=cortex-a8',
165               '-mfpu=vfp3',
166             ],
167           }],
168           # NOTE: The stlport header include paths below are specified in
169           # cflags rather than include_dirs because they need to come
170           # after include_dirs. Think of them like system headers, but
171           # don't use '-isystem' because the arm-linux-androideabi-4.4.3
172           # toolchain (circa Gingerbread) will exhibit strange errors.
173           # The include ordering here is important; change with caution.
174           ['use_system_stlport==0', {
175             'cflags': [
176               '-I<(android_stlport_include)',
177             ],
178             'conditions': [
179               ['target_arch=="arm" and arm_version==7', {
180                 'ldflags': [
181                   '-L<(android_stlport_libs)/armeabi-v7a',
182                 ],
183               }],
184               ['target_arch=="arm" and arm_version < 7', {
185                 'ldflags': [
186                   '-L<(android_stlport_libs)/armeabi',
187                 ],
188               }],
189               ['target_arch=="mipsel"', {
190                 'ldflags': [
191                   '-L<(android_stlport_libs)/mips',
192                 ],
193               }],
194               ['target_arch=="ia32" or target_arch=="x87"', {
195                 'ldflags': [
196                   '-L<(android_stlport_libs)/x86',
197                 ],
198               }],
199               ['target_arch=="x64"', {
200                 'ldflags': [
201                   '-L<(android_stlport_libs)/x86_64',
202                 ],
203               }],
204               ['target_arch=="arm64"', {
205                 'ldflags': [
206                   '-L<(android_stlport_libs)/arm64-v8a',
207                 ],
208               }],
209             ],
210           }],
211           ['target_arch=="ia32" or target_arch=="x87"', {
212             # The x86 toolchain currently has problems with stack-protector.
213             'cflags!': [
214               '-fstack-protector',
215             ],
216             'cflags': [
217               '-fno-stack-protector',
218             ],
219           }],
220           ['target_arch=="mipsel"', {
221             # The mips toolchain currently has problems with stack-protector.
222             'cflags!': [
223               '-fstack-protector',
224               '-U__linux__'
225             ],
226             'cflags': [
227               '-fno-stack-protector',
228             ],
229           }],
230           ['(target_arch=="arm" or target_arch=="arm64" or target_arch=="x64") and component!="shared_library"', {
231             'cflags': [
232               '-fPIE',
233             ],
234             'ldflags': [
235               '-pie',
236             ],
237           }],
238         ],
239         'target_conditions': [
240           ['_type=="executable"', {
241             'conditions': [
242               ['target_arch=="arm64" or target_arch=="x64"', {
243                 'ldflags': [
244                   '-Wl,-dynamic-linker,/system/bin/linker64',
245                 ],
246               }, {
247                 'ldflags': [
248                   '-Wl,-dynamic-linker,/system/bin/linker',
249                 ],
250               }]
251             ],
252             'ldflags': [
253               '-Bdynamic',
254               '-Wl,-z,nocopyreloc',
255               # crtbegin_dynamic.o should be the last item in ldflags.
256               '<(android_lib)/crtbegin_dynamic.o',
257             ],
258             'libraries': [
259               # crtend_android.o needs to be the last item in libraries.
260               # Do not add any libraries after this!
261               '<(android_lib)/crtend_android.o',
262             ],
263           }],
264           ['_type=="shared_library"', {
265             'ldflags': [
266               '-Wl,-shared,-Bsymbolic',
267               '<(android_lib)/crtbegin_so.o',
268             ],
269           }],
270           ['_type=="static_library"', {
271             'ldflags': [
272               # Don't export symbols from statically linked libraries.
273               '-Wl,--exclude-libs=ALL',
274             ],
275           }],
276         ],
277       }],  # _toolset=="target"
278       # Settings for building host targets using the system toolchain.
279       ['_toolset=="host"', {
280         'cflags': [ '-pthread' ],
281         'ldflags': [ '-pthread' ],
282         'ldflags!': [
283           '-Wl,-z,noexecstack',
284           '-Wl,--gc-sections',
285           '-Wl,-O1',
286           '-Wl,--as-needed',
287         ],
288       }],
289     ],  # target_conditions
290   },  # target_defaults
291 }