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
This commit is contained in:
gullradriel
2026-02-15 22:29:26 +01:00
committed by GitHub
parent 94d46036f8
commit 95eafeb812
17 changed files with 240 additions and 24 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
$ErrorActionPreference = "Stop"
$Ver = "18.1.8"
$Root = Resolve-Path (Join-Path $PSScriptRoot "..")
$Bin = Join-Path $Root "tools\clang-format-bin\$Ver\windows-x86_64\clang-format.exe"
if (-not (Test-Path $Bin)) {
throw "Missing clang-format binary: $Bin"
}
& $Bin @args
exit $LASTEXITCODE
+36
View File
@@ -0,0 +1,36 @@
#!/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" "$@"
+73
View File
@@ -0,0 +1,73 @@
#!/usr/bin/env bash
set -euo pipefail
VER="18.1.8"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DEST="$ROOT/tools/clang-format-bin/$VER"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
base="https://github.com/llvm/llvm-project/releases/download/llvmorg-${VER}"
# Archives you said you want to support
LINUX_X86="clang+llvm-${VER}-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
LINUX_A64="clang+llvm-${VER}-aarch64-linux-gnu.tar.xz"
MAC_A64="clang+llvm-${VER}-arm64-apple-macos11.tar.xz"
WIN_X86="clang+llvm-${VER}-x86_64-pc-windows-msvc.tar.xz"
mkdir -p \
"$DEST/linux-x86_64" \
"$DEST/linux-arm64" \
"$DEST/macos-arm64" \
"$DEST/windows-x86_64"
fetch_and_extract() {
local archive="$1"
local outpath="$2"
local inner="$3"
echo "Downloading $archive"
curl -fsSL "$base/$archive" -o "$TMP/$archive"
echo "Extracting $inner"
tar -xf "$TMP/$archive" -C "$TMP"
# The tarball extracts into a single top-level directory; find it
local topdir
topdir="$(find "$TMP" -maxdepth 1 -type d -name "clang+llvm-${VER}-*" | head -n 1)"
if [[ -z "${topdir:-}" ]]; then
echo "Could not locate extracted directory for $archive" >&2
exit 4
fi
if [[ ! -f "$topdir/$inner" ]]; then
echo "Missing expected file inside archive: $inner" >&2
exit 5
fi
cp "$topdir/$inner" "$outpath"
rm -rf "$topdir"
}
# Linux x86_64 -> clang-format
fetch_and_extract "$LINUX_X86" "$DEST/linux-x86_64/clang-format" "bin/clang-format"
chmod +x "$DEST/linux-x86_64/clang-format"
# Linux arm64 -> clang-format
fetch_and_extract "$LINUX_A64" "$DEST/linux-arm64/clang-format" "bin/clang-format"
chmod +x "$DEST/linux-arm64/clang-format"
# macOS arm64 -> clang-format
fetch_and_extract "$MAC_A64" "$DEST/macos-arm64/clang-format" "bin/clang-format"
chmod +x "$DEST/macos-arm64/clang-format"
# Windows x86_64 -> clang-format.exe
fetch_and_extract "$WIN_X86" "$DEST/windows-x86_64/clang-format.exe" "bin/clang-format.exe"
echo
echo "Done. Installed pinned clang-format binaries under:"
echo " $DEST"
echo
echo "Verify:"
"$ROOT/tools/clang-format" --version || true
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
VER="18.1.8"
X86_DEST="clang-format-bin/${VER}/linux-x86_64/lib"
ARM_DEST="clang-format-bin/${VER}/linux-arm64/lib"
mkdir -p "$X86_DEST" "$ARM_DEST"
docker run --rm \
--platform linux/amd64 \
-v "$PWD":/repo \
ubuntu:18.04 \
bash -lc "
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends ca-certificates dpkg-dev curl
mkdir -p /tmp/dl /tmp/t
cd /tmp/dl
echo '[*] amd64: download + extract libtinfo5'
apt-get download libtinfo5
rm -rf /tmp/t && mkdir -p /tmp/t
dpkg-deb -x /tmp/dl/libtinfo5_*_amd64.deb /tmp/t
cp -av /tmp/t/lib/x86_64-linux-gnu/libtinfo.so.5* /repo/${X86_DEST}/
echo '[*] arm64: download libtinfo5 .deb directly + extract'
# This is the Ubuntu 18.04 (bionic-updates) arm64 libtinfo5 package matching the amd64 one above.
ARM_DEB='libtinfo5_6.1-1ubuntu1.18.04.1_arm64.deb'
ARM_URL='http://ports.ubuntu.com/ubuntu-ports/pool/main/n/ncurses/'\"\$ARM_DEB\"
curl -fsSL \"\$ARM_URL\" -o \"/tmp/dl/\$ARM_DEB\"
rm -rf /tmp/t && mkdir -p /tmp/t
dpkg-deb -x \"/tmp/dl/\$ARM_DEB\" /tmp/t
cp -av /tmp/t/lib/aarch64-linux-gnu/libtinfo.so.5* /repo/${ARM_DEST}/
echo
echo '[*] Done. Repo now contains:'
ls -la /repo/${X86_DEST} || true
ls -la /repo/${ARM_DEST} || true
"