Linux / Astra Linux SE 1.8 — portable build (VirtualBox)
=======================================================

Canonical entry point: ./build.sh
Full guide: docs/linux-build.md

When sources are mounted from Windows via VirtualBox shared folder
(/media/sf_ALPs/...), do NOT put .venv or build/dist inside sf_*.
Use a local venv and ALPS_BUILD_DIR on the Linux disk.

Quick path (matches ALPS prompt)
--------------------------------

# 0. Check
python3 --version          # expect 3.11 on Astra SE 1.8
ldd --version              # glibc ~2.36
ls -la /media/sf_ALPs/alps-v/alps-v/build.sh

# 1. Fix CRLF if needed + executable bit
sed -i 's/\r$//' /media/sf_ALPs/alps-v/alps-v/build.sh
chmod +x /media/sf_ALPs/alps-v/alps-v/build.sh

# 2. venv on LOCAL disk (build.sh creates it automatically; optional manual setup)
# export ALPS_VENV=~/.venv-alps-v
# RTSP streams need opencv-python (already in requirements.txt).
# From a VirtualBox guest the camera IP must be reachable (bridged networking
# or host route). If the widget shows "Cannot open stream", test:
#   ffplay -rtsp_transport tcp 'rtsp://…'
# ALP-V tries RTSP over TCP then UDP automatically.

# 3. Build
cd /media/sf_ALPs/alps-v/alps-v
export ALPS_VENV=~/.venv-alps-v
export ALPS_BUILD_DIR=~/ALPS-v-build
./build.sh

# 4. Smoke-test
~/ALPS-v-build/dist/ALP-V-*-linux-portable/ALP-V

Expected output
---------------

  ~/ALPS-v-build/dist/ALP-V-<version>-linux-portable/
  ~/ALPS-v-build/dist/ALP-V-<version>-linux-portable.tar.gz

Version comes from the VERSION file in the repo root (override: ./build.sh --version 1.0.1).

Options
-------

  ./build.sh --no-clean
  ./build.sh --onefile
  ./build.sh --run
  ./build.sh --help

If source is under /media/sf_* and ALPS_BUILD_DIR is unset, build.sh
defaults to ~/ALPS-v-build automatically.

System packages (if GUI / venv fails)
-------------------------------------

  sudo apt-get update
  sudo apt-get install -y \
    python3 python3-venv python3-pip \
    libxcb-cursor0 libxkbcommon-x11-0 libegl1 libgl1 \
    libxcb-xinerama0 libdbus-1-3 fonts-dejavu-core

On Astra SE 1.8 enable main + extended repositories if python3-venv is missing.

Optional user install (menu + MIME)
-----------------------------------

After a successful build, optional user install (menu + MIME, no root):

  PREFIX=~/ALPS-v-build/dist/ALP-V-*-linux-portable APP_NAME=ALP-V ./scripts/install_linux.sh

Also see: scripts/build_linux.sh (older helper; prefer ./build.sh).
