From c0b9339d312cf2723632c25b7a7fd9204b0393fa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 22 Feb 2021 13:50:02 +0100 Subject: [PATCH] zeroconf/AvahiPoll: move to lib/avahi/ --- src/zeroconf/ZeroconfAvahi.cxx | 2 +- .../{AvahiPoll.cxx => avahi/Poll.cxx} | 2 +- .../{AvahiPoll.hxx => avahi/Poll.hxx} | 0 src/zeroconf/avahi/meson.build | 21 +++++++++++++++++++ src/zeroconf/meson.build | 19 +++++++---------- test/meson.build | 2 +- 6 files changed, 32 insertions(+), 14 deletions(-) rename src/zeroconf/{AvahiPoll.cxx => avahi/Poll.cxx} (99%) rename src/zeroconf/{AvahiPoll.hxx => avahi/Poll.hxx} (100%) create mode 100644 src/zeroconf/avahi/meson.build diff --git a/src/zeroconf/ZeroconfAvahi.cxx b/src/zeroconf/ZeroconfAvahi.cxx index 466a29351..46517d80f 100644 --- a/src/zeroconf/ZeroconfAvahi.cxx +++ b/src/zeroconf/ZeroconfAvahi.cxx @@ -18,7 +18,7 @@ */ #include "ZeroconfAvahi.hxx" -#include "AvahiPoll.hxx" +#include "avahi/Poll.hxx" #include "ZeroconfInternal.hxx" #include "Listen.hxx" #include "util/Domain.hxx" diff --git a/src/zeroconf/AvahiPoll.cxx b/src/zeroconf/avahi/Poll.cxx similarity index 99% rename from src/zeroconf/AvahiPoll.cxx rename to src/zeroconf/avahi/Poll.cxx index 1753458d2..ed836596c 100644 --- a/src/zeroconf/AvahiPoll.cxx +++ b/src/zeroconf/avahi/Poll.cxx @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "AvahiPoll.hxx" +#include "Poll.hxx" #include "event/SocketEvent.hxx" #include "event/CoarseTimerEvent.hxx" #include "time/Convert.hxx" diff --git a/src/zeroconf/AvahiPoll.hxx b/src/zeroconf/avahi/Poll.hxx similarity index 100% rename from src/zeroconf/AvahiPoll.hxx rename to src/zeroconf/avahi/Poll.hxx diff --git a/src/zeroconf/avahi/meson.build b/src/zeroconf/avahi/meson.build new file mode 100644 index 000000000..76de2949a --- /dev/null +++ b/src/zeroconf/avahi/meson.build @@ -0,0 +1,21 @@ +libavahi_client = dependency('avahi-client', required: get_option('zeroconf') == 'avahi') +if not libavahi_client.found() + avahi_dep = dependency('', required: false) + subdir_done() +endif + +avahi = static_library( + 'avahi', + 'Poll.cxx', + include_directories: inc, + dependencies: [ + libavahi_client, + ], +) + +avahi_dep = declare_dependency( + link_with: avahi, + dependencies: [ + event_dep, + ], +) diff --git a/src/zeroconf/meson.build b/src/zeroconf/meson.build index eb7158d31..aedcfbeb9 100644 --- a/src/zeroconf/meson.build +++ b/src/zeroconf/meson.build @@ -1,6 +1,6 @@ zeroconf_option = get_option('zeroconf') -libavahi_client_dep = dependency('', required: false) +avahi_dep = dependency('', required: false) if zeroconf_option == 'auto' if is_darwin @@ -8,12 +8,7 @@ if zeroconf_option == 'auto' elif is_android or is_windows zeroconf_option = 'disabled' elif dbus_dep.found() - libavahi_client_dep = dependency('avahi-client', required: false) - if libavahi_client_dep.found() - zeroconf_option = 'avahi' - else - zeroconf_option = 'disabled' - endif + zeroconf_option = 'avahi' else zeroconf_option = 'disabled' endif @@ -50,8 +45,11 @@ if zeroconf_option == 'bonjour' dependencies: bonjour_deps, ) else - if not libavahi_client_dep.found() - libavahi_client_dep = dependency('avahi-client') + subdir('avahi') + + if not avahi_dep.found() + zeroconf_dep = dependency('', required: false) + subdir_done() endif conf.set('HAVE_AVAHI', true) @@ -60,10 +58,9 @@ else 'zeroconf_bonjour', 'ZeroconfGlue.cxx', 'ZeroconfAvahi.cxx', - 'AvahiPoll.cxx', include_directories: inc, dependencies: [ - libavahi_client_dep, + avahi_dep, dbus_dep, time_dep, log_dep, diff --git a/test/meson.build b/test/meson.build index e1b8c5550..e51cf7ac7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -105,7 +105,7 @@ test('TestIcu', executable( ], )) -if libavahi_client_dep.found() +if avahi_dep.found() executable( 'run_avahi', 'run_avahi.cxx',