- src/video/: video_probe/video_get_info/video_transcode_start (FFmpeg, HAVE_FFMPEG) - chat_core/chat_msg: media_video флаг, chat_core_submit_media_message, транскод перед index - headless: команда attach с --video - chatgui: диалог 'Как видео' + прогресс транскода + sendVideoAttachment - FFmpeg в сборке (configure.ac, Makefile.am, chatgui CMake, build_nix.sh) - debug: категория DEBUG_CATEGORY_VIDEO
99 lines
2.8 KiB
Bash
Executable File
99 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# ============================================================================
|
|
# build_nix.sh — ChatGUI build (Linux / FreeBSD)
|
|
#
|
|
# ./build_nix.sh quick (incremental) build
|
|
# ./build_nix.sh --full "под ключ": deps + clean + configure + build
|
|
# ./build_nix.sh -jN parallel jobs
|
|
# ./build_nix.sh --asan build with AddressSanitizer
|
|
# ============================================================================
|
|
|
|
SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
BUILD_DIR="$SRC_DIR/build"
|
|
|
|
FULL=0
|
|
ASAN=0
|
|
JOBS=""
|
|
|
|
usage() {
|
|
echo "Usage: $0 [--full] [-jN] [--asan]"
|
|
echo " --full install deps + clean rebuild (all-in-one)"
|
|
echo " -jN parallel build jobs (default: CPU count)"
|
|
echo " --asan build with AddressSanitizer"
|
|
exit 0
|
|
}
|
|
|
|
for arg; do
|
|
case "$arg" in
|
|
--full) FULL=1 ;;
|
|
--asan) ASAN=1 ;;
|
|
-j*) JOBS="${arg#-j}" ;;
|
|
--jobs=*) JOBS="${arg#--jobs=}" ;;
|
|
-h|--help) usage ;;
|
|
*) echo "Unknown option: $arg" >&2; usage ;;
|
|
esac
|
|
done
|
|
|
|
OS_NAME="$(uname -s)"
|
|
case "$OS_NAME" in
|
|
Linux) OS_ID=linux; ;;
|
|
FreeBSD) OS_ID=bsd; ;;
|
|
*) echo "Unsupported OS: $OS_NAME (supported: Linux, FreeBSD)" >&2; exit 1 ;;
|
|
esac
|
|
|
|
if [ -z "$JOBS" ]; then
|
|
if [ "$OS_ID" = linux ]; then
|
|
JOBS="$(nproc)"
|
|
else
|
|
JOBS="$(sysctl -n hw.ncpu)"
|
|
fi
|
|
fi
|
|
|
|
install_deps() {
|
|
echo "[deps] installing build dependencies..."
|
|
if [ "$OS_ID" = linux ]; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake qt6-base-dev librlottie-dev zlib1g-dev libssl-dev \
|
|
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev
|
|
else
|
|
sudo pkg install -y cmake qt6-base rlottie openssl ffmpeg
|
|
fi
|
|
}
|
|
|
|
# Auto-detect FFmpeg (optional video transcoding). CMake finds it via pkg-config.
|
|
if command -v pkg-config >/dev/null 2>&1 && \
|
|
pkg-config --exists libavformat libavcodec libavutil libswscale libswresample 2>/dev/null; then
|
|
echo "[ffmpeg] detected — video transcoding enabled"
|
|
else
|
|
echo "[ffmpeg] not found — video transcoding disabled"
|
|
fi
|
|
|
|
SAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer -g"
|
|
if [ "$ASAN" -eq 1 ]; then
|
|
echo "[build] ASAN ENABLED"
|
|
CMAKE_ARGS=(-DCMAKE_C_FLAGS="$SAN_FLAGS" -DCMAKE_CXX_FLAGS="$SAN_FLAGS" -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address)
|
|
else
|
|
CMAKE_ARGS=()
|
|
fi
|
|
|
|
if [ "$FULL" -eq 1 ]; then
|
|
install_deps
|
|
echo "[build] clean rebuild..."
|
|
rm -rf "$BUILD_DIR"
|
|
fi
|
|
|
|
if [ ! -f "$BUILD_DIR/CMakeCache.txt" ] || [ "$ASAN" -eq 1 ]; then
|
|
cmake -S "$SRC_DIR" -B "$BUILD_DIR" "${CMAKE_ARGS[@]}"
|
|
fi
|
|
|
|
cmake --build "$BUILD_DIR" -j"$JOBS"
|
|
|
|
echo ""
|
|
if [ "$ASAN" -eq 1 ]; then
|
|
echo "OK. Run: ASAN_OPTIONS=detect_leaks=1:halt_on_error=0 $BUILD_DIR/vibechat"
|
|
else
|
|
echo "OK. Run: $BUILD_DIR/vibechat"
|
|
fi
|