# HG changeset patch
# Node ID 99cb7f5db6f7
# Parent  0c1829dae5b6
diff --git a/finch/meson.build b/finch/meson.build
--- a/finch/meson.build
+++ b/finch/meson.build
@@ -1,86 +1,80 @@
 enable_consoleui = false
-if get_option('consoleui')
-	libgnt_dep = dependency('gnt3',
-		version : '>= 3.0.0',
-		fallback : ['libgnt', 'libgnt_dep'])
+if not get_option('consoleui')
+  subdir_done()
+endif
+
+libgnt_dep = dependency('gnt3',
+	version : '>= 3.0.0',
+	fallback : ['libgnt', 'libgnt_dep'])
 
-	#######################################################################
-	# Check for ncurses and other things used by it
-	# FIXME: This should be temporary until libgnt wraps the functionality.
-	#######################################################################
-	ncurses_available = true
-	ncurses_header = 'ncurses.h'
-	# Some distros put the headers in ncursesw/, some don't. These are ordered to
-	# pick the last available as most-specific version.
-	ncursesw_header_paths = ['', 'ncursesw/']
+#######################################################################
+# Check for ncurses and other things used by it
+# FIXME: This should be temporary until libgnt wraps the functionality.
+#######################################################################
+ncurses_available = true
+ncurses_header = 'ncurses.h'
+# Some distros put the headers in ncursesw/, some don't. These are ordered to
+# pick the last available as most-specific version.
+ncursesw_header_paths = ['', 'ncursesw/']
 
-	ncurses = dependency('ncursesw', required : false)
-	if ncurses.found()
+ncurses = dependency('ncursesw', required : false)
+if ncurses.found()
+	foreach location : ncursesw_header_paths
+		f = location / 'ncurses.h'
+		if compiler.has_header_symbol(f, 'get_wch',
+		    prefix : '#define _XOPEN_SOURCE_EXTENDED')
+			ncurses_header = f
+		endif
+	endforeach
+else
+	ncurses_available = false
+	ncurses_inc = []
+	ncurses_libs = compiler.find_library('ncursesw', required : false)
+	if ncurses_libs.found()
 		foreach location : ncursesw_header_paths
 			f = location / 'ncurses.h'
 			if compiler.has_header_symbol(f, 'get_wch',
 			    prefix : '#define _XOPEN_SOURCE_EXTENDED')
+				ncurses_available = true
 				ncurses_header = f
 			endif
 		endforeach
-	else
-		ncurses_available = false
-		ncurses_inc = []
-		ncurses_libs = compiler.find_library('ncursesw', required : false)
-		if ncurses_libs.found()
-			foreach location : ncursesw_header_paths
-				f = location / 'ncurses.h'
-				if compiler.has_header_symbol(f, 'get_wch',
-				    prefix : '#define _XOPEN_SOURCE_EXTENDED')
-					ncurses_available = true
-					ncurses_header = f
-				endif
-			endforeach
 
-			if ncurses_available
-				ncurses = declare_dependency(
-				    include_directories : ncurses_inc,
-				    dependencies : ncurses_libs
-				)
-			endif
+		if ncurses_available
+			ncurses = declare_dependency(
+			    include_directories : ncurses_inc,
+			    dependencies : ncurses_libs
+			)
 		endif
 	endif
+endif
 
-	if not ncurses_available
-		# ncursesw was not found. Look for plain old ncurses
-		ncurses = dependency('ncurses', required : false)
-		if ncurses.found()
-			ncurses_available = true
-		else
-			ncurses_libs = compiler.find_library('ncurses', required : false)
-			ncurses_available = ncurses_libs.found()
-			ncurses = declare_dependency(dependencies : ncurses_libs)
-		endif
-	endif
-
-	if not ncurses_available and host_machine.system() == 'windows'
-		# Try pdcurses too.
-		ncurses_header = 'curses.h'
-		ncurses_libs = compiler.find_library('pdcurses', required : false)
-		ncurses_available = compiler.has_header(ncurses_header) and ncurses_libs.found()
+if not ncurses_available
+	# ncursesw was not found. Look for plain old ncurses
+	ncurses = dependency('ncurses', required : false)
+	if ncurses.found()
+		ncurses_available = true
+	else
+		ncurses_libs = compiler.find_library('ncurses', required : false)
+		ncurses_available = ncurses_libs.found()
 		ncurses = declare_dependency(dependencies : ncurses_libs)
 	endif
