Home/docs/project/Building and dependencies

Building and dependencies

Building and Dependencies

liberika's Rust code builds directly with cargo. Native dependencies such as FFmpeg, dav1d, libass, and HarfBuzz are fetched as source, built inside third_party/, and managed by xtask deps. The build scripts keep CI output consistent with local builds.

Prerequisites#

TargetTools
macOS / iOS / tvOSXcode Command Line Tools; nasm, meson, ninja, and pkg-config (from Homebrew).
WindowsInside MSYS2 (UCRT64): make, tar, pkgconf, perl, and zip. Also nasm; Python meson and ninja; and LLVM (set LIBCLANG_PATH to its bin/ directory).
AndroidAndroid SDK and NDK (r29, API 26).
OpenHarmonyDevEco Studio with the matching SDK / NDK.

Native dependencies#

Dependencies for release targets are fetched from upstream source at pinned versions, and the build scripts apply the patches in third_party/patches/.

ComponentVersionDescription
FFmpeg8.1.2Wrapped in crates/erika_ffmpeg_sys. Android uses the patchset erika-android-mediacodec-v4.
dav1d1.5.1AV1 decoding.
libass0.17.5Subtitle rendering.
HarfBuzz14.2.1Text shaping.
FreeType2.14.3Font rasterization.
FriBidi1.0.16Bidirectional text.
zlib1.3.2FFmpeg dependency.

Fetch and build results stay in the workspace's third_party/ directory; nothing is installed into system directories:

third_party/cache     # Downloaded source archives
third_party/src       # Extracted source trees
third_party/build     # Build directories, split by target / profile
third_party/dist      # Output prefixes, split by target / profile

xtask deps#

Full build workflow

cargo run -p xtask -- deps plan                 # Print the dependency plan
cargo run -p xtask -- deps fetch                # Download and extract sources
cargo run -p xtask -- deps build --all          # Build the host target
OptionValuesDefault
--profilelgpl / gpl-fulllgpl
--ffmpegFFmpeg format set (full, common, slim or slim,<group>)full
--crtWindows C runtime (dynamic / static)dynamic
--targetSee the target table belowhost
--forceForce a rebuild of native dependenciesOff; completed outputs are reused by default
--allAlso builds the subtitle stack: libass + FreeType + HarfBuzz + FriBidi (fetch downloads the sources of all four as well)Builds only the video stack
--jobsParallelismAutomatic

The two profiles differ in FFmpeg's configure flags. lgpl disables GPL components, disables networking, and enables only the demuxers, parsers, and decoders the playback core needs. gpl-full also enables the GPL components. The default, lgpl, meets release requirements.

Build results store a build marker per target and profile, and FFmpeg and dav1d check the version, patches, and build options against it. After you change xtask/src/main.rs or third_party/patches/, run deps build --force to trigger a rebuild.

Windows / MSVC#

Since 0.3.8, host on Windows x64 and ARM64 resolves to the matching MSVC target, so the dependency directory matches a cargo build without --target. Name a target explicitly when you need another architecture. For x64:

PowerShell

cargo run -p xtask -- deps build --all --profile lgpl --target x86_64-pc-windows-msvc
$env:ERIKA_NATIVE_TARGET = "x86_64-pc-windows-msvc"
cargo build --locked -p erika_capi --target x86_64-pc-windows-msvc

For ARM64, use aarch64-pc-windows-msvc. The default is the DLL CRT (/MD); omit --crt static unless Rust uses -C target-feature=+crt-static. Static CRT dependencies are stored separately under lgpl-crt-static.

Targets#

TargetPlatform
x86_64-unknown-linux-gnu / aarch64-unknown-linux-gnuLinux (GNU, native build).
hostThe current machine.
aarch64-apple-darwin / x86_64-apple-darwinmacOS.
aarch64-apple-iosiOS device.
aarch64-apple-ios-sim / x86_64-apple-iosiOS simulator.
aarch64-apple-tvos / aarch64-apple-tvos-sim / x86_64-apple-tvostvOS.
x86_64-pc-windows-msvc / aarch64-pc-windows-msvcWindows.
aarch64-linux-android / armv7-linux-androideabi / x86_64-linux-android / i686-linux-androidAndroid.
aarch64-unknown-linux-ohosOpenHarmony.

macOS artifacts are built with MACOSX_DEPLOYMENT_TARGET=11.0; the script fills in the default if it is unset. At release time, the arm64 and x86_64 outputs for Apple platforms are merged into universal binaries; see Releases and artifacts.

Workspace build#

cargo build --workspace
cargo test --workspace

The workspace contains four library crates: erika (the kernel), erika_capi (the C ABI), and erika_plugin (plugin ABI), erika_ffmpeg_sys (the FFmpeg bindings), plus xtask and more than 20 examples. Each example is a minimal program that exercises one specific path:

macOS desktop smoke test

cargo run -p macos_native_demo -- --smoke-seconds 3 /path/to/video.mp4

macos_native_demo is a complete end-to-end Presenter demo: open, play, Metal rendering, and system media controls. The other examples are divided up by name. capi_smoke covers the main C ABI call paths, and playback_tick / player_tick cover the scheduling loops of the two entry points, play and pull.

Linux release and source builds#

Since 0.3.7 there are four Linux ZIPs: x64 / ARM64 × bundled / system, all based on Ubuntu 22.04 / glibc 2.35. Release builds need a native GNU/Linux host of the matching CPU, Rust 1.92+, Meson 1.8.5 and the development tools listed in CI; the old distro Rust/Meson are insufficient. Run the modes separately:

shell

ERIKA_LINUX_DEPENDENCIES=bundled bash scripts/build_linux_release.sh

ERIKA_LINUX_DEPENDENCIES=system bash scripts/build_linux_release.sh

The script prepares a pinned FFmpeg 8 SDK and build headers. Outputs are isolated in target/linux-<mode>/<triple>/release, with ZIPs in dist/. bundled embeds media dependencies; system requires matching FFmpeg 8 shared libraries on the host. Both need system audio and graphics drivers. The Ubuntu 26.04 system-library path remains available: run scripts/build_linux_libass.sh, then cargo build --locked --release -p erika_capi -p linux_native_demo.

Rust / C / Flutter · HAL patch · PIC

The codecs and license of the system FFmpeg depend on how your distribution built it; setting the lgpl profile does not change system libraries.

liberika v0.3.8 Section Project License MPL-2.0