#!/bin/bash set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" WAYLAND_SHELL="${WAYLAND_SHELL:-xdg-shell}" CLANG_QUERY="${CLANG_QUERY:-clang-query}" BUILD_DIR="${BUILD_DIR:-$SCRIPT_DIR/client/build}" case "$WAYLAND_SHELL" in xdg-shell) shell_ignore=shell_libdecor.c ;; libdecor) shell_ignore=shell_xdg.c ;; *) echo "Unknown Wayland shell: $WAYLAND_SHELL" exit 1 esac if ! command -v "$CLANG_QUERY" &> /dev/null; then echo "clang-query is not installed" exit 1 fi if [ ! -f "$BUILD_DIR/compile_commands.json" ]; then echo "compile_commands.json not found in $BUILD_DIR" echo 'Run cmake with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to enable' exit 1 fi tempdir="$(mktemp -d)" cleanup() { rm -rf "$tempdir" } trap cleanup EXIT sed '/EGL_VERSION_1_5/,$d' /usr/include/EGL/egl.h > "$tempdir/egl1.4.h" getCalls() { query="$1" dir="$2" command=(find "$dir" -name '*.c') if [ $# -gt 2 ]; then command+=(-not) shift 2 for exclude in "$@"; do command+=(-name "$exclude") done fi cat > "$tempdir/query" <