Add gobject-introspection for ircv3
This includes a pkgconfig file and installs the header files as well as
purpleircv3.h to ${prefix}/include/purple-3/libpurple/protocols/ircv3.
This does not yet include the documentation as I assume that's going to touch
a bunch of files.
Testing Done:
Compiled against gplugin 0.41.0 locally without issue. Also installed to a local prefix and verified everything looked okie dokie.
Reviewed at https://reviews.imfreedom.org/r/2484/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/ircv3generategir.c Sat Jul 01 02:01:14 2023 -0500
@@ -0,0 +1,10 @@
+#include <gplugin-introspection.h> +main(int argc, char *argv[]) { + return gplugin_introspection_introspect_plugin(&argc, &argv, --- a/libpurple/protocols/ircv3/meson.build Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/meson.build Sat Jul 01 02:01:14 2023 -0500
@@ -20,20 +20,85 @@
- ircv3_resources = gnome.compile_resources('ircv3resource',
- 'resources/ircv3.gresource.xml',
- source_dir : 'resources',
- c_name : 'purple_ircv3')
- IRCV3_SOURCES += ircv3_resources
+ircv3_filebase = f'purple-@purple_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', + c_name : 'purple_ircv3') +IRCV3_SOURCES += ircv3_resources +foreach header : IRCV3_HEADERS + ircv3_h_includes += f'#include <@header@>' +ircv3_h_conf = configuration_data() +ircv3_h_conf.set('IRCV3_H_INCLUDES', '\n'.join(ircv3_h_includes)) +ircv3_h = configure_file(input : 'purpleircv3.h.in', + output : 'purpleircv3.h', + configuration : ircv3_h_conf, + install_dir : get_option('includedir') / ircv3_include_base) +install_headers(IRCV3_HEADERS, + subdir : ircv3_include_base) +ircv3_prpl = shared_library('ircv3', IRCV3_SOURCES + IRCV3_HEADERS + [ircv3_h], + c_args : ['-DPURPLE_IRCV3_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-IRCv3"'], + dependencies : [libpurple_dep, glib, gio, hasl, ws2_32], + install_dir : PURPLE_PLUGINDIR) - ircv3_prpl = shared_library('ircv3', IRCV3_SOURCES + IRCV3_HEADERS,
- c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-IRCv3"'],
- dependencies : [libpurple_dep, glib, gio, hasl, ws2_32],
+ircv3_dep = declare_dependency( + sources : [IRCV3_SOURCES, IRCV3_HEADERS], + include_directories : ircv3_includes, + dependencies : [libpurple_dep, glib, gio, hasl, ws2_32]) + # we purposely don't put the library here because you should not be + # linking to the plugin, everything will be resolved during runtime. + description : 'a purple3 protocol plugin for IRCv3', + version : meson.project_version(), + subdirs : [ircv3_include_base], + filebase : ircv3_filebase, + requires : [gio, glib, 'gplugin', 'hasl', libpurple]) +meson.override_dependency(ircv3_filebase, ircv3_dep) +devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir()) +if get_option('introspection') + GPLUGIN_INTROSPECTION = dependency('gplugin-introspection') + plugin_filename = ircv3_prpl.full_path() + ircv3_introspection_stub = executable('ircv3generategir', + sources : 'ircv3generategir.c', + dependencies : [ircv3_dep, libpurple_dep, glib, gio, hasl, ws2_32, GPLUGIN_INTROSPECTION], + c_args : ['-DPURPLE_IRCV3_COMPILATION', f'-DPLUGIN_FILENAME="@plugin_filename@"'], + ircv3_gir = gnome.generate_gir( + ircv3_introspection_stub, + sources : [IRCV3_SOURCES, IRCV3_HEADERS], + includes : ['GLib-2.0', 'GObject-2.0', 'GPlugin-1.0', libpurple_gir[0]], + namespace : 'PurpleIRCv3', + symbol_prefix : 'purple_ircv3', - install_dir : PURPLE_PLUGINDIR)
+ dependencies: [gplugin_dep], + export_packages : ['ircv3'], + extra_args : ['-DPURPLE_IRCV3_COMPILATION', '--verbose']) - devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/purpleircv3.h.in Sat Jul 01 02:01:14 2023 -0500
@@ -0,0 +1,40 @@
+ * Purple - Internet Messaging Library + * Copyright (C) Pidgin Developers <devel@pidgin.im> + * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses/>. +#ifndef __GI_SCANNER__ /* hide this bit from g-ir-scanner */ +# ifdef PURPLE_IRCV3_COMPILATION +# error "ircv3 source files should not be including purpleircv3.h" +# endif /* PURPLE_IRCV3_COMPILATION */ +#endif /* __GI_SCANNER__ */ +#ifndef PURPLE_IRCV3_GLOBAL_HEADER_INSIDE +# define PURPLE_IRCV3_GLOBAL_HEADER_INSIDE +#endif /* PURPLE_IRCV3_GLOBAL_HEADER_INSIDE */ +#undef PURPLE_IRCV3_GLOBAL_HEADER_INSIDE +#endif /* PURPLE_IRCV3_H */ --- a/libpurple/protocols/ircv3/purpleircv3capabilities.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3capabilities.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_CAPABILITIES_H
#define PURPLE_IRCV3_CAPABILITIES_H
@@ -35,6 +39,14 @@
#include "purpleircv3connection.h"
+ * purple_ircv3_capabilities_register: (skip) + * @plugin: The [class@GPlugin.NativePlugin] instance. + * Dynamically registers the PurpleIRCv3Capabilities type. G_GNUC_INTERNAL void purple_ircv3_capabilities_register(GPluginNativePlugin *plugin);
G_GNUC_INTERNAL PurpleIRCv3Capabilities *purple_ircv3_capabilities_new(PurpleIRCv3Connection *connection);
--- a/libpurple/protocols/ircv3/purpleircv3connection.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3connection.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_CONNECTION_H
#define PURPLE_IRCV3_CONNECTION_H
@@ -43,8 +47,26 @@
+ * purple_ircv3_connection_register: (skip) + * @plugin: The GTypeModule + * Registers the dynamic type using @plugin. G_GNUC_INTERNAL void purple_ircv3_connection_register(GPluginNativePlugin *plugin);
+ * purple_ircv3_connection_get_cancellable: (skip) + * @connection: The instance. + * This is a private method that is not exposed externally. + * Gets the cancellable for @connection. G_GNUC_INTERNAL GCancellable *purple_ircv3_connection_get_cancellable(PurpleIRCv3Connection *connection);
@@ -66,7 +88,7 @@
* Gets the list of capabilities that the server supplied during registration.
- * Returns: The list of capabilities that the server supports.
+ * Returns: (transfer none): The list of capabilities that the server supports. PurpleIRCv3Capabilities *purple_ircv3_connection_get_capabilities(PurpleIRCv3Connection *connection);
--- a/libpurple/protocols/ircv3/purpleircv3core.c Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3core.c Sat Jul 01 02:01:14 2023 -0500
@@ -58,6 +58,7 @@
"website", PURPLE_WEBSITE,
"abi-version", PURPLE_ABI_VERSION,
@@ -76,13 +77,16 @@
purple_ircv3_connection_register(GPLUGIN_NATIVE_PLUGIN(plugin));
purple_ircv3_protocol_register(GPLUGIN_NATIVE_PLUGIN(plugin));
- manager = purple_protocol_manager_get_default();
+ ircv3_protocol = purple_ircv3_protocol_new(); - ircv3_protocol = purple_ircv3_protocol_new();
- if(!purple_protocol_manager_register(manager, ircv3_protocol, error)) {
- g_clear_object(&ircv3_protocol);
+ manager = purple_protocol_manager_get_default(); + /* Manager can be NULL when we're generating the GIR stuff. */ + if(PURPLE_IS_PROTOCOL_MANAGER(manager)) { + if(!purple_protocol_manager_register(manager, ircv3_protocol, error)) { + g_clear_object(&ircv3_protocol);
@@ -103,8 +107,13 @@
manager = purple_protocol_manager_get_default();
- if(!purple_protocol_manager_unregister(manager, ircv3_protocol, error)) {
+ /* Manager can be NULL when we're generating the GIR stuff. */ + if(PURPLE_IS_PROTOCOL_MANAGER(manager)) { + if(!purple_protocol_manager_unregister(manager, ircv3_protocol, g_clear_object(&ircv3_protocol);
--- a/libpurple/protocols/ircv3/purpleircv3core.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3core.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_CORE_H
#define PURPLE_IRCV3_CORE_H
--- a/libpurple/protocols/ircv3/purpleircv3messagehandlers.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3messagehandlers.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_MESSAGE_HANDLERS_H
#define PURPLE_IRCV3_MESSAGE_HANDLERS_H
@@ -32,8 +36,8 @@
* @source: The source of the command.
* @command: The command or numeric of the message.
* @n_params: The number of parameters.
- * @params: (array_length=n_params): The parameters of the message.
- * @error: (nullable) (optional): A return address for a [type@GLib.Error].
+ * @params: (array length=n_params): The parameters of the message. + * @error: (nullable): A return address for a [type@GLib.Error]. * @data: The user data that was passed to [method@PurpleIRCv3.Parser.parse].
* Defines the type of a function that will be called to handle a message.
--- a/libpurple/protocols/ircv3/purpleircv3parser.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3parser.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_PARSER_H
#define PURPLE_IRCV3_PARSER_H
--- a/libpurple/protocols/ircv3/purpleircv3protocol.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3protocol.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_PROTOCOL_H
#define PURPLE_IRCV3_PROTOCOL_H
@@ -41,6 +45,14 @@
+ * purple_ircv3_protocol_register: (skip) + * @plugin: The GTypeModule + * Registers the dynamic type using @plugin. G_GNUC_INTERNAL void purple_ircv3_protocol_register(GPluginNativePlugin *plugin);
G_GNUC_INTERNAL PurpleProtocol *purple_ircv3_protocol_new(void);
--- a/libpurple/protocols/ircv3/purpleircv3protocolim.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3protocolim.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_PROTOCOL_IM_H
#define PURPLE_IRCV3_PROTOCOL_IM_H
--- a/libpurple/protocols/ircv3/purpleircv3sasl.h Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/purpleircv3sasl.h Sat Jul 01 02:01:14 2023 -0500
@@ -15,6 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
+#if !defined(PURPLE_IRCV3_GLOBAL_HEADER_INSIDE) && \ + !defined(PURPLE_IRCV3_COMPILATION) +# error "only <libpurple/protocols/ircv3.h> may be included directly" #ifndef PURPLE_IRCV3_SASL_H
#define PURPLE_IRCV3_SASL_H
--- a/libpurple/protocols/ircv3/tests/meson.build Sat Jul 01 01:52:29 2023 -0500
+++ b/libpurple/protocols/ircv3/tests/meson.build Sat Jul 01 02:01:14 2023 -0500
@@ -6,7 +6,8 @@
f'test_ircv3_@prog@', f'test_ircv3_@prog@.c',
dependencies : [libpurple_dep, glib, hasl],
- objects : ircv3_prpl.extract_all_objects())
+ objects : ircv3_prpl.extract_all_objects(), + c_args : ['-DPURPLE_IRCV3_COMPILATION']) --- a/meson.build Sat Jul 01 01:52:29 2023 -0500
+++ b/meson.build Sat Jul 01 02:01:14 2023 -0500
@@ -460,7 +460,7 @@
#######################################################################
#######################################################################
-gplugin_version = ['>=0.40.0', '<0.41.0']
+gplugin_version = ['>=0.41.0', '<0.42.0'] gplugin_dep = dependency('gplugin',
version : gplugin_version,
fallback : ['gplugin', 'gplugin_dep'])
--- a/subprojects/gplugin.wrap Sat Jul 01 01:52:29 2023 -0500
+++ b/subprojects/gplugin.wrap Sat Jul 01 02:01:14 2023 -0500
@@ -1,4 +1,4 @@
url = https://keep.imfreedom.org/gplugin/gplugin