fluxa-core/docs/building.md
KhooLy 894ca2c81f feat: companion server, FFI cleanup, and pre-release hardening
- Add fluxa-streaming-engine companion server (torrent start/stop,
  ffmpeg transcode/probe, OAuth token exchange) for the web build
- Add SSRF guard restricting transcode/probe url param to http(s)
  loopback hosts, blocking file:// and remote-host abuse via ffmpeg
- Add src/ffi.rs string-routed RPC dispatcher and wasm bindings
- Add headless engine profile module and several FFI surface
  additions (scrobble plans, episode navigation, collections import/export)
- Remove dead runtime::msg/update scaffolding and addon_transport trait
- Remove fluxa_play.rs dev scratch binary (hardcoded scraper, not
  part of the product)
- Reorder dv_rewrite.rs so implementation precedes its test module;
  strip decorative section dividers
- Add docs/, fuzz/ targets, and a rewritten README
- Fix .gitignore to cover fluxa-streaming-engine/target
2026-06-17 20:01:42 +03:00

2.5 KiB

Building

Features

Feature What it enables
native (default) JNI bindings, Dolby Vision RPU, UniFFI Kotlin bindings
uniffi-bindings UniFFI runtime support (pulled in by native)
uniffi-cli Adds the uniffi-bindgen binary for generating Kotlin/Swift source
wasm wasm-bindgen exports for webOS
fuzzing Enables fuzz targets

Common commands

# default build (native features — what Android uses)
cargo build

# run the test suite (~190 tests, fast)
cargo test --lib

# check the webOS/WASM path compiles
cargo check --no-default-features --features wasm

# generate UniFFI Kotlin bindings
cargo run --bin uniffi-bindgen --features uniffi-cli -- generate \
    --library target/debug/libfluxa_core.so \
    --language kotlin \
    --out-dir <output-dir>

# release build (LTO + strip, used for Android .so)
cargo build --release

Android cross-compilation

Install targets first:

rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android

Then build for each ABI, pointing to the Android NDK toolchain:

cargo build --release --target aarch64-linux-android
cargo build --release --target armv7-linux-androideabi
cargo build --release --target x86_64-linux-android

The Android project (Fluxa) picks up the resulting .so files from target/<abi>/release/libfluxa_core.so.

WASM warnings are expected

Under --no-default-features --features wasm, roughly 240 "never used" warnings appear. This is correct: most of the crate is Android-only logic with no core_invoke route and no WASM wrapper. Don't add blanket #[allow(dead_code)] to silence them — they accurately show which functions are Android-only.

Under the default native build there are no warnings, because bindings/jni.rs uses almost every domain function.

Panic policy

The release profile keeps panic = "unwind". The JNI boundary in bindings/jni.rs and ffi.rs::core_invoke both use catch_unwind so a panic in domain logic returns a safe null/error instead of aborting the host process. Switching to panic = "abort" would silently defeat this.

fluxa-streaming-engine

The companion crate at fluxa-streaming-engine/ builds independently:

cd fluxa-streaming-engine
cargo build                          # native features (tokio, axum, librqbit, jni)
cargo build --bin torrent_serve      # local torrent HTTP proxy
cargo build --bin companion_server   # fluxa-web's local companion process