blob: c16ec4422999f58df4fef893e09d45ab3d3c3a1f [file] [log] [blame]
# Copyright 2018 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/pkg_config.gni")
group("all") {
deps = [
":hammerd",
":install_dbus_config",
":install_rsyslog_conf",
":install_upstart_configs",
":install_upstart_scripts",
":libhammerd",
]
if (use.hammerd_api) {
deps += [ ":libhammerd-api" ]
}
if (use.test) {
deps += [ ":unittest_runner" ]
}
if (use.fuzzer) {
deps += [
":hammerd_load_ec_image_fuzzer",
":hammerd_update_fw_fuzzer",
]
}
}
pkg_config("target_defaults") {
# NOSORT
pkg_deps = [
"fmap",
"libbrillo",
"libchrome",
"libmetrics",
"libpcrecpp",
"openssl",
# 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.
"system_api",
"protobuf-lite",
]
}
static_library("libhammerd") {
sources = [
# TODO(crbug.com/649672): Upgrade to OpenSSL 1.1 support curve25519.
"curve25519.c",
"dbus_wrapper.cc",
"fmap_utils.cc",
"hammer_updater.cc",
"pair_utils.cc",
"process_lock.cc",
"update_fw.cc",
"usb_utils.cc",
]
configs += [ ":target_defaults" ]
configs -= [ "//common-mk:pie" ]
cflags = [ "-fPIC" ]
}
executable("hammerd") {
sources = [ "main.cc" ]
configs += [ ":target_defaults" ]
install_path = "bin"
deps = [ ":libhammerd" ]
}
if (use.hammerd_api) {
shared_library("libhammerd-api") {
sources = [ "hammerd_api.cc" ]
configs += [ ":target_defaults" ]
deps = [ ":libhammerd" ]
}
}
install_config("install_upstart_configs") {
sources = [ "init/hammerd.conf" ]
install_path = "/etc/init"
}
install_config("install_upstart_scripts") {
sources = [
"init/hammerd-at-boot.sh",
"init/hammerd-base-detector.sh",
]
install_path = "/usr/share/cros/init"
type = "executable"
}
install_config("install_dbus_config") {
sources = [ "dbus/org.chromium.hammerd.conf" ]
install_path = "/etc/dbus-1/system.d"
}
install_config("install_rsyslog_conf") {
sources = [ "rsyslog/rsyslog.hammerd.conf" ]
install_path = "/etc/rsyslog.d"
}
if (use.test) {
executable("unittest_runner") {
sources = [
"curve25519_test.cc",
"hammer_updater_test.cc",
"pair_utils_test.cc",
"update_fw_test.cc",
]
configs += [
# //common-mk:test should be at the top. crbug.com/887845
# TODO(crbug.com/887845): Remove this note after library order issue is resolved.
"//common-mk:test",
":target_defaults",
]
run_test = true
deps = [
":libhammerd",
"//common-mk/testrunner",
]
}
}
if (use.fuzzer) {
executable("hammerd_load_ec_image_fuzzer") {
sources = [
"fuzzed_ec_image.cc",
"update_fw_load_ec_image_fuzzer.cc",
]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
deps = [ ":libhammerd" ]
}
executable("hammerd_update_fw_fuzzer") {
sources = [
"fuzzed_ec_image.cc",
"update_fw_fuzzer.cc",
]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
deps = [ ":libhammerd" ]
}
}