summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorjdduke <jdduke@chromium.org>2015-02-06 11:33:07 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-06 19:33:41 +0000
commit8681920fa22ded465054301ce96657a4ddaf2a04 (patch)
tree089cf4c19a2dcf4cbaf10f3e13dd5d55504e7b1c /build
parent4d7bcd649f45b21838e41a9174568c6db6373786 (diff)
downloadchromium_src-8681920fa22ded465054301ce96657a4ddaf2a04.zip
chromium_src-8681920fa22ded465054301ce96657a4ddaf2a04.tar.gz
chromium_src-8681920fa22ded465054301ce96657a4ddaf2a04.tar.bz2
Enable libc++ on Android
Switch Chrome on Android to use libc++ instead of stlport. WebView AOSP builds will continue to use stlport for the time being. Note that this change is exploratory, and likely to be reverted before branch point (ensuring WebView and Chrome remain in lockstep with respect to standard library dependencies). BUG=427718 TBR=cpu@chromium.org Review URL: https://codereview.chromium.org/835633003 Cr-Commit-Position: refs/heads/master@{#315085}
Diffstat (limited to 'build')
-rw-r--r--build/android/setup.gyp2
-rw-r--r--build/common.gypi36
-rw-r--r--build/config/android/config.gni8
-rw-r--r--build/config/compiler/BUILD.gn59
4 files changed, 43 insertions, 62 deletions
diff --git a/build/android/setup.gyp b/build/android/setup.gyp
index 7dce19d..b3c3422 100644
--- a/build/android/setup.gyp
+++ b/build/android/setup.gyp
@@ -16,7 +16,7 @@
{
'destination': '<(SHARED_LIB_DIR)/',
'files': [
- '<(android_stlport_libs_dir)/libstlport_shared.so',
+ '<(android_libcpp_libs_dir)/libc++_shared.so',
],
},
],
diff --git a/build/common.gypi b/build/common.gypi
index eae87e3..153a500 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1668,7 +1668,7 @@
'android_ndk_root%': '<(android_ndk_root)',
'android_sdk_root%': '<(android_sdk_root)',
'android_sdk_version%': '<(android_sdk_version)',
- 'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
+ 'android_libcpp_root': '<(android_ndk_root)/sources/cxx-stl/llvm-libc++',
'host_os%': '<(host_os)',
'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
@@ -1745,9 +1745,10 @@
'android_sdk%': '<(android_sdk)',
'android_sdk_jar%': '<(android_sdk)/android.jar',
- 'android_stlport_root': '<(android_stlport_root)',
- 'android_stlport_include': '<(android_stlport_root)/stlport',
- 'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
+ 'android_libcpp_root': '<(android_libcpp_root)',
+ 'android_libcpp_include': '<(android_libcpp_root)/libcxx/include',
+ 'android_libcpp_libs_dir': '<(android_libcpp_root)/libs/<(android_app_abi)',
+
'host_os%': '<(host_os)',
# Location of the "objcopy" binary, used by both gyp and scripts.
@@ -4498,9 +4499,9 @@
# Figure this out early since it needs symbols from libgcc.a, so it
# has to be before that in the set of libraries.
['component=="shared_library"', {
- 'android_stlport_library': 'stlport_shared',
+ 'android_libcpp_library': 'c++_shared',
}, {
- 'android_stlport_library': 'stlport_static',
+ 'android_libcpp_library': 'c++_static',
}],
],
@@ -4584,8 +4585,6 @@
'defines': [
'ANDROID',
'__GNU_SOURCE=1', # Necessary for clone()
- 'USE_STLPORT=1',
- '_STLP_USE_PTR_SPECIALIZATIONS=1',
'CHROME_BUILD_ID="<(chrome_build_id)"',
],
'ldflags!': [
@@ -4659,12 +4658,13 @@
'-nostdlib',
],
'libraries': [
- '-l<(android_stlport_library)',
+ '-l<(android_libcpp_library)',
+ '-latomic',
# Manually link the libgcc.a that the cross compiler uses.
'<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
+ '-lm',
'-lc',
'-ldl',
- '-lm',
],
}],
['android_webview_build==1', {
@@ -4716,20 +4716,20 @@
'-Wl,--icf=safe',
],
}],
- # 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.
['android_webview_build==0', {
'cflags': [
- '-isystem<(android_stlport_include)',
+ '-isystem<(android_libcpp_include)',
+ '-isystem<(android_ndk_root)/sources/cxx-stl/llvm-libc++abi/libcxxabi/include',
+ '-isystem<(android_ndk_root)/sources/android/support/include',
],
'ldflags': [
- '-L<(android_stlport_libs_dir)',
+ '-L<(android_libcpp_libs_dir)',
],
}, { # else: android_webview_build!=0
+ 'defines': [
+ 'USE_STLPORT=1',
+ '_STLP_USE_PTR_SPECIALIZATIONS=1',
+ ],
'aosp_build_settings': {
# Specify that we want to statically link stlport from the
# NDK. This will provide all the include and library paths
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index 60934c2..c6202d4 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -129,14 +129,6 @@ if (is_android) {
android_gdbserver =
"$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
- # stlport stuff --------------------------------------------------------------
-
- if (component_mode == "shared_library") {
- android_stlport_library = "stlport_shared"
- } else {
- android_stlport_library = "stlport_static"
- }
-
# ABI ------------------------------------------------------------------------
if (cpu_arch == "x86") {
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 9739093..b50a64c 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -529,7 +529,7 @@ config("runtime_library") {
]
}
- # Stlport setup. Android uses a different (smaller) version of the STL.
+ # Android standard library setup.
if (is_android) {
if (is_clang) {
# Work around incompatibilities between bionic and clang headers.
@@ -539,55 +539,44 @@ config("runtime_library") {
]
}
- defines += [
- "USE_STLPORT=1",
- "_STLP_USE_PTR_SPECIALIZATIONS=1",
- "__GNU_SOURCE=1", # Necessary for clone().
- ]
+ defines += [ "__GNU_SOURCE=1" ] # Necessary for clone().
ldflags += [
"-Wl,--warn-shared-textrel",
"-nostdlib",
]
- # 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.
- android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport"
+ android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
- 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_libcpp_root/libcxx/include", root_build_dir),
+ "-isystem" + rebase_path(
+ "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include",
+ root_build_dir),
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/android/support/include",
+ root_build_dir),
+ ]
- if (component_mode == "shared_library") {
- libs += [ "stlport_shared" ]
- } else {
- libs += [ "stlport_static" ]
- }
+ lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ]
- if (cpu_arch == "mipsel") {
- libs += [
- # ld linker is used for mips Android, and ld does not accept library
- # absolute path prefixed by "-l"; Since libgcc does not exist in mips
- # sysroot the proper library will be linked.
- # TODO(gordanac): Remove once gold linker is used for mips Android.
- "gcc",
- ]
+ if (component_mode == "shared_library") {
+ android_libcpp_library = "c++_shared"
} else {
- libs += [
- # Manually link the libgcc.a that the cross compiler uses. This is
- # absolute because the linker will look inside the sysroot if it's not.
- rebase_path(android_libgcc_file),
- ]
+ android_libcpp_library = "c++_static"
}
libs += [
+ "$android_libcpp_library",
+ "atomic",
+
+ # Manually link the libgcc.a that the cross compiler uses. This is
+ # absolute because the linker will look inside the sysroot if it's not.
+ rebase_path(android_libgcc_file),
+ "m",
"c",
"dl",
- "m",
]
}
}