#!/bin/bash # Build script for CutThenThink Lite set -e echo "Building CutThenThink Lite..." # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Detect OS OS="unknown" if [[ "$OSTYPE" == "linux-gnu"* ]]; then OS="linux" elif [[ "$OSTYPE" == "darwin"* ]]; then OS="macos" elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then OS="windows" fi echo -e "${GREEN}Detected OS: $OS${NC}" # Check dependencies if [ "$OS" == "linux" ]; then echo -e "${YELLOW}Checking Linux dependencies...${NC}" # Check if running as root if [ "$EUID" -ne 0 ]; then echo -e "${YELLOW}Note: Some dependencies may require sudo${NC}" fi # Check for required packages MISSING=() for pkg in libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf; do if ! dpkg -l | grep -q "$pkg"; then MISSING+=("$pkg") fi done if [ ${#MISSING[@]} -gt 0 ]; then echo -e "${RED}Missing dependencies: ${MISSING[*]}${NC}" echo -e "${YELLOW}Install them with:${NC}" echo "sudo apt-get install -y ${MISSING[*]}" exit 1 fi echo -e "${GREEN}All dependencies installed${NC}" fi # Check Node.js if ! command -v node &> /dev/null; then echo -e "${RED}Node.js is not installed${NC}" exit 1 fi # Check npm if ! command -v npm &> /dev/null; then echo -e "${RED}npm is not installed${NC}" exit 1 fi # Check Rust/Cargo if ! command -v cargo &> /dev/null; then echo -e "${RED}Rust/Cargo is not installed${NC}" echo -e "${YELLOW}Install from: https://rustup.rs/${NC}" exit 1 fi echo -e "${GREEN}Installing Node dependencies...${NC}" npm ci echo -e "${GREEN}Building frontend...${NC}" npm run build echo -e "${GREEN}Building Tauri application...${NC}" npm run tauri build echo -e "${GREEN}Build complete!${NC}" echo -e "Output directory: src-tauri/target/release/bundle/"