mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-10-14 19:27:09 -04:00
Build the DirectAudio relay from source
The relay helper shipped as a prebuilt libdirectaudiorelay.so with no source in the repo. Its source (The412Banner/directaudio @ 3548a4a, the commit the bundled driver names in version.txt) now lives in tools/directaudio-relay, unmodified, and CI and build_local.sh compile it into jniLibs the way proot is built. It shares da_relay_proto.h with the PulseAudio sink, which is byte-identical to its own copy.
This commit is contained in:
1 parent
c636eea355
commit
056aa1d5c7
7 files changed
+1122
No files matched your search
@@ -6,6 +6,7 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- 'tools/aaudio-sink/**'
|
||||
- 'tools/directaudio-relay/**'
|
||||
- '.github/workflows/build-aaudio-sink.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -25,6 +26,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
tools/aaudio-sink/build.sh "$PWD/pa13" "$PWD/out"
|
||||
tools/directaudio-relay/build.sh "$PWD/out"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: audio-sink-modules
|
||||
|
||||
@@ -325,6 +325,11 @@ jobs:
|
||||
mv pulseaudio.tzst app/src/main/assets/pulseaudio.tzst
|
||||
tar --use-compress-program=unzstd -tf app/src/main/assets/pulseaudio.tzst | grep -c '\.so$'
|
||||
rm -rf pa-bundle sink-out
|
||||
- name: Build the DirectAudio relay
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
tools/directaudio-relay/build.sh app/src/main/jniLibs/arm64-v8a
|
||||
|
||||
- name: Cache proot
|
||||
id: proot
|
||||
|
||||
@@ -14,6 +14,7 @@ app/src/main/assets/linuxfs/
|
||||
app/src/main/jniLibs/arm64-v8a/libproot.so
|
||||
app/src/main/jniLibs/arm64-v8a/.proot-inputs
|
||||
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
||||
app/src/main/jniLibs/arm64-v8a/libdirectaudiorelay.so
|
||||
app/src/main/assets/droiddeck-esync/
|
||||
|
||||
# Kotlin compiler session files (build-tool state, never source).
|
||||
|
||||
Binary file not shown.
@@ -301,6 +301,7 @@ fi
|
||||
|
||||
sink_output="${staging_dir}/sink-out"
|
||||
"${repo_root}/tools/aaudio-sink/build.sh" "${pa_source}" "${sink_output}"
|
||||
"${repo_root}/tools/directaudio-relay/build.sh" "${repo_root}/app/src/main/jniLibs/arm64-v8a"
|
||||
# proot is rebuilt only when its sources (source.env, the patches, the build script) changed since
|
||||
# the libraries in jniLibs were built.
|
||||
proot_out="${repo_root}/app/src/main/jniLibs/arm64-v8a"
|
||||
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
OUTDIR=$1
|
||||
mkdir -p "$OUTDIR"
|
||||
: "${NDK:?set NDK to the Android NDK root}"
|
||||
API=28
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
REPO=$(cd "$HERE/../.." && pwd)
|
||||
case "$(uname -s):$(uname -m)" in
|
||||
Darwin:arm64) NDK_HOST=darwin-arm64 ;;
|
||||
Darwin:x86_64) NDK_HOST=darwin-x86_64 ;;
|
||||
Linux:x86_64) NDK_HOST=linux-x86_64 ;;
|
||||
Linux:aarch64|Linux:arm64) NDK_HOST=linux-aarch64 ;;
|
||||
*) echo "Unsupported build host: $(uname -s) $(uname -m)" >&2; exit 1 ;;
|
||||
esac
|
||||
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/$NDK_HOST/bin"
|
||||
if [[ ! -d "$TOOLCHAIN" && "$NDK_HOST" == darwin-arm64 && -d "$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin" ]]; then
|
||||
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin"
|
||||
fi
|
||||
if [[ ! -d "$TOOLCHAIN" && "$NDK_HOST" == linux-aarch64 && -d "$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" ]]; then
|
||||
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||
fi
|
||||
CC="$TOOLCHAIN/aarch64-linux-android${API}-clang"
|
||||
if [[ ! -x "$CC" ]]; then
|
||||
echo "Android NDK toolchain not found at $TOOLCHAIN" >&2
|
||||
exit 1
|
||||
fi
|
||||
OUT="$OUTDIR/libdirectaudiorelay.so"
|
||||
"$CC" -O2 -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -fPIE -pie -Wl,-z,max-page-size=16384 \
|
||||
-I"$REPO/tools/aaudio-sink" \
|
||||
-o "$OUT" "$HERE/directaudio-relay.c" -laaudio -llog
|
||||
"$TOOLCHAIN/llvm-strip" --strip-unneeded "$OUT"
|
||||
NEEDED=$("$TOOLCHAIN/llvm-readelf" -d "$OUT" | sed -n 's/.*NEEDED.*\[\(.*\)\]/\1/p' | tr '\n' ' ')
|
||||
echo "$(basename "$OUT") NEEDED: $NEEDED"
|
||||
for lib in $NEEDED; do
|
||||
case $lib in libaaudio.so|liblog.so|libc.so|libm.so|libdl.so) ;;
|
||||
*) echo "ERROR: unexpected dependency $lib"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
ls -l "$OUT"
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user