Commit 3bc122f4 authored by torne's avatar torne Committed by Commit bot

android_webview: Build against NDK prebuilts, not system libraries.

To allow the chromium WebView to build unbundled, we need to stop
linking to system libraries and instead link to the prebuilt libraries
in the NDK.

This change rolls gyp to include the required makefile generation
changes, and adjusts the chromium side to match:

1) Stop setting use_system_stlport and instead use the NDK stlport by
   specifying LOCAL_NDK_STL_VARIANT := stlport_static

2) Remove support for the use_system_stlport flag entirely as WebView
   was the only user.

3) Don't try to link standard libraries like -lc -lm as the NDK does
   this automatically.

4) Don't include the OpenAL headers from frameworks/wilhelm; these are
   already part of the NDK with no special include path needed.

BUG=409851

Review URL: https://codereview.chromium.org/571953002

Cr-Commit-Position: refs/heads/master@{#300212}
parent 2b0dec7a
......@@ -169,7 +169,7 @@ deps = {
Var('chromium_git') + '/external/grit-i18n.git' + '@' + '740badd5e3e44434a9a47b5d16749daac1e8ea80', # from svn revision 176
'src/tools/gyp':
Var('chromium_git') + '/external/gyp.git' + '@' + '9e65902d36018e0ad70901e8f2348ce1d11d4032', # from svn revision 1989
Var('chromium_git') + '/external/gyp.git' + '@' + '9202573e476f9f61341aec21b585cdc984141916', # from svn revision 1990
'src/tools/swarming_client':
Var('chromium_git') + '/external/swarming.client.git' + '@' + Var('swarming_revision'),
......
......@@ -49,16 +49,6 @@
'-Wl,--fatal-warnings',
],
}],
['android_webview_build==1 and use_system_stlport==1', {
# ICU requires RTTI, which is not present in the system's stlport, so
# we have to include gabi++. We can't include it in icu.gyp because
# link_settings cannot be used inside target_conditions. This will be
# removed once we stop using the system stlport.
# http://crbug.com/409851
'libraries': [
'-lgabi++',
],
}],
],
'sources': [
'lib/main/webview_entry_point.cc',
......
......@@ -1760,9 +1760,9 @@
# Uses system APIs for decoding audio and video.
'use_libffmpeg%': '0',
# When building as part of the Android system, use system libraries
# where possible to reduce ROM size.
'use_system_stlport%': '<(android_webview_build)',
# TODO(torne): Remove this unsupported option once all the places that
# test it have been updated.
'use_system_stlport%': 0,
# Copy it out one scope.
'android_webview_build%': '<(android_webview_build)',
......@@ -4339,19 +4339,12 @@
# build of chrome (e.g. where to find archived symbols).
'chrome_build_id%': '',
'conditions': [
# Use shared stlport library when system one used.
# Figure this out early since it needs symbols from libgcc.a, so it
# has to be before that in the set of libraries.
['use_system_stlport==1', {
'android_stlport_library': 'stlport',
['component=="shared_library"', {
'android_stlport_library': 'stlport_shared',
}, {
'conditions': [
['component=="shared_library"', {
'android_stlport_library': 'stlport_shared',
}, {
'android_stlport_library': 'stlport_static',
}],
],
'android_stlport_library': 'stlport_static',
}],
],
......@@ -4443,17 +4436,8 @@
'-pthread', # Not supported by Android toolchain.
],
'ldflags': [
'-nostdlib',
'-Wl,--no-undefined',
],
'libraries': [
'-l<(android_stlport_library)',
# Manually link the libgcc.a that the cross compiler uses.
'<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
'-lc',
'-ldl',
'-lm',
],
'conditions': [
['component=="static_library"', {
'ldflags': [
......@@ -4526,13 +4510,18 @@
],
'ldflags': [
'--sysroot=<(android_ndk_sysroot)',
'-nostdlib',
],
'libraries': [
'-l<(android_stlport_library)',
# Manually link the libgcc.a that the cross compiler uses.
'<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
'-lc',
'-ldl',
'-lm',
],
}],
['android_webview_build==1', {
'include_dirs': [
# OpenAL headers from the Android tree.
'<(android_src)/frameworks/wilhelm/include',
],
'cflags': [
# Android predefines this as 1; undefine it here so Chromium
# can redefine it later to be 2 for chromium code and unset
......@@ -4552,6 +4541,9 @@
'-Wno-non-virtual-dtor',
'-Wno-sign-promo',
],
'libraries': [
'-ldl',
],
}],
['android_webview_build==1', {
'target_conditions': [
......@@ -4584,19 +4576,20 @@
# 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==1', {
'cflags': [
# For libstdc++/include, which is used by stlport.
'-I<(android_src)/bionic',
'-I<(android_src)/external/stlport/stlport',
],
}, { # else: use_system_stlport!=1
['android_webview_build==0', {
'cflags': [
'-isystem<(android_stlport_include)',
],
'ldflags': [
'-L<(android_stlport_libs_dir)',
],
}, { # else: android_webview_build!=0
'aosp_build_settings': {
# Specify that we want to statically link stlport from the
# NDK. This will provide all the include and library paths
# automatically at build time, and link the right library.
'LOCAL_NDK_STL_VARIANT': 'stlport_static',
},
}],
['target_arch=="ia32"', {
# The x86 toolchain currently has problems with stack-protector.
......
......@@ -119,11 +119,7 @@ if (is_android) {
# stlport stuff --------------------------------------------------------------
use_system_stlport = is_android_webview_build
if (use_system_stlport) {
android_stlport_library = "stlport"
} else if (component_mode == "shared_library") {
if (component_mode == "shared_library") {
android_stlport_library = "stlport_shared"
} else {
android_stlport_library = "stlport_static"
......@@ -149,5 +145,4 @@ if (is_android) {
if (!defined(is_android_webview_build)) {
is_android_webview_build = false
}
use_system_stlport = false
}
......@@ -458,30 +458,18 @@ config("runtime_library") {
# arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
# strange errors. The include ordering here is important; change with
# caution.
if (use_system_stlport) {
cflags += [
# For libstdc++/include, which is used by stlport.
"-I" + rebase_path("$android_src/bionic", root_build_dir),
"-I" + rebase_path("$android_src/external/stlport/stlport",
root_build_dir),
]
libs += [
"stlport",
]
} else {
android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport"
android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport"
cflags += [
"-isystem" + rebase_path("$android_stlport_root/stlport",
root_build_dir)
]
lib_dirs += [ "$android_stlport_root/libs/$android_app_abi" ]
cflags += [
"-isystem" + rebase_path("$android_stlport_root/stlport",
root_build_dir)
]
lib_dirs += [ "$android_stlport_root/libs/$android_app_abi" ]
if (component_mode == "shared_library") {
libs += [ "stlport_shared" ]
} else {
libs += [ "stlport_static" ]
}
if (component_mode == "shared_library") {
libs += [ "stlport_shared" ]
} else {
libs += [ "stlport_static" ]
}
if (cpu_arch == "mipsel") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment