1// Copyright (C) 2017 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. 14 15// Default values for the USE flags. Override these USE flags from your product 16// by setting BRILLO_USE_* values. Note that we define local variables like 17// local_use_* to prevent leaking our default setting for other packages. 18 19libbrillo_core_sources = [ 20 "brillo/backoff_entry.cc", 21 "brillo/data_encoding.cc", 22 "brillo/errors/error.cc", 23 "brillo/errors/error_codes.cc", 24 "brillo/flag_helper.cc", 25 "brillo/imageloader/manifest.cc", 26 "brillo/key_value_store.cc", 27 "brillo/message_loops/base_message_loop.cc", 28 "brillo/message_loops/message_loop.cc", 29 "brillo/message_loops/message_loop_utils.cc", 30 "brillo/mime_utils.cc", 31 "brillo/osrelease_reader.cc", 32 "brillo/process.cc", 33 "brillo/process_information.cc", 34 "brillo/secure_blob.cc", 35 "brillo/strings/string_utils.cc", 36 "brillo/syslog_logging.cc", 37 "brillo/type_name_undecorate.cc", 38 "brillo/url_utils.cc", 39 "brillo/userdb_utils.cc", 40 "brillo/value_conversion.cc", 41] 42 43libbrillo_linux_sources = [ 44 "brillo/asynchronous_signal_handler.cc", 45 "brillo/daemons/daemon.cc", 46 "brillo/file_utils.cc", 47 "brillo/process_reaper.cc", 48] 49 50libbrillo_binder_sources = ["brillo/binder_watcher.cc"] 51 52libbrillo_http_sources = [ 53 "brillo/http/curl_api.cc", 54 "brillo/http/http_connection_curl.cc", 55 "brillo/http/http_form_data.cc", 56 "brillo/http/http_request.cc", 57 "brillo/http/http_transport.cc", 58 "brillo/http/http_transport_curl.cc", 59 "brillo/http/http_utils.cc", 60] 61 62libbrillo_policy_sources = [ 63 "policy/device_policy.cc", 64 "policy/libpolicy.cc", 65] 66 67libbrillo_stream_sources = [ 68 "brillo/streams/file_stream.cc", 69 "brillo/streams/input_stream_set.cc", 70 "brillo/streams/memory_containers.cc", 71 "brillo/streams/memory_stream.cc", 72 "brillo/streams/openssl_stream_bio.cc", 73 "brillo/streams/stream.cc", 74 "brillo/streams/stream_errors.cc", 75 "brillo/streams/stream_utils.cc", 76 "brillo/streams/tls_stream.cc", 77] 78 79libbrillo_test_helpers_sources = [ 80 "brillo/http/http_connection_fake.cc", 81 "brillo/http/http_transport_fake.cc", 82 "brillo/message_loops/fake_message_loop.cc", 83 "brillo/streams/fake_stream.cc", 84 "brillo/unittest_utils.cc", 85] 86 87libbrillo_test_sources = [ 88 "brillo/asynchronous_signal_handler_unittest.cc", 89 "brillo/backoff_entry_unittest.cc", 90 "brillo/data_encoding_unittest.cc", 91 "brillo/enum_flags_unittest.cc", 92 "brillo/errors/error_codes_unittest.cc", 93 "brillo/errors/error_unittest.cc", 94 "brillo/file_utils_unittest.cc", 95 "brillo/flag_helper_unittest.cc", 96 "brillo/http/http_connection_curl_unittest.cc", 97 "brillo/http/http_form_data_unittest.cc", 98 "brillo/http/http_request_unittest.cc", 99 "brillo/http/http_transport_curl_unittest.cc", 100 "brillo/http/http_utils_unittest.cc", 101 "brillo/imageloader/manifest_unittest.cc", 102 "brillo/key_value_store_unittest.cc", 103 "brillo/map_utils_unittest.cc", 104 "brillo/message_loops/base_message_loop_unittest.cc", 105 "brillo/message_loops/fake_message_loop_unittest.cc", 106 "brillo/mime_utils_unittest.cc", 107 "brillo/osrelease_reader_unittest.cc", 108 "brillo/process_reaper_unittest.cc", 109 "brillo/process_unittest.cc", 110 "brillo/secure_blob_unittest.cc", 111 "brillo/streams/fake_stream_unittest.cc", 112 "brillo/streams/file_stream_unittest.cc", 113 "brillo/streams/input_stream_set_unittest.cc", 114 "brillo/streams/memory_containers_unittest.cc", 115 "brillo/streams/memory_stream_unittest.cc", 116 "brillo/streams/openssl_stream_bio_unittests.cc", 117 "brillo/streams/stream_unittest.cc", 118 "brillo/streams/stream_utils_unittest.cc", 119 "brillo/strings/string_utils_unittest.cc", 120 "brillo/unittest_utils.cc", 121 "brillo/url_utils_unittest.cc", 122 "brillo/value_conversion_unittest.cc", 123] 124 125libbrillo_CFLAGS = [ 126 "-Wall", 127 "-Werror", 128] 129 130libbrillo_shared_libraries = ["libchrome"] 131 132// Main library, shared and static for host and target 133// ======================================================== 134cc_library { 135 name: "libbrillo", 136 host_supported: true, 137 recovery_available: true, 138 srcs: libbrillo_core_sources, 139 shared_libs: libbrillo_shared_libraries, 140 static_libs: [ 141 "libmodpb64", 142 "libgtest_prod", 143 ], 144 cflags: libbrillo_CFLAGS, 145 export_include_dirs: ["."], 146 147 target: { 148 host: { 149 cppflags: ["-D__ANDROID_HOST__"], 150 }, 151 android: { 152 srcs: libbrillo_linux_sources, 153 }, 154 darwin: { 155 enabled: false 156 } 157 }, 158} 159 160// Shared binder library for target 161// ======================================================== 162cc_library_shared { 163 name: "libbrillo-binder", 164 srcs: libbrillo_binder_sources, 165 shared_libs: libbrillo_shared_libraries + [ 166 "libbinder", 167 "libbrillo", 168 "libutils", 169 ], 170 static_libs: ["libgtest_prod"], 171 cflags: libbrillo_CFLAGS, 172 export_include_dirs: ["."], 173} 174 175// Shared minijail library for target 176// ======================================================== 177cc_library_shared { 178 name: "libbrillo-minijail", 179 srcs: [ 180 "brillo/minijail/minijail.cc", 181 ], 182 shared_libs: [ 183 "libchrome", 184 "libbrillo", 185 "libminijail", 186 ], 187 static_libs: ["libgtest_prod"], 188 cflags: libbrillo_CFLAGS, 189 export_include_dirs: ["."], 190} 191 192// Shared and static stream library for target and host 193// ======================================================== 194cc_library { 195 name: "libbrillo-stream", 196 srcs: libbrillo_stream_sources, 197 shared_libs: libbrillo_shared_libraries + [ 198 "libbrillo", 199 "libcrypto", 200 "libssl", 201 ], 202 static_libs: ["libgtest_prod"], 203 cflags: libbrillo_CFLAGS, 204 export_include_dirs: ["."], 205 206 host_supported: true, 207 recovery_available: true, 208 target: { 209 darwin: { 210 enabled: false, 211 }, 212 windows: { 213 enabled: false, 214 }, 215 }, 216} 217 218// Shared http library for target and host 219// ======================================================== 220cc_library_shared { 221 name: "libbrillo-http", 222 srcs: libbrillo_http_sources, 223 shared_libs: libbrillo_shared_libraries + [ 224 "libbrillo", 225 "libbrillo-stream", 226 "libcurl", 227 ], 228 static_libs: ["libgtest_prod"], 229 cflags: libbrillo_CFLAGS, 230 export_include_dirs: ["."], 231 232 host_supported: true, 233 target: { 234 darwin: { 235 enabled: false, 236 }, 237 windows: { 238 enabled: false, 239 }, 240 }, 241} 242 243// Shared policy library for target 244// ======================================================== 245cc_library_shared { 246 name: "libbrillo-policy", 247 srcs: libbrillo_policy_sources, 248 shared_libs: libbrillo_shared_libraries, 249 static_libs: ["libgtest_prod"], 250 cflags: libbrillo_CFLAGS, 251 export_include_dirs: ["."], 252} 253 254 255// Static test-helpers library for target 256// ======================================================== 257cc_library_static { 258 name: "libbrillo-test-helpers", 259 srcs: libbrillo_test_helpers_sources, 260 static_libs: [ 261 "libgtest", 262 "libgmock", 263 ], 264 shared_libs: libbrillo_shared_libraries + [ 265 "libbrillo", 266 "libcurl", 267 "libbrillo-http", 268 "libbrillo-stream", 269 "libcrypto", 270 ], 271 cflags: libbrillo_CFLAGS, 272 cppflags: ["-Wno-sign-compare"], 273 export_include_dirs: ["."], 274} 275 276// Unit tests. 277// ======================================================== 278cc_test { 279 name: "libbrillo_test", 280 srcs: libbrillo_test_sources, 281 isolated: true, 282 static_libs: [ 283 "libgtest", 284 "libchrome_test_helpers", 285 "libbrillo-test-helpers", 286 "libgmock", 287 ], 288 shared_libs: libbrillo_shared_libraries + [ 289 "libbrillo", 290 "libcurl", 291 "libbrillo-http", 292 "libbrillo-stream", 293 "libcrypto", 294 "libprotobuf-cpp-lite", 295 ], 296 cflags: libbrillo_CFLAGS, 297 cppflags: ["-Wno-sign-compare"], 298} 299