waydroid-apple-music

LOW
maintainer kanya-approve 0 votes scanned 2026-09-02 00:02:31.333316
View on AUR
Why flagged

The package builds a patched audio HAL from source for Waydroid to enable high-resolution audio with Apple Music; it downloads source code from GitHub repositories (including the maintainer's fork) without verifiable checksums, but all built components are self-contained and intended for local use, with no evidence of malicious behavior or remote code execution.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Low AI review llm_review

An AI model (qwen/qwen3-235b-a22b-2507) reviewed this and agrees it is LOW (confidence 95%): The package builds a patched audio HAL from source for Waydroid to enable high-resolution audio with Apple Music; it downloads source code from GitHub repositories (including the maintainer's fork) without verifiable checksums, but all built components are self-contained and intended for local use, with no evidence of malicious behavior or remote code execution.

PKGBUILD

1# Maintainer: kanya-approve
2
3pkgname=waydroid-apple-music
4pkgver=1.0.0
5pkgrel=1
6pkgdesc="Bit-perfect Apple Music on Waydroid: patched audio HAL, container properties, and app settings. Works with any Waydroid image; ships neither the image nor the app."
7arch=('x86_64')
8url="https://github.com/kanya-approve/android_hardware_waydroid-hires"
9license=('Apache-2.0')
10
11depends=('waydroid')
12
13# android-ndk is an AUR package, so plain `makepkg -s` cannot resolve it -
14# build through an AUR helper or install it first.
15makedepends=('android-ndk')
16
17optdepends=('pipewire-audio: sample-rate switching for bit-perfect output')
18
19install="${pkgname}.install"
20options=('!strip' '!debug')
21
22
23# Patched audio HAL. Upstream Waydroid forces every output stream to
24# S16_LE/48000 and treats float as unrepresentable, so hi-res and even ordinary
25# 44.1kHz content is resampled on the way out. Built from source here; drop
26# this block and _build_hal once the fix lands in Waydroid proper.
27_hal=407f9b6278d039352e730c696e784216a2fb6606
28_libhardware=0eb202d7ebd7d2410eb2f62c908c0341964a4829 # lineage-20.0
29_media=41c2d1ab132fd5388d39418507263e77483fe987 # lineage-20.0
30_core=c0500ffe2cc283d61f1e3db1b2c979bfbd9beb8c # lineage-20.0
31_logging=373d54e772f303c441faf2e584a2edf3601b4181 # lineage-20.0
32_alsa=8a1eff33a2430b29ea2fc11f32a0a349e90c1c93 # lineage-17.1, Waydroid's alsa fork
33_halurl=https://github.com/kanya-approve/android_hardware_waydroid-hires
34_ndkapi=33 # Android 13
35_ndkarch=i686 # /vendor/lib/hw is 32-bit
36_module=audio.primary.waydroid
37
38source=('99-waydroid-hires.conf'
39 "hal-${_hal}.tar.gz::${_halurl}/archive/${_hal}.tar.gz"
40 "libhardware-${_libhardware}.tar.gz::https://github.com/LineageOS/android_hardware_libhardware/archive/${_libhardware}.tar.gz"
41 "media-${_media}.tar.gz::https://github.com/LineageOS/android_system_media/archive/${_media}.tar.gz"
42 "core-${_core}.tar.gz::https://github.com/LineageOS/android_system_core/archive/${_core}.tar.gz"
43 "logging-${_logging}.tar.gz::https://github.com/LineageOS/android_system_logging/archive/${_logging}.tar.gz"
44 "alsa-${_alsa}.tar.gz::https://github.com/WayDroid/android_external_alsa-lib/archive/${_alsa}.tar.gz")
45sha256sums=('SKIP'
46 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')
47
48prepare() {
49 # alsa-lib generates asoundlib.h and version.h during its own build - the
50 # repo only carries asoundlib-head.h and -tail.h. Reproduce what its
51 # Android.mk does so they exist before the HAL compiles against them.
52 local a="${srcdir}/android_external_alsa-lib-${_alsa}"
53 local g="${srcdir}/alsa-gen/alsa"
54 install -dm755 "$g"
55
56 local ver major minor sub
57 ver=$(sed -n 's/^AC_INIT(alsa-lib, \([0-9.]*\))/\1/p' "$a/configure.ac" | head -1)
58 [ -n "$ver" ] || { error "could not read the alsa version from configure.ac"; return 1; }
59 IFS=. read -r major minor sub <<< "$ver"
60 {
61 echo "#define SND_LIB_MAJOR $major"
62 echo "#define SND_LIB_MINOR $minor"
63 echo "#define SND_LIB_SUBMINOR $sub"
64 echo "#define SND_LIB_EXTRAVER 1000000"
65 echo "#define SND_LIB_VER(maj, min, sub) (((maj)<<16)|((min)<<8)|(sub))"
66 echo "#define SND_LIB_VERSION SND_LIB_VER(SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR)"
67 echo "#define SND_LIB_VERSION_STR \"$ver\""
68 } > "$g/version.h"
69 cp "$g/version.h" "${srcdir}/alsa-gen/version.h"
70 {
71 cat "$a/include/asoundlib-head.h"
72 sed -n 's/.*\(#include <[ae].*\.h>\).*/\1/p' "$a/configure.ac"
73 cat "$a/include/asoundlib-tail.h"
74 } > "$g/asoundlib.h"
75 msg2 "generated alsa headers for ${ver}"
76}
77
78build() {
79 local cc
80 cc="$(find /opt/android-ndk/toolchains/llvm/prebuilt -maxdepth 1 -mindepth 1 -type d | head -1)/bin/clang"
81 [ -x "$cc" ] || { error "no NDK clang under /opt/android-ndk"; return 1; }
82
83 local inc=(
84 -I"${srcdir}/android_hardware_libhardware-${_libhardware}/include"
85 -I"${srcdir}/android_system_media-${_media}/audio/include"
86 -I"${srcdir}/android_system_media-${_media}/audio_utils/include"
87 -I"${srcdir}/android_system_media-${_media}/audio_effects/include"
88 -I"${srcdir}/android_system_core-${_core}/libcutils/include"
89 -I"${srcdir}/android_system_core-${_core}/libsystem/include"
90 -I"${srcdir}/android_system_logging-${_logging}/liblog/include"
91 -I"${srcdir}/alsa-gen"
92 -I"${srcdir}/android_external_alsa-lib-${_alsa}/android"
93 -I"${srcdir}/android_external_alsa-lib-${_alsa}/include"
94 )
95 local src="${srcdir}/android_hardware_waydroid-hires-${_hal}/audio/audio_hw.c"
96 [ -f "$src" ] || { error "HAL source missing at $src"; return 1; }
97
98 msg2 "pass 1: discovering undefined symbols"
99 "$cc" --target="${_ndkarch}-linux-android${_ndkapi}" -shared -fPIC -O2 \
100 -Wall -Wno-unused-parameter "${inc[@]}" -DHAVE_BIG_ENDIAN=0 \
101 -o "${srcdir}/${_module}.so" "$src" -llog -Wl,--allow-shlib-undefined || return 1
102
103 # Android's vendor linker namespace resolves symbols only from libraries
104 # named in DT_NEEDED. libasound and libcutils are not in the NDK, so build
105 # stubs carrying the right SONAMEs purely to satisfy the link; at runtime
106 # the loader binds to the real ones inside the container. Without this the
107 # HAL loads but no snd_pcm_* call resolves, every output fails to open, and
108 # AudioFlinger reports getOutputForAttr() = -19 for every stream.
109 install -dm755 "${srcdir}/stubs"
110 readelf -W --dyn-syms "${srcdir}/${_module}.so" \
111 | awk '$7=="UND"{print $8}' | sed 's/@.*//' | sort -u > "${srcdir}/stubs/und.txt"
112 local lib re n sym
113 for lib in libasound libcutils; do
114 case "$lib" in
115 libasound) re='^snd_' ;;
116 libcutils) re='^(str_parms_|property_)' ;;
117 esac
118 : > "${srcdir}/stubs/${lib}.c"
119 n=0
120 while read -r sym; do
121 printf 'void %s(void) {}\n' "$sym" >> "${srcdir}/stubs/${lib}.c"
122 n=$((n+1))
123 done < <(grep -E "$re" "${srcdir}/stubs/und.txt")
124 [ "$n" -gt 0 ] || { error "no symbols matched for ${lib}"; return 1; }
125 "$cc" --target="${_ndkarch}-linux-android${_ndkapi}" -shared -fPIC \
126 -Wl,-soname,"${lib}.so" -o "${srcdir}/stubs/${lib}.so" \
127 "${srcdir}/stubs/${lib}.c" || return 1
128 msg2 " stub ${lib}.so (${n} symbols)"
129 done
130
131 msg2 "pass 2: relinking against libasound and libcutils"
132 "$cc" --target="${_ndkarch}-linux-android${_ndkapi}" -shared -fPIC -O2 \
133 -Wall -Wno-unused-parameter "${inc[@]}" -DHAVE_BIG_ENDIAN=0 \
134 -o "${srcdir}/${_module}.so" "$src" \
135 -L"${srcdir}/stubs" -lasound -lcutils -llog || return 1
136}
137
138check() {
139 local so="${srcdir}/${_module}.so"
140 # Both of these fail silently at runtime: Android falls back to the stub
141 # HAL and there is simply no sound, with nothing obvious in the log.
142 file -b "$so" | grep -q 'ELF 32-bit.*[iI]386' \
143 || { error "HAL is not 32-bit i386; /vendor/lib/hw will not load it"; return 1; }
144 readelf -W --dyn-syms "$so" | grep -q ' HMI$' \
145 || { error "HAL exports no HMI symbol; Android will not recognise it"; return 1; }
146 local lib
147 for lib in libasound.so libcutils.so; do
148 readelf -d "$so" | grep -q "\[$lib\]" \
149 || { error "$lib missing from DT_NEEDED; snd_pcm_* will not resolve"; return 1; }
150 done
151 msg2 "HAL: 32-bit i386, exports HMI, links libasound and libcutils"
152}
153
154package() {
155 # Waydroid mounts this overlay over the container's /vendor. The HAL and
156 # the policy must ship together: the policy advertises float profiles and
157 # the stock HAL aborts on float.
158 local _overlay="${pkgdir}/var/lib/waydroid/overlay"
159 install -Dm644 "${srcdir}/${_module}.so" \
160 "${_overlay}/vendor/lib/hw/${_module}.so"
161 install -Dm644 "${srcdir}/android_hardware_waydroid-hires-${_hal}/audio/audio_policy_configuration.xml" \
162 "${_overlay}/vendor/etc/audio_policy_configuration.xml"
163
164 # Let PipeWire follow the source rate instead of resampling to a fixed one.
165 # System-wide because a package must not write into a user's ~/.config.
166 install -Dm644 "${srcdir}/99-waydroid-hires.conf" \
167 "${pkgdir}/etc/pipewire/pipewire.conf.d/99-waydroid-hires.conf"
168}
169

Scan history

Scanned at (UTC)SeverityRules
2026-09-02 00:02:31 Low 2
2026-09-01 23:49:29 Low 2

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion