#!/usr/bin/env bash # Launch script for SolveSpace (native GTK3 CAD application). # Standalone: works without build.sh having been sourced first. set -euo pipefail INSTALL_DIR="/workspace/install" BIN="${INSTALL_DIR}/bin/solvespace" # --- Runtime environment --------------------------------------------------- # SolveSpace links against system libraries plus libslvs installed under # ${INSTALL_DIR}/lib; make sure the dynamic loader can find it. export LD_LIBRARY_PATH="${INSTALL_DIR}/lib:${INSTALL_DIR}/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}" # Shared data (icons, shaders, etc.) installed under the prefix. export XDG_DATA_DIRS="${INSTALL_DIR}/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" # Native GTK/ATK app: expose the AT-SPI accessibility tree via the GTK bridge. export NO_AT_BRIDGE=0 export GTK_A11Y="${GTK_A11Y:-atspi}" # Ensure a display is set (the pipeline manages Xvfb; do not start one). export DISPLAY="${DISPLAY:-:0}" # SolveSpace uses GTK's default GSettings-based resources indirectly through # the shared system schemas; compile any local schema dir if one exists. if command -v glib-compile-schemas >/dev/null 2>&1; then if [ -d "${INSTALL_DIR}/share/glib-2.0/schemas" ]; then glib-compile-schemas "${INSTALL_DIR}/share/glib-2.0/schemas" 2>/dev/null || true export GSETTINGS_SCHEMA_DIR="${INSTALL_DIR}/share/glib-2.0/schemas:${GSETTINGS_SCHEMA_DIR:-}" fi fi # Provide a writable XDG_RUNTIME_DIR if the environment's default is not owned # by the current user (avoids GTK/PulseAudio ownership warnings). if [ -z "${XDG_RUNTIME_DIR:-}" ] || [ ! -w "${XDG_RUNTIME_DIR:-/nonexistent}" ]; then RUNTIME_DIR="$(mktemp -d)" export XDG_RUNTIME_DIR="${RUNTIME_DIR}" chmod 700 "${XDG_RUNTIME_DIR}" fi exec "${BIN}" "$@"