| #!/bin/sh |
| # Copyright 2024 The Fuchsia Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| set -e |
| |
| readonly HEADER="src/tee/tee_internal_api/include/lib/tee_internal_api/tee_internal_api.h" |
| readonly GENERATED_BINDINGS="src/tee/tee_internal_api/src/binding.rs" |
| |
| if [[ ! -f $HEADER ]]; then |
| echo 'Please run this script from the root of the Fuchsia source tree.' |
| exit 1 |
| fi |
| |
| readonly RAW_LINES="// Copyright 2024 The Fuchsia Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // This file is automatically generated by src/tee/tee_internal_api/bindgen.sh. |
| |
| #![allow(dead_code)] |
| #![allow(non_camel_case_types)] |
| #![allow(non_snake_case)] |
| #![allow(non_upper_case_globals)] |
| #![allow(clippy::missing_safety_doc)] |
| |
| " |
| |
| case "$(uname -s -m)" in |
| "Linux x86_64") PREBUILT_PLATFORM="linux-x64" ;; |
| "Darwin x86_64") PREBUILT_PLATFORM="mac-x64" ;; |
| "Darwin arm64") PREBUILT_PLATFORM="mac-arm64" ;; |
| esac |
| |
| readonly BINDGEN_PATH="prebuilt/third_party/rust_bindgen/${PREBUILT_PLATFORM}/bindgen" |
| |
| ${BINDGEN_PATH} ${HEADER} \ |
| -o ${GENERATED_BINDINGS} \ |
| --no-layout-tests \ |
| --explicit-padding \ |
| --allowlist-function "TEE_.*" \ |
| --allowlist-function "TA_.*" \ |
| --allowlist-item "TEE_.*" \ |
| --raw-line "${RAW_LINES}" \ |
| --impl-debug \ |
| --with-derive-partialeq \ |
| --formatter none \ |
| -- \ |
| -target fuchsia-unknown-x86_64 \ |
| -I zircon/system/public/ |
| |
| scripts/fx format-code --files=${GENERATED_BINDINGS} |
| |