-
-	if not ncurses_available
-		error('ncurses could not be found!')
-	endif
+endif
 
-	if libgnt_dep.found() and ncurses_available
-		ncurses_header = '-DNCURSES_HEADER="@0@"'.format(ncurses_header)
-		enable_consoleui = true
-	else
-		error('''
+if not ncurses_available and host_machine.system() == 'windows'
+	# Try pdcurses too.
+	ncurses_header = 'curses.h'
+	ncurses_libs = compiler.find_library('pdcurses', required : false)
+	ncurses_available = compiler.has_header(ncurses_header) and ncurses_libs.found()
+	ncurses = declare_dependency(dependencies : ncurses_libs)
+endif
 
-Finch will not be built. You need to install libgnt (or its requirements) and its development headers.
+if not ncurses_available
+	error('ncurses could not be found!')
+endif
 
-''')
-	endif
-endif
+ncurses_header = '-DNCURSES_HEADER="@0@"'.format(ncurses_header)
+enable_consoleui = true
 
 
 libfinch_SOURCES = [
@@ -156,92 +150,90 @@ else
 	winmm = []
 endif
 
-if enable_consoleui
-	libfinch_enums = gnome.mkenums_simple('finchenums',
-		sources: libfinch_enum_headers)
-	libfinch_built_sources += libfinch_enums[0]
-	libfinch_built_headers += libfinch_enums[1]
+libfinch_enums = gnome.mkenums_simple('finchenums',
+	sources: libfinch_enum_headers)
+libfinch_built_sources += libfinch_enums[0]
+libfinch_built_headers += libfinch_enums[1]
 
-	FINCH_H_INCLUDES = []
-	foreach header : libfinch_headers + ['finchenums.h']
-		FINCH_H_INCLUDES += '#include <finch/@0@>'.format(header)
-	endforeach
-	finch_h_conf = configuration_data()
-	finch_h_conf.set('FINCH_H_INCLUDES', '\n'.join(FINCH_H_INCLUDES))
+FINCH_H_INCLUDES = []
+foreach header : libfinch_headers + ['finchenums.h']
+	FINCH_H_INCLUDES += '#include <finch/@0@>'.format(header)
+endforeach
+finch_h_conf = configuration_data()
+finch_h_conf.set('FINCH_H_INCLUDES', '\n'.join(FINCH_H_INCLUDES))
 
-	finch_h = configure_file(input : 'finch.h.in',
-	                         output : 'finch.h',
-	                         configuration : finch_h_conf,
-	                         install : true,
-				 install_dir : get_option('includedir') / 'finch-3')
-	libfinch_built_headers += finch_h
+finch_h = configure_file(input : 'finch.h.in',
+                         output : 'finch.h',
+                         configuration : finch_h_conf,
+                         install : true,
+			 install_dir : get_option('includedir') / 'finch-3')
+libfinch_built_headers += finch_h
 
-	install_headers(libfinch_headers, subdir : 'finch-3')
+install_headers(libfinch_headers, subdir : 'finch-3')
 
-	libfinch_inc = include_directories('.')
-	libfinch = shared_library('finch3',
-	    libfinch_SOURCES + libfinch_built_headers + libfinch_built_sources,
-	    c_args : [
-	        '-DSTANDALONE',
-	        '-DGNTSEAL_ENABLE',
-	        '-DFINCH_COMPILATION',
-	        ncurses_header,
-	        '-DG_LOG_USE_STRUCTURED',
-	        '-DG_LOG_DOMAIN="Finch"',
-	    ],
-	    include_directories : [toplevel_inc],
-	    version : PURPLE_LIB_VERSION,
-	    dependencies : [libpurple_dep, libgnt_dep, ncurses, glib, winmm],
-	    install : true)
+libfinch_inc = include_directories('.')
+libfinch = shared_library('finch3',
+    libfinch_SOURCES + libfinch_built_headers + libfinch_built_sources,
+    c_args : [
+        '-DSTANDALONE',
+        '-DGNTSEAL_ENABLE',
+        '-DFINCH_COMPILATION',
+        ncurses_header,
+        '-DG_LOG_USE_STRUCTURED',
+        '-DG_LOG_DOMAIN="Finch"',
+    ],
+    include_directories : [toplevel_inc],
+    version : PURPLE_LIB_VERSION,
+    dependencies : [libpurple_dep, libgnt_dep, ncurses, glib, winmm],
+    install : true)
 
-	if enable_introspection
-		introspection_sources = libfinch_headers
+if enable_introspection
+	introspection_sources = libfinch_headers
 
-		libfinch_gir = gnome.generate_gir(libfinch,
-		    sources : introspection_sources,
-		    header : 'finch.h',
-		    includes : ['GLib-2.0', 'GModule-2.0', 'GObject-2.0', libpurple_gir[0], 'Gnt-3.0'],
-		    namespace : 'Finch',
-		    symbol_prefix : 'finch',
-		    identifier_prefix : 'Finch',
-		    export_packages : 'finch-3',
-		    nsversion : '@0@.@1@'.format(purple_major_version,
-		                                 purple_minor_version),
-		    dependencies: [libgnt_dep, gplugin_dep, libpurple_dep],
-		    install : true,
-		    extra_args : ['-DFINCH_COMPILATION', '--quiet'])
-		libfinch_generated_sources += libfinch_gir
-	endif
+	libfinch_gir = gnome.generate_gir(libfinch,
+	    sources : introspection_sources,
+	    header : 'finch.h',
+	    includes : ['GLib-2.0', 'GModule-2.0', 'GObject-2.0', libpurple_gir[0], 'Gnt-3.0'],
+	    namespace : 'Finch',
+	    symbol_prefix : 'finch',
+	    identifier_prefix : 'Finch',
+	    export_packages : 'finch-3',
+	    nsversion : '@0@.@1@'.format(purple_major_version,
+	                                 purple_minor_version),
+	    dependencies: [libgnt_dep, gplugin_dep, libpurple_dep],
+	    install : true,
+	    extra_args : ['-DFINCH_COMPILATION', '--quiet'])
+	libfinch_generated_sources += libfinch_gir
+endif
 
-	libfinch_dep = declare_dependency(
-	    include_directories : [toplevel_inc, libfinch_inc],
-	    link_with : libfinch,
-	    sources: libfinch_built_headers + libfinch_generated_sources,
-	    dependencies : [libpurple_dep, libgnt_dep, glib])
+libfinch_dep = declare_dependency(
+    include_directories : [toplevel_inc, libfinch_inc],
+    link_with : libfinch,
+    sources: libfinch_built_headers + libfinch_generated_sources,
+    dependencies : [libpurple_dep, libgnt_dep, glib])
 
-	finch = executable('finch3',
-	    finch_SOURCES,
-	    c_args : [
-	        '-DSTANDALONE',
-	        '-DGNTSEAL_ENABLE',
-	        '-DG_LOG_USE_STRUCTURED',
-	        '-DG_LOG_DOMAIN="Finch"',
-	    ],
-	    dependencies : [libpurple_dep, libgnt_dep, libfinch_dep],
-	    install : true)
+finch = executable('finch3',
+    finch_SOURCES,
+    c_args : [
+        '-DSTANDALONE',
+        '-DGNTSEAL_ENABLE',
+        '-DG_LOG_USE_STRUCTURED',
+        '-DG_LOG_DOMAIN="Finch"',
+    ],
+    dependencies : [libpurple_dep, libgnt_dep, libfinch_dep],
+    install : true)
 
-	meson.override_dependency('finch-3', libfinch_dep)
+meson.override_dependency('finch-3', libfinch_dep)
 
-	pkgconfig.generate(
-	    libfinch,
-	    name : 'Finch',
-	    description : 'Finch is an instant messenger application that uses libpurple for protocol support and ncurses (libgnt) for the UI.',
-	    version : meson.project_version(),
-	    filebase : 'finch-3',
-	    subdirs : 'finch-3',
-	    # NOTE: Don't use gnt from pkgconfig, as it might be a subproject.
-	    requires : ['gnt', libpurple],
-	    variables : ['plugindir=${libdir}/finch-@0@'.format(purple_major_version)])
+pkgconfig.generate(
+    libfinch,
+    name : 'Finch',
+    description : 'Finch is an instant messenger application that uses libpurple for protocol support and ncurses (libgnt) for the UI.',
+    version : meson.project_version(),
+    filebase : 'finch-3',
+    subdirs : 'finch-3',
+    # NOTE: Don't use gnt from pkgconfig, as it might be a subproject.
+    requires : ['gnt', libpurple],
+    variables : ['plugindir=${libdir}/finch-@0@'.format(purple_major_version)])
 
-	subdir('plugins')
-endif  # enable_consoleui
+subdir('plugins')
diff --git a/libpurple/plugins/kwallet/meson.build b/libpurple/plugins/kwallet/meson.build
--- a/libpurple/plugins/kwallet/meson.build
+++ b/libpurple/plugins/kwallet/meson.build
@@ -1,20 +1,18 @@
-if kwallet.found()
-	kwallet_moc = qt5.preprocess(
-		moc_headers: 'purplekwallet.h',
-		dependencies: qt5_dep,
-	)
+kwallet_moc = qt5.preprocess(
+	moc_headers: 'purplekwallet.h',
+	dependencies: qt5_dep,
+)
 
-	kwallet_sources = [
-		'purplekwallet.cpp',
-		'purplekwallet.h',
-		kwallet_moc,
-	]
+kwallet_sources = [
+	'purplekwallet.cpp',
+	'purplekwallet.h',
+	kwallet_moc,
+]
 
-	kwallet_plugin = library('purplekwallet', kwallet_sources,
-	    c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-KWalletKeyring"'],
-	    dependencies : [kwallet, qt5_dep, libpurple_dep],
-	    name_prefix : '',
-	    install : true, install_dir : PURPLE_PLUGINDIR)
+kwallet_plugin = library('purplekwallet', kwallet_sources,
+    c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-KWalletKeyring"'],
+    dependencies : [kwallet, qt5_dep, libpurple_dep],
+    name_prefix : '',
+    install : true, install_dir : PURPLE_PLUGINDIR)
 
-	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
-endif
+devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
diff --git a/libpurple/plugins/libsecret/meson.build b/libpurple/plugins/libsecret/meson.build
--- a/libpurple/plugins/libsecret/meson.build
+++ b/libpurple/plugins/libsecret/meson.build
@@ -1,9 +1,7 @@
-if libsecret.found()
-	libsecret_plugin = library('libsecret', 'libsecret.c',
-	    c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-LibSecret"'],
-	    dependencies : [libsecret, libpurple_dep],
-	    name_prefix : '',
-	    install : true, install_dir : PURPLE_PLUGINDIR)
+libsecret_plugin = library('libsecret', 'libsecret.c',
+    c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-LibSecret"'],
+    dependencies : [libsecret, libpurple_dep],
+    name_prefix : '',
+    install : true, install_dir : PURPLE_PLUGINDIR)
 
-	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
-endif
+devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
diff --git a/libpurple/plugins/meson.build b/libpurple/plugins/meson.build
--- a/libpurple/plugins/meson.build
+++ b/libpurple/plugins/meson.build
@@ -3,8 +3,8 @@ subdir('buddynote')
 subdir('idle')
 subdir('joinpart')
 subdir('keychain-access')
-subdir('kwallet')
-subdir('libsecret')
+subdir('kwallet', if_found : kwallet)
+subdir('libsecret', if_found : libsecret)
 subdir('notification-sound')
 subdir('psychic')
 subdir('purple-toast')
diff --git a/libpurple/protocols/zephyr/meson.build b/libpurple/protocols/zephyr/meson.build
--- a/libpurple/protocols/zephyr/meson.build
+++ b/libpurple/protocols/zephyr/meson.build
@@ -63,7 +63,7 @@ ZEPHYR_SOURCES = [
 ]
 
 extdep = krb4
-if EXTERNAL_LIBZEPHYR
+if ext_zephyr.found()
 	extdep = ext_zephyr
 else
 	ZEPHYR_SOURCES += ZEPHYR_INTERNAL_SOURCES
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -547,8 +547,7 @@ sasl = dependency('libsasl2', version : 
 # Check for external libzephyr
 #######################################################################
 ext_zephyr = dependency('zephyr', required : get_option('zephyr'))
-EXTERNAL_LIBZEPHYR = ext_zephyr.found()
-conf.set('LIBZEPHYR_EXT', EXTERNAL_LIBZEPHYR)
+conf.set('LIBZEPHYR_EXT', ext_zephyr.found())
 
 #######################################################################
 # Check for Kerberos (for Zephyr)
@@ -668,6 +667,8 @@ summary({
     'datadir': get_option('datadir'),
 }, section : 'Directories')
 
+# TODO: Remove `.found()` once https://github.com/mesonbuild/meson/pull/10949
+# is merged and in a release that we require.
 summary({
     'GTK': get_option('gtkui'),
     'console': enable_consoleui,
@@ -676,11 +677,13 @@ summary({
 
 summary({
     'Dynamic protocols': DYNAMIC_PRPLS,
-    'Cyrus SASL support (IRC and XMPP)': sasl.found(),
-    'External libzephyr': EXTERNAL_LIBZEPHYR,
+    'Cyrus SASL support (IRC and XMPP)': sasl,
+    'External libzephyr': ext_zephyr,
     'Use kerberos 4 with zephyr': kerberos,
 }, section: 'Protocol Support', bool_yn: true, list_sep: ', ')
 
+# TODO: Remove `.found()` once https://github.com/mesonbuild/meson/pull/10949
+# is merged and in a release that we require.
 summary({
     'KWallet credential provider': kwallet.found(),
     'libsecret credential provider': libsecret.found(),
diff --git a/pidgin/meson.build b/pidgin/meson.build
--- a/pidgin/meson.build
+++ b/pidgin/meson.build
@@ -1,3 +1,7 @@
+if not ENABLE_GTK
+  subdir_done()
+endif
+
 libpidgin_SOURCES = [
 	'gtkaccount.c',
 	'gtkblist.c',
@@ -167,6 +171,14 @@ if IS_WIN32
 		'win32/gtkwin32dep.c',
 	]
 
+	pidgin_dll_rc = configure_file(
+	    input : 'win32/pidgin_dll_rc.rc.in',
+	    output : 'pidgin_dll_rc.rc',
+	    configuration : version_conf)
+	libpidgin_SOURCES += windows.compile_resources(pidgin_dll_rc,
+	    include_directories : include_directories('win32')
+	)
+
 	pidgin_exe_rc = configure_file(
 	    input : 'win32/pidgin_exe_rc.rc.in',
 	    output : 'pidgin_exe_rc.rc',
@@ -179,137 +191,125 @@ if IS_WIN32
 	]
 endif
 
-if ENABLE_GTK
-	if IS_WIN32
-		pidgin_dll_rc = configure_file(
-		    input : 'win32/pidgin_dll_rc.rc.in',
-		    output : 'pidgin_dll_rc.rc',
-		    configuration : version_conf)
-		libpidgin_SOURCES += windows.compile_resources(pidgin_dll_rc,
-		    include_directories : include_directories('win32')
-		)
-	endif
+libpidgin_enums = gnome.mkenums_simple('pidginenums',
+	sources: libpidgin_enum_headers,
+	install_header: true,
+	install_dir: get_option('includedir') / pidgin_include_base)
+libpidgin_enums_c = libpidgin_enums[0]
+libpidgin_enums_h = libpidgin_enums[1]
 
-	libpidgin_enums = gnome.mkenums_simple('pidginenums',
-		sources: libpidgin_enum_headers,
-		install_header: true,
-		install_dir: get_option('includedir') / pidgin_include_base)
-	libpidgin_enums_c = libpidgin_enums[0]
-	libpidgin_enums_h = libpidgin_enums[1]
+PIDGIN_H_INCLUDES = []
+foreach header : libpidgin_headers + libpidgin_prefs_headers + ['pidginenums.h']
+	PIDGIN_H_INCLUDES += '#include <pidgin/@0@>'.format(header)
+endforeach
+pidgin_h_conf = configuration_data()
+pidgin_h_conf.set('PIDGIN_H_INCLUDES', '\n'.join(PIDGIN_H_INCLUDES))
+pidgin_h = configure_file(input : 'pidgin.h.in',
+                          output : 'pidgin.h',
+                          configuration : pidgin_h_conf,
+                          install : true,
+                          install_dir : get_option('includedir') / pidgin_filebase)
+
+install_headers(libpidgin_headers, subdir : pidgin_include_base)
+install_headers(libpidgin_prefs_headers, subdir : pidgin_include_base / 'prefs')
 
-	PIDGIN_H_INCLUDES = []
-	foreach header : libpidgin_headers + libpidgin_prefs_headers + ['pidginenums.h']
-		PIDGIN_H_INCLUDES += '#include <pidgin/@0@>'.format(header)
-	endforeach
-	pidgin_h_conf = configuration_data()
-	pidgin_h_conf.set('PIDGIN_H_INCLUDES', '\n'.join(PIDGIN_H_INCLUDES))
-	pidgin_h = configure_file(input : 'pidgin.h.in',
-	                          output : 'pidgin.h',
-	                          configuration : pidgin_h_conf,
-	                          install : true,
-	                          install_dir : get_option('includedir') / pidgin_filebase)
+_libpidgin_dependencies = [
+	glib,
+	gplugin_gtk_dep,
+	gtk,
+	IOKIT,
+	json,
+	libadwaita,
+	math,
+	libsoup,
+	talkatu_dep,
+	libpurple_dep,
+]
 
-	install_headers(libpidgin_headers, subdir : pidgin_include_base)
-	install_headers(libpidgin_prefs_headers, subdir : pidgin_include_base / 'prefs')
+libpidgin_built_sources = [
+	libpidgin_enums_c,
+]
 
-	_libpidgin_dependencies = [
-		glib,
-		gplugin_gtk_dep,
-		gtk,
-		IOKIT,
-		json,
-		libadwaita,
-		math,
-		libsoup,
-		talkatu_dep,
-		libpurple_dep,
-	]
+libpidgin_built_headers = [
+	pidgin_h,
+	libpidgin_enums_h,
+]
 
-	libpidgin_built_sources = [
-		libpidgin_enums_c,
-	]
-
-	libpidgin_built_headers = [
-		pidgin_h,
-		libpidgin_enums_h,
-	]
+libpidgin_inc = include_directories('.')
+libpidgin = shared_library('pidgin3',
+    libpidgin_SOURCES + libpidgin_built_sources + libpidgin_built_headers + ['pidginprivate.h'],
+    package_revision,
+    c_args : ['-DPIDGIN_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Pidgin"'],
+    include_directories : [toplevel_inc, include_directories('prefs')],
+    version : PURPLE_LIB_VERSION,
+    dependencies : _libpidgin_dependencies,
+    install : true)
+libpidgin_dep = declare_dependency(
+    include_directories : [toplevel_inc, libpidgin_inc],
+    link_with : libpidgin,
+    sources : libpidgin_built_headers,
+    dependencies : [gtk, glib, libadwaita, math, talkatu_dep, gplugin_gtk_dep])
 
-	libpidgin_inc = include_directories('.')
-	libpidgin = shared_library('pidgin3',
-	    libpidgin_SOURCES + libpidgin_built_sources + libpidgin_built_headers + ['pidginprivate.h'],
-	    package_revision,
-	    c_args : ['-DPIDGIN_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Pidgin"'],
-	    include_directories : [toplevel_inc, include_directories('prefs')],
-	    version : PURPLE_LIB_VERSION,
-	    dependencies : _libpidgin_dependencies,
-	    install : true)
-	libpidgin_dep = declare_dependency(
-	    include_directories : [toplevel_inc, libpidgin_inc],
-	    link_with : libpidgin,
-	    sources : libpidgin_built_headers,
-	    dependencies : [gtk, glib, libadwaita, math, talkatu_dep, gplugin_gtk_dep])
+pidgin = executable('pidgin3',
+    pidgin_SOURCES,
+    c_args : ['-DPIDGIN_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Pidgin"'],
+    include_directories : toplevel_inc,
+    dependencies : IS_WIN32 ? [] : [libpurple_dep, libpidgin_dep],
+    win_subsystem : 'windows',
+    install : true)
+
+meson.override_dependency(pidgin_filebase, libpidgin_dep)
 
-	pidgin = executable('pidgin3',
-	    pidgin_SOURCES,
-	    c_args : ['-DPIDGIN_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Pidgin"'],
-	    include_directories : toplevel_inc,
-	    dependencies : IS_WIN32 ? [] : [libpurple_dep, libpidgin_dep],
-	    win_subsystem : 'windows',
-	    install : true)
-
-	meson.override_dependency(pidgin_filebase, libpidgin_dep)
-
-	pkgconfig.generate(
-	    libpidgin,
-	    name : 'Pidgin',
-	    description : 'Pidgin is a GTK based instant messenger application.',
-	    version : meson.project_version(),
-	    filebase : pidgin_filebase,
-	    subdirs : pidgin_filebase,
-	    # NOTE: Don't use dependencies from subprojects.
-	    requires : [gtk, libadwaita, libpurple, 'talkatu', 'gplugin-gtk4'],
-	    variables : ['plugindir=${libdir}/pidgin-@0@'.format(purple_major_version)])
+pkgconfig.generate(
+    libpidgin,
+    name : 'Pidgin',
+    description : 'Pidgin is a GTK based instant messenger application.',
+    version : meson.project_version(),
+    filebase : pidgin_filebase,
+    subdirs : pidgin_filebase,
+    # NOTE: Don't use dependencies from subprojects.
+    requires : [gtk, libadwaita, libpurple, 'talkatu', 'gplugin-gtk4'],
+    variables : ['plugindir=${libdir}/pidgin-@0@'.format(purple_major_version)])
 
-	PIDGIN_DESKTOP_FILE = 'im.pidgin.Pidgin3.desktop'
-	i18n = import('i18n')
-	desktop_file_in = configure_file(
-	    input : 'data' / (PIDGIN_DESKTOP_FILE + '.in.in'),
-	    output : PIDGIN_DESKTOP_FILE + '.in',
-	    configuration : conf)
-	desktop_file = i18n.merge_file(
-	    input : desktop_file_in,
-	    output : PIDGIN_DESKTOP_FILE,
-	    po_dir : meson.project_source_root() / 'po',
-	    type : 'desktop',
-	    install : true,
-	    install_dir : get_option('datadir') / 'applications')
+PIDGIN_DESKTOP_FILE = 'im.pidgin.Pidgin3.desktop'
+i18n = import('i18n')
+desktop_file_in = configure_file(
+    input : 'data' / (PIDGIN_DESKTOP_FILE + '.in.in'),
+    output : PIDGIN_DESKTOP_FILE + '.in',
+    configuration : conf)
+desktop_file = i18n.merge_file(
+    input : desktop_file_in,
+    output : PIDGIN_DESKTOP_FILE,
+    po_dir : meson.project_source_root() / 'po',
+    type : 'desktop',
+    install : true,
+    install_dir : get_option('datadir') / 'applications')
 
-	appdata = i18n.merge_file(
-	    input : 'data/im.pidgin.Pidgin3.appdata.xml.in',
-	    output : 'im.pidgin.Pidgin3.appdata.xml',
-	    po_dir : meson.project_source_root() / 'po',
-	    install : true,
-	    install_dir : get_option('datadir') / 'metainfo')
+appdata = i18n.merge_file(
+    input : 'data/im.pidgin.Pidgin3.appdata.xml.in',
+    output : 'im.pidgin.Pidgin3.appdata.xml',
+    po_dir : meson.project_source_root() / 'po',
+    install : true,
+    install_dir : get_option('datadir') / 'metainfo')
 
-	if enable_introspection
-		introspection_sources = libpidgin_SOURCES + libpidgin_headers + libpidgin_prefs_headers
+if enable_introspection
+	introspection_sources = libpidgin_SOURCES + libpidgin_headers + libpidgin_prefs_headers
 
-		pidgin_gir = gnome.generate_gir(libpidgin,
-			sources : introspection_sources,
-			header : 'pidgin.h',
-			includes : ['GLib-2.0', 'GObject-2.0', 'Gtk-4.0', libpurple_gir[0], 'Talkatu-0.0'],
-			namespace : 'Pidgin',
-			symbol_prefix : 'pidgin',
-			identifier_prefix : 'Pidgin',
-			export_packages : 'pidgin-@0@'.format(purple_major_version),
-			nsversion : '@0@.@1@'.format(purple_major_version,
-			                             purple_minor_version),
-			dependencies : [gplugin_dep, gplugin_gtk_dep, talkatu_dep, libpurple_dep],
-			install : true,
-			extra_args : ['-DPIDGIN_COMPILATION', '--quiet'])
-	endif
+	pidgin_gir = gnome.generate_gir(libpidgin,
+		sources : introspection_sources,
+		header : 'pidgin.h',
+		includes : ['GLib-2.0', 'GObject-2.0', 'Gtk-4.0', libpurple_gir[0], 'Talkatu-0.0'],
+		namespace : 'Pidgin',
+		symbol_prefix : 'pidgin',
+		identifier_prefix : 'Pidgin',
+		export_packages : 'pidgin-@0@'.format(purple_major_version),
+		nsversion : '@0@.@1@'.format(purple_major_version,
+		                             purple_minor_version),
+		dependencies : [gplugin_dep, gplugin_gtk_dep, talkatu_dep, libpurple_dep],
+		install : true,
+		extra_args : ['-DPIDGIN_COMPILATION', '--quiet'])
+endif
 
-	subdir('data')
-	subdir('pixmaps')
-	subdir('plugins')
-endif  # ENABLE_GTK
+subdir('data')
+subdir('pixmaps')
+subdir('plugins')
diff --git a/pidgin/plugins/meson.build b/pidgin/plugins/meson.build
--- a/pidgin/plugins/meson.build
+++ b/pidgin/plugins/meson.build
@@ -5,7 +5,5 @@ subdir('iconaway')
 subdir('notify')
 subdir('spellchk')
 subdir('transparency')
-if enable_unity
-	subdir('unity')
-endif
+subdir('unity', if_found : UNITY)
 subdir('xmppconsole')
