feat: promote linux native audio path

This commit is contained in:
Edison Jwa
2026-05-25 17:42:06 +09:00
parent c19de3a370
commit a2d686d9d0
73 changed files with 26156 additions and 467 deletions
+8 -1
View File
@@ -12,6 +12,7 @@ STAGE_DIR="$(mktemp -d "${TMPDIR:-/tmp}/chanora-linux-deb.XXXXXX")"
PKG_ROOT="$STAGE_DIR/package"
INSTALL_ROOT="$PKG_ROOT/opt/chanora"
ICON_SRC="$APP_DIR/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png"
ONNXRUNTIME_SHARED_LIB="${CHANORA_ONNXRUNTIME_SHARED_LIB:-}"
cleanup() {
rm -rf "$STAGE_DIR"
@@ -67,6 +68,9 @@ main() {
require_cmd dpkg-deb
require_file "$PUBSPEC" "Flutter pubspec"
require_file "$ICON_SRC" "launcher icon"
if [[ -n "$ONNXRUNTIME_SHARED_LIB" ]]; then
require_file "$ONNXRUNTIME_SHARED_LIB" "Linux ONNX Runtime shared library"
fi
if [[ ! -f "$OBOE_DIR/Cargo.toml" ]]; then
cat >&2 <<EOF
@@ -106,6 +110,9 @@ EOF
local bundle_dir="$APP_DIR/build/linux/$flutter_arch/release/bundle"
local app_binary="$bundle_dir/chanora_flutter"
require_file "$app_binary" "Linux release bundle binary"
if [[ -n "$ONNXRUNTIME_SHARED_LIB" ]]; then
require_file "$bundle_dir/lib/libonnxruntime.so" "bundled Linux ONNX Runtime shared library"
fi
mkdir -p \
"$PKG_ROOT/DEBIAN" \
@@ -123,7 +130,7 @@ Section: net
Priority: optional
Architecture: $arch
Maintainer: Chanora Project Contributors
Depends: libasound2, libgtk-3-0, libpulse0, libsdl2-2.0-0, libstdc++6
Depends: libasound2, libgtk-3-0, libpipewire-0.3-0, libpulse0, libstdc++6
Description: Chanora voice client for TeamSpeak-compatible servers
Chanora is a Flutter + Rust voice client for TeamSpeak-compatible servers.
EOF
+70 -7
View File
@@ -6,7 +6,9 @@
# - Rust stable with x86_64-unknown-linux-gnu target
# - Flutter 3.41.9+ stable on PATH
# - CMake 3.13+, pkg-config, GTK3 dev headers, clang
# - System libopus dev package (libopus-dev / opus-devel)
# - System libopus development package (libopus-dev / opus-devel)
# - Optional: CHANORA_ONNXRUNTIME_SHARED_LIB=/abs/path/libonnxruntime.so
# to bundle ONNX Runtime into the Linux app under bundle/lib/
# - flutter_rust_bridge_codegen 2.12.0 (only if regenerating bindings)
#
# Usage (from the repo root ~/chanora):
@@ -26,6 +28,7 @@ VERSION="v0.2.0-beta.1"
SKIP_RUST=0
REGEN=0
TARGET="x86_64-unknown-linux-gnu"
ONNXRUNTIME_SHARED_LIB="${CHANORA_ONNXRUNTIME_SHARED_LIB:-}"
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -48,6 +51,7 @@ echo "Repo root : $REPO_ROOT"
echo "Version : $VERSION"
echo "Target : $TARGET"
echo "Build Rust: $([ "$SKIP_RUST" = 1 ] && echo skip || echo yes)"
echo "Bundle ORT: ${ONNXRUNTIME_SHARED_LIB:-<not set>}"
bar
# ---------- 1. Verify toolchain ----------
@@ -66,9 +70,54 @@ if ! pkg-config --exists gtk+-3.0 2>/dev/null; then
exit 1
fi
# Verify libopus dev headers (needed by audiopus_sys to link)
# Verify libopus development files. tsclientlib's audio feature pulls in
# audiopus, which links libopus for Linux builds/tests.
if ! pkg-config --exists opus 2>/dev/null; then
echo " ERROR: opus dev headers not found. Install libopus-dev (Debian/Ubuntu) or opus-devel (Fedora)." >&2
echo " ERROR: opus pkg-config metadata not found." >&2
echo " Install the Opus development package (libopus-dev on" >&2
echo " Debian/Ubuntu or opus-devel on Fedora)." >&2
exit 1
fi
printf " %-12s : %s\n" "opus" "$(pkg-config --modversion opus)"
# Verify the exact PipeWire pkg-config modules the primary Linux voice backend uses.
# `pipewire-0.3` is not the module name exposed by distro packages; the crates
# resolve `libpipewire-0.3` and `libspa-0.2`.
if ! pkg-config --exists libpipewire-0.3 2>/dev/null; then
echo " ERROR: libpipewire-0.3 pkg-config metadata not found." >&2
echo " Install PipeWire development headers (for example pipewire-devel" >&2
echo " on Fedora or libpipewire-0.3-dev on Debian/Ubuntu)." >&2
exit 1
fi
if ! pkg-config --exists libspa-0.2 2>/dev/null; then
echo " ERROR: libspa-0.2 pkg-config metadata not found." >&2
echo " Install the PipeWire SPA development headers packaged with" >&2
echo " your distro's PipeWire development package." >&2
exit 1
fi
printf " %-12s : %s\n" "libpipewire" "$(pkg-config --modversion libpipewire-0.3)"
printf " %-12s : %s\n" "libspa" "$(pkg-config --modversion libspa-0.2)"
# Verify PulseAudio development files used by the fallback Linux voice backend.
if ! pkg-config --exists libpulse 2>/dev/null; then
echo " ERROR: libpulse pkg-config metadata not found." >&2
echo " Install PulseAudio development headers (for example libpulse-dev" >&2
echo " on Debian/Ubuntu, pulseaudio-libs-devel on Fedora, or libpulse" >&2
echo " on Arch Linux)." >&2
exit 1
fi
if ! pkg-config --exists libpulse-simple 2>/dev/null; then
echo " ERROR: libpulse-simple pkg-config metadata not found." >&2
echo " Install PulseAudio simple API development headers." >&2
exit 1
fi
printf " %-12s : %s\n" "libpulse" "$(pkg-config --modversion libpulse)"
printf " %-12s : %s\n" "pulse-simple" "$(pkg-config --modversion libpulse-simple)"
# Verify the optional ONNX Runtime shared library when explicitly requested.
if [[ -n "$ONNXRUNTIME_SHARED_LIB" && ! -f "$ONNXRUNTIME_SHARED_LIB" ]]; then
echo " ERROR: CHANORA_ONNXRUNTIME_SHARED_LIB does not exist:" >&2
echo " $ONNXRUNTIME_SHARED_LIB" >&2
exit 1
fi
@@ -124,6 +173,7 @@ fi
# ---------- 5. flutter build linux --release ----------
echo "[5/6] flutter build linux --release"
cd "$FLUTTER_APP"
export CHANORA_BRIDGE_SHARED_LIB="$BRIDGE_SO"
flutter pub get
flutter build linux --release
@@ -134,12 +184,25 @@ if [[ ! -f "$EXE" ]]; then
exit 1
fi
# Copy the bridge .so into the bundle's lib/ directory so dart:ffi finds it.
mkdir -p "$BUNDLE_DIR/lib"
cp "$BRIDGE_SO" "$BUNDLE_DIR/lib/"
echo " Bundle dir : $BUNDLE_DIR"
echo " EXE : $EXE"
echo " Bridge .so : $BUNDLE_DIR/lib/libchanora_bridge.so"
if [[ ! -f "$BUNDLE_DIR/lib/libchanora_bridge.so" ]]; then
echo " ERROR: bridge shared library missing from Linux bundle:" >&2
echo " $BUNDLE_DIR/lib/libchanora_bridge.so" >&2
exit 1
fi
if [[ -n "$ONNXRUNTIME_SHARED_LIB" ]]; then
if [[ -f "$BUNDLE_DIR/lib/libonnxruntime.so" ]]; then
echo " ORT .so : $BUNDLE_DIR/lib/libonnxruntime.so"
else
echo " ERROR: ONNX Runtime bundle file missing after flutter build:" >&2
echo " $BUNDLE_DIR/lib/libonnxruntime.so" >&2
exit 1
fi
else
echo " ORT .so : not bundled (set CHANORA_ONNXRUNTIME_SHARED_LIB to include it)"
fi
# ---------- 6. Package the bundle ----------
echo "[6/6] Package release tarball"
@@ -162,4 +225,4 @@ echo " target/$TARGET/release/libchanora_bridge.so"
echo " Bundle dir:"
echo " $BUNDLE_DIR/"
echo " Tarball:"
echo " $TAR_PATH"
echo " $TAR_PATH"