Files
oak-editor/tooling/install-deps.sh
T
Mike-Solar 05e42668cb build(ffmpeg): static GPL FFmpeg 8.0 via project script + FFMPEG_DIR
- tooling/ffmpeg/build-ffmpeg.sh builds release/8.0 static+PIC into
  .cache/ffmpeg: GPL/version3, every free-license external codec lib
  probed via pkg-config (enabled when present), per-OS hardware
  acceleration (VideoToolbox/AudioToolbox, VAAPI/VDPAU/libdrm,
  D3D11VA/DXVA2/MediaFoundation, nvenc when ffnvcodec exists)
- tooling/install-deps.sh installs those libraries on Homebrew / MSYS2
  UCRT64 / Debian-Ubuntu / Fedora / Arch; nothing in the build sudo's
- ffmpeg-next's own build feature is unusable (every crate-version to
  FFmpeg-release pairing is broken upstream: 9.0.0->FF9 AVCodec fields,
  8.1.0->FF8.1 new enum variants, 8.0.0->FF8 FF_PROFILE rename), so
  ffmpeg-next 9 + FFmpeg 8.x headers via FFMPEG_DIR it is
- new links-crate oakffmpeg-link emits the static FFmpeg's transitive
  link flags from its .pc files (cargo only propagates them from links
  crates, and rustc prunes the flags unless the rlib is referenced —
  hence the force_link statics)
- docs/build.md updated for the Rust workspace flow
2026-08-11 20:04:44 +08:00

94 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Oak Video Editor - Non-Linear Video Editor
# Copyright (C) 2026 Oak Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Installs the system dependencies of the Oak Rust workspace:
# the free-license external codec/filter libraries FFmpeg is configured
# with (see crates/oakcodec/Cargo.toml), plus the build tools. FFmpeg
# itself is built from source by cargo (ffmpeg-next `build` feature) and
# is NOT installed here.
#
# Supported: Homebrew (macOS), MSYS2 UCRT64 (Windows), Debian/Ubuntu,
# Fedora, Arch. Run it yourself — nothing in the build invokes it
# automatically (it needs sudo on Linux).
#
# Usage: tooling/install-deps.sh
set -euo pipefail
run() { echo "+ $*"; "$@"; }
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || -n "${MSYSTEM:-}" ]]; then
if [ "${MSYSTEM:-}" != "UCRT64" ]; then
echo "Please run this from the MSYS2 UCRT64 shell (MSYSTEM=$MSYSTEM)." >&2
exit 1
fi
run pacman -S --needed --noconfirm \
mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-pkgconf \
mingw-w64-ucrt-x86_64-nasm \
mingw-w64-ucrt-x86_64-x264 mingw-w64-ucrt-x86_64-x265 \
mingw-w64-ucrt-x86_64-dav1d mingw-w64-ucrt-x86_64-libvpx \
mingw-w64-ucrt-x86_64-openh264 mingw-w64-ucrt-x86_64-openjpeg2 \
mingw-w64-ucrt-x86_64-libtheora mingw-w64-ucrt-x86_64-libwebp \
mingw-w64-ucrt-x86_64-lame mingw-w64-ucrt-x86_64-opus \
mingw-w64-ucrt-x86_64-libvorbis mingw-w64-ucrt-x86_64-speex \
mingw-w64-ucrt-x86_64-snappy mingw-w64-ucrt-x86_64-libass \
mingw-w64-ucrt-x86_64-freetype mingw-w64-ucrt-x86_64-fribidi \
mingw-w64-ucrt-x86_64-fontconfig mingw-w64-ucrt-x86_64-gnutls
exit 0
fi
case "$(uname -s)" in
Darwin)
run brew install pkg-config nasm \
x264 x265 dav1d libvpx openh264 openjpeg libtheora libwebp \
lame opus libvorbis speex snappy libass freetype fribidi \
fontconfig gnutls
;;
Linux)
if command -v apt-get >/dev/null; then
run sudo apt-get update
run sudo apt-get install -y build-essential pkg-config nasm \
libx264-dev libx265-dev libdav1d-dev libvpx-dev \
libopenh264-dev libopenjp2-7-dev libtheora-dev libwebp-dev \
libmp3lame-dev libopus-dev libvorbis-dev libspeex-dev \
libsnappy-dev libass-dev libfreetype-dev libfribidi-dev \
libfontconfig-dev libgnutls28-dev
elif command -v dnf >/dev/null; then
run sudo dnf install -y gcc gcc-c++ pkgconf-pkg-config nasm \
x264-devel x265-devel dav1d-devel libvpx-devel \
openh264-devel openjpeg2-devel libtheora-devel libwebp-devel \
lame-devel opus-devel libvorbis-devel speex-devel \
snappy-devel libass-devel freetype-devel fribidi-devel \
fontconfig-devel gnutls-devel
elif command -v pacman >/dev/null; then
run sudo pacman -S --needed --noconfirm base-devel pkgconf nasm \
x264 x265 dav1d libvpx openh264 openjpeg2 libtheora libwebp \
lame opus libvorbis speex snappy libass freetype2 fribidi \
fontconfig gnutls
else
echo "Unsupported Linux distribution (need apt-get, dnf or pacman)." >&2
exit 1
fi
;;
*)
echo "Unsupported platform: $(uname -s)" >&2
exit 1
;;
esac
echo "Done. 'cargo build' now compiles FFmpeg 8.1 from source with these libraries."