Repository Public Apache-2.0
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | SOFTWARE & RESEARCH4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : SPB Quantum Crypto8# File : scripts/gen-header.sh9# Module : Scripts10# Repository : https://git.spboucher.ai/spb-quantum-crypto11# Project Website : https://pqce.spboucher.ai12# Created : 2026-12-0313# Last Modified : 2026-12-0314#15# Author : Simon-Pierre Boucher16# Position : Professor of Finance17# Institution : Université du Québec en Outaouais (UQO)18# Organization : SP Boucher19# Website : https://spboucher.ai20# Git : https://git.spboucher.ai21#22# Preferred Contact: contact@spboucher.ai23# Development : dev@spboucher.ai24# Support : support@spboucher.ai25# Security/Admin : admin@spboucher.ai26#27# Copyright (c) 202628# Simon-Pierre Boucher29# All rights reserved where applicable. This file is governed by the30# applicable project license, copyright notices and relevant law.31# Existing third-party rights and notices remain unaffected.32#33# License : Apache-2.034#35# Do not embed credentials, private keys, access tokens,36# certificates or confidential personal information.37#38# =============================================================================39# END OF SP BOUCHER SOURCE HEADER40# =============================================================================4142# Regenerates include/spb_pqc.h from the FFI crate with cbindgen.43# With --check, fails if the committed header is out of date.44set -euo pipefail45cd "$(dirname "$0")/.."46command -v cbindgen >/dev/null || { echo "cbindgen not found (cargo install cbindgen --version 0.29.4 --locked)" >&2; exit 1; }47tmp="$(mktemp)"48trap 'rm -f "$tmp"' EXIT49cbindgen --quiet --config crates/spb-pqc-ffi/cbindgen.toml --crate spb-pqc-ffi --output "$tmp" crates/spb-pqc-ffi50if [ "${1:-}" = "--check" ]; then51 if ! diff -u include/spb_pqc.h "$tmp"; then52 echo "include/spb_pqc.h is out of date: run ./scripts/gen-header.sh" >&253 exit 154 fi55 echo "include/spb_pqc.h is up to date"56else57 cp "$tmp" include/spb_pqc.h58 echo "wrote include/spb_pqc.h"59fi60