We don't have the resources to port everything to sndio (which means ongoing work in many cases, not just a one-off). pulseaudio itself uses sndio as a backend so those ports using it *are* using sndio albeit indirectly.

As you have seen, inter-library dependencies can mean that various programs record linkage to a library which is used by another library. Just making a separate flavour of that library is not enough, you also need similar work with ports *using* that library (and because the "pulse" and "no-pulse" flavours can't be installed simultaneously this ends up with problems in bulk builds). As a result there are very few libraries in ports which use flavours (and those which exist, like the LDAP flavours of apr and apr-util, are difficult to work with).

--
 Sent from a phone, apologies for poor formatting.

On 17 April 2023 14:56:22 Johannes Thyssen Tishman <johan...@thyssentishman.com> wrote:

Hi everyone,

Some time ago I noticed that pulseaudio was being pulled as a dependency
of the qutebrowser. Now, it is my understanding that in OpenBSD programs
such as pulseaudio, pipewire, alsa etc. are redundant since we have
sndio, so why do we include pulseaudio? I suppose some programs might
need it of course, but most programs I've seen that are built with
support for pulseaudio list it as an optional dependency. Additionally
pulseaudio pulls other dependencies (e.g. consolekit and polkit) that
again (and please correct me if I'm wrong) are redundant software in
OpenBSD.

I found out that the two packages that were pulling pulseaudio for
qutebrowser are the following:

py-qt5 -> qtmultimedia
py-qt5 -> qtspeech -> speech-dispatcher -> espeak -> pcaudiolib

However, these two packages can be compiled without support for
pulseaudio. Now, a quick look at reverse dependencies with
show-reverse-deps(1) shows that quite a lot of packages depend on them.
For this reason I suggest adding a flavor to the packages:


--- /usr/ports/audio/pcaudiolib/Makefile Sun Nov 13 12:56:15 2022
+++ Makefile Mon Apr 17 13:32:03 2023
@@ -11,19 +11,24 @@ CATEGORIES= audio devel
# GPLv3
PERMIT_PACKAGE= Yes

-WANTLIB += FLAC Xau Xdmcp dbus-1 execinfo iconv intl m mp3lame
-WANTLIB += mpg123 ogg opus pthread pulse pulse-simple sndfile
-WANTLIB += vorbis vorbisenc xcb
-
-LIB_DEPENDS= audio/pulseaudio
-
AUTOCONF_VERSION= 2.69
AUTOMAKE_VERSION= 1.16
AUTORECONF= ./autogen.sh

CONFIGURE_STYLE= autoreconf

+FLAVORS= pulse
+FLAVOR?=
+
CONFIGURE_ARGS= --without-oss
+
+.if ${FLAVOR:Mpulse}
+CONFIGURE_ARGS+= --with-pulseaudio
+WANTLIB+= FLAC Xau Xdmcp dbus-1 execinfo iconv intl m mp3lame
+WANTLIB+= mpg123 ogg opus pthread pulse pulse-simple sndfile
+WANTLIB+= vorbis vorbisenc xcb
+LIB_DEPENDS+= audio/pulseaudio
+.endif

DEBUG_PACKAGES= ${BUILD_PACKAGES}


--- /usr/ports/x11/qt5/qtmultimedia/Makefile Sun Apr 16 20:39:11 2023
+++ Makefile Mon Apr 17 14:26:12 2023
@@ -8,11 +8,11 @@ SHARED_LIBS +=  Qt5MultimediaWidgets      3.0 # 5.9
SHARED_LIBS +=  Qt5MultimediaGstTools     0.0 # 5.13
SHARED_LIBS +=  Qt5MultimediaQuick        0.0 # 5.13

-WANTLIB += ${COMPILER_LIBCXX} GL Qt5Core Qt5Gui Qt5Network Qt5OpenGL
-WANTLIB += Qt5Qml Qt5Quick Qt5Widgets glib-2.0 gobject-2.0 gstapp-1.0
-WANTLIB += gstaudio-1.0 gstbase-1.0 gstpbutils-1.0 gstphotography-1.0
-WANTLIB += gstreamer-1.0 gstvideo-1.0 intl m openal pulse pulse-mainloop-glib
-WANTLIB += Qt5QmlModels gstallocators-1.0 gstgl-1.0
+WANTLIB-main += ${COMPILER_LIBCXX} GL Qt5Core Qt5Gui Qt5Network Qt5OpenGL
+WANTLIB-main += Qt5Qml Qt5QmlModels Qt5Quick Qt5Widgets glib-2.0 gobject-2.0
+WANTLIB-main += gstallocators-1.0 gstapp-1.0 gstaudio-1.0 gstbase-1.0
+WANTLIB-main += gstgl-1.0 gstpbutils-1.0 gstphotography-1.0 gstreamer-1.0
+WANTLIB-main += gstvideo-1.0 intl m openal

BUILD_DEPENDS = multimedia/gstreamer1/mm

@@ -21,7 +21,6 @@ RUN_DEPENDS-main = multimedia/gstreamer1/mm
RUN_DEPENDS-examples = x11/qt5/qtdeclarative>=${QT5_VERSION},<${QT5_NEXT_VERSION}

LIB_DEPENDS = audio/openal \
- audio/pulseaudio \
 multimedia/gstreamer1/core \
 multimedia/gstreamer1/plugins-base \
 multimedia/gstreamer1/plugins-bad \
@@ -33,11 +32,19 @@ LIB_DEPENDS = audio/openal \
# do not build documentation by default, to avoid circular dependency
# via qtdeclarative-docindex

-FLAVORS = debug
+FLAVORS = debug pulse
FLAVOR ?= bootstrap no_examples
PSEUDO_FLAVORS = bootstrap no_examples

MODQMAKE_ARGS = GST_VERSION=1.0
MODQMAKE_RECURSIVE = No
+
+CONFIGURE_ARGS = -no-pulseaudio
+
+.if ${FLAVOR:Mpulse}
+CONFIGURE_ARGS-= -no-pulseaudio
+WANTLIB+= pulse pulse-mainloop-glib
+LIB_DEPENDS+= audio/pulseaudio
+.endif

.include <bsd.port.mk>


With these two pataches I was able to compile the two packages without
pulseaudio. However the when compiling the consumers of pcaudiolib
(without pulseaudio) e.g espeak, make complained with the following:

===>  Verifying specs: c++ c++abi pthread c execinfo iconv m ogg pcaudio
pulse pulse-simple vorbis
Missing library for pcaudio>=0.0
Missing library for pulse>=0.0
Missing library for pulse-simple>=0.0
Fatal error
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2385
'/usr/ports/pobj/espeak-1.51/.runwantlibs-': @case X${_DEPENDS_CACHE} in
X)...) *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2155
'/var/db/pkg/espeak-1.51/+CONTENTS': @cd /usr/ports/audio/espeak &&
SUBPACKA...) *** Error 2 in /usr/ports/audio/espeak
(/usr/ports/infrastructure/mk/bsd.port.mk:2600 'install':
@lock=espeak-1.51;  export _LOCKS_HELD=" es...)

I understand that this is due to the declared WANTLIB's in the Makefile,
but why are these pulse specific libraries in the Makefile of espeak if
they are implicit in its dependency for pcaudiolib (when using the pulse
flavor)? If this is the case for all other consumers of pcaudiolib then
I assume that this will definitely be more work than just adding a
flavor.

I'm am just starting with ports in OpenBSD so rather than this being a
submission it is more a call for feedback and support. These two patches
and the WANTLIB modifications in the mentioned consumers allowed me to
run qutebrowser without pulseaudio without any issues. Audio output
works well, but I don't know about audio input since I don't have a
microphone to test it. If anyone could test this and perhaps other
speech-dispatcher related functions, I would really appreciate it.

I hope this doesn't come as a complaint to anyone. I really like this
beautiful OS and I thank all the mantainers (specially those of the
ports I mentioned) very much for their hard work.

Thank you all.

Kind regards,

--
Johannes Thyssen Tishman
https://thyssentishman.com

Reply via email to