Add discrete options for protocol plugins

Mon, 12 May 2025 20:27:27 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 May 2025 20:27:27 -0500
changeset 43247
197c541b3e7c
parent 43246
0e9bbe9b4da8
child 43248
55ff17a82093

Add discrete options for protocol plugins

This removes the dynamic-prpls option and replaces it with discrete options
for each protocol plugin.

Testing Done:
Called in the turtles after removing all of my subproject check outs.

Reviewed at https://reviews.imfreedom.org/r/3994/

meson.build file | annotate | diff | comparison | revisions
meson_options.txt file | annotate | diff | comparison | revisions
protocols/bonjour/meson.build file | annotate | diff | comparison | revisions
protocols/demo/meson.build file | annotate | diff | comparison | revisions
protocols/ircv3/meson.build file | annotate | diff | comparison | revisions
protocols/sip/meson.build file | annotate | diff | comparison | revisions
protocols/xmpp/meson.build file | annotate | diff | comparison | revisions
--- a/meson.build	Mon May 12 20:25:16 2025 -0500
+++ b/meson.build	Mon May 12 20:27:27 2025 -0500
@@ -246,34 +246,9 @@
 pango_dep = dependency('pango', version : '>=1.54.0')
 seagull_dep = dependency('seagull', version : '>= 0.1.1')
 sqlite3 = dependency('sqlite3', version : '>= 3.27.0')
-xeme_dep = dependency('xeme')
 
 dependency('shoes', required : false)
 
-DEFAULT_PRPLS = ['demo', 'ircv3', 'sip', 'xmpp']
-
-dynamic_list = get_option('dynamic-prpls').split(',')
-if dynamic_list == ['all']
-	dynamic_list = DEFAULT_PRPLS
-endif
-DYNAMIC_PRPLS = []
-foreach prpl : dynamic_list
-	if prpl == ''
-		# The list was empty; do nothing.
-	elif prpl == 'xmpp' and not xeme_dep.found()
-		# Do nothing.
-	elif prpl == 'sip' and host_machine.system() == 'windows'
-		# Disable the plugin on windows as we don't have the dependency right now.
-	else
-		DYNAMIC_PRPLS += [prpl]
-	endif
-endforeach
-
-DYNAMIC_DEMO = DYNAMIC_PRPLS.contains('demo')
-DYNAMIC_IRCV3 = DYNAMIC_PRPLS.contains('ircv3')
-DYNAMIC_SIP = DYNAMIC_PRPLS.contains('sip')
-DYNAMIC_XMPP = DYNAMIC_PRPLS.contains('xmpp')
-
 add_project_arguments(
     '-DPURPLE_DISABLE_DEPRECATED',
     '-DPIDGIN_DISABLE_DEPRECATED',
@@ -440,10 +415,6 @@
     'GTK': get_option('gtkui'),
 }, section: 'User Interfaces', bool_yn: true)
 
