Skip to content

Instantly share code, notes, and snippets.

Created Feb 18, 2017
What would you like to do?
pkgdesc="A featureful, general-purpose sound server"
arch=("i686" "x86_64" "armv7h")
license=("GPL" "LGPL")
depends=("rtkit" "libltdl" "speex" "tdb" "systemd" "fftw" "orc" "libsamplerate"
"webrtc-audio-processing" "sbc" "libasyncns" "libxtst" "libsm" "libsndfile" "json-c")
makedepends=("git" "attr" "avahi" "bluez" "gconf" "intltool" "openssl" "bluez-libs")
optdepends=("alsa-plugins: ALSA support"
"avahi: zeroconf support"
"bluez: bluetooth support"
"gconf: configuration through gconf"
"jack: jack support"
"lirc-utils: infra-red support"
"openssl: RAOP support"
"python-pyqt4: Equalizer GUI (qpaeq)")
provides=("pulseaudio" "libpulse" "pulseaudio-zeroconf" "pulseaudio-gconf" "pulseaudio-equalizer" "pulseaudio-bluetooth" "pulseaudio-jack" "pulseaudio-xen" "pulseaudio-lirc")
conflicts=("pulseaudio" "libpulse" "pulseaudio-zeroconf" "pulseaudio-gconf" "pulseaudio-equalizer" "pulseaudio-bluetooth" "pulseaudio-jack" "pulseaudio-xen" "pulseaudio-lirc")
replaces=("pulseaudio" "libpulse" "pulseaudio-zeroconf" "pulseaudio-gconf" "pulseaudio-equalizer" "pulseaudio-bluetooth" "pulseaudio-jack" "pulseaudio-xen" "pulseaudio-lirc")
pkgver() {
cd "$srcdir/$_pkgname"
# git describe --always | sed "s/-/./g"
printf "%s.%s.%s" "tanuk" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
build() {
cd "$srcdir/$_pkgname"
GIT_DESCRIBE_FOR_BUILD="$pkgver" ./ --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib \
--localstatedir=/var \
--with-udev-rules-dir=/usr/lib/udev/rules.d \
--with-database=tdb \
--disable-hal-compat \
--disable-tcpwrap \
--disable-bluez4 \
--disable-rpath \
package() {
cd "$srcdir/$_pkgname"
make DESTDIR="$pkgdir" install bashcompletiondir=/usr/share/bash-completion/completions
# Speed up pulseaudio shutdown so that it exits immediately with
# the last user session (module-systemd-login keeps it alive)
sed -e "/exit-idle-time/iexit-idle-time=0" -i "$pkgdir/etc/pulse/daemon.conf"
# Disable cork-request module, can result in e.g. media players unpausing
# when there"s a Skype call incoming
sed -e "s|/usr/bin/pactl load-module module-x11-cork-request|#&|" -i "$pkgdir/usr/bin/start-pulseaudio-x11"
rm "$pkgdir/etc/dbus-1/system.d/pulseaudio-system.conf"
install -Dm644 shell-completion/zsh/_pulseaudio "$pkgdir/usr/share/zsh/site-functions/_pulseaudio"
Copy link

CharlSteynberg commented Aug 6, 2018

Thanks for this, I'm wrestling with the same issue you had; using SkullCandy Bluetooth headset. .. this is 2 years ago - surely an "official" fix should be available? I'll try this patch though.

Copy link

jtiemer commented Jan 1, 2019

Didn't check it out yet, but thanks. Wrangling with a Sony MDR-ZX330BT on an x230t.

Copy link

Lyle-Tafoya commented Mar 11, 2019

I'm getting build errors. First one was a static definition of a non-statically declared method:

./pulsecore/memfd-wrappers.h:36:19: error: static declaration of ‘memfd_create’ follows non-static declaration
 static inline int memfd_create(const char *name, unsigned int flags) {

I fixed this by removing the keyword "static", but then ended up with the following error

modules/raop/raop_client.c:167:8: error: dereferencing pointer to incomplete type ‘RSA’ {aka ‘struct rsa_st’}
     rsa->n = BN_bin2bn(modules, size, NULL);

Trying desparately to get the mic working on my Plantronics Beatback Pro 2. It used to work fine, but I haven't managed to get it working for at least a year. Was hoping this would do the trick.

Copy link

tigerjack commented Oct 28, 2019

Same problem of @Lyle-Tafoya here.

Copy link

7nik commented Mar 20, 2021

I could build the package after adding the following lines:

export PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig
export CFLAGS="-Wno-error"

prepare() {
    cd "$srcdir/$_pkgname"
    patch --strip=1 --input=../../memfd_create.patch
    patch --strip=1 --input=../../raop_client.patch

and pathes memfd_create.patch and raop_client.patch:

Subject: [PATCH] raop_client: now n and e props are private so use the setter
 modules/raop/raop_client.c     | 1 ++-
 1 file changed,  insertions(+), 3 deletions(-)

diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index 3b6c36ec..85e4c18e 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -159,14 +159,13 @@ static int rsa_encrypt(uint8_t *text, int len, uint8_t *res) {
     const char e[] = "AQAB";
     uint8_t modules[256];
     uint8_t exponent[8];
-    int size;
+    int size, size2;
     RSA *rsa;

     rsa = RSA_new();
     size = pa_base64_decode(n, modules);
-    rsa->n = BN_bin2bn(modules, size, NULL);
-    size = pa_base64_decode(e, exponent);
-    rsa->e = BN_bin2bn(exponent, size, NULL);
+    size2 = pa_base64_decode(e, exponent);
+    RSA_set0_key(rsa, BN_bin2bn(modules, size, NULL), BN_bin2bn(exponent, size2, NULL), NULL);

     size = RSA_public_encrypt(len, text, res, rsa, RSA_PKCS1_OAEP_PADDING);

To install this package, I had to remove the original libpulse, pulseaudio, and pulseaudio-* packages and a bunch of packages that used them.

After rebooting I was able to pair my headset via HSP/HFP protocol only and use a microphone. But the sound quality was awful and built-in audio wasn't available anymore so I reversed all changes.

For some reason, now I can choose between A2DP and HSP/HFP protocols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment