Files
mayhem-firmware/tools/clang-format.sh
T
gullradriel 95eafeb812 fix clang format workflow, update hackrf submodule, fix subghzd compilation warning, remove flashsize.h (#2992)
* trying to fix clang format workflow
* try without docker repo, classic apt install
* find what installed clang format 18 version is
* removed auto generated flashsize
* comment on flashsize.h
* modified to use repo owned clang-format binaries
* code format for windows hosts
* add clang-format binaries for linux x86_64/arm64, macos-arm64, windows x86_64
* add helper script to download specific llvm clang-format version
* add helper to download missing libraries (use docker)
* use custom clang-format
* fix ui_subghzd.cpp:85:29: warning: narrowing conversion of 'this->ui::SubGhzDRecentEntryDetailView::cnt' from 'uint32_t' {aka 'long unsigned int'} to 'uint16_t' {aka 'short unsigned int'} [-Wnarrowing]
* remove auto generated file
* Update tools/clang-format.sh
* removed fallback
* updated hackrf submodule
2026-02-15 21:29:26 +00:00

37 lines
883 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
VER="18.1.8"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux) OS_ID="linux" ;;
Darwin) OS_ID="macos" ;;
*) echo "Unsupported OS: $OS" >&2; exit 2 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH_ID="x86_64" ;;
arm64|aarch64) ARCH_ID="arm64" ;;
*) echo "Unsupported arch: $ARCH" >&2; exit 2 ;;
esac
BIN="$ROOT/tools/clang-format-bin/$VER/$OS_ID-$ARCH_ID/clang-format"
if [[ ! -x "$BIN" ]]; then
echo "Missing clang-format binary: $BIN" >&2
exit 3
fi
# Fix Ubuntu-built clang-format runtime deps on Debian/Arch by vendoring needed libs
if [[ "$OS_ID" == "linux" ]]; then
LIBDIR="$ROOT/tools/clang-format-bin/$VER/$OS_ID-$ARCH_ID/lib"
if [[ -d "$LIBDIR" ]]; then
export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
fi
exec "$BIN" "$@"