| # Copyright 2018 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/pkg_config.gni") | |
| group("all") { | |
| deps = [ | |
| ":install_init_scripts", | |
| ":install_seccomp_policy", | |
| ":install_tmpfiles_config", | |
| ":tpm2-simulator", | |
| ":tpm2-simulator-init", | |
| ":tpm2-simulator-stop", | |
| ] | |
| } | |
| pkg_config("target_default_deps") { | |
| pkg_deps = [ | |
| "libbrillo", | |
| "libchrome", | |
| "libselinux", | |
| "openssl", | |
| ] | |
| } | |
| config("target_defaults") { | |
| configs = [ ":target_default_deps" ] | |
| defines = [ | |
| "USE_TPM1=${use.tpm}&&!${use.test}", | |
| "USE_TPM2=${use.tpm2}||${use.test}", | |
| "USE_TI50=${use.ti50_onboard}&&!${use.test}", | |
| ] | |
| include_dirs = [ "${sysroot}/usr/include/pinweaver" ] | |
| } | |
| source_set("tpm_executor_version_library") { | |
| sources = [ "tpm_executor_version.cc" ] | |
| configs += [ | |
| ":target_defaults", | |
| "//common-mk:pic", | |
| ] | |
| } | |
| static_library("libtpm2_simulator_executor") { | |
| sources = [ | |
| "tpm_command_utils.cc", | |
| "tpm_vendor_cmd_locality.cc", | |
| ] | |
| configs += [ | |
| ":target_defaults", | |
| "//common-mk:nouse_thin_archive", | |
| "//common-mk:pic", | |
| ] | |
| configs -= [ "//common-mk:use_thin_archive" ] | |
| libs = [] | |
| install_path = "lib" | |
| if (use.tpm && !use.test) { | |
| sources += [ "tpm_executor_tpm1_impl.cc" ] | |
| libs += [ "tpms" ] | |
| } | |
| if (use.test) { | |
| # To link with tpm2 library. | |
| configs += [ "//common-mk:test" ] | |
| } | |
| if (use.tpm2 || use.test) { | |
| sources += [ | |
| "pinweaver_eal.cc", | |
| "tpm_executor_tpm2_impl.cc", | |
| "tpm_vendor_cmd_pinweaver.cc", | |
| ] | |
| libs += [ | |
| "hwsec-foundation", | |
| "pinweaver", | |
| "tpm2", | |
| ] | |
| } | |
| if (use.ti50_onboard && !use.test) { | |
| sources += [ "tpm_executor_ti50_impl.cc" ] | |
| } | |
| } | |
| executable("tpm2-simulator") { | |
| sources = [ | |
| "main.cc", | |
| "simulator.cc", | |
| "tpm_nvchip_utils.cc", | |
| ] | |
| libs = [] | |
| configs += [ ":target_defaults" ] | |
| install_path = "bin" | |
| pkg_deps = [ "libminijail" ] | |
| deps = [ | |
| ":libtpm2_simulator_executor", | |
| ":tpm_executor_version_library", | |
| ] | |
| } | |
| executable("tpm2-simulator-init") { | |
| sources = [ "simulator-init.cc" ] | |
| configs += [ ":target_defaults" ] | |
| install_path = "bin" | |
| pkg_deps = [ "vboot_host" ] | |
| } | |
| executable("tpm2-simulator-stop") { | |
| sources = [ "simulator-stop.cc" ] | |
| configs += [ ":target_defaults" ] | |
| install_path = "bin" | |
| pkg_deps = [ "vboot_host" ] | |
| } | |
| install_config("install_init_scripts") { | |
| sources = [ "init/tpm2-simulator.conf" ] | |
| install_path = "upstart" | |
| } | |
| # Install seccomp policy for cryptohome-proxy | |
| install_config("install_seccomp_policy") { | |
| sources = [ "seccomp/tpm2-simulator-" + getenv("ARCH") + ".policy" ] | |
| install_path = "seccomp_policy" | |
| outputs = [ "tpm2-simulator.policy" ] | |
| } | |
| install_config("install_tmpfiles_config") { | |
| sources = [ "tmpfiles.d/tpm2-simulator.conf" ] | |
| install_path = "tmpfilesd" | |
| } |