gplugin/gplugin

Merged in develop (pull request #71)
develop
2020-03-01, Gary Kramlich
de7769e8d081
Merged in develop (pull request #71)

Some Python/Perl build fixes

Approved-by: Gary Kramlich
--- a/perl/gplugin-perl-loader.c Sat Feb 29 03:18:44 2020 -0500
+++ b/perl/gplugin-perl-loader.c Sun Mar 01 07:31:12 2020 +0000
@@ -19,6 +19,8 @@
#include "gplugin-perl-plugin.h"
+#include <gperl.h>
+
struct _GPluginPerlLoader {
GPluginLoader parent;
};
--- a/perl/gplugin-perl-plugin.c Sat Feb 29 03:18:44 2020 -0500
+++ b/perl/gplugin-perl-plugin.c Sun Mar 01 07:31:12 2020 +0000
@@ -17,9 +17,6 @@
#include "gplugin-perl-plugin.h"
-#include <EXTERN.h>
-#include <perl.h>
-
/******************************************************************************
* Typedefs
*****************************************************************************/
--- a/perl/gplugin-perl-plugin.h Sat Feb 29 03:18:44 2020 -0500
+++ b/perl/gplugin-perl-plugin.h Sun Mar 01 07:31:12 2020 +0000
@@ -22,11 +22,21 @@
#include <gplugin-native.h>
#define PERL_NO_GET_CONTEXT
-#include <gperl.h>
+#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
--- a/perl/meson.build Sat Feb 29 03:18:44 2020 -0500
+++ b/perl/meson.build Sun Mar 01 07:31:12 2020 +0000
@@ -30,9 +30,27 @@
link_args : run_command(PERL, '-MExtUtils::Embed', '-e', 'ldopts', check : true).stdout().split(),
)
+ if host_machine.system() == 'freebsd'
+ 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(
- compile_args : run_command(PERL, '-MConfig', '-e', 'print "-I$Config{vendorarch}/Glib/Install"', check : true).stdout().split(),
- link_args : run_command(PERL, '-MConfig', '-e', 'print "$Config{vendorarch}/auto/Glib/Glib.so"', check : true).stdout().split(),
+ dependencies : glib_perl_dep,
+ # Annoyingly, this is not transferred over from the header_args.
+ compile_args : glib_perl_incdir
)
shared_library('gplugin-perl',
--- a/python/gplugin-python3-test-pygobject.c Sat Feb 29 03:18:44 2020 -0500
+++ b/python/gplugin-python3-test-pygobject.c Sun Mar 01 07:31:12 2020 +0000
@@ -34,29 +34,28 @@
/* setup wargv */
len = mbstowcs(NULL, argv[0], 0);
- if(len == (size_t)-1)
+ if(len == (size_t)-1) {
+ printf("Failed to call mbstowcs to find length of argv[0]: %s\n", argv[0]);
return -1;
+ }
wargv[0] = g_new0(wchar_t, len + 1);
len = mbstowcs(wargv[0], argv[0], len + 1);
if(len == (size_t)-1) {
g_free(wargv[0]);
+ printf("Failed to call mbstowcs to convert argv[0]: %s\n", argv[0]);
return -1;
}
/* setup sys.path */
-#if PY_VERSION_HEX < 0x03010300
- PySys_SetArgv(1, wargv);
- PyRun_SimpleString("import sys; sys.path.pop(0)\n");
-#else
PySys_SetArgvEx(1, wargv, 0);
-#endif
g_free(wargv[0]);
/* initialize pygobject */
pygobject_init(3, 0, 0);
if(PyErr_Occurred()) {
+ printf("Calling pygobject_init failed.\n");
PyErr_Print();
return -1;
}