Build dolphin-emu port with OSS as only audio option

I came across this thread some time ago.
In that thread a user mentions that dolphin-emu has a hard dependency on the middleware pulseaudio.
I like dolphin-emu very much, and need it desperately so much that I looked up the Makefile in
Code:
/usr/ports//usr/ports/emulators/dolphin-emu
There I noticed that the emulator also has a hard dependency on jack and sndio.
Since I have already OSS working and are quite happy with it, why should I use middleware or sndio from OpenBSD.
So, I experimented a bit.

To get dolphin-emu build from ports, you can either do it manually, use ports-mgmt/poudriere, or ports-mgmt/synth.
I am not going to explain here how to use either method, and I assume that you are familiar with ports building, but if not, I will leave links behind where you can get familiar with manually building, poudriere, or synth.
The ports builder which I will use in this guide is poudriere.

Links to learn how to build ports:
Manual Building
Poudriere (poudriere ports -c p local -F -M /usr/ports -f none) did not work, but (poudriere ports -c -m null -M /usr/ports -p port-name) did.
Synth

Lets us begin to get the unneeded hard-dependencies out of the dolphin-emu makefile.
I would recommend to create a dolphin-emu-custom directory in /usr/ports/emulators.
To do so run as root the following command:
Code:
cp -r /usr/ports/emulators/dolphin-emu /usr/ports/emulators/dolphin-emu-custom

Now open /usr/ports/emulators/dolphin-emu-custom/Makefile with your text editor of choice.
Search for:
-> audio/pulseaudio
-> audio/jack
-> audio/sndio
and delete these entries and save the file.

Now issue as root:
Code:
poudriere bulk -j your-jailname -p your-port-name emulators/dolphin-emu-custom
pkg install dolphin-emu-custom

Type in as your user dolphin-emu.
It should open, and in the QT GUI you should now notice in the audio tab that you only have cubeb as audio option.
But that is fine as Cubeb is an external dependency and compatible with OSS.
Choose as audio backend Cubeb and the sound should work.

One benefit is the reduced package amount, and saved device space which can in turn be used for other software.
Hopefully this guide is helpful.
If you have questions or suggestions do not hesitate to reply to this Howto.
 
This is just the beginning of your journey to become a great FreeBSD ports contributor :) Now take a look into the Porter's Handbook and get your hands dirty in trying to improve, extend or fix a port. Maybe you even want to become a maintainer of some ports. The FreeBSD community always needs more contributors.

You could start by adding ALSA, PULSEAUDIO and CUBEB port options to emulators/dolphin-emu in order to make these audio backends optional in the port. And cubeb is used in some other emulators too, for example emulators/pcsx2 and emulators/fbsd-duckstation. Damn! This is compiled over and over again! Create a new port for cubeb and unbundle this dependency in ports using it, so they use the new cubeb port instead. While there you will scream in anger, because cubeb enables dependencies when it finds the header files in the build environment, for example it enables ALSA support when it finds {LOCALBASE}/include/alsa/asoundlib.h during configuration stage. I hate this behavior! Now everytime some transient dependency happens to depend on audio/alsa-lib it pollutes your build. Nothing should be linked in without explicit consent, will they never learn... So you create a custom patch in your cubeb port which adds a build option no enable the audio backends in cubeb explicitly. Then you try to upstream your patch so that you can save humanity and make this world a better place.

Now the question is, also regarding your post, when is a default port dependency appropriate. 5.10. Dependencies of the handbook has a hint:
When software has extra dependencies that provide extra features, the base dependencies listed in *_DEPENDS should include the extra dependencies that would benefit most users. The base dependencies should never be a "minimal" dependency set. The goal is not to include every dependency possible. Only include those that will benefit most people.
Regarding audio backends, I'd say enable all options by default (except pulseaudio ... not on my watch). There are times when one audio backend works better than another, depending on the port, the users machine and its configuration. For example: the OpenAL backend was broken for a specific release of games/gemrb, and while gemrb itself supports a SDL audio backend too, it wasn't available in the port at that time unfortunately (well granted, the SDL backend had huge latency back then, but at least it worked). Or emulators/mednafen: It supports ALSA and OSS, but the ALSA backend works just better right out of the box, for OSS it might be necessary to set some buffer options manually in the configuration file in order for it to work good on FreeBSD (at least that was on my machine with my configuration).

Space saving considerations are mood in this case. You want the best possible audio in all possible cases and don't limit the users of the port.
 
This is just the beginning of your journey to become a great FreeBSD ports contributor :) Now take a look into the Porter's Handbook and get your hands dirty in trying to improve, extend or fix a port. Maybe you even want to become a maintainer of some ports. The FreeBSD community always needs more contributors.
First of all thank you for your kind words. :)
I have the porters handbook on my plan, too.
Before starting with FreeBSD I read Michael W. Lucas Absolute FreeBSD Handbook, and the FreeBSD Handbook.
Michael W. Lucas mentioned the porters handbook, too.
Step by step, I set up my FreeBSD environment, starting from 24 January 2025.
It sounds strange, but I have frequently dreams of GDKChan and him saying that it is OK if I take over Ryujinx, and continue to improve it.
I do not have experience with C#, but I have 3 months experience with Vulkan, and 10+ years experience with C++ so, once ported over, I will invest my whole freetime to learn C# and continue to improve Ryujinx.
Ripeririperi and other talented programmer will not return, but I hope to evenutally get a talented programmer team together to revive Ryujinx as it is by far the best switch emulator for PC.
My next goal now, is to set up neovim with lazy.vim for development, and then porting Ryujinx to FreeBSD, after I have now freed dolphin-emu from the unneeded audio part.
However, I agree with you, making ALSA, PORTAUDIO, PULSEAUDIO, and PIPEWIRE an option in the makefile would be great for people who use the audio servers, or middleware.
I do not understand why the current maintainer decided to make PULSEAUDIO, SNDIO, JACK a hard-lib dependency in dolphin-emu, and to tell you the truth, I did not believe that hard-lib dependencies could be removed without breaking the software, but they can, and nothing broke.
First of all, I always check which software will be Installed before answering pkg install pkg-name with "y".
In the dolphin-emu case, cubeb did not enable any alsa stuff, but it can have another effect in another builds.
Anyway cubeb is an external dependency for dolphin-emu not listed in the makefile nor in fresh ports, which just happens to work.

Regarding audio backends, I'd say enable all options by default (except pulseaudio ... not on my watch).
I agree, the option only should be there, by default I would enable everything except harry poetterings pulseaudio for users which just want things to work.

Well, next week or the week afterward I will invest all my time to port Ryujinx over to FreeBSD 14.2 onwards.
With that port/pkg I plan to start as a contributor, and make FreeBSD an even more attractive choice than it already is.
 
Back
Top