| #!/usr/bin/env fuchsia-vendored-python | |
| # | |
| # Copyright 2024 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| from pathlib import Path | |
| from build.rust.bindgen import Bindgen | |
| FUCHSIA_DIR = Path(__file__).parent.parent.parent.parent.parent | |
| TEE_INTERNAL_API_DIR = ( | |
| FUCHSIA_DIR / "src" / "microfuchsia" / "tee" / "tee_internal_api" | |
| ) | |
| INPUT_FILE = ( | |
| TEE_INTERNAL_API_DIR | |
| / "include" | |
| / "lib" | |
| / "tee_internal_api" | |
| / "tee_internal_api.h" | |
| ) | |
| OUTPUT_FILE = TEE_INTERNAL_API_DIR / "src" / "binding.rs" | |
| RELATIVE_SCRIPT_PATH = Path(__file__).relative_to(FUCHSIA_DIR) | |
| RAW_LINES = f""" | |
| // This file is automatically generated by //{RELATIVE_SCRIPT_PATH}. | |
| """ | |
| bindgen = Bindgen() | |
| bindgen.raw_lines = RAW_LINES | |
| bindgen.include_dirs = ["zircon/system/public"] | |
| bindgen.std_impls = ["debug"] | |
| bindgen.std_derives = ["partialeq"] | |
| bindgen.function_allowlist = ["TEE_.*", "TA_.*"] | |
| bindgen.type_allowlist = ["TEE_.*"] | |
| bindgen.var_allowlist = ["TEE_.*"] | |
| bindgen.run(str(INPUT_FILE), str(OUTPUT_FILE)) |