Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 1 | // 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 Fuller | c96b3d1 | 2019-05-07 19:50:04 +0100 | [diff] [blame] | 14 | |
Neil Fuller | c96b3d1 | 2019-05-07 19:50:04 +0100 | [diff] [blame] | 15 | // A shared library for use on Android by frameworks and other code outside |
Martin Stjernholm | 1eee609 | 2019-07-17 21:18:35 +0100 | [diff] [blame] | 16 | // of the ART mainline module. It provides a subset of ICU APIs, some |
Neil Fuller | c96b3d1 | 2019-05-07 19:50:04 +0100 | [diff] [blame] | 17 | // 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. |
| 22 | cc_library_shared { |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 23 | name: "libandroidicu", |
Neil Fuller | 18e7c88 | 2019-02-27 15:25:53 +0000 | [diff] [blame] | 24 | |
| 25 | // Most code is imported via libandroidicu_static. |
| 26 | srcs: [ |
| 27 | "aicu/AIcu.cpp", |
| 28 | ], |
Victor Chang | 4f9422b | 2020-04-03 19:01:55 +0100 | [diff] [blame] | 29 | // 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 Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 32 | host_supported: true, |
dimitry | fa9b6a3 | 2019-05-14 14:12:12 +0200 | [diff] [blame] | 33 | native_bridge_supported: true, |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 34 | unique_host_soname: true, |
Jiyong Park | 0ddd1ef | 2019-12-19 02:11:30 +0000 | [diff] [blame] | 35 | apex_available: [ |
Victor Chang | aaf6845 | 2020-05-05 16:02:45 +0100 | [diff] [blame] | 36 | "com.android.i18n", |
Jiyong Park | 0ddd1ef | 2019-12-19 02:11:30 +0000 | [diff] [blame] | 37 | // b/133140750 Clean this up. This is due to the dependency to from libmedia |
| 38 | "//apex_available:platform", |
| 39 | ], |
Neil Fuller | 18e7c88 | 2019-02-27 15:25:53 +0000 | [diff] [blame] | 40 | |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 41 | // 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 Fuller | e24629b | 2019-06-12 13:02:34 +0100 | [diff] [blame] | 54 | "libbase", |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 55 | "libicuuc", |
| 56 | "libicui18n", |
Neil Fuller | 18e7c88 | 2019-02-27 15:25:53 +0000 | [diff] [blame] | 57 | "liblog", |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 58 | ], |
Victor Chang | fff0fd2 | 2020-03-10 23:10:21 +0000 | [diff] [blame] | 59 | header_libs: ["libandroidicu_headers"], |
| 60 | export_header_lib_headers: ["libandroidicu_headers"], |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 61 | 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 Chang | 4f9422b | 2020-04-03 19:01:55 +0100 | [diff] [blame] | 76 | static_libs: [ |
| 77 | "libandroidicuinit", |
| 78 | ], |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 79 | cflags: [ |
| 80 | "-DANDROID_LINK_SHARED_ICU4C", |
| 81 | ], |
dimitry | f7c83cd | 2019-03-26 15:04:13 +0100 | [diff] [blame] | 82 | version_script: "libandroidicu.map.txt", |
Victor Chang | 4f9422b | 2020-04-03 19:01:55 +0100 | [diff] [blame] | 83 | }, |
| 84 | not_windows: { |
| 85 | // libandroidicuinit requires mmap(2) in sys/mman.h, but it's not |
| 86 | // available in the latest MinGW version. |
Neil Fuller | e24629b | 2019-06-12 13:02:34 +0100 | [diff] [blame] | 87 | static_libs: [ |
| 88 | "libandroidicuinit", |
| 89 | ], |
Jerome Gaillard | aee4269 | 2019-01-15 19:35:54 +0000 | [diff] [blame] | 90 | }, |
| 91 | windows: { |
| 92 | enabled: true, |
| 93 | }, |
| 94 | }, |
Victor Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 95 | } |
| 96 | |
Victor Chang | fff0fd2 | 2020-03-10 23:10:21 +0000 | [diff] [blame] | 97 | cc_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 Chang | aaf6845 | 2020-05-05 16:02:45 +0100 | [diff] [blame] | 104 | "com.android.i18n", |
Victor Chang | fff0fd2 | 2020-03-10 23:10:21 +0000 | [diff] [blame] | 105 | ], |
| 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 Chang | cacdd87 | 2018-10-24 03:31:13 +0100 | [diff] [blame] | 119 | // TODO: http://b/120776993 Testing for libandroidicu |