| # Copyright 2021 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") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":dnsproxyd", |
| ":libdnsproxy", |
| ] |
| if (use.fuzzer) { |
| deps += [ |
| ":ares_client_fuzzer", |
| ":doh_curl_client_fuzzer", |
| ":resolver_fuzzer", |
| ] |
| } |
| if (use.test) { |
| deps += [ ":dns-proxy_test" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| # NOSORT |
| pkg_deps = [ |
| "dbus-1", |
| "libbrillo", |
| "libchrome", |
| "libmetrics", |
| "libminijail", |
| "libpatchpanel-client", |
| "libpatchpanel-util", |
| "libsession_manager-client", |
| "libshill-client", |
| "libshill-dbus-client", |
| "libshill-net", |
| |
| # system_api depends on protobuf (or protobuf-lite). It must |
| # appear before protobuf or the linker flags won't be in the right |
| # order. |
| "system_api", |
| "protobuf-lite", |
| ] |
| } |
| |
| static_library("libdnsproxy") { |
| sources = [ |
| "ares_client.cc", |
| "chrome_features_service_client.cc", |
| "controller.cc", |
| "doh_curl_client.cc", |
| "metrics.cc", |
| "proxy.cc", |
| "resolver.cc", |
| "session_monitor.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| deps = [] |
| } |
| |
| executable("dnsproxyd") { |
| sources = [ "main.cc" ] |
| configs += [ ":target_defaults" ] |
| all_dependent_pkg_deps = [ |
| "libcares", |
| "libcurl", |
| ] |
| deps = [ ":libdnsproxy" ] |
| } |
| |
| if (use.fuzzer) { |
| pkg_config("dns-proxy_fuzz_config") { |
| pkg_deps = [ "libchrome-test" ] |
| } |
| |
| executable("ares_client_fuzzer") { |
| sources = [ "ares_client_fuzzer.cc" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":dns-proxy_fuzz_config", |
| ] |
| all_dependent_pkg_deps = [ "libcares" ] |
| deps = [ ":libdnsproxy" ] |
| } |
| |
| executable("doh_curl_client_fuzzer") { |
| sources = [ "doh_curl_client_fuzzer.cc" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":dns-proxy_fuzz_config", |
| ] |
| all_dependent_pkg_deps = [ "libcurl" ] |
| deps = [ ":libdnsproxy" ] |
| } |
| |
| executable("resolver_fuzzer") { |
| sources = [ "resolver_fuzzer.cc" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":dns-proxy_fuzz_config", |
| ] |
| all_dependent_pkg_deps = [ |
| "libcares", |
| "libcurl", |
| ] |
| deps = [ ":libdnsproxy" ] |
| } |
| } |
| |
| if (use.test) { |
| pkg_config("dns-proxy_test_config") { |
| pkg_deps = [ |
| "libchrome", |
| "libchrome-test", |
| "libshill-client-test", |
| ] |
| } |
| executable("dns-proxy_test") { |
| sources = [ |
| "proxy_test.cc", |
| "resolver_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":dns-proxy_test_config", |
| ":target_defaults", |
| ] |
| defines = [ "UNIT_TEST" ] |
| all_dependent_pkg_deps = [ |
| "libcares", |
| "libcurl", |
| ] |
| deps = [ |
| ":libdnsproxy", |
| "//common-mk/testrunner:testrunner", |
| ] |
| } |
| } |