blob: bc9d4a84f8274f0de8bde79745b16e102bf537e2 [file] [log] [blame]
Victor Changcacdd872018-10-24 03:31:13 +01001// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
Neil Fullerc96b3d12019-05-07 19:50:04 +010014
Neil Fullerc96b3d12019-05-07 19:50:04 +010015// A shared library for use on Android by frameworks and other code outside
Martin Stjernholm1eee6092019-07-17 21:18:35 +010016// of the ART mainline module. It provides a subset of ICU APIs, some
Neil Fullerc96b3d12019-05-07 19:50:04 +010017// Android extensions and stable symbols. Most Android target code should
18// depend on this library.
19//
20// With the exception of a few special cases like host apex build targets,
21// host binaries should use libicuuc + libicui18n directly.
22cc_library_shared {
Victor Changcacdd872018-10-24 03:31:13 +010023 name: "libandroidicu",
Neil Fuller18e7c882019-02-27 15:25:53 +000024
25 // Most code is imported via libandroidicu_static.
26 srcs: [
27 "aicu/AIcu.cpp",
28 ],
Victor Chang4f9422b2020-04-03 19:01:55 +010029 // host_supported is required for some cases, e.g. host apex. This library
30 // is not intended for general host use. Please refer to
31 // external/icu/build/icu.go for the full whitelist.
Victor Changcacdd872018-10-24 03:31:13 +010032 host_supported: true,
dimitryfa9b6a32019-05-14 14:12:12 +020033 native_bridge_supported: true,
Victor Changcacdd872018-10-24 03:31:13 +010034 unique_host_soname: true,
Jiyong Park0ddd1ef2019-12-19 02:11:30 +000035 apex_available: [
Victor Changaaf68452020-05-05 16:02:45 +010036 "com.android.i18n",
Jiyong Park0ddd1ef2019-12-19 02:11:30 +000037 // b/133140750 Clean this up. This is due to the dependency to from libmedia
38 "//apex_available:platform",
39 ],
Neil Fuller18e7c882019-02-27 15:25:53 +000040
Victor Changcacdd872018-10-24 03:31:13 +010041 // The implementation of libandroidicu depends on libicuuc and and libicui18n,
42 // but we need to export the headers in include/.
43 //
44 // However, include/unicode has a copy of a subset of header files
45 // as in libicuuc and libicui18n. We can't build C/C++ codes against
46 // both set of headers, since the headers have the same relative paths,
47 // and the compiler will find it ambiguous.
48 //
49 // Instead, we build the implementation of the shim libaray
50 // as a static library aganist libicuuc and libicui18n first,
51 // and export the headers in include/.
52 whole_static_libs: ["libandroidicu_static"],
53 shared_libs: [
Neil Fullere24629b2019-06-12 13:02:34 +010054 "libbase",
Victor Changcacdd872018-10-24 03:31:13 +010055 "libicuuc",
56 "libicui18n",
Neil Fuller18e7c882019-02-27 15:25:53 +000057 "liblog",
Victor Changcacdd872018-10-24 03:31:13 +010058 ],
Victor Changfff0fd22020-03-10 23:10:21 +000059 header_libs: ["libandroidicu_headers"],
60 export_header_lib_headers: ["libandroidicu_headers"],
Victor Changcacdd872018-10-24 03:31:13 +010061 stubs: {
62 symbol_file: "libandroidicu.map.txt",
63 versions: [
64 "1",
65 ],
66 },
67 cppflags: [
68 "-std=c++11", // Use the same C++ version as libicuuc
69 ],
70 cflags: [
71 "-Wall",
72 "-Werror",
73 ],
74 target: {
75 android: {
Victor Chang4f9422b2020-04-03 19:01:55 +010076 static_libs: [
77 "libandroidicuinit",
78 ],
Victor Changcacdd872018-10-24 03:31:13 +010079 cflags: [
80 "-DANDROID_LINK_SHARED_ICU4C",
81 ],
dimitryf7c83cd2019-03-26 15:04:13 +010082 version_script: "libandroidicu.map.txt",
Victor Chang4f9422b2020-04-03 19:01:55 +010083 },
84 not_windows: {
85 // libandroidicuinit requires mmap(2) in sys/mman.h, but it's not
86 // available in the latest MinGW version.
Neil Fullere24629b2019-06-12 13:02:34 +010087 static_libs: [
88 "libandroidicuinit",
89 ],
Jerome Gaillardaee42692019-01-15 19:35:54 +000090 },
91 windows: {
92 enabled: true,
93 },
94 },
Victor Changcacdd872018-10-24 03:31:13 +010095}
96
Victor Changfff0fd22020-03-10 23:10:21 +000097cc_library_headers {
98 name: "libandroidicu_headers",
99 host_supported: true,
100 native_bridge_supported: true,
101 apex_available: [
102 "com.android.art.release",
103 "com.android.art.debug",
Victor Changaaf68452020-05-05 16:02:45 +0100104 "com.android.i18n",
Victor Changfff0fd22020-03-10 23:10:21 +0000105 ],
106
107 // include/aicu/: extra utility APIs added by android
108 // include/unicode/: Includes modified C headers from ICU4C,
109 // but excludes C++ headers.
110 // include/uconfig_local.h: local configuration specific for libandroidicu
111 export_include_dirs: ["include"],
112 target: {
113 windows: {
114 enabled: true,
115 },
116 },
117}
118
Victor Changcacdd872018-10-24 03:31:13 +0100119// TODO: http://b/120776993 Testing for libandroidicu