| # Copyright 2020 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/pkg_config.gni") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":dbus_code_generator", |
| ":libsystemproxy", |
| ":system_proxy", |
| ":system_proxy_worker", |
| ":worker-protos", |
| ] |
| if (use.test) { |
| deps += [ ":system-proxy_test" ] |
| } |
| if (use.fuzzer) { |
| deps += [ |
| ":system_proxy_connect_headers_parser_fuzzer", |
| ":system_proxy_worker_config_fuzzer", |
| ] |
| } |
| } |
| |
| # D-Bus code generator. |
| generate_dbus_adaptors("dbus_code_generator") { |
| new_fd_bindings = true |
| dbus_service_config = "dbus_bindings/dbus-service-config.json" |
| dbus_adaptors_out_dir = "include/system_proxy" |
| sources = [ "dbus_bindings/org.chromium.SystemProxy.xml" ] |
| } |
| |
| # Worker configs protos. |
| proto_library("worker-protos") { |
| proto_in_dir = "proto" |
| proto_out_dir = "include/bindings" |
| sources = [ "${proto_in_dir}/worker_common.proto" ] |
| } |
| |
| pkg_config("target_defaults") { |
| # NOSORT |
| pkg_deps = [ |
| "dbus-1", |
| "libbrillo", |
| "libchrome-${libbase_ver}", |
| "libminijail", |
| "libpatchpanel-client", |
| |
| # 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", |
| ] |
| if (use.fuzzer) { |
| # Link against protobuf for fuzzers so we can use libprotobuf-mutator. |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| } |
| |
| # System-proxy library (shared between executables and tests). |
| static_library("libsystemproxy") { |
| configs += [ ":target_defaults" ] |
| sources = [ |
| "kerberos_client.cc", |
| "protobuf_util.cc", |
| "sandboxed_worker.cc", |
| "system_proxy_adaptor.cc", |
| "system_proxy_daemon.cc", |
| ] |
| deps = [ |
| ":dbus_code_generator", |
| ":worker-protos", |
| ] |
| } |
| |
| # System-proxy worker library (shared between executables and tests). |
| static_library("libsystemproxyworker") { |
| configs += [ ":target_defaults" ] |
| sources = [ |
| "curl_socket.cc", |
| "http_util.cc", |
| "protobuf_util.cc", |
| "proxy_connect_job.cc", |
| "server_proxy.cc", |
| ] |
| deps = [ ":worker-protos" ] |
| } |
| |
| executable("system_proxy_worker") { |
| configs += [ ":target_defaults" ] |
| all_dependent_pkg_deps = [ "libcurl" ] |
| sources = [ "system_proxy_worker.cc" ] |
| deps = [ |
| ":libsystemproxyworker", |
| ":worker-protos", |
| ] |
| } |
| |
| executable("system_proxy") { |
| configs += [ ":target_defaults" ] |
| sources = [ "system_proxy.cc" ] |
| deps = [ ":libsystemproxy" ] |
| } |
| |
| # Unit tests. |
| if (use.test) { |
| pkg_config("system-proxy_test_config") { |
| pkg_deps = [ |
| "libchrome-${libbase_ver}", |
| "libchrome-test-${libbase_ver}", |
| ] |
| } |
| executable("system-proxy_test") { |
| configs += [ |
| "//common-mk:test", |
| ":system-proxy_test_config", |
| ":target_defaults", |
| ] |
| all_dependent_pkg_deps = [ "libcurl" ] |
| sources = [ |
| "http_util_test.cc", |
| "kerberos_client_test.cc", |
| "proxy_connect_job_test.cc", |
| "server_proxy_test.cc", |
| "system_proxy_adaptor_test.cc", |
| "test_http_server.cc", |
| ] |
| defines = [ "UNIT_TEST" ] |
| deps = [ |
| ":libsystemproxy", |
| ":libsystemproxyworker", |
| "//common-mk/testrunner:testrunner", |
| ] |
| } |
| } |
| |
| if (use.fuzzer) { |
| pkg_config("config_fuzzer_pkg_deps") { |
| pkg_deps = [ "libprotobuf-mutator" ] |
| } |
| executable("system_proxy_worker_config_fuzzer") { |
| all_dependent_pkg_deps = [ "libcurl" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":config_fuzzer_pkg_deps", |
| ":target_defaults", |
| ] |
| sources = [ "worker_config_fuzzer.cc" ] |
| deps = [ ":libsystemproxyworker" ] |
| } |
| |
| executable("system_proxy_connect_headers_parser_fuzzer") { |
| all_dependent_pkg_deps = [ "libcurl" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| sources = [ "connect_headers_parser_fuzzer.cc" ] |
| deps = [ ":libsystemproxyworker" ] |
| } |
| } |