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