remove macOS support

There were a few macOS related bug reports on the bug tracker which
have been open for years without a volunteer caring for them.  The
GitHub actions build has also been broken for a long time due to bugs
in the ancient LLVM toolchain shipped with macOS, making macOS an
unsuitable non-Linux target for testing MPD's portability.

All of this makes macOS support an annoying liability for me.  To
avoid more frustration, I'm hereby dropping macOS support completely
from MPD.  Maybe this causes enough pain for a new maintainer to
spawn, but maybe nobody cares, so... let's see.
This commit is contained in:
Max Kellermann
2024-05-06 13:47:04 +02:00
parent 1c69498c58
commit 518ce0187a
33 changed files with 40 additions and 1659 deletions

View File

@@ -1,76 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#include "Bonjour.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
#include <dns_sd.h>
#include <stdexcept>
#include <arpa/inet.h>
static constexpr Domain bonjour_domain("bonjour");
/**
* A wrapper for DNSServiceRegister() which returns the DNSServiceRef
* and throws on error.
*/
static DNSServiceRef
RegisterBonjour(const char *name, const char *type, unsigned port,
DNSServiceRegisterReply callback, void *ctx)
{
DNSServiceRef ref;
DNSServiceErrorType error = DNSServiceRegister(&ref,
0, 0, name, type,
nullptr, nullptr,
htons(port), 0,
nullptr,
callback, ctx);
if (error != kDNSServiceErr_NoError)
throw std::runtime_error("DNSServiceRegister() failed");
return ref;
}
BonjourHelper::BonjourHelper(EventLoop &_loop, const char *name,
const char *service_type, unsigned port)
:service_ref(RegisterBonjour(name, service_type, port,
Callback, this)),
socket_event(_loop,
BIND_THIS_METHOD(OnSocketReady),
SocketDescriptor(DNSServiceRefSockFD(service_ref)))
{
socket_event.ScheduleRead();
}
void
BonjourHelper::Callback([[maybe_unused]] DNSServiceRef sdRef,
[[maybe_unused]] DNSServiceFlags flags,
DNSServiceErrorType errorCode, const char *name,
[[maybe_unused]] const char *regtype,
[[maybe_unused]] const char *domain,
[[maybe_unused]] void *context) noexcept
{
auto &helper = *(BonjourHelper *)context;
if (errorCode != kDNSServiceErr_NoError) {
LogError(bonjour_domain,
"Failed to register zeroconf service");
helper.Cancel();
} else {
FmtDebug(bonjour_domain,
"Registered zeroconf service with name {:?}",
name);
}
}
std::unique_ptr<BonjourHelper>
BonjourInit(EventLoop &loop, const char *name,
const char *service_type, unsigned port)
{
return std::make_unique<BonjourHelper>(loop, name, service_type, port);
}

View File

@@ -1,55 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#ifndef MPD_ZEROCONF_BONJOUR_HXX
#define MPD_ZEROCONF_BONJOUR_HXX
#include "event/SocketEvent.hxx"
#include <dns_sd.h>
#include <memory>
class EventLoop;
class BonjourHelper final {
const DNSServiceRef service_ref;
SocketEvent socket_event;
public:
BonjourHelper(EventLoop &_loop, const char *name,
const char *service_name, unsigned port);
~BonjourHelper() noexcept {
DNSServiceRefDeallocate(service_ref);
}
BonjourHelper(const BonjourHelper &) = delete;
BonjourHelper &operator=(const BonjourHelper &) = delete;
private:
void Cancel() noexcept {
socket_event.Cancel();
}
static void Callback(DNSServiceRef sdRef, DNSServiceFlags flags,
DNSServiceErrorType errorCode, const char *name,
const char *regtype,
const char *domain,
void *context) noexcept;
/* virtual methods from class SocketMonitor */
void OnSocketReady([[maybe_unused]] unsigned flags) noexcept {
DNSServiceProcessResult(service_ref);
}
};
/**
* Throws on error.
*/
std::unique_ptr<BonjourHelper>
BonjourInit(EventLoop &loop, const char *name,
const char *service_type, unsigned port);
#endif

View File

@@ -3,20 +3,13 @@
#include "Glue.hxx"
#include "Helper.hxx"
#include "avahi/Helper.hxx"
#include "config/Data.hxx"
#include "config/Option.hxx"
#include "Listen.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
#ifdef HAVE_AVAHI
#include "avahi/Helper.hxx"
#endif
#ifdef HAVE_BONJOUR
#include "Bonjour.hxx"
#endif
#include <climits>
#include <string.h>

