summaryrefslogtreecommitdiff
path: root/_posts/2022-04-03-backporting-pipewire-in-devuan.md
blob: 1d20df2d59a014257801494f77c02e4e9b8a1e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
layout: post
title: Backporting Pipewire in Devuan
date: 2022-04-03 17:45 +0200
category: tech
language: en
---

**Update 2023-09-07**: With Devuan Daedelus Pipewire is in the
stable repositories. After a dist-upgrade, my Bluetooth headset wasn't
working anymore, though! I'm not sure why, if it's stale config files,
maybe a bug, packages I'm missing, or something else...
I uninstalled everything Pipewire-related and installed Pulseaudio again.
Also, I got myself a USB headset. Which works out of the box.
I'll continue using my headset with my smartphone. Maybe I'll try reinstalling
Pipewire again later.

Ever since I heard about Pipewire and used it in a VM (Fedora) I was
sad I couldn't have it on my Devuan system. Audio quality over Bluetooth
was much better than in Pulseaudio. (That is, HSP/HFP - so for recording
and voice chats).

Devuan Beowulf didn't have it at all. Since the update to Chimaera, I could
install it. Took some fiddling around to start the service, since I use
Devuan specifically to not have to deal with systemd. - However, it needs
to be run for the user.

Thanks to [this issue](https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1135),
I created launchers to start the server in a session. I only had to adapt the launchers
to not use the `-B` switch, which strangely wasn't present in the daemon binary in Devuan.
(missing elogind support?).

Now, it kinda worked, but Pipewire (?) would only offer either one of the HSP/HFP or A2DP
profile - chosen randomly. From some research it seemed this might be a Pipewire bug, fixed
in newer versions.

So I had to, yet again, look into backporting and the - in my
opinion - mess of Debian packaging tools. I ended up using cowbuilder / pbuilder, as suggested
by [BuildingFormalBackports](https://wiki.debian.org/BuildingFormalBackports) on the Debian wiki.

So, this ended up being my `.pbuilderrc`:

	DISTRIBUTION=chimaera
	BASEPATH=/var/cache/pbuilder/base.cow
	BINDMOUNTS=/var/local/repo-backports
	OTHERMIRROR="deb http://deb.devuan.org/merged chimaera-backports main contrib non-free|deb [trusted=yes] file:///var/local/repo-backports ./"

I had to backport `libfreeaptx0` first. Then I had to make two small changes in the pipewire source package.
Namely, I edited the meson build script, because it kept failing because it couldn't find systemd and libxfixes, although
these were set as "required" by "options", which were set to "auto". Searching around the internet, this might be a
bug in meson??? - Not sure. I edited the `meson.build` directly and set required to `false`. I have no experience
with meson whatsoever. Maybe I should've edited meson_options.txt instead?

Patches applied:

```diff
--- pipewire-0.3.49.orig/meson.build
+++ pipewire-0.3.49/meson.build
@@ -280,7 +280,7 @@ x11_dep = dependency('x11-xcb', required
 summary({'X11 (x11-bell)': x11_dep.found()}, bool_yn: true,
   section: 'Misc dependencies')
 
-xfixes_dep = dependency('xfixes', required : get_option('x11-xfixes'), version: '>= 6')
+xfixes_dep = dependency('xfixes', required : false, version: '>= 6')
 cdata.set('HAVE_XFIXES_6', xfixes_dep.found())
 
 canberra_dep = dependency('libcanberra', required : get_option('libcanberra'))
```

and

```diff
--- pipewire-0.3.49.orig/meson.build
+++ pipewire-0.3.49/meson.build
@@ -224,8 +224,8 @@ endforeach
 cdata.set('HAVE_PIDFD_OPEN',
           cc.get_define('SYS_pidfd_open', prefix: '#include <sys/syscall.h>') != '')
 
-systemd = dependency('systemd', required: get_option('systemd'))
-systemd_dep = dependency('libsystemd',required: get_option('systemd'))
+systemd = dependency('systemd', required: false)
+systemd_dep = dependency('libsystemd',required: false)
 summary({'systemd conf data': systemd.found()}, bool_yn: true)
 summary({'libsystemd': systemd_dep.found()}, bool_yn: true)
 cdata.set('HAVE_SYSTEMD', systemd.found() and systemd_dep.found())
```

With that, pbuilder / cowbuilder ran successfully. And now I enjoy my latest
Pipewire version. :)