#!/bin/bash # ============================================================================ # Spotify Le 2 - Build Linux Client # ============================================================================ # This script compiles the Flutter app into a Linux executable # # Prerequisites: # 1. Flutter SDK installed # 2. clang, cmake, ninja-build, gtk3-devel # ============================================================================ echo "========================================" echo " SPOTIFY LE 2 - BUILD LINUX CLIENT" echo "========================================" echo "" # Check if Flutter is installed if ! command -v flutter &> /dev/null; then echo "[ERROR] Flutter is not installed!" echo "Please install Flutter from: https://docs.flutter.dev/get-started/install/linux" exit 1 fi echo "[1/6] Checking Flutter installation..." flutter --version if [ $? -ne 0 ]; then echo "[ERROR] Flutter check failed!" exit 1 fi echo "[OK] Flutter is ready!" echo "" echo "[2/6] Checking Flutter doctor..." flutter doctor -v echo "" echo "[3/6] Navigate to frontend directory..." cd frontend || exit 1 echo "" echo "[4/6] Installing dependencies..." flutter pub get if [ $? -ne 0 ]; then echo "[ERROR] Failed to install dependencies!" exit 1 fi echo "[OK] Dependencies installed!" echo "" echo "[5/6] Building Linux executable..." echo "This may take several minutes..." flutter build linux --release if [ $? -ne 0 ]; then echo "[ERROR] Build failed!" exit 1 fi echo "" echo "[6/6] Creating distribution package..." BUILD_DIR="build/linux/x64/release/bundle" DIST_DIR="dist/linux" VERSION="0.1.0" # Create distribution directory rm -rf "$DIST_DIR" mkdir -p "$DIST_DIR" # Copy executable and assets cp -r "$BUILD_DIR"/* "$DIST_DIR/" # Create README cat > "$DIST_DIR/README.txt" << EOF Spotify Le 2 - Linux Client Version: $VERSION To run the application: ./spotify_le_2 Make sure the backend server is running on http://localhost:8000 EOF chmod +x "$DIST_DIR/spotify_le_2" echo "[OK] Distribution package created!" echo "" echo "========================================" echo " BUILD COMPLETED SUCCESSFULLY!" echo "========================================" echo "" echo "Executable location: $DIST_DIR/spotify_le_2" echo "" echo "To run the application:" echo " 1. Make sure the backend is running" echo " 2. Execute: $DIST_DIR/spotify_le_2" echo ""