macOS: New implementation of service publication (#2786)

The current implementation of service publication on macOS uses
`avahi-client`, but the majority of macOS machines do not have Avahi
installed because macOS provides a native alternative (`mDNSresponder`),
meaning that there is no reason to install Avahi.

The current implementation also attempts to load the Avahi client
libraries using `dlopen(3)`, which has a variety of restrictions on
macOS, such as only being willing to load from certain directories.
Depending on where the Avahi binaries are installed, they might not
be loadable through the current invocation of `dlopen(3)`.

Instead of using an Avahi client on macOS, it makes more sense to use
the native macOS API for publishing services via `mDNSresponder`. This
commit supplies such an implementation that uses the macOS native API.
It also has the advantage of being much simpler than the previous
implementation. Furthermore, this new implementation works on all
macOS machines, because it relies only on native APIs, rather than on
third-party software that is not commonly installed on macOS.
This commit is contained in:
Cathy J. Fitzpatrick 2024-07-07 08:19:51 -07:00 committed by GitHub
commit 3cc12dfbe7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 100 additions and 420 deletions

View file

@ -38,8 +38,7 @@ depends_build-append port:doxygen \
port:python311 \
port:py311-pip
depends_lib port:avahi \
port:curl \
depends_lib port:curl \
port:libopus \
port:miniupnpc

View file

@ -37,6 +37,7 @@ class @PROJECT_NAME@ < Formula
depends_on "icu4c" => :recommended
on_linux do
depends_on "avahi"
depends_on "libcap"
depends_on "libdrm"
depends_on "libnotify"