| # Copyright 2021 The ChromiumOS Authors |
| # 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 = [ |
| ":install_dbus_config", |
| ":install_headers", |
| ":install_init", |
| ":libspaced_pc", |
| ":spaced", |
| ":spaced_cli", |
| ] |
| |
| if (use.test) { |
| deps += [ ":libspaced_unittests" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| |
| # system_api depends on protobuf (or protobuf-lite). It must appear |
| # before protobuf here or the linker flags won't be in the right |
| # order. |
| "protobuf-lite", |
| "system_api", |
| ] |
| } |
| |
| generate_dbus_adaptors("spaced_adaptor") { |
| dbus_service_config = "dbus_bindings/dbus-service-config.json" |
| dbus_adaptors_out_dir = "include/spaced/dbus_adaptors" |
| sources = [ "dbus_bindings/org.chromium.Spaced.xml" ] |
| } |
| |
| generate_dbus_proxies("spaced_proxy") { |
| dbus_service_config = "dbus_bindings/dbus-service-config.json" |
| proxy_output_file = "include/spaced/dbus-proxies.h" |
| mock_output_file = "include/spaced/dbus-proxy-mocks.h" |
| proxy_path_in_mocks = "spaced/dbus-proxies.h" |
| sources = [ "dbus_bindings/org.chromium.Spaced.xml" ] |
| } |
| |
| generate_pkg_config("libspaced_pc") { |
| name = "libspaced" |
| description = "Library for disk usage introspection" |
| version = getenv("PV") |
| cflags = [ "-I/usr/include/spaced-client" ] |
| libs = [ "-lspaced" ] |
| install = true |
| } |
| |
| shared_library("libspaced") { |
| sources = [ |
| "calculator/stateful_free_space_calculator.cc", |
| "disk_usage_impl.cc", |
| "disk_usage_proxy.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| install_path = "lib" |
| deps = [ ":spaced_proxy" ] |
| } |
| |
| executable("spaced") { |
| sources = [ |
| "daemon.cc", |
| "main.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| install_path = "sbin" |
| libs = [ "rootdev" ] |
| deps = [ |
| ":libspaced", |
| ":spaced_adaptor", |
| ] |
| } |
| |
| executable("spaced_cli") { |
| sources = [ "cli.cc" ] |
| configs += [ ":target_defaults" ] |
| install_path = "sbin" |
| deps = [ ":libspaced" ] |
| } |
| |
| install_config("install_dbus_config") { |
| sources = [ "dbus_bindings/org.chromium.Spaced.conf" ] |
| install_path = "/etc/dbus-1/system.d" |
| } |
| |
| install_config("install_init") { |
| sources = [ "init/spaced.conf" ] |
| install_path = "/etc/init" |
| } |
| |
| install_config("install_headers") { |
| sources = [ |
| "daemon.h", |
| "disk_usage.h", |
| "disk_usage_impl.h", |
| "disk_usage_proxy.h", |
| ] |
| install_path = "/usr/include/spaced" |
| } |
| |
| if (use.test) { |
| executable("libspaced_unittests") { |
| sources = [ |
| "calculator/stateful_free_space_calculator_test.cc", |
| "disk_usage_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ] |
| run_test = true |
| deps = [ |
| ":libspaced", |
| "//common-mk/testrunner", |
| ] |
| } |
| } |