[Kimchi-devel] [PATCH V2 6/7] add an optional to toggle the sample plugin
shaohef at linux.vnet.ibm.com
shaohef at linux.vnet.ibm.com
Fri May 16 19:30:53 UTC 2014
From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
sample plugin is used to test as a plugin demo.
we disable it by default.
use this command to enable sample plugin
$ ./autogen.sh --enable-plugins
Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
configure.ac | 10 ++++++++++
plugins/sample/Makefile.am | 18 +++++++++++++++++-
plugins/sample/{sample.conf => sample.conf.in} | 2 +-
3 files changed, 28 insertions(+), 2 deletions(-)
rename plugins/sample/{sample.conf => sample.conf.in} (90%)
diff --git a/configure.ac b/configure.ac
index cc971e8..ab1b302 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,16 @@ if test "x$PYFLAKES" = "x"; then
AC_MSG_WARN([pyflakes not found])
fi
+AC_ARG_ENABLE(
+ [plugins],
+ [AS_HELP_STRING(
+ [--enable-plugins],
+ [build plugins packages @<:@default=no@:>@]
+ )],
+ ,
+ [enable_plugins="no"]
+)
+AM_CONDITIONAL([PLUGINS], [test "${enable_plugins}" = "yes"])
AC_CONFIG_FILES([
po/Makefile.in
diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
index e03a4c0..b0beb32 100644
--- a/plugins/sample/Makefile.am
+++ b/plugins/sample/Makefile.am
@@ -19,4 +19,20 @@
SUBDIRS = ui
-EXTRA_DIST = API.json sample.conf $(wildcard *.py)
+EXTRA_DIST = API.json sample.conf.in $(wildcard *.py)
+
+if PLUGINS
+ENABLE_PLUGINS = True
+else
+ENABLE_PLUGINS = False
+endif
+
+do_substitution = \
+ sed -e 's,[@]ENABLE_PLUGINS[@],$(ENABLE_PLUGINS),g'
+
+sample.conf: sample.conf.in Makefile
+ echo $(ENABLE_PLUGINS)
+ $(do_substitution) < $< > $@
+
+BUILT_SOURCES = sample.conf
+CLEANFILES = sample.conf
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf.in
similarity index 90%
rename from plugins/sample/sample.conf
rename to plugins/sample/sample.conf.in
index 78a9f4e..12a3eef 100644
--- a/plugins/sample/sample.conf
+++ b/plugins/sample/sample.conf.in
@@ -1,5 +1,5 @@
[kimchi]
-enable = True
+enable = @ENABLE_PLUGINS@
plugin_class = "Drawings"
uri = "/plugins/sample"
--
1.9.0
More information about the Kimchi-devel
mailing list