mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00: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
@@ -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