summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Vermeulen <bert@biot.com>2016-04-21 01:33:49 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2016-05-04 19:34:47 +0200
commitbe93391b62b1575ad75db99bf25fef245b85f8b7 (patch)
tree2c6195b12949a3ecefae02a83ff7d8f6096ca50d
parent30d775b095a4b76e5fa755b19d5521affa3c053c (diff)
downloadlibsigrokdecode-be93391b62b1575ad75db99bf25fef245b85f8b7.tar.gz
libsigrokdecode-be93391b62b1575ad75db99bf25fef245b85f8b7.zip
Add common directory for shared modules.
-rw-r--r--Makefile.am11
-rw-r--r--srd.c6
2 files changed, 15 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index a8df8f6..1a1074e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,11 +23,12 @@ AM_LIBTOOLFLAGS = --silent
GNUMAKEFLAGS = --no-print-directory
DECODERS_DIR = $(pkgdatadir)/decoders
+COMMON_DIR = $(pkgdatadir)/common
# Do not hard-code the decoders location on Windows.
if WIN32
AM_CPPFLAGS =
else
-AM_CPPFLAGS = -DDECODERS_DIR='"$(DECODERS_DIR)"'
+AM_CPPFLAGS = -DDECODERS_DIR='"$(DECODERS_DIR)"' -DCOMMON_DIR='"$(COMMON_DIR)"'
endif
# The tests CFLAGS are a superset of the libsigrokdecode CFLAGS.
@@ -88,14 +89,20 @@ ChangeLog:
dist-hook: ChangeLog
$(MKDIR_P) $(distdir)/tools
cp ${top_srcdir}/tools/install-decoders $(distdir)/tools
+ $(MKDIR_P) $(distdir)/common
+ cp -a ${top_srcdir}/common $(distdir)
$(MKDIR_P) $(distdir)/decoders
${top_srcdir}/tools/install-decoders -i ${top_srcdir}/decoders \
-o $(distdir)/decoders
+install-common:
+ $(MKDIR_P) $(DESTDIR)$(COMMON_DIR)
+ cp -a ${top_srcdir}/common $(DESTDIR)$(pkgdatadir)
+
install-decoders:
$(MKDIR_P) $(DESTDIR)$(DECODERS_DIR)
$(PYTHON3) ${top_srcdir}/tools/install-decoders \
-i ${top_srcdir}/decoders -o $(DESTDIR)$(DECODERS_DIR)
-install-data-hook: install-decoders
+install-data-hook: install-common install-decoders
diff --git a/srd.c b/srd.c
index 2947ca8..c74d2de 100644
--- a/srd.c
+++ b/srd.c
@@ -169,6 +169,12 @@ SRD_API int srd_init(const char *path)
}
}
#ifdef DECODERS_DIR
+ /* Common modules for use by any decoder. */
+ if ((ret = srd_decoder_searchpath_add(COMMON_DIR)) != SRD_OK) {
+ Py_Finalize();
+ return ret;
+ }
+
/* Hardcoded decoders install location, if defined. */
if ((ret = srd_decoder_searchpath_add(DECODERS_DIR)) != SRD_OK) {
Py_Finalize();