-summary({
-    'Dynamic protocols': DYNAMIC_PRPLS,
-}, 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({
--- a/meson_options.txt	Mon May 12 20:25:16 2025 -0500
+++ b/meson_options.txt	Mon May 12 20:27:27 2025 -0500
@@ -22,11 +22,20 @@
 ##############################################################################
 # Protocol Plugins
 
-option('avahi', type : 'feature',
-       description : 'compile with avahi (required for Bonjour support)')
+option('demo', type : 'feature',
+       description : 'build the demo protocol plugin')
+
+option('ircv3', type : 'feature',
+       description : 'build the IRCv3 protocol plugin')
 
-option('dynamic-prpls', type : 'string', value: 'all',
-       description : 'specify which protocols to build dynamically')
+option('link-local-messaging', type : 'feature',
+       description : 'build the link local messaging protocol plugin')
+
+option('sip', type : 'feature',
+       description : 'build the SIP protocol plugin')
+
+option('xmpp', type : 'feature',
+       description : 'build the XMPP protocol plugin')
 
 ##############################################################################
 # Pidgin Options
--- a/protocols/bonjour/meson.build	Mon May 12 20:25:16 2025 -0500
+++ b/protocols/bonjour/meson.build	Mon May 12 20:27:27 2025 -0500
@@ -1,3 +1,13 @@
+feature = get_option('link-local-messaging')
+
+summary({'Link Local Messaging': feature}, section : 'Protocols')
+
+if not feature.allowed()
+  subdir_done()
+endif
+
+xeme_dep = dependency('xeme')
+
 BONJOUR_SOURCES = [
 	'purplebonjourconnection.c',
 	'purplebonjourcore.c',
--- a/protocols/demo/meson.build	Mon May 12 20:25:16 2025 -0500
+++ b/protocols/demo/meson.build	Mon May 12 20:27:27 2025 -0500
@@ -1,3 +1,11 @@
+feature = get_option('demo')
+
+summary({'Demo': feature}, section : 'Protocols')
+
+if not feature.allowed()
+  subdir_done()
+endif
+
 DEMO_SOURCES = [
 	'purpledemocommands.c',
 	'purpledemocommands.h',
@@ -17,19 +25,17 @@
 	'purpledemoprotocolconversation.h',
 ]
 
-if DYNAMIC_DEMO
-	demo_resources = gnome.compile_resources('purpledemoresource',
-		'resources/purpledemo.gresource.xml',
-		source_dir : 'resources',
-		c_name : 'purple_demo')
-	DEMO_SOURCES += demo_resources
+demo_resources = gnome.compile_resources('purpledemoresource',
+	'resources/purpledemo.gresource.xml',
+	source_dir : 'resources',
+	c_name : 'purple_demo')
+DEMO_SOURCES += demo_resources
 
-	shared_library('demo', DEMO_SOURCES,
-		c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-Demo"'],
-		gnu_symbol_visibility : 'hidden',
-		dependencies : [glib, json, libpurple_dep],
-		install : true,
-		install_dir : PURPLE_PLUGINDIR)
+shared_library('demo', DEMO_SOURCES,
+	c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-Demo"'],
+	gnu_symbol_visibility : 'hidden',
+	dependencies : [glib, json, libpurple_dep],
+	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())
--- a/protocols/ircv3/meson.build	Mon May 12 20:25:16 2025 -0500
+++ b/protocols/ircv3/meson.build	Mon May 12 20:27:27 2025 -0500
@@ -1,3 +1,11 @@
+feature = get_option('ircv3')
+
+summary({'IRCv3': feature}, section : 'Protocols')
+
+if not feature.allowed()
+  subdir_done()
+endif
+
 IRCV3_SOURCES = [
 	'purpleircv3commands.c',
 	'purpleircv3connection.c',
@@ -18,19 +26,8 @@
 	'purpleircv3protocolconversation.h',
 ]
 
-if not DYNAMIC_IRCV3
-	subdir_done()
-endif
-
 ibis_dep = dependency('ibis', version : '>= 0.13.1')
 
-ircv3_filebase = f'purple-@purple_api_major_version@-ircv3'
-ircv3_filebase = f'purple-@purple_api_major_version@-ircv3'
-
-ircv3_includes = include_directories('.')
-ircv3_include_base = purple_include_base / 'protocols/ircv3'
-
-
 ircv3_resources = gnome.compile_resources('ircv3resource',
 	'resources/ircv3.gresource.xml',
 	source_dir : 'resources',
--- a/protocols/sip/meson.build	Mon May 12 20:25:16 2025 -0500
+++ b/protocols/sip/meson.build	Mon May 12 20:27:27 2025 -0500
@@ -1,3 +1,15 @@
+feature = get_option('sip')
+
+feature = feature.disable_if(
+  host_machine.system() == 'windows',
+  error_message : 'sofia-sip is not currently packaged for windows.')
+
+summary({'SIP': feature}, section : 'Protocols')
+
+if not feature.allowed()
+  subdir_done()
+endif
+
 SIP_SOURCES = [
 	'purplesipplugin.c',
 	'purplesipplugin.h',
@@ -5,22 +17,20 @@
 	'purplesipprotocol.h',
 ]
 
-if DYNAMIC_SIP
-	sofia_sip_ua_dep = dependency('sofia-sip-ua', version : '>=1.12.11')
-	sofia_sip_ua_glib_dep = dependency('sofia-sip-ua-glib', version : '>=1.12.11')
+sofia_sip_ua_dep = dependency('sofia-sip-ua', version : '>=1.12.11')
+sofia_sip_ua_glib_dep = dependency('sofia-sip-ua-glib', version : '>=1.12.11')
 
-	sip_resources = gnome.compile_resources('purplesipresource',
-		'resources/purplesip.gresource.xml',
-		source_dir : 'resources',
-		c_name : 'purple_sip')
-	SIP_SOURCES += sip_resources
+sip_resources = gnome.compile_resources('purplesipresource',
+	'resources/purplesip.gresource.xml',
+	source_dir : 'resources',
+	c_name : 'purple_sip')
+SIP_SOURCES += sip_resources
 
-	shared_library('sip', SIP_SOURCES,
-		c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-Sip"'],
-		gnu_symbol_visibility : 'hidden',
-		dependencies : [glib, libpurple_dep, sofia_sip_ua_dep, sofia_sip_ua_glib_dep],
-		install : true,
-		install_dir : PURPLE_PLUGINDIR)
+shared_library('sip', SIP_SOURCES,
+	c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-Sip"'],
+	gnu_symbol_visibility : 'hidden',
+	dependencies : [glib, libpurple_dep, sofia_sip_ua_dep, sofia_sip_ua_glib_dep],
+	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())
--- a/protocols/xmpp/meson.build	Mon May 12 20:25:16 2025 -0500
+++ b/protocols/xmpp/meson.build	Mon May 12 20:27:27 2025 -0500
@@ -1,3 +1,13 @@
+feature = get_option('xmpp')
+
+summary({'XMPP': feature}, section : 'Protocols')
+
+if not feature.allowed()
+  subdir_done()
+endif
+
+xeme_dep = dependency('xeme')
+
 XMPP_SOURCES = [
 	'purplexmppconnection.c',
 	'purplexmppcore.c',
@@ -11,10 +21,6 @@
 	'purplexmppprotocol.h',
 ]
 
-if not DYNAMIC_XMPP
-	subdir_done()
-endif
-
 xmpp_resources = gnome.compile_resources('xmppresource',
 	'resources/xmpp.gresource.xml',
 	source_dir : 'resources',

mercurial