summaryrefslogtreecommitdiff
path: root/plugins/dex
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-02-04 18:45:19 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-02-04 18:45:19 (GMT)
commitff187d24b7441e88e1f0361d59b0f6f55851791f (patch)
treee340d88fb8189ef79f2c2d4193eea97be4fa003e /plugins/dex
parent9b35b89fce2499d5352f5323baec53abbf9a4af2 (diff)
Added an option to drop Python support at compilation time.
Diffstat (limited to 'plugins/dex')
-rw-r--r--plugins/dex/Makefile.am23
-rw-r--r--plugins/dex/core.c18
2 files changed, 33 insertions, 8 deletions
diff --git a/plugins/dex/Makefile.am b/plugins/dex/Makefile.am
index 95a63e0..9b6cb72 100644
--- a/plugins/dex/Makefile.am
+++ b/plugins/dex/Makefile.am
@@ -4,6 +4,18 @@ lib_LTLIBRARIES = libdex.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON3_BINDINGS
+
+PYTHON3_LIBADD = python/libdexpython.la
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
+ -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+PYTHON3_SUBDIRS = python
+
+endif
+
+
libdex_la_SOURCES = \
core.h core.c \
class.h class.c \
@@ -16,12 +28,11 @@ libdex_la_SOURCES = \
pool.h pool.c
libdex_la_LIBADD = \
- python/libdexpython.la
+ $(PYTHON3_LIBADD)
-libdex_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore \
- -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+libdex_la_LDFLAGS = \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide-$(subdir)
@@ -33,4 +44,4 @@ AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I$(top_srcdir)/src
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = python
+SUBDIRS = $(PYTHON3_SUBDIRS)
diff --git a/plugins/dex/core.c b/plugins/dex/core.c
index 3e5b835..0f66c86 100644
--- a/plugins/dex/core.c
+++ b/plugins/dex/core.c
@@ -24,17 +24,27 @@
#include "core.h"
+#include <config.h>
#include <core/global.h>
#include <plugins/plugin-def.h>
#include "format.h"
-#include "python/module.h"
+#ifdef HAVE_PYTHON3_BINDINGS
+# include "python/module.h"
+#endif
+
+
+#ifdef HAVE_PYTHON3_BINDINGS
+# define PG_REQ RL("PyChrysalide", "dexbnf")
+#else
+# define PG_REQ RL("dexbnf")
+#endif
DEFINE_CHRYSALIDE_PLUGIN("GDexPlugin", "dex", "Add support for the DEX format", "0.1.0",
- RL("PyChrysalide", "dexbnf"), AL(PGA_PLUGIN_INIT, PGA_CONTENT_RESOLVER));
+ PG_REQ, AL(PGA_PLUGIN_INIT, PGA_CONTENT_RESOLVER));
@@ -54,7 +64,11 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
{
bool result; /* Bilan à retourner */
+#ifdef HAVE_PYTHON3_BINDINGS
result = add_format_dex_module_to_python_module();
+#else
+ result = true;
+#endif
return result;