| # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//common-mk/generate-dbus-adaptors.gni") |
| import("//common-mk/generate-dbus-proxies.gni") |
| import("//common-mk/pkg_config.gni") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ ":modemfwd" ] |
| if (use.test) { |
| deps += [ ":modemfw_test" ] |
| } |
| if (use.fuzzer) { |
| deps += [ |
| ":firmware_manifest_fuzzer", |
| ":firmware_manifest_v2_fuzzer", |
| ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| # NOSORT |
| pkg_deps = [ |
| "libchrome", |
| "libbrillo", |
| "libcros_config", |
| "libshill-client", |
| "liblzma", |
| "ModemManager", |
| |
| # system_api depends on protobuf. It must appear before protobuf |
| # here or the linker flags won't be in the right order. |
| "system_api", |
| "protobuf", |
| ] |
| } |
| |
| proto_library("modemfw-protos") { |
| proto_in_dir = "." |
| proto_out_dir = "include/modemfwd/proto_bindings" |
| sources = [ |
| "${proto_in_dir}/firmware_manifest.proto", |
| "${proto_in_dir}/firmware_manifest_v2.proto", |
| "${proto_in_dir}/helper_manifest.proto", |
| "${proto_in_dir}/journal_entry.proto", |
| ] |
| } |
| |
| generate_dbus_proxies("modemmanager_proxies") { |
| modemmanager_in_dir = "${sysroot}/usr/share/dbus-1/interfaces/" |
| proxy_output_file = "include/modemmanager/dbus-proxies.h" |
| sources = [ |
| "${modemmanager_in_dir}/org.freedesktop.ModemManager1.Modem.xml", |
| "${modemmanager_in_dir}/org.freedesktop.ModemManager1.xml", |
| ] |
| } |
| |
| generate_dbus_adaptors("modemfwd_adaptors") { |
| dbus_service_config = "dbus_bindings/dbus-service-config.json" |
| dbus_adaptors_out_dir = "include/modemfwd/dbus_adaptors" |
| sources = [ "dbus_bindings/org.chromium.Modemfwd.xml" ] |
| } |
| |
| static_library("libmodemfw") { |
| configs += [ ":target_defaults" ] |
| deps = [ |
| ":modemfw-protos", |
| ":modemmanager_proxies", |
| ] |
| sources = [ |
| "file_decompressor.cc", |
| "firmware_directory.cc", |
| "firmware_file.cc", |
| "firmware_manifest.cc", |
| "firmware_manifest_v2.cc", |
| "journal.cc", |
| "logging.cc", |
| "modem.cc", |
| "modem_flasher.cc", |
| "modem_helper.cc", |
| "modem_helper_directory.cc", |
| "modem_tracker.cc", |
| "scoped_temp_file.cc", |
| ] |
| } |
| |
| executable("modemfwd") { |
| configs += [ ":target_defaults" ] |
| deps = [ |
| ":libmodemfw", |
| ":modemfwd_adaptors", |
| ] |
| sources = [ |
| "daemon.cc", |
| "main.cc", |
| ] |
| } |
| |
| if (use.test) { |
| executable("modemfw_test") { |
| configs += [ |
| ":target_defaults", |
| "//common-mk:test", |
| ] |
| pkg_deps = [ "libchrome-test" ] |
| deps = [ |
| ":libmodemfw", |
| "//common-mk/testrunner:testrunner", |
| ] |
| sources = [ |
| "file_decompressor_test.cc", |
| "firmware_directory_stub.cc", |
| "firmware_directory_test.cc", |
| "firmware_file_test.cc", |
| "journal_test.cc", |
| "modem_flasher_test.cc", |
| ] |
| } |
| } |
| |
| if (use.fuzzer) { |
| executable("firmware_manifest_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| pkg_deps = [ "libprotobuf-mutator" ] |
| sources = [ "firmware_manifest_fuzzer.cc" ] |
| deps = [ ":libmodemfw" ] |
| } |
| executable("firmware_manifest_v2_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| pkg_deps = [ "libprotobuf-mutator" ] |
| sources = [ "firmware_manifest_v2_fuzzer.cc" ] |
| deps = [ ":libmodemfw" ] |
| } |
| } |