Install sdbus++
Change-Id: Ie6af7436fdf66bd123bd196d238eff47b3fb95b8
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/Makefile.am b/Makefile.am
index 65e57d3..5b39bc1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,4 +16,4 @@
sdbusplus/utility/type_traits.hpp \
sdbusplus/vtable.hpp
-SUBDIRS = test
+SUBDIRS = test tools
diff --git a/configure.ac b/configure.ac
index 7c491d9..35fde11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,19 @@
AC_PROG_INSTALL
AC_PROG_MAKE_SET
+# setup sdbus++
+AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])])
+AC_SUBST([PYTHONDIR], ${pythondir})
+AS_IF([test "$PYTHON" != :], [have_python=yes], [have_python=no])
+
+AC_ARG_ENABLE([sdbuspp],
+ AS_HELP_STRING([--disable-sdbuspp], [Disable sdbus++]))
+
+AS_IF([test "x$enable_sdbuspp" != "xno"],
+ [AS_IF([test "x$have_python" = "xno"], [AC_MSG_ERROR([sdbus++ requires python])])])
+
+AM_CONDITIONAL([WANT_SDBUSPP], [test "x$enable_sdbuspp" != "xno"])
+
# Checks for libraries.
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
@@ -49,5 +62,5 @@
)
# Create configured output
-AC_CONFIG_FILES([Makefile test/Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/setup.py])
AC_OUTPUT
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644
index 0000000..3386cd7
--- /dev/null
+++ b/tools/Makefile.am
@@ -0,0 +1,21 @@
+if WANT_SDBUSPP
+
+all-local:
+ $(AM_V_at)$(PYTHON) ${top_builddir}/tools/setup.py build
+
+clean-local:
+ rm -rfv ${top_builddir}/build
+
+install-exec-hook:
+ $(AM_V_at)$(PYTHON) ${top_builddir}/tools/setup.py install \
+ --prefix=$(DESTDIR)${prefix} \
+ --install-data=$(DESTDIR)${datadir} \
+ --install-lib=$(DESTDIR)$(PYTHONDIR) \
+ --install-scripts=$(DESTDIR)${bindir} \
+ --record=${top_builddir}/python_install.log
+
+uninstall-hook:
+ cat ${top_builddir}/python_install.log \
+ | awk '{print "$(DESTDIR)"$$1}' | xargs rm -fv
+
+endif
diff --git a/tools/setup.py.in b/tools/setup.py.in
new file mode 100644
index 0000000..761043c
--- /dev/null
+++ b/tools/setup.py.in
@@ -0,0 +1,9 @@
+from distutils.core import setup
+
+setup(name='sdbusplus',
+ version='1.0',
+ package_dir={'':'@top_srcdir@/tools'},
+ packages=['sdbusplus'],
+ scripts=['@top_srcdir@/tools/sdbus++'],
+ package_data={'sdbusplus': ['templates/*.mako.*']},
+ )