#!/usr/bin/env bash set -euo pipefail DIR="$(cd -- "$(dirname -- "$0")" && pwd)" if ! XCB=$(pkg-config --cflags --libs xcb xcb-icccm 2>/dev/null); then echo "Error: lib-xcb not found. Please install lib-xcb." >&2 exit 1 fi mkdir -p "$DIR/build" # shellcheck disable=SC2086 gcc -shared -fPIC -Wall -Wextra -o "$DIR/build/X-kutu.so" "$DIR/src/c/X-kutu.c" $XCB if [ ! -f "$DIR/build/X-kutu.so" ]; then echo "Error: compilation failed." >&2 exit 1 else echo "Success: $DIR/build/X-kutu.so is compiled." fi for f in "$DIR/bin/"* "$DIR/src/shell/"*; do chmod +x "$f" || { echo "Error: Failed to chmod $f" >&2 exit 1 } done echo -e "\e[32mAll done! Build successful.\e[0m"