Rename the perl loader to perl5
Rename the perl plugin to perl5
Testing Done:
Built, tested, verified the docs, and build the debian and fedora packages.
Reviewed at https://reviews.imfreedom.org/r/93/
--- a/gplugin/reference/gplugin-docs.xml Sat Aug 22 19:29:50 2020 -0500
+++ b/gplugin/reference/gplugin-docs.xml Wed Aug 26 03:12:40 2020 -0500
@@ -29,7 +29,7 @@
<xi:include href="genie.xml"/>
<xi:include href="lua.xml"/>
<xi:include href="native-plugins.xml"/>
- <xi:include href="perl.xml"/>
+ <xi:include href="perl5.xml"/> <xi:include href="python.xml"/>
<xi:include href="vala.xml"/>
--- a/gplugin/reference/meson.build Sat Aug 22 19:29:50 2020 -0500
+++ b/gplugin/reference/meson.build Wed Aug 26 03:12:40 2020 -0500
@@ -31,7 +31,7 @@
--- a/gplugin/reference/perl.xml Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
-<chapter id="chapter-perl">
- <title>Perl Plugins</title>
- You <emphasis role="strong">MUST</emphasis> have the Perl loader
- plugin installed and working as well as the gobject-introspection
- package for GPlugin installed to use Perl plugins.
- <title>Example Perl Plugin</title>
- Like all plugins in GPlugin, Perl plugins must also implement
- the <code>gplugin_query</code>, <code>gplugin_load</code>, and
- <code>gplugin_unload</code> functions.
- The following is a basic Perl plugin.
- <informalexample><programlisting>
- use Glib::Object::Introspection;
- Glib::Object::Introspection->setup(basename => "GPlugin", version => "0.0", package=> "GPlugin");
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl-basic-plugin",
- abi_version => 0x01020304,
- name => "basic plugin",
- authors => ("author1"),
- license_id => "license",
- description => "description",
- </programlisting></informalexample>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/perl5.xml Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,60 @@
+<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<chapter id="chapter-perl5"> + <title>Perl5 Plugins</title> + You <emphasis role="strong">MUST</emphasis> have the Perl5 loader + plugin installed and working as well as the gobject-introspection + package for GPlugin installed to use Perl5 plugins. + <title>Example Perl5 Plugin</title> + Like all plugins in GPlugin, Perl5 plugins must also implement + the <code>gplugin_query</code>, <code>gplugin_load</code>, and + <code>gplugin_unload</code> functions. + The following is a basic Perl5 plugin. + <informalexample><programlisting> + use Glib::Object::Introspection; + Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin"); + return GPlugin::PluginInfo->new( + id => "gplugin/perl5-basic-plugin", + abi_version => 0x01020304, + name => "basic plugin", + authors => ("author1"), + license_id => "license", + description => "description", + </programlisting></informalexample> --- a/meson.build Sat Aug 22 19:29:50 2020 -0500
+++ b/meson.build Wed Aug 26 03:12:40 2020 -0500
@@ -90,7 +90,7 @@
--- a/meson_options.txt Sat Aug 22 19:29:50 2020 -0500
+++ b/meson_options.txt Wed Aug 26 03:12:40 2020 -0500
@@ -35,7 +35,7 @@
type : 'boolean', value : true,
description : 'Whether or not to build the Perl plugin loader'
--- a/packaging/debian/control Sat Aug 22 19:29:50 2020 -0500
+++ b/packaging/debian/control Wed Aug 26 03:12:40 2020 -0500
@@ -140,15 +140,15 @@
This package allows GPlugin to load plugins written in the Python programming
-Package: libgplugin-perl
+Package: libgplugin-perl5 Depends: ${misc:Depends}, ${shlibs:Depends}, perl, libglib-perl,
libglib-object-introspection-perl, libgplugin0, gir1.2-gplugin-0.0
-Description: GPlugin Perl Loader
+Description: GPlugin Perl5 Loader GPlugin is a GObject based library that implements a reusable plugin system
which supports loading plugins in other languages via loaders. It relies
heavily on GObjectIntrospection to expose its API to the other languages.
- This package allows GPlugin to load plugins written in the Perl programming
+ This package allows GPlugin to load plugins written in the Perl5 programming --- a/packaging/debian/libgplugin-perl.install Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-debian/tmp/usr/lib/*/gplugin/gplugin-perl.so
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packaging/debian/libgplugin-perl5.install Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,1 @@
+debian/tmp/usr/lib/*/gplugin/gplugin-perl5.so --- a/packaging/gplugin.spec.in Sat Aug 22 19:29:50 2020 -0500
+++ b/packaging/gplugin.spec.in Wed Aug 26 03:12:40 2020 -0500
@@ -61,7 +61,7 @@
Summary: A GObject based library that implements a reusable plugin system
Group: Development/Libraries
Summary: A GObject based library that implements a reusable plugin system
Group: Development/Libraries
@@ -122,7 +122,7 @@
This package contains the Lua Loader for %{name} library.
GPlugin is a GObject based library that implements a reusable plugin system
that supports loading plugins in other languages via loaders. GPlugin also
implements dependencies among the plugins.
@@ -225,11 +225,11 @@
%{_libdir}/gplugin/gplugin-lua.so
-%{_libdir}/gplugin/gplugin-perl.so
+%{_libdir}/gplugin/gplugin-perl5.so @@ -245,6 +245,9 @@
%{_datadir}/vala/vapi/gplugin.deps
+* Tue Aug 25 2020 Gary Kramlich <grim@reaperworld.com> +- Updated the perl packages for its new name. * Tue Feb 18 2020 Gary Kramlich <grim@reaperworld.com>
- Updated the python files to reference the new name for gplugin-python3
--- a/packaging/mingw-cross/PKGBUILD Sat Aug 22 19:29:50 2020 -0500
+++ b/packaging/mingw-cross/PKGBUILD Wed Aug 26 03:12:40 2020 -0500
@@ -26,7 +26,7 @@
--cross-file=${MINGW_PACKAGE_PREFIX}.txt \
--- a/perl/gplugin-perl-core.c Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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 <http://www.gnu.org/licenses/>.
-#include <gplugin-native.h>
-#include "gplugin-perl-loader.h"
-#include "gplugin-perl-plugin.h"
-#include <glib/gi18n-lib.h>
-G_MODULE_EXPORT GPluginPluginInfo *
-gplugin_query(GError **error)
- const gchar *const authors[] = {
- "Gary Kramlich <grim@reaperworld.com>",
- return gplugin_plugin_info_new(
- GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
- "name", "Perl 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.",
- "website", GPLUGIN_WEBSITE,
-G_MODULE_EXPORT gboolean
-gplugin_load(GPluginNativePlugin *plugin, GError **error)
- gplugin_perl_plugin_register(plugin);
- gplugin_perl_loader_register(plugin);
- return gplugin_manager_register_loader(GPLUGIN_PERL_TYPE_LOADER, error);
-G_MODULE_EXPORT gboolean
-gplugin_unload(GPluginNativePlugin *plugin, GError **error)
- _("The Perl loader can not be unloaded"));
--- a/perl/gplugin-perl-loader.c Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +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 <http://www.gnu.org/licenses/>.
-#include "gplugin-perl-loader.h"
-#include "gplugin-perl-plugin.h"
-struct _GPluginPerlLoader {
-static PerlInterpreter *my_perl = NULL;
-/******************************************************************************
- *****************************************************************************/
-extern void boot_DynaLoader(pTHX_ CV *cv);
-static void gplugin_perl_loader_xs_init(pTHX)
- newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
-gplugin_perl_loader_init_perl(void)
- gchar **argv = (gchar **)args;
- 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);
-gplugin_perl_loader_uninit_perl(void)
- PERL_SET_CONTEXT(my_perl);
- perl_destruct(my_perl);
-static GPluginPluginInfo *
-gplugin_perl_loader_call_gplugin_query(
- PerlInterpreter *interpreter,
- GPluginPluginInfo *info = NULL;
- PerlInterpreter *old = NULL;
- PERL_SET_CONTEXT(interpreter);
- ret = call_pv("gplugin_query", G_EVAL | G_NOARGS);
- "gplugin_query did not return a GPluginPluginInfo");
- const gchar *errmsg = SvPVutf8_nolen(ERRSV);
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
- 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));
-gplugin_perl_loader_call_boolean(
- PerlInterpreter *interpreter,
- PerlInterpreter *old = NULL;
- PERL_SET_CONTEXT(interpreter);
- count = call_pv(func, G_EVAL | G_SCALAR);
- "%s did not return a value",
- const gchar *errmsg = SvPVutf8_nolen(ERRSV);
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
-/******************************************************************************
- * GPluginLoaderInterface API
- *****************************************************************************/
-gplugin_perl_loader_supported_extensions(G_GNUC_UNUSED GPluginLoader *l)
- return g_slist_append(NULL, "pl");
-gplugin_perl_loader_query(
- 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);
- perl_parse(interpreter, gplugin_perl_loader_xs_init, argc, argv, NULL);
- const gchar *errmsg = "unknown error";
- errmsg = SvPVutf8_nolen(ERRSV);
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
- perl_destruct(interpreter);
- perl_free(interpreter);
- ret = perl_run(interpreter);
- const gchar *errmsg = "unknown error";
- errmsg = SvPVutf8_nolen(ERRSV);
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg);
- perl_destruct(interpreter);
- perl_free(interpreter);
- info = gplugin_perl_loader_call_gplugin_query(interpreter, error);
- if(!GPLUGIN_IS_PLUGIN_INFO(info)) {
- g_set_error_literal(error, GPLUGIN_DOMAIN, 0, "failed to query");
- GPLUGIN_PERL_TYPE_PLUGIN,
- "interpreter", interpreter,
- "loader", g_object_ref(loader),
-gplugin_perl_loader_load(
- G_GNUC_UNUSED GPluginLoader *loader,
- GPluginPerlPlugin *pplugin = GPLUGIN_PERL_PLUGIN(plugin);
- PerlInterpreter *interpreter = NULL;
- interpreter = gplugin_perl_plugin_get_interpreter(pplugin);
- return gplugin_perl_loader_call_boolean(interpreter, "gplugin_load", error);
-gplugin_perl_loader_unload(
- G_GNUC_UNUSED GPluginLoader *loader,
- GPluginPerlPlugin *pplugin = GPLUGIN_PERL_PLUGIN(plugin);
- PerlInterpreter *interpreter = NULL;
- interpreter = gplugin_perl_plugin_get_interpreter(pplugin);
- return gplugin_perl_loader_call_boolean(
-/******************************************************************************
- *****************************************************************************/
-gplugin_perl_loader_init(G_GNUC_UNUSED GPluginPerlLoader *loader)
-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();
-gplugin_perl_loader_class_finalize(G_GNUC_UNUSED GPluginPerlLoaderClass *klass)
- /* perl uninitialization */
- gplugin_perl_loader_uninit_perl();
-/******************************************************************************
- *****************************************************************************/
-gplugin_perl_loader_register(GPluginNativePlugin *plugin)
- gplugin_perl_loader_register_type(G_TYPE_MODULE(plugin));
--- a/perl/gplugin-perl-loader.h Sat Aug 22 19:29:50 2020 -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 <http://www.gnu.org/licenses/>.
-#ifndef GPLUGIN_PERL_LOADER_H
-#define GPLUGIN_PERL_LOADER_H
-#include <gplugin-native.h>
-#define GPLUGIN_PERL_TYPE_LOADER (gplugin_perl_loader_get_type())
-void gplugin_perl_loader_register(GPluginNativePlugin *plugin);
-#endif /* GPLUGIN_PERL_PLUGIN_LOADER_H */
--- a/perl/gplugin-perl-plugin.c Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +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 <http://www.gnu.org/licenses/>.
-#include "gplugin-perl-plugin.h"
-/******************************************************************************
- *****************************************************************************/
-struct _GPluginPerlPlugin {
- PerlInterpreter *interpreter;
- GPluginPluginInfo *info;
- GPluginPluginState state;
-/******************************************************************************
- *****************************************************************************/
- PROP_FILENAME = N_PROPERTIES,
-static GParamSpec *properties[N_PROPERTIES] = {
-/* I hate forward declarations... */
-static void gplugin_perl_plugin_iface_init(GPluginPluginInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED(
- G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_perl_plugin_iface_init));
-/******************************************************************************
- * GPluginPlugin Implementation
- *****************************************************************************/
-gplugin_perl_plugin_iface_init(G_GNUC_UNUSED GPluginPluginInterface *iface)
-/******************************************************************************
- *****************************************************************************/
-gplugin_perl_plugin_get_property(
- GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj);
- gplugin_perl_plugin_get_interpreter(plugin));
- g_value_set_string(value, plugin->filename);
- g_value_set_object(value, plugin->loader);
- g_value_set_object(value, plugin->info);
- g_value_set_enum(value, plugin->state);
- g_value_set_boxed(value, plugin->error);
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-gplugin_perl_plugin_set_property(
- GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj);
- plugin->interpreter = g_value_get_pointer(value);
- plugin->filename = g_value_dup_string(value);
- plugin->loader = g_value_dup_object(value);
- plugin->info = g_value_dup_object(value);
- plugin->state = g_value_get_enum(value);
- plugin->error = g_value_dup_boxed(value);
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-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);
-gplugin_perl_plugin_init(G_GNUC_UNUSED GPluginPerlPlugin *plugin)
-gplugin_perl_plugin_class_finalize(G_GNUC_UNUSED GPluginPerlPluginClass *klass)
-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(
- "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_ERROR, "error");
-/******************************************************************************
- *****************************************************************************/
-gplugin_perl_plugin_register(GPluginNativePlugin *native)
- gplugin_perl_plugin_register_type(G_TYPE_MODULE(native));
-gplugin_perl_plugin_get_interpreter(GPluginPerlPlugin *plugin)
- g_return_val_if_fail(GPLUGIN_PERL_IS_PLUGIN(plugin), NULL);
- return plugin->interpreter;
--- a/perl/gplugin-perl-plugin.h Sat Aug 22 19:29:50 2020 -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 <http://www.gnu.org/licenses/>.
-#ifndef GPLUGIN_PERL_PLUGIN_H
-#define GPLUGIN_PERL_PLUGIN_H
-#include <gplugin-native.h>
-#define PERL_NO_GET_CONTEXT
-/* 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
-#define properties freebsd_properties
-/* perl define's _() to something completely different that we don't use. So
- * we undef it so that we can use it for gettext.
-#define GPLUGIN_PERL_TYPE_PLUGIN (gplugin_perl_plugin_get_type())
-void gplugin_perl_plugin_register(GPluginNativePlugin *native);
-PerlInterpreter *gplugin_perl_plugin_get_interpreter(GPluginPerlPlugin *plugin);
-#endif /* GPLUGIN_PERL_PLUGIN_H */
--- a/perl/meson.build Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
- if not get_option('introspection')
- error('Perl plugin requires GObject Introspection.')
- GPLUGIN_PERL_SOURCES = [
- 'gplugin-perl-loader.c',
- 'gplugin-perl-plugin.c',
- GPLUGIN_PERL_HEADERS = [
- 'gplugin-perl-loader.h',
- 'gplugin-perl-plugin.h',
- # make sure we have the perl executable, we need it to figure out the
- PERL = find_program('perl')
- # make sure we have the gobject introspection perl module.
- '-e use Glib::Object::Introspection;',
- 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() == 'freebsd'
- perl_arch = 'sitearchexp'
- perl_arch = 'vendorarchexp'
- perl_arch = run_command(PERL,
- '-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(
- 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-perl',
- dependencies : [GMODULE, gplugin_dep, perl_dep, glib_perl_dep],
- install_dir : get_option('libdir') / 'gplugin'
--- a/perl/tests/meson.build Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-e = executable('test-perl-loader', 'test-perl-loader.c',
- '-DPERL_LOADER_DIR="@0@/.."'.format(meson.current_build_dir()),
- '-DPERL_PLUGIN_DIR="@0@/plugins"'.format(meson.current_source_dir()),
- link_with : gplugin_loader_tests,
- dependencies : [GLIB, GOBJECT, gplugin_dep, perl_dep])
--- a/perl/tests/plugins/basic.pl Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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 <http://www.gnu.org/licenses/>.
-use Glib::Object::Introspection;
-Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl-basic-plugin",
- abi_version => 0x01020304,
- name => "basic plugin",
- authors => ("author1"),
- license_id => "license",
- description => "description",
--- a/perl/tests/plugins/dependent.pl Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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 <http://www.gnu.org/licenses/>.
-use Glib::Object::Introspection;
-Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl-dependent-plugin",
- dependencies => ['dependency1', 'dependency2'],
--- a/perl/tests/plugins/load-exception.pl Sat Aug 22 19:29:50 2020 -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 <http://www.gnu.org/licenses/>.
-use Glib::Object::Introspection;
-Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl-load-exception",
--- a/perl/tests/plugins/load-failed.pl Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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 <http://www.gnu.org/licenses/>.
-use Glib::Object::Introspection;
-Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl-load-failed",
--- a/perl/tests/plugins/unload-failed.pl Sat Aug 22 19:29:50 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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 <http://www.gnu.org/licenses/>.
-use Glib::Object::Introspection;
-Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin");
- return GPlugin::PluginInfo->new(
- id => "gplugin/perl-unload-failed",
--- a/perl/tests/test-perl-loader.c Sat Aug 22 19:29:50 2020 -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 <http://www.gnu.org/licenses/>.
-#include <gplugin/gplugin-loader-tests.h>
-main(gint argc, gchar **argv)
- g_test_init(&argc, &argv, NULL);
- gplugin_loader_tests_main(PERL_LOADER_DIR, PERL_PLUGIN_DIR, "perl");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/gplugin-perl5-core.c Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,73 @@
+ * 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 <http://www.gnu.org/licenses/>. +#include <gplugin-native.h> +#include "gplugin-perl5-loader.h" +#include "gplugin-perl5-plugin.h" +#include <glib/gi18n-lib.h> +G_MODULE_EXPORT GPluginPluginInfo * +gplugin_query(GError **error) + const gchar *const authors[] = { + "Gary Kramlich <grim@reaperworld.com>", + return gplugin_plugin_info_new( + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION, + "name", "Perl 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.", + "website", GPLUGIN_WEBSITE, +G_MODULE_EXPORT gboolean +gplugin_load(GPluginNativePlugin *plugin, GError **error) + gplugin_perl_plugin_register(plugin); + gplugin_perl_loader_register(plugin); + return gplugin_manager_register_loader(GPLUGIN_PERL_TYPE_LOADER, error); +G_MODULE_EXPORT gboolean +gplugin_unload(GPluginNativePlugin *plugin, GError **error) + _("The Perl loader can not be unloaded")); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/gplugin-perl5-loader.c Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,332 @@
+ * 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 <http://www.gnu.org/licenses/>. +#include "gplugin-perl5-loader.h" +#include "gplugin-perl5-plugin.h" +struct _GPluginPerlLoader { +static PerlInterpreter *my_perl = NULL; +/****************************************************************************** + *****************************************************************************/ +extern void boot_DynaLoader(pTHX_ CV *cv); +static void gplugin_perl_loader_xs_init(pTHX) + newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); +gplugin_perl_loader_init_perl(void) + gchar **argv = (gchar **)args; + 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); +gplugin_perl_loader_uninit_perl(void) + PERL_SET_CONTEXT(my_perl); + perl_destruct(my_perl); +static GPluginPluginInfo * +gplugin_perl_loader_call_gplugin_query( + PerlInterpreter *interpreter, + GPluginPluginInfo *info = NULL; + PerlInterpreter *old = NULL; + PERL_SET_CONTEXT(interpreter); + ret = call_pv("gplugin_query", G_EVAL | G_NOARGS); + "gplugin_query did not return a GPluginPluginInfo"); + const gchar *errmsg = SvPVutf8_nolen(ERRSV); + g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg); + 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)); +gplugin_perl_loader_call_boolean( + PerlInterpreter *interpreter, + PerlInterpreter *old = NULL; + PERL_SET_CONTEXT(interpreter); + count = call_pv(func, G_EVAL | G_SCALAR); + "%s did not return a value", + const gchar *errmsg = SvPVutf8_nolen(ERRSV); + g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg); +/****************************************************************************** + * GPluginLoaderInterface API + *****************************************************************************/ +gplugin_perl_loader_supported_extensions(G_GNUC_UNUSED GPluginLoader *l) + return g_slist_append(NULL, "pl"); +gplugin_perl_loader_query( + 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); + perl_parse(interpreter, gplugin_perl_loader_xs_init, argc, argv, NULL); + const gchar *errmsg = "unknown error"; + errmsg = SvPVutf8_nolen(ERRSV); + g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg); + perl_destruct(interpreter); + perl_free(interpreter); + ret = perl_run(interpreter); + const gchar *errmsg = "unknown error"; + errmsg = SvPVutf8_nolen(ERRSV); + g_set_error_literal(error, GPLUGIN_DOMAIN, 0, errmsg); + perl_destruct(interpreter); + perl_free(interpreter); + info = gplugin_perl_loader_call_gplugin_query(interpreter, error); + if(!GPLUGIN_IS_PLUGIN_INFO(info)) { + g_set_error_literal(error, GPLUGIN_DOMAIN, 0, "failed to query"); + GPLUGIN_PERL_TYPE_PLUGIN, + "interpreter", interpreter, + "loader", g_object_ref(loader), +gplugin_perl_loader_load( + G_GNUC_UNUSED GPluginLoader *loader, + GPluginPerlPlugin *pplugin = GPLUGIN_PERL_PLUGIN(plugin); + PerlInterpreter *interpreter = NULL; + interpreter = gplugin_perl_plugin_get_interpreter(pplugin); + return gplugin_perl_loader_call_boolean(interpreter, "gplugin_load", error); +gplugin_perl_loader_unload( + G_GNUC_UNUSED GPluginLoader *loader, + GPluginPerlPlugin *pplugin = GPLUGIN_PERL_PLUGIN(plugin); + PerlInterpreter *interpreter = NULL; + interpreter = gplugin_perl_plugin_get_interpreter(pplugin); + return gplugin_perl_loader_call_boolean( +/****************************************************************************** + *****************************************************************************/ +gplugin_perl_loader_init(G_GNUC_UNUSED GPluginPerlLoader *loader) +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(); +gplugin_perl_loader_class_finalize(G_GNUC_UNUSED GPluginPerlLoaderClass *klass) + /* perl uninitialization */ + gplugin_perl_loader_uninit_perl(); +/****************************************************************************** + *****************************************************************************/ +gplugin_perl_loader_register(GPluginNativePlugin *plugin) + gplugin_perl_loader_register_type(G_TYPE_MODULE(plugin)); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/gplugin-perl5-loader.h Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,38 @@
+ * 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 <http://www.gnu.org/licenses/>. +#ifndef GPLUGIN_PERL_LOADER_H +#define GPLUGIN_PERL_LOADER_H +#include <gplugin-native.h> +#define GPLUGIN_PERL_TYPE_LOADER (gplugin_perl_loader_get_type()) +void gplugin_perl_loader_register(GPluginNativePlugin *plugin); +#endif /* GPLUGIN_PERL_PLUGIN_LOADER_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/gplugin-perl5-plugin.c Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,217 @@
+ * 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 <http://www.gnu.org/licenses/>. +#include "gplugin-perl5-plugin.h" +/****************************************************************************** + *****************************************************************************/ +struct _GPluginPerlPlugin { + PerlInterpreter *interpreter; + GPluginPluginInfo *info; + GPluginPluginState state; +/****************************************************************************** + *****************************************************************************/ + PROP_FILENAME = N_PROPERTIES, +static GParamSpec *properties[N_PROPERTIES] = { +/* I hate forward declarations... */ +static void gplugin_perl_plugin_iface_init(GPluginPluginInterface *iface); +G_DEFINE_DYNAMIC_TYPE_EXTENDED( + G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_perl_plugin_iface_init)); +/****************************************************************************** + * GPluginPlugin Implementation + *****************************************************************************/ +gplugin_perl_plugin_iface_init(G_GNUC_UNUSED GPluginPluginInterface *iface) +/****************************************************************************** + *****************************************************************************/ +gplugin_perl_plugin_get_property( + GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj); + gplugin_perl_plugin_get_interpreter(plugin)); + g_value_set_string(value, plugin->filename); + g_value_set_object(value, plugin->loader); + g_value_set_object(value, plugin->info); + g_value_set_enum(value, plugin->state); + g_value_set_boxed(value, plugin->error); + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); +gplugin_perl_plugin_set_property( + GPluginPerlPlugin *plugin = GPLUGIN_PERL_PLUGIN(obj); + plugin->interpreter = g_value_get_pointer(value); + plugin->filename = g_value_dup_string(value); + plugin->loader = g_value_dup_object(value); + plugin->info = g_value_dup_object(value); + plugin->state = g_value_get_enum(value); + plugin->error = g_value_dup_boxed(value); + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); +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); +gplugin_perl_plugin_init(G_GNUC_UNUSED GPluginPerlPlugin *plugin) +gplugin_perl_plugin_class_finalize(G_GNUC_UNUSED GPluginPerlPluginClass *klass) +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( + "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_ERROR, "error"); +/****************************************************************************** + *****************************************************************************/ +gplugin_perl_plugin_register(GPluginNativePlugin *native) + gplugin_perl_plugin_register_type(G_TYPE_MODULE(native)); +gplugin_perl_plugin_get_interpreter(GPluginPerlPlugin *plugin) + g_return_val_if_fail(GPLUGIN_PERL_IS_PLUGIN(plugin), NULL); + return plugin->interpreter; --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/gplugin-perl5-plugin.h Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,57 @@
+ * 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 <http://www.gnu.org/licenses/>. +#ifndef GPLUGIN_PERL_PLUGIN_H +#define GPLUGIN_PERL_PLUGIN_H +#include <gplugin-native.h> +#define PERL_NO_GET_CONTEXT +/* 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 +#define properties freebsd_properties +/* perl define's _() to something completely different that we don't use. So + * we undef it so that we can use it for gettext. +#define GPLUGIN_PERL_TYPE_PLUGIN (gplugin_perl_plugin_get_type()) +void gplugin_perl_plugin_register(GPluginNativePlugin *native); +PerlInterpreter *gplugin_perl_plugin_get_interpreter(GPluginPerlPlugin *plugin); +#endif /* GPLUGIN_PERL_PLUGIN_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/meson.build Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,66 @@
+ if not get_option('introspection') + error('Perl plugin requires GObject Introspection.') + 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 + PERL = find_program('perl') + # make sure we have the gobject introspection perl module. + '-e use Glib::Object::Introspection;', + 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() == 'freebsd' + perl_arch = 'sitearchexp' + perl_arch = 'vendorarchexp' + perl_arch = run_command(PERL, + '-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( + 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', + dependencies : [GMODULE, gplugin_dep, perl_dep, glib_perl_dep], + install_dir : get_option('libdir') / 'gplugin' --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/meson.build Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,12 @@
+e = executable('test-perl5-loader', 'test-perl5-loader.c', + '-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]) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/plugins/basic.pl Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,43 @@
+# 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 <http://www.gnu.org/licenses/>. +use Glib::Object::Introspection; +Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin"); + return GPlugin::PluginInfo->new( + id => "gplugin/perl5-basic-plugin", + abi_version => 0x01020304, + name => "basic plugin", + authors => ("author1"), + license_id => "license", + description => "description", --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/plugins/dependent.pl Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,35 @@
+# 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 <http://www.gnu.org/licenses/>. +use Glib::Object::Introspection; +Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin"); + return GPlugin::PluginInfo->new( + id => "gplugin/perl5-dependent-plugin", + dependencies => ['dependency1', 'dependency2'], --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/plugins/load-exception.pl Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,36 @@
+# 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 <http://www.gnu.org/licenses/>. +use Glib::Object::Introspection; +Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin"); + return GPlugin::PluginInfo->new( + id => "gplugin/perl5-load-exception", --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/plugins/load-failed.pl Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,34 @@
+# 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 <http://www.gnu.org/licenses/>. +use Glib::Object::Introspection; +Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin"); + return GPlugin::PluginInfo->new( + id => "gplugin/perl5-load-failed", --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/plugins/unload-failed.pl Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,34 @@
+# 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 <http://www.gnu.org/licenses/>. +use Glib::Object::Introspection; +Glib::Object::Introspection->setup(basename => "GPlugin", version => "1.0", package=> "GPlugin"); + return GPlugin::PluginInfo->new( + id => "gplugin/perl5-unload-failed", --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/perl5/tests/test-perl5-loader.c Wed Aug 26 03:12:40 2020 -0500
@@ -0,0 +1,31 @@
+ * 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 <http://www.gnu.org/licenses/>. +#include <gplugin/gplugin-loader-tests.h> +main(gint argc, gchar **argv) + g_test_init(&argc, &argv, NULL); + gplugin_loader_tests_main(PERL5_LOADER_DIR, PERL5_PLUGIN_DIR, "perl5");