gplugin/gplugin

Remove Perl5 support

19 months ago, Gary Kramlich
725422517004
Parents 4b36b685913f
Children 09a3e2c08076
Remove Perl5 support

This was originally added to keep feature parity with purple2, but it has been
a huge pain, there's no solution on macOS, it randomly breaks, and there never
really was a lot of adoption of it in purple2.

Also the IEEE and Stack Overflow surveys from 2022 have Perl ranked between the
20th and 30th most popular programming language so I feel comfortable remove it.

If necessary we can always pull back out of version control and bring it back up
to date.

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/1793/
--- a/HACKING.OSX Sun Sep 18 00:31:31 2022 -0500
+++ b/HACKING.OSX Mon Sep 19 01:58:31 2022 -0500
@@ -4,9 +4,6 @@
support fink or macports, please let me know and I will merge your pull
request.
-Currently there is no known way to build the Perl loader on MacOS. So you
-**MUST** run meson with `-Dperl5=false`.
-
## Lua
For the Lua loader to work, you need to install `lgi` from luarocks either
--- a/README.md Sun Sep 18 00:31:31 2022 -0500
+++ b/README.md Mon Sep 19 01:58:31 2022 -0500
@@ -21,8 +21,7 @@
## Language Support
-GPlugin currently supports plugins written in C/C++, Lua, Perl5, Python3, and
-Vala.
+GPlugin currently supports plugins written in C/C++, Lua, Python3, and Vala.
## API Reference
--- a/gplugin/reference/gplugin.toml.in Sun Sep 18 00:31:31 2022 -0500
+++ b/gplugin/reference/gplugin.toml.in Mon Sep 19 01:58:31 2022 -0500
@@ -41,7 +41,6 @@
"genie.md",
"lua.md",
"native-plugins.md",
- "perl5.md",
"python3.md",
"vala.md",
]
--- a/gplugin/reference/meson.build Sun Sep 18 00:31:31 2022 -0500
+++ b/gplugin/reference/meson.build Mon Sep 19 01:58:31 2022 -0500
@@ -3,7 +3,6 @@
'genie.md',
'lua.md',
'native-plugins.md',
- 'perl5.md',
'python3.md',
'vala.md',
]
--- a/gplugin/reference/perl5.md Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-Title: Perl5 Plugins
-Slug: perl5
-
-## Perl5 Plugins
-
-> You **MUST** have the Perl5 loader plugin installed and working as well as
-> the gobject-introspection package for GPlugin installed to use Perl5 plugins.
-
-### Example Perl5 Plugin
-
-Like all plugins in GPlugin, Perl5 plugins must also implement the
-`gplugin_query`, `gplugin_load`, and `glugin_unload` functions.
-
-The following is a basic Perl5 plugin.
-
-```perl
-use strict;
-
-use Glib::Object::Introspection;
-
-Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
-
-# gplugin_plugin_query is called when searching for plugins. The only thing this
-# function should do, is return a GPlugin.PluginInfo instance.
-sub gplugin_query {
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl5-basic-plugin",
- abi_version => 0x01020304,
- name => "basic plugin",
- authors => ("author1"),
- category => "test",
- version => "version",
- license_id => "license",
- summary => "summary",
- website => "website",
- description => "description",
- );
-}
-
-# gplugin_plugin_load is called when your plugin is loaded in the application.
-# If something isn't quite right, you can return non zero or call die() to
-# signify that something went wrong and stop your plugin from being loaded.
-sub gplugin_load {
- my $plugin = shift;
-
- return 0;
-}
-
-# gplugin_plugin_unload is called when your plugin is unloaded in the
-# application. The shutdown parameter tells your plugin whether or not the
-# application is shutting down. For example, if a user unloads your plugin,
-# shutdown will be 1, but if the program is shutting down, shutdown will be 0.
-#
-# If something went wrong with the unload or the plugin isn't ready to be
-# unloaded you can return 1 here to stop it from being unloaded. Note if
-# shutdown is 0, the return value is not honored.
-sub gplugin_unload {
- my $plugin = shift;
- my $shutdown = shift;
-
- return 0;
-}
-```
-
--- a/meson.build Sun Sep 18 00:31:31 2022 -0500
+++ b/meson.build Mon Sep 19 01:58:31 2022 -0500
@@ -125,7 +125,6 @@
subdir('po')
subdir('lua')
-subdir('perl5')
subdir('python3')
subdir('rust')
subdir('tcc')
--- a/meson_options.txt Sun Sep 18 00:31:31 2022 -0500
+++ b/meson_options.txt Mon Sep 19 01:58:31 2022 -0500
@@ -53,12 +53,6 @@
)
option(
- 'perl5',
- type : 'boolean', value : true,
- description : 'Whether or not to build the Perl plugin loader'
-)
-
-option(
'python3',
type : 'boolean', value : true,
description : 'Whether or not to build the Python 3.x plugin loader'
--- a/perl5/gplugin-perl5-core.c Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * 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/>.
- */
-
-#include <gplugin.h>
-#include <gplugin-native.h>
-
-#include "gplugin-perl5-loader.h"
-#include "gplugin-perl5-plugin.h"
-
-#undef _
-#include <glib/gi18n-lib.h>
-
-static GPluginLoader *loader = NULL;
-
-static GPluginPluginInfo *
-gplugin_perl5_query(G_GNUC_UNUSED GError **error)
-{
- const gchar *const authors[] = {
- "Gary Kramlich <grim@reaperworld.com>",
- NULL,
- };
-
- /* clang-format off */
- return gplugin_plugin_info_new(
- "gplugin/perl5-loader",
- GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
- "internal", TRUE,
- "load-on-query", TRUE,
- "name", "Perl5 Plugin Loader",
- "version", GPLUGIN_VERSION,
- "license-id", "LGPL-2.0-or-later",
- "summary", "A plugin that can load perl plugins",
- "description", "This plugin allows the loading of plugins written in "
- "the perl programming language.",
- "authors", authors,
- "website", GPLUGIN_WEBSITE,
- "category", "loaders",
- "bind-global", TRUE,
- "unloadable", FALSE,
- NULL);
- /* clang-format on */
-}
-
-static gboolean
-gplugin_perl5_load(GPluginPlugin *plugin, GError **error)
-{
- GPluginManager *manager = NULL;
-
- manager = gplugin_manager_get_default();
-
- gplugin_perl_plugin_register(G_TYPE_MODULE(plugin));
- gplugin_perl_loader_register(G_TYPE_MODULE(plugin));
-
- loader = gplugin_perl_loader_new();
- if(!gplugin_manager_register_loader(manager, loader, error)) {
- g_clear_object(&loader);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-gplugin_perl5_unload(
- G_GNUC_UNUSED GPluginPlugin *plugin,
- gboolean shutdown,
- GError **error)
-{
- GPluginManager *manager = NULL;
- gboolean ret = FALSE;
-
- if(!shutdown) {
- g_set_error_literal(
- error,
- GPLUGIN_DOMAIN,
- 0,
- _("The Perl5 loader can not be unloaded"));
-
- return FALSE;
- }
-
- manager = gplugin_manager_get_default();
- ret = gplugin_manager_unregister_loader(manager, loader, error);
- g_clear_object(&loader);
-
- return ret;
-}
-
-GPLUGIN_NATIVE_PLUGIN_DECLARE(gplugin_perl5)
--- a/perl5/gplugin-perl5-loader.c Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,396 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * 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/>.
- */
-
-#include "gplugin-perl5-loader.h"
-
-#include "gplugin-perl5-plugin.h"
-
-#include <gperl.h>
-
-struct _GPluginPerlLoader {
- GPluginLoader parent;
-};
-
-G_DEFINE_DYNAMIC_TYPE(
- GPluginPerlLoader,
- gplugin_perl_loader,
- GPLUGIN_TYPE_LOADER)
-
-static PerlInterpreter *my_perl = NULL;
-
-/******************************************************************************
- * Perl Stuff
- *****************************************************************************/
-extern void boot_DynaLoader(pTHX_ CV *cv);
-
-static void
-gplugin_perl_loader_xs_init(pTHX)
-{
- dXSUB_SYS;
-
- newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
-}
-
-static void
-gplugin_perl_loader_init_perl(void)
-{
- gchar *args[] = {
- "",
- };
- gchar **argv = (gchar **)args;
- gint argc = 1;
-
- PERL_SYS_INIT(&argc, &argv);
-
- my_perl = perl_alloc();
- PERL_SET_CONTEXT(my_perl);
- PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
- perl_construct(my_perl);
-}
-
-static void
-gplugin_perl_loader_uninit_perl(void)
-{
- PERL_SET_CONTEXT(my_perl);
- perl_destruct(my_perl);
- perl_free(my_perl);
- PERL_SYS_TERM();
-}
-
-static GPluginPluginInfo *
-gplugin_perl_loader_call_gplugin_query(
- PerlInterpreter *interpreter,
- GError **error)
-{
- GPluginPluginInfo *info = NULL;
- PerlInterpreter *old = NULL;
- SV *err_tmp;
- gint ret = 0;
-
- dSP;
-
- old = my_perl;
- my_perl = interpreter;
- PERL_SET_CONTEXT(interpreter);
-
- ENTER;
- SAVETMPS;
-
- PUSHMARK(SP);
- PUTBACK;
-
- ret = call_pv("gplugin_query", G_EVAL | G_NOARGS);
-
- SPAGAIN;
-
- /* ERRSV is a macro, so we store it instead of calling it multiple times. */
- err_tmp = ERRSV;
- if(SvTRUE(err_tmp)) {
- const gchar *errmsg = SvPVutf8_nolen(err_tmp);
-
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
- } else {
- if(ret != 1) {
- g_set_error_literal(
- error,
- GPLUGIN_DOMAIN,
- 0,
- "gplugin_query did not return a GPluginPluginInfo");
- } else {
- info = (GPluginPluginInfo *)gperl_get_object(POPs);
-
- /* if we did get a real GPluginPluginInfo ref it because the perl
- * code below will take it out of scope and delete it if its
- * reference count is zero.
- */
- if(GPLUGIN_IS_PLUGIN_INFO(info)) {
- g_object_ref(G_OBJECT(info));
- }
- }
- }
-
- PUTBACK;
- FREETMPS;
- LEAVE;
-
- my_perl = old;
-
- return info;
-}
-
-/******************************************************************************
- * GPluginLoaderInterface API
- *****************************************************************************/
-static GSList *
-gplugin_perl_loader_supported_extensions(G_GNUC_UNUSED GPluginLoader *l)
-{
- return g_slist_append(NULL, "pl");
-}
-
-static GPluginPlugin *
-gplugin_perl_loader_query(
- GPluginLoader *loader,
- const gchar *filename,
- GError **error)
-{
- GPluginPlugin *plugin = NULL;
- GPluginPluginInfo *info = NULL;
- PerlInterpreter *interpreter = NULL;
- const gchar *args[] = {"", filename};
- gchar **argv = (gchar **)args;
- gint argc = 2, ret = 0;
-
- interpreter = perl_alloc();
- PERL_SET_CONTEXT(interpreter);
- PL_perl_destruct_level = 1;
- perl_construct(interpreter);
-
- ret =
- perl_parse(interpreter, gplugin_perl_loader_xs_init, argc, argv, NULL);
- if(ret != 0) {
- SV *err_tmp;
- const gchar *errmsg = "unknown error";
-
- /* ERRSV is a macro so we need to store its returned value so we don't
- * call it multiple times.
- */
- err_tmp = ERRSV;
- if(SvTRUE(err_tmp)) {
- errmsg = SvPVutf8_nolen(err_tmp);
- }
-
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
-
- perl_destruct(interpreter);
- perl_free(interpreter);
-
- return NULL;
- }
-
- ret = perl_run(interpreter);
- if(ret != 0) {
- SV *err_tmp;
- const gchar *errmsg = "unknown error";
-
- /* ERRSV is a macro so we need to store its returned value so we don't
- * call it multiple times.
- */
- err_tmp = ERRSV;
- if(SvTRUE(err_tmp)) {
- errmsg = SvPVutf8_nolen(err_tmp);
- }
-
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
-
- perl_destruct(interpreter);
- perl_free(interpreter);
-
- return NULL;
- }
-
- info = gplugin_perl_loader_call_gplugin_query(interpreter, error);
- if(!GPLUGIN_IS_PLUGIN_INFO(info)) {
- /* If the plugin's query method didn't set error, set it to a generic
- * message.
- */
- if(error != NULL && *error == NULL) {
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, "failed to query");
- }
-
- return NULL;
- }
-
- /* clang-format off */
- plugin = g_object_new(
- GPLUGIN_PERL_TYPE_PLUGIN,
- "interpreter", interpreter,
- "filename", filename,
- "info", info,
- "loader", g_object_ref(loader),
- NULL);
- /* clang-format on */
-
- return plugin;
-}
-
-static gboolean
-gplugin_perl_loader_load(
- G_GNUC_UNUSED GPluginLoader *loader,
- GPluginPlugin *plugin,
- GError **error)
-{
- GPluginPerlPlugin *pplugin = GPLUGIN_PERL_PLUGIN(plugin);
- PerlInterpreter *old = NULL;
- SV *err_tmp = NULL;
- gboolean r = FALSE;
- gint count = 0;
-
- dSP;
-
- old = my_perl;
- my_perl = gplugin_perl_plugin_get_interpreter(pplugin);
- PERL_SET_CONTEXT(my_perl);
-
- ENTER;
- SAVETMPS;
- PUSHMARK(SP);
- EXTEND(SP, 1);
- PUSHs(sv_2mortal(newSVGObject(g_object_ref(G_OBJECT(pplugin)))));
-
- PUTBACK;
- count = call_pv("gplugin_load", G_EVAL | G_SCALAR);
- SPAGAIN;
-
- /* ERRSV is a macro, so we store it instead of calling it multiple times. */
- err_tmp = ERRSV;
- if(SvTRUE(err_tmp)) {
- const gchar *errmsg = SvPVutf8_nolen(err_tmp);
-
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
- } else {
- if(count != 1) {
- g_set_error_literal(
- error,
- GPLUGIN_DOMAIN,
- 0,
- "gplugin_load did not return a value");
- } else {
- if(POPi == 0) {
- r = TRUE;
- }
- }
- }
-
- PUTBACK;
- FREETMPS;
- LEAVE;
-
- my_perl = old;
-
- PERL_SET_CONTEXT(my_perl);
-
- return r;
-}
-
-static gboolean
-gplugin_perl_loader_unload(
- G_GNUC_UNUSED GPluginLoader *loader,
- GPluginPlugin *plugin,
- gboolean shutdown,
- GError **error)
-{
- GPluginPerlPlugin *pplugin = GPLUGIN_PERL_PLUGIN(plugin);
- PerlInterpreter *old = NULL;
- SV *err_tmp = NULL;
- gboolean r = FALSE;
- gint count = 0;
-
- dSP;
- old = my_perl;
- my_perl = gplugin_perl_plugin_get_interpreter(pplugin);
- PERL_SET_CONTEXT(my_perl);
-
- ENTER;
- SAVETMPS;
- PUSHMARK(SP);
- EXTEND(SP, 2);
- PUSHs(sv_2mortal(newSVGObject(g_object_ref(G_OBJECT(pplugin)))));
- PUSHs(sv_2mortal(newSViv(shutdown)));
-
- PUTBACK;
- count = call_pv("gplugin_unload", G_EVAL | G_SCALAR);
- SPAGAIN;
-
- /* ERRSV is a macro, so we store it instead of calling it multiple times. */
- err_tmp = ERRSV;
- if(SvTRUE(err_tmp)) {
- const gchar *errmsg = SvPVutf8_nolen(err_tmp);
-
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
- } else {
- if(count != 1) {
- g_set_error_literal(
- error,
- GPLUGIN_DOMAIN,
- 0,
- "gplugin_unload did not return a value");
- } else {
- if(POPi == 0) {
- r = TRUE;
- }
- }
- }
-
- PUTBACK;
- FREETMPS;
- LEAVE;
-
- my_perl = old;
- PERL_SET_CONTEXT(my_perl);
-
- return r;
-}
-
-/******************************************************************************
- * GObject Stuff
- *****************************************************************************/
-static void
-gplugin_perl_loader_init(G_GNUC_UNUSED GPluginPerlLoader *loader)
-{
-}
-
-static void
-gplugin_perl_loader_class_init(GPluginPerlLoaderClass *klass)
-{
- GPluginLoaderClass *loader_class = GPLUGIN_LOADER_CLASS(klass);
-
- loader_class->supported_extensions =
- gplugin_perl_loader_supported_extensions;
- loader_class->query = gplugin_perl_loader_query;
- loader_class->load = gplugin_perl_loader_load;
- loader_class->unload = gplugin_perl_loader_unload;
-
- /* perl initialization */
- gplugin_perl_loader_init_perl();
-}
-
-static void
-gplugin_perl_loader_class_finalize(G_GNUC_UNUSED GPluginPerlLoaderClass *klass)
-{
- /* perl uninitialization */
- gplugin_perl_loader_uninit_perl();
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-void
-gplugin_perl_loader_register(GTypeModule *module)
-{
- gplugin_perl_loader_register_type(module);
-}
-
-GPluginLoader *
-gplugin_perl_loader_new(void)
-{
- /* clang-format off */
- return g_object_new(
- GPLUGIN_PERL_TYPE_LOADER,
- "id", "gplugin-perl5",
- NULL);
- /* clang-format on */
-}
--- a/perl5/gplugin-perl5-loader.h Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * 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/>.
- */
-
-#ifndef GPLUGIN_PERL_LOADER_H
-#define GPLUGIN_PERL_LOADER_H
-
-#include <gplugin.h>
-#include <gplugin-native.h>
-
-G_BEGIN_DECLS
-
-#define GPLUGIN_PERL_TYPE_LOADER (gplugin_perl_loader_get_type())
-G_DECLARE_FINAL_TYPE(
- GPluginPerlLoader,
- gplugin_perl_loader,
- GPLUGIN_PERL,
- LOADER,
- GPluginLoader)
-
-void gplugin_perl_loader_register(GTypeModule *module);
-
-GPluginLoader *gplugin_perl_loader_new(void);
-
-G_END_DECLS
-
-#endif /* GPLUGIN_PERL_PLUGIN_LOADER_H */
--- a/perl5/gplugin-perl5-plugin.c Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * 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/>.
- */
-
-#include "gplugin-perl5-plugin.h"
-
-/******************************************************************************
- * Typedefs
- *****************************************************************************/
-struct _GPluginPerlPlugin {
- GObject parent;
-
- PerlInterpreter *interpreter;
-
- /* overrides */
- gchar *filename;
- GPluginLoader *loader;
- GPluginPluginInfo *info;
- GPluginPluginState state;
- GPluginPluginState desired_state;
- GError *error;
-};
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-enum {
- PROP_ZERO,
- PROP_INTERPRETER,
- N_PROPERTIES,
- /* overrides */
- PROP_FILENAME = N_PROPERTIES,
- PROP_LOADER,
- PROP_INFO,
- PROP_STATE,
- PROP_DESIRED_STATE,
- PROP_ERROR,
-};
-static GParamSpec *properties[N_PROPERTIES] = {
- NULL,
-};
-
-/* I hate forward declarations... */
-static void gplugin_perl_plugin_iface_init(GPluginPluginInterface *iface);
-
-G_DEFINE_DYNAMIC_TYPE_EXTENDED(
- GPluginPerlPlugin,
- gplugin_perl_plugin,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_perl_plugin_iface_init))
-
-/******************************************************************************
- * GPluginPlugin Implementation
- *****************************************************************************/
-static void
-gplugin_perl_plugin_iface_init(G_GNUC_UNUSED GPluginPluginInterface *iface)
-{
-}
-
-/******************************************************************************
- * Object Stuff
- *****************************************************************************/
-static void
-gplugin_perl_plugin_get_property(
- GObject *obj,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj);
-
- switch(param_id) {
- case PROP_INTERPRETER:
- g_value_set_pointer(
- value,
- gplugin_perl_plugin_get_interpreter(plugin));
- break;
-
- /* overrides */
- case PROP_FILENAME:
- g_value_set_string(value, plugin->filename);
- break;
- case PROP_LOADER:
- g_value_set_object(value, plugin->loader);
- break;
- case PROP_INFO:
- g_value_set_object(value, plugin->info);
- break;
- case PROP_STATE:
- g_value_set_enum(value, plugin->state);
- break;
- case PROP_DESIRED_STATE:
- g_value_set_enum(value, plugin->desired_state);
- break;
- case PROP_ERROR:
- g_value_set_boxed(value, plugin->error);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-gplugin_perl_plugin_set_property(
- GObject *obj,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj);
-
- switch(param_id) {
- case PROP_INTERPRETER:
- plugin->interpreter = g_value_get_pointer(value);
- break;
-
- /* overrides */
- case PROP_FILENAME:
- plugin->filename = g_value_dup_string(value);
- break;
- case PROP_LOADER:
- plugin->loader = g_value_dup_object(value);
- break;
- case PROP_INFO:
- plugin->info = g_value_dup_object(value);
- break;
- case PROP_STATE:
- plugin->state = g_value_get_enum(value);
- break;
- case PROP_DESIRED_STATE:
- plugin->desired_state = g_value_get_enum(value);
- break;
- case PROP_ERROR:
- plugin->error = g_value_dup_boxed(value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- }
-}
-
-static void
-gplugin_perl_plugin_finalize(GObject *obj)
-{
- GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj);
-
- perl_destruct(plugin->interpreter);
- perl_free(plugin->interpreter);
- plugin->interpreter = NULL;
-
- g_clear_pointer(&plugin->filename, g_free);
- g_clear_object(&plugin->loader);
- g_clear_object(&plugin->info);
- g_clear_error(&plugin->error);
-
- G_OBJECT_CLASS(gplugin_perl_plugin_parent_class)->finalize(obj);
-}
-
-static void
-gplugin_perl_plugin_init(G_GNUC_UNUSED GPluginPerlPlugin *plugin)
-{
-}
-
-static void
-gplugin_perl_plugin_class_finalize(G_GNUC_UNUSED GPluginPerlPluginClass *klass)
-{
-}
-
-static void
-gplugin_perl_plugin_class_init(GPluginPerlPluginClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-
- obj_class->get_property = gplugin_perl_plugin_get_property;
- obj_class->set_property = gplugin_perl_plugin_set_property;
- obj_class->finalize = gplugin_perl_plugin_finalize;
-
- properties[PROP_INTERPRETER] = g_param_spec_pointer(
- "interpreter",
- "interpreter",
- "The PERL interpreter for this plugin",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
-
- /* add our overrides */
- g_object_class_override_property(obj_class, PROP_FILENAME, "filename");
- g_object_class_override_property(obj_class, PROP_LOADER, "loader");
- g_object_class_override_property(obj_class, PROP_INFO, "info");
- g_object_class_override_property(obj_class, PROP_STATE, "state");
- g_object_class_override_property(
- obj_class,
- PROP_DESIRED_STATE,
- "desired-state");
- g_object_class_override_property(obj_class, PROP_ERROR, "error");
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-void
-gplugin_perl_plugin_register(GTypeModule *module)
-{
- gplugin_perl_plugin_register_type(module);
-}
-
-PerlInterpreter *
-gplugin_perl_plugin_get_interpreter(GPluginPerlPlugin *plugin)
-{
- g_return_val_if_fail(GPLUGIN_PERL_IS_PLUGIN(plugin), NULL);
-
- return plugin->interpreter;
-}
--- a/perl5/gplugin-perl5-plugin.h Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * 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/>.
- */
-
-#ifndef GPLUGIN_PERL_PLUGIN_H
-#define GPLUGIN_PERL_PLUGIN_H
-
-#include <gplugin.h>
-#include <gplugin-native.h>
-
-#define PERL_NO_GET_CONTEXT
-#ifdef __FreeBSD__
-/* On FreeBSD, perl.h includes libutil.h (which doesn't appear necessary), and
- * that defines some generic 'properties' type. So use the preprocessor to hide
- * that name. */
-#define properties freebsd_properties
-#endif
-#include <EXTERN.h>
-#include <perl.h>
-/* perl define's _() to something completely different that we don't use. So
- * we undef it so that we can use it for gettext.
- */
-#undef _
-#ifdef __FreeBSD__
-#undef properties
-#endif
-
-G_BEGIN_DECLS
-
-#define GPLUGIN_PERL_TYPE_PLUGIN (gplugin_perl_plugin_get_type())
-G_DECLARE_FINAL_TYPE(
- GPluginPerlPlugin,
- gplugin_perl_plugin,
- GPLUGIN_PERL,
- PLUGIN,
- GObject)
-
-void gplugin_perl_plugin_register(GTypeModule *module);
-
-PerlInterpreter *gplugin_perl_plugin_get_interpreter(GPluginPerlPlugin *plugin);
-
-G_END_DECLS
-
-#endif /* GPLUGIN_PERL_PLUGIN_H */
--- a/perl5/meson.build Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-summary('perl5', get_option('perl5'), section : 'Loader Support', bool_yn : true)
-
-if get_option('perl5')
- if not get_option('introspection')
- error('Perl plugin requires GObject Introspection.')
- endif
-
- GPLUGIN_PERL_SOURCES = [
- 'gplugin-perl5-core.c',
- 'gplugin-perl5-loader.c',
- 'gplugin-perl5-plugin.c',
- ]
-
- GPLUGIN_PERL_HEADERS = [
- 'gplugin-perl5-loader.h',
- 'gplugin-perl5-plugin.h',
- ]
-
- # make sure we have the perl executable, we need it to figure out the
- # build arguments.
- PERL = find_program('perl')
-
- # make sure we have the perl library as well.
- LIBPERL = []
- if host_machine.system() != 'freebsd'
- INC = run_command(PERL, '-e print join("/CORE ",grep(/^\\//,@INC))."/CORE"', check : true)
- LIBPERL = compiler.find_library('libperl', dirs: INC.stdout().strip().split(' '))
- endif
-
- # make sure we have the gobject introspection perl module.
- run_command(
- PERL,
- '-e use Glib::Object::Introspection;',
- check : true,
- )
-
- perl_dep = declare_dependency(
- compile_args : run_command(PERL, '-MExtUtils::Embed', '-e', 'ccopts', check : true).stdout().split(),
- link_args : run_command(PERL, '-MExtUtils::Embed', '-e', 'ldopts', check : true).stdout().split(),
- )
-
- if host_machine.system() in ['freebsd', 'openbsd']
- perl_arch = 'sitearchexp'
- else
- perl_arch = 'vendorarchexp'
- endif
-
- perl_arch = run_command(PERL,
- '-MConfig',
- '-e', 'if ($Config{@0@}) { print "$Config{@0@}" } else { exit 1 }'.format(perl_arch),
- check : true).stdout().split()
- glib_perl_incdir = '-I@0@/Glib/Install'.format(perl_arch[0])
- glib_perl_libdir = '@0@/auto/Glib/'.format(perl_arch[0])
- glib_perl_dep = compiler.find_library(
- 'Glib',
- dirs : glib_perl_libdir,
- has_headers : 'gperl.h',
- header_args : glib_perl_incdir
- )
- glib_perl_dep = declare_dependency(
- dependencies : glib_perl_dep,
- # Annoyingly, this is not transferred over from the header_args.
- compile_args : glib_perl_incdir
- )
-
- shared_library('gplugin-perl5',
- GPLUGIN_PERL_SOURCES,
- GPLUGIN_PERL_HEADERS,
- name_prefix : '',
- c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="GPlugin-Perl5"'],
- dependencies : [GMODULE, gplugin_dep, perl_dep, glib_perl_dep],
- install : true,
- install_dir : get_option('libdir') / 'gplugin'
- )
-
- # Add the loader's path to our environment variable
- devenv.append('GPLUGIN_PLUGIN_PATH', meson.current_build_dir())
-endif # perl5
-
-subdir('tests')
--- a/perl5/tests/meson.build Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-if get_option('perl5')
-
-e = executable('test-perl5-loader', 'test-perl5-loader.c',
- c_args : [
- '-DPERL5_LOADER_DIR="@0@/.."'.format(meson.current_build_dir()),
- '-DPERL5_PLUGIN_DIR="@0@/plugins"'.format(meson.current_source_dir()),
- ],
- link_with : gplugin_loader_tests,
- dependencies : [GLIB, GOBJECT, gplugin_dep, perl_dep])
-test('Perl5 Loader', e)
-
-# Add the test plugins path to our environment variable
-devenv.append('GPLUGIN_PLUGIN_PATH', meson.current_source_dir() / 'plugins')
-
-endif # perl5
--- a/perl5/tests/plugins/basic.pl Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-# Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# 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/>.
-
-use strict;
-
-use Glib::Object::Introspection;
-use Scalar::Util qw(blessed);
-
-Glib::Object::Introspection->setup(basename => "GPlugin",
- version => "1.0",
- package => "GPlugin");
-
-sub gplugin_query {
- my $info = GPlugin::PluginInfo->new(
- id => "gplugin/perl5-basic-plugin",
- abi_version => 0x01020304,
- name => "basic plugin",
- authors => ("author1"),
- category => "test",
- version => "version",
- license_id => "license",
- summary => "summary",
- website => "website",
- description => "description",
- );
-
- return $info;
-}
-
-sub gplugin_load {
- my $plugin = shift;
-
- if(!defined($plugin) or (blessed($plugin) and !$plugin->isa("GPlugin::Plugin"))) {
- die("plugin is not a GPlugin::Plugin");
- }
-
- return 0;
-}
-
-sub gplugin_unload {
- my $plugin = shift;
- my $shutdown = shift;
-
- if(!defined($plugin) or (blessed($plugin) and !$plugin->isa("GPlugin::Plugin"))) {
- die("plugin is not a GPlugin::Plugin");
- }
-
- if($shutdown) {
- die("shutdown was true");
- }
-
- return 0;
-}
--- a/perl5/tests/plugins/dependent.pl Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-# Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# 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/>.
-
-use strict;
-
-use Glib::Object::Introspection;
-
-Glib::Object::Introspection->setup(basename => "GPlugin",
- version => "1.0",
- package => "GPlugin");
-
-sub gplugin_query {
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl5-dependent-plugin",
- dependencies => ['dependency1', 'dependency2'],
- );
-}
-
-sub gplugin_load {
- return 1;
-}
-
-sub gplugin_unload {
- return 1;
-}
--- a/perl5/tests/plugins/load-exception.pl Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-# Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# 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/>.
-
-use strict;
-
-use Glib::Object::Introspection;
-
-Glib::Object::Introspection->setup(basename => "GPlugin",
- version => "1.0",
- package => "GPlugin");
-
-sub gplugin_query {
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl5-load-exception",
- );
-}
-
-sub gplugin_load {
- die("you be dead");
-
- return 0;
-}
-
-sub gplugin_unload {
- return 0;
-}
--- a/perl5/tests/plugins/load-failed.pl Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-# Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# 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/>.
-
-use strict;
-
-use Glib::Object::Introspection;
-
-Glib::Object::Introspection->setup(basename => "GPlugin",
- version => "1.0",
- package => "GPlugin");
-
-sub gplugin_query {
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl5-load-failed",
- );
-}
-
-sub gplugin_load {
- return 1;
-}
-
-sub gplugin_unload {
- return 0;
-}
--- a/perl5/tests/plugins/unload-failed.pl Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-# Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# 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/>.
-
-use strict;
-
-use Glib::Object::Introspection;
-
-Glib::Object::Introspection->setup(basename => "GPlugin",
- version => "1.0",
- package => "GPlugin");
-
-sub gplugin_query() {
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl5-unload-failed",
- );
-}
-
-sub gplugin_load() {
- return 0;
-}
-
-sub gplugin_unload() {
- die("cya");
-
- return 1;
-}
--- a/perl5/tests/plugins/unload-shutdown.pl Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-# Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# 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/>.
-
-use strict;
-
-use Glib::Object::Introspection;
-
-Glib::Object::Introspection->setup(basename => "GPlugin",
- version => "1.0",
- package => "GPlugin");
-
-sub gplugin_query() {
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl5-unload-shutdown",
- );
-}
-
-sub gplugin_load() {
- return 0;
-}
-
-sub gplugin_unload() {
- my ($plugin, $shutdown) = @_;
-
- if(not $shutdown) {
- die("shutdown was false");
- }
-
- return 0;
-}
--- a/perl5/tests/test-perl5-loader.c Sun Sep 18 00:31:31 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * 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/>.
- */
-
-#include <glib.h>
-
-#include <gplugin.h>
-#include <gplugin/gplugin-loader-tests.h>
-
-gint
-main(gint argc, gchar **argv)
-{
- g_test_init(&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
-
- gplugin_loader_tests_main(PERL5_LOADER_DIR, PERL5_PLUGIN_DIR, "perl5");
-
- return g_test_run();
-}
--- a/po/POTFILES Sun Sep 18 00:31:31 2022 -0500
+++ b/po/POTFILES Mon Sep 19 01:58:31 2022 -0500
@@ -22,9 +22,6 @@
lua/gplugin-lua-loader.c
lua/gplugin-lua-plugin.c
lua/gplugin-lua-test-lgi.c
-perl5/gplugin-perl5-core.c
-perl5/gplugin-perl5-loader.c
-perl5/gplugin-perl5-plugin.c
python3/gplugin-python3-core.c
python3/gplugin-python3-loader.c
python3/gplugin-python3-plugin.c