I found a function in cmake config file of cubeb and it is for "lazily" loading all shared libraries of sound backends. Thanks for information. I'll see if i can port cubeb and maybe add cubeb option for dolphin-emu if OP would like some help.This is just the beginning of your journey to become a great FreeBSD ports contributorNow 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 addingALSA
,PULSEAUDIO
andCUBEB
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 enablesALSA
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:
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 supportsALSA
andOSS
, 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.
C-like:
option(LAZY_LOAD_LIBS "Lazily load shared libraries" ON)
if(LAZY_LOAD_LIBS)
check_include_files(pulse/pulseaudio.h USE_PULSE)
check_include_files(alsa/asoundlib.h USE_ALSA)
check_include_files(jack/jack.h USE_JACK)
check_include_files(sndio.h USE_SNDIO)
check_include_files(aaudio/AAudio.h USE_AAUDIO)
if(USE_PULSE OR USE_ALSA OR USE_JACK OR USE_SNDIO OR USE_AAUDIO)
target_link_libraries(cubeb PRIVATE ${CMAKE_DL_LIBS})
if(ANDROID)
target_compile_definitions(cubeb PRIVATE __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
endif()
endif()