Files
cthulhu/build-local.sh
Hunter Jozwiak 04c79f2e0f Implement AT-SPI selection bridging groundwork
Add the document selection adapter, integrate it through script utilities and major callers, and package the clipboard fallback work that was needed during manual testing on Wayland.

Also include a handoff note for the still-open browser link-selection issue so other developers can continue from the current branch state without reconstructing the debug trail.
2026-04-09 05:22:00 -04:00

110 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
#
# Build script for Cthulhu screen reader using Meson build system
# This script builds and installs Cthulhu locally to ~/.local
#
set -e # Exit on error
echo "Cthulhu Meson Local Build Script"
echo "Building and installing Cthulhu to ~/.local"
echo "================================================"
# Check if we're in the right directory
if [[ ! -f "meson.build" ]] || [[ ! -f "src/cthulhu/cthulhu.py" ]]; then
echo "Error: This script must be run from the Cthulhu source directory"
exit 1
fi
# Check for required dependencies
echo "Checking dependencies..."
for cmd in meson ninja python3; do
if ! command -v "$cmd" &> /dev/null; then
echo "Error: $cmd is not installed"
echo "Please install: meson ninja python"
exit 1
fi
done
if ! python3 -c "import tomlkit" 2>/dev/null; then
echo "Error: Python module tomlkit is not installed"
echo "Please install: python-tomlkit"
exit 1
fi
getPythonSiteDir() {
python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")'
}
removeExistingLocalInstall() {
local pythonSite packageDir binPath desktopFile manPage
pythonSite="$HOME/.local/lib/python$(getPythonSiteDir)/site-packages"
packageDir="$pythonSite/cthulhu"
binPath="$HOME/.local/bin/cthulhu"
desktopFile="$HOME/.local/share/applications/cthulhu.desktop"
manPage="$HOME/.local/share/man/man1/cthulhu.1"
echo "Removing existing local installation targets..."
rm -f "$binPath"
rm -rf "$packageDir"
rm -f "$desktopFile"
rm -f "$manPage"
}
# Check for optional dependencies
missingOptional=()
if ! python3 -c "import gi" 2>/dev/null; then
missingOptional+=("python-gi")
fi
if [[ ${#missingOptional[@]} -gt 0 ]]; then
echo "Warning: Optional dependencies missing: ${missingOptional[*]}"
echo "Cthulhu may not function properly without these."
fi
# Clean any cached bytecode
echo "Removing __pycache__ directories..."
find . -type d -name "__pycache__" -prune -exec rm -rf {} +
# Clean any existing build directory
if [[ -d "_build" ]]; then
echo "Removing existing build directory..."
rm -rf _build
fi
# Setup Meson build
echo "Setting up Meson build..."
meson setup _build --prefix="$HOME/.local" --buildtype=debugoptimized
# Build
echo "Building Cthulhu..."
meson compile -C _build
# Install
echo "Installing Cthulhu to ~/.local..."
removeExistingLocalInstall
meson install -C _build
# Update desktop database and icon cache
if command -v update-desktop-database &> /dev/null; then
echo "Updating desktop database..."
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
fi
if command -v gtk-update-icon-cache &> /dev/null; then
echo "Updating icon cache..."
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
fi
echo
echo "Build completed successfully!"
echo
echo "To run Cthulhu:"
echo " ~/.local/bin/cthulhu"
echo
echo "To run Cthulhu setup:"
echo " ~/.local/bin/cthulhu -s"
echo
echo "Build artifacts are in: _build/"
echo "To clean build artifacts, run: rm -rf _build"