2012-01-16 13:29:12 +00:00
|
|
|
# Copyright 2012 the V8 project authors. All rights reserved.
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above
|
|
|
|
# copyright notice, this list of conditions and the following
|
|
|
|
# disclaimer in the documentation and/or other materials provided
|
|
|
|
# with the distribution.
|
|
|
|
# * Neither the name of Google Inc. nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived
|
|
|
|
# from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
# Definitions for building standalone V8 binaries to run on Android.
|
|
|
|
# This is mostly excerpted from:
|
|
|
|
# http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi
|
|
|
|
|
|
|
|
{
|
|
|
|
'variables': {
|
|
|
|
# Location of Android NDK.
|
|
|
|
'variables': {
|
2012-09-03 11:27:09 +00:00
|
|
|
'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
|
|
|
|
'android_toolchain%': '<!(/bin/echo -n $ANDROID_TOOLCHAIN)',
|
2013-03-12 17:35:33 +00:00
|
|
|
# This is set when building the Android WebView inside the Android build
|
|
|
|
# system, using the 'android' gyp backend.
|
|
|
|
'android_webview_build%': 0,
|
2012-01-16 13:29:12 +00:00
|
|
|
},
|
2012-09-03 11:27:09 +00:00
|
|
|
'conditions': [
|
|
|
|
['android_ndk_root==""', {
|
|
|
|
'variables': {
|
|
|
|
'android_sysroot': '<(android_toolchain)/sysroot/',
|
|
|
|
'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/',
|
|
|
|
},
|
|
|
|
'android_include': '<(android_sysroot)/usr/include',
|
|
|
|
'android_lib': '<(android_sysroot)/usr/lib',
|
|
|
|
'android_stlport_include': '<(android_stlport)/stlport',
|
|
|
|
'android_stlport_libs': '<(android_stlport)/libs',
|
|
|
|
}, {
|
|
|
|
'variables': {
|
2014-04-10 21:28:40 +00:00
|
|
|
'android_sysroot': '<(android_ndk_root)/platforms/android-<(android_target_platform)/arch-<(android_target_arch)',
|
2012-09-03 11:27:09 +00:00
|
|
|
'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/',
|
|
|
|
},
|
|
|
|
'android_include': '<(android_sysroot)/usr/include',
|
|
|
|
'android_lib': '<(android_sysroot)/usr/lib',
|
|
|
|
'android_stlport_include': '<(android_stlport)/stlport',
|
|
|
|
'android_stlport_libs': '<(android_stlport)/libs',
|
|
|
|
}],
|
|
|
|
],
|
2012-01-16 13:29:12 +00:00
|
|
|
# Enable to use the system stlport, otherwise statically
|
|
|
|
# link the NDK one?
|
2013-03-12 17:35:33 +00:00
|
|
|
'use_system_stlport%': '<(android_webview_build)',
|
2012-01-16 13:29:12 +00:00
|
|
|
'android_stlport_library': 'stlport_static',
|
|
|
|
# Copy it out one scope.
|
2013-03-12 17:35:33 +00:00
|
|
|
'android_webview_build%': '<(android_webview_build)',
|
2012-01-16 13:29:12 +00:00
|
|
|
}, # variables
|
|
|
|
'target_defaults': {
|
|
|
|
'defines': [
|
|
|
|
'ANDROID',
|
|
|
|
'V8_ANDROID_LOG_STDOUT',
|
|
|
|
],
|
|
|
|
'configurations': {
|
|
|
|
'Release': {
|
|
|
|
'cflags': [
|
|
|
|
'-fomit-frame-pointer',
|
|
|
|
],
|
|
|
|
}, # Release
|
|
|
|
}, # configurations
|
|
|
|
'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter',
|
|
|
|
'-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', ],
|
|
|
|
'target_conditions': [
|
|
|
|
['_toolset=="target"', {
|
|
|
|
'cflags!': [
|
|
|
|
'-pthread', # Not supported by Android toolchain.
|
|
|
|
],
|
|
|
|
'cflags': [
|
|
|
|
'-U__linux__', # Don't allow toolchain to claim -D__linux__
|
|
|
|
'-ffunction-sections',
|
|
|
|
'-funwind-tables',
|
|
|
|
'-fstack-protector',
|
|
|
|
'-fno-short-enums',
|
|
|
|
'-finline-limit=64',
|
|
|
|
'-Wa,--noexecstack',
|
|
|
|
'-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings.
|
|
|
|
# Note: This include is in cflags to ensure that it comes after
|
|
|
|
# all of the includes.
|
2012-09-03 11:27:09 +00:00
|
|
|
'-I<(android_include)',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
'defines': [
|
|
|
|
'ANDROID',
|
|
|
|
#'__GNU_SOURCE=1', # Necessary for clone()
|
|
|
|
'USE_STLPORT=1',
|
|
|
|
'_STLP_USE_PTR_SPECIALIZATIONS=1',
|
|
|
|
'HAVE_OFF64_T',
|
|
|
|
'HAVE_SYS_UIO_H',
|
|
|
|
'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize.
|
|
|
|
],
|
|
|
|
'ldflags!': [
|
|
|
|
'-pthread', # Not supported by Android toolchain.
|
|
|
|
],
|
|
|
|
'ldflags': [
|
|
|
|
'-nostdlib',
|
|
|
|
'-Wl,--no-undefined',
|
|
|
|
],
|
|
|
|
'libraries!': [
|
|
|
|
'-lrt', # librt is built into Bionic.
|
|
|
|
# Not supported by Android toolchain.
|
|
|
|
# Where do these come from? Can't find references in
|
|
|
|
# any Chromium gyp or gypi file. Maybe they come from
|
|
|
|
# gyp itself?
|
|
|
|
'-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', '-lplds4', '-lplc4', '-lnspr4',
|
|
|
|
],
|
|
|
|
'libraries': [
|
|
|
|
'-l<(android_stlport_library)',
|
|
|
|
# Manually link the libgcc.a that the cross compiler uses.
|
|
|
|
'<!($CC -print-libgcc-file-name)',
|
|
|
|
'-lc',
|
|
|
|
'-ldl',
|
|
|
|
'-lstdc++',
|
|
|
|
'-lm',
|
|
|
|
],
|
|
|
|
'conditions': [
|
2013-03-12 17:35:33 +00:00
|
|
|
['android_webview_build==0', {
|
2012-01-16 13:29:12 +00:00
|
|
|
'ldflags': [
|
2012-09-03 11:27:09 +00:00
|
|
|
'-Wl,-rpath-link=<(android_lib)',
|
|
|
|
'-L<(android_lib)',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
2012-07-18 11:43:44 +00:00
|
|
|
['target_arch == "arm"', {
|
|
|
|
'ldflags': [
|
|
|
|
# Enable identical code folding to reduce size.
|
|
|
|
'-Wl,--icf=safe',
|
|
|
|
],
|
|
|
|
}],
|
2013-12-11 11:58:07 +00:00
|
|
|
['target_arch=="arm" and arm_version==7', {
|
2012-07-18 11:43:44 +00:00
|
|
|
'cflags': [
|
|
|
|
'-march=armv7-a',
|
|
|
|
'-mtune=cortex-a8',
|
|
|
|
'-mfpu=vfp3',
|
|
|
|
],
|
|
|
|
}],
|
2012-01-16 13:29:12 +00:00
|
|
|
# NOTE: The stlport header include paths below are specified in
|
|
|
|
# cflags rather than include_dirs because they need to come
|
|
|
|
# after include_dirs. Think of them like system headers, but
|
|
|
|
# don't use '-isystem' because the arm-linux-androideabi-4.4.3
|
|
|
|
# toolchain (circa Gingerbread) will exhibit strange errors.
|
|
|
|
# The include ordering here is important; change with caution.
|
|
|
|
['use_system_stlport==0', {
|
|
|
|
'cflags': [
|
2012-09-03 11:27:09 +00:00
|
|
|
'-I<(android_stlport_include)',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
'conditions': [
|
2013-12-11 11:58:07 +00:00
|
|
|
['target_arch=="arm" and arm_version==7', {
|
2012-01-16 13:29:12 +00:00
|
|
|
'ldflags': [
|
2012-09-03 11:27:09 +00:00
|
|
|
'-L<(android_stlport_libs)/armeabi-v7a',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
2013-12-11 11:58:07 +00:00
|
|
|
['target_arch=="arm" and arm_version < 7', {
|
2012-01-16 13:29:12 +00:00
|
|
|
'ldflags': [
|
2012-09-03 11:27:09 +00:00
|
|
|
'-L<(android_stlport_libs)/armeabi',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
2013-02-25 16:39:03 +00:00
|
|
|
['target_arch=="mipsel"', {
|
|
|
|
'ldflags': [
|
|
|
|
'-L<(android_stlport_libs)/mips',
|
|
|
|
],
|
|
|
|
}],
|
2014-05-23 16:37:27 +00:00
|
|
|
['target_arch=="ia32" or target_arch=="x87"', {
|
2012-01-16 13:29:12 +00:00
|
|
|
'ldflags': [
|
2012-09-03 11:27:09 +00:00
|
|
|
'-L<(android_stlport_libs)/x86',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
2014-03-24 15:56:35 +00:00
|
|
|
['target_arch=="x64"', {
|
|
|
|
'ldflags': [
|
|
|
|
'-L<(android_stlport_libs)/x86_64',
|
|
|
|
],
|
|
|
|
}],
|
2014-03-21 09:28:26 +00:00
|
|
|
['target_arch=="arm64"', {
|
2014-02-12 09:19:30 +00:00
|
|
|
'ldflags': [
|
2014-03-24 13:00:01 +00:00
|
|
|
'-L<(android_stlport_libs)/arm64-v8a',
|
2014-02-12 09:19:30 +00:00
|
|
|
],
|
|
|
|
}],
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
2014-05-23 16:37:27 +00:00
|
|
|
['target_arch=="ia32" or target_arch=="x87"', {
|
2012-01-16 13:29:12 +00:00
|
|
|
# The x86 toolchain currently has problems with stack-protector.
|
|
|
|
'cflags!': [
|
|
|
|
'-fstack-protector',
|
|
|
|
],
|
|
|
|
'cflags': [
|
|
|
|
'-fno-stack-protector',
|
|
|
|
],
|
|
|
|
}],
|
2013-02-25 16:39:03 +00:00
|
|
|
['target_arch=="mipsel"', {
|
|
|
|
# The mips toolchain currently has problems with stack-protector.
|
|
|
|
'cflags!': [
|
|
|
|
'-fstack-protector',
|
|
|
|
'-U__linux__'
|
|
|
|
],
|
|
|
|
'cflags': [
|
|
|
|
'-fno-stack-protector',
|
|
|
|
],
|
|
|
|
}],
|
2014-05-14 14:11:54 +00:00
|
|
|
['target_arch=="arm64" or target_arch=="x64"', {
|
|
|
|
# TODO(ulan): Enable PIE for other architectures (crbug.com/373219).
|
|
|
|
'cflags': [
|
|
|
|
'-fPIE',
|
|
|
|
],
|
|
|
|
'ldflags': [
|
|
|
|
'-pie',
|
|
|
|
],
|
|
|
|
}],
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
'target_conditions': [
|
|
|
|
['_type=="executable"', {
|
2014-02-12 09:19:30 +00:00
|
|
|
'conditions': [
|
2014-03-21 09:28:26 +00:00
|
|
|
['target_arch=="arm64"', {
|
2014-02-12 09:19:30 +00:00
|
|
|
'ldflags': [
|
|
|
|
'-Wl,-dynamic-linker,/system/bin/linker64',
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
'ldflags': [
|
|
|
|
'-Wl,-dynamic-linker,/system/bin/linker',
|
|
|
|
],
|
|
|
|
}]
|
|
|
|
],
|
2012-01-16 13:29:12 +00:00
|
|
|
'ldflags': [
|
|
|
|
'-Bdynamic',
|
|
|
|
'-Wl,-z,nocopyreloc',
|
|
|
|
# crtbegin_dynamic.o should be the last item in ldflags.
|
2012-09-03 11:27:09 +00:00
|
|
|
'<(android_lib)/crtbegin_dynamic.o',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
'libraries': [
|
|
|
|
# crtend_android.o needs to be the last item in libraries.
|
|
|
|
# Do not add any libraries after this!
|
2012-09-03 11:27:09 +00:00
|
|
|
'<(android_lib)/crtend_android.o',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
|
|
|
['_type=="shared_library"', {
|
|
|
|
'ldflags': [
|
|
|
|
'-Wl,-shared,-Bsymbolic',
|
2012-10-24 12:11:15 +00:00
|
|
|
'<(android_lib)/crtbegin_so.o',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
['_type=="static_library"', {
|
|
|
|
'ldflags': [
|
|
|
|
# Don't export symbols from statically linked libraries.
|
|
|
|
'-Wl,--exclude-libs=ALL',
|
2012-01-16 13:29:12 +00:00
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}], # _toolset=="target"
|
|
|
|
# Settings for building host targets using the system toolchain.
|
|
|
|
['_toolset=="host"', {
|
2014-07-17 09:56:58 +00:00
|
|
|
'cflags': [ '-pthread' ],
|
|
|
|
'ldflags': [ '-pthread' ],
|
2012-01-16 13:29:12 +00:00
|
|
|
'ldflags!': [
|
|
|
|
'-Wl,-z,noexecstack',
|
|
|
|
'-Wl,--gc-sections',
|
|
|
|
'-Wl,-O1',
|
|
|
|
'-Wl,--as-needed',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
], # target_conditions
|
|
|
|
}, # target_defaults
|
2012-09-03 11:27:09 +00:00
|
|
|
}
|