#!/bin/bash echo "Installing dependencies for img2pdf..." ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Check if Go is installed if ! command -v go &> /dev/null; then echo "Go is not installed. Please install Go first:" echo " - On Ubuntu/Debian: sudo apt install golang-go" echo " - On macOS: brew install go" echo " - On Windows: Download from https://golang.org/dl/" exit 1 fi # Check if we're in a git repository if ! git rev-parse --git-dir > /dev/null 2>&1; then echo "This is not a git repository. Initializing git..." git init fi # Install Go dependencies echo "Installing Go dependencies..." (cd "$ROOT_DIR" && go mod download) # Check for system-specific GUI dependencies case "$(uname -s)" in Linux*) echo "Checking for Linux GUI dependencies..." if command -v apt-get &> /dev/null; then echo "Detected Debian/Ubuntu system" echo "Installing required development packages..." echo "Please enter your sudo password when prompted:" sudo apt-get install -y libgl1-mesa-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libglu1-mesa-dev elif command -v dnf &> /dev/null; then echo "Detected Fedora system" echo "Installing required development packages..." echo "Please enter your sudo password when prompted:" sudo dnf install -y libX11-devel libXcursor-devel libXrandr-devel libXi-devel mesa-libGL-devel libXinerama-devel elif command -v pacman &> /dev/null; then echo "Detected Arch Linux system" echo "Installing required development packages..." echo "Please enter your sudo password when prompted:" sudo pacman -S --noconfirm libx11 libxcursor libxrandr libxi mesa libxinerama fi ;; Darwin*) echo "macOS detected - GUI dependencies should be handled by Xcode command line tools" if ! xcode-select -p &> /dev/null; then echo "Installing Xcode command line tools..." xcode-select --install fi ;; CYGWIN*|MINGW*|MSYS*) echo "Windows detected - make sure you have GCC/MinGW installed" ;; esac echo "Dependency installation complete!" echo "Run './scripts/build.sh' to build the application."