View File

@@ -1,11 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#ifndef MPD_ZEROCONF_GLUE_HXX
#define MPD_ZEROCONF_GLUE_HXX
#pragma once
#include "Helper.hxx"
#include "config.h"
#include <memory>
@@ -13,14 +11,8 @@ struct ConfigData;
class EventLoop;
class ZeroconfHelper;
#ifdef HAVE_ZEROCONF
/**
* Throws on error.
*/
std::unique_ptr<ZeroconfHelper>
ZeroconfInit(const ConfigData &config, EventLoop &loop);
#endif /* ! HAVE_ZEROCONF */
#endif

View File

@@ -2,19 +2,10 @@
// Copyright The Music Player Daemon Project
#include "Helper.hxx"
#ifdef HAVE_AVAHI
#include "avahi/Helper.hxx"
#define CreateHelper AvahiInit
#endif
#ifdef HAVE_BONJOUR
#include "Bonjour.hxx"
#define CreateHelper BonjourInit
#endif
ZeroconfHelper::ZeroconfHelper(EventLoop &event_loop, const char *name,
const char *service_type, unsigned port)
:helper(CreateHelper(event_loop, name, service_type, port)) {}
:helper(AvahiInit(event_loop, name, service_type, port)) {}
ZeroconfHelper::~ZeroconfHelper() noexcept = default;

View File

@@ -1,25 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#ifndef MPD_ZEROCONF_HELPER_HXX
#define MPD_ZEROCONF_HELPER_HXX
#include "config.h"
#pragma once
#include <memory>
class EventLoop;
class AvahiHelper;
class BonjourHelper;
class ZeroconfHelper final {
#ifdef HAVE_AVAHI
std::unique_ptr<AvahiHelper> helper;
#endif
#ifdef HAVE_BONJOUR
std::unique_ptr<BonjourHelper> helper;
#endif
public:
ZeroconfHelper(EventLoop &event_loop, const char *name,
@@ -27,5 +17,3 @@ public:
~ZeroconfHelper() noexcept;
};
#endif

View File

@@ -3,9 +3,7 @@ zeroconf_option = get_option('zeroconf')
avahi_dep = dependency('', required: false)
if zeroconf_option == 'auto'
if is_darwin
zeroconf_option = 'bonjour'
elif is_android or is_windows
if is_android or is_windows
zeroconf_option = 'disabled'
elif dbus_dep.found()
zeroconf_option = 'avahi'
@@ -19,61 +17,30 @@ if zeroconf_option == 'disabled'
subdir_done()
endif
if zeroconf_option == 'bonjour'
if not compiler.has_header('dns_sd.h')
error('dns_sd.h not found')
endif
subdir('avahi')
bonjour_deps = [
]
if not is_darwin
bonjour_deps += declare_dependency(link_args: ['-ldns_sd'])
endif
conf.set('HAVE_BONJOUR', true)
zeroconf = static_library(
'zeroconf_bonjour',
'Glue.cxx',
'Helper.cxx',
'Bonjour.cxx',
include_directories: inc,
dependencies: [
event_dep,
log_dep,
],
)
zeroconf_dep = declare_dependency(
link_with: zeroconf,
dependencies: bonjour_deps,
)
else
subdir('avahi')
if not avahi_dep.found()
zeroconf_dep = dependency('', required: false)
subdir_done()
endif
conf.set('HAVE_AVAHI', true)
zeroconf = static_library(
'zeroconf_bonjour',
'Glue.cxx',
'Helper.cxx',
include_directories: inc,
dependencies: [
avahi_dep,
dbus_dep,
time_dep,
log_dep,
],
)
zeroconf_dep = declare_dependency(
link_with: zeroconf,
)
if not avahi_dep.found()
zeroconf_dep = dependency('', required: false)
subdir_done()
endif
conf.set('HAVE_AVAHI', true)
zeroconf = static_library(
'zeroconf',
'Glue.cxx',
'Helper.cxx',
include_directories: inc,
dependencies: [
avahi_dep,
dbus_dep,
time_dep,
log_dep,
],
)
zeroconf_dep = declare_dependency(
link_with: zeroconf,
)
conf.set('HAVE_ZEROCONF', true)