summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-03-14 07:17:01 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-03-28 20:54:05 +0000
commit77bc009e86eb30c9c8911d1727beb5923bd02551 (patch)
tree94be5216644a80a6b34fa73e97af7da4995474ba
parent70e4fcf5af8913ba2da4ba7b1a4e77c17adcd6b3 (diff)
downloadopenpower-dbus-interfaces-77bc009e86eb30c9c8911d1727beb5923bd02551.zip
openpower-dbus-interfaces-77bc009e86eb30c9c8911d1727beb5923bd02551.tar.gz
build: autotools files for libopenpower_dbus.so
Use the interface YAML files present to generate the server.cpp and server.hpp files, build them into a shared library, and install. Change-Id: I87217ba299c04b3eb3fac819463707a103a287b5 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
-rw-r--r--Makefile.am15
-rw-r--r--Makefile.interfaces.in1
-rwxr-xr-xbootstrap.sh18
-rw-r--r--configure.ac37
-rwxr-xr-xgenerate_makefile.sh84
5 files changed, 155 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..6e63e81
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,15 @@
+AM_DEFAULT_SOURCE_EXT = .cpp
+
+nobase_include_HEADERS = ## These get filled in by Makefile.interfaces
+
+libopenpower_dbusdir = ${libdir}
+libopenpower_dbus_LTLIBRARIES = libopenpower_dbus.la
+libopenpower_dbus_la_LDFLAGS = $(SDBUSPLUS_LIBS) -version-info 0:0:0 -shared
+libopenpower_dbus_la_CXXFLAGS = $(SDBUSPLUS_CFLAGS)
+
+BUILT_SOURCES = libopenpower_dbus.cpp
+CLEANFILES = libopenpower_dbus.cpp
+
+clean-local: clean-dbus
+
+-include Makefile.interfaces
diff --git a/Makefile.interfaces.in b/Makefile.interfaces.in
new file mode 100644
index 0000000..714e6d0
--- /dev/null
+++ b/Makefile.interfaces.in
@@ -0,0 +1 @@
+# Empty file so that 'configure' attempts to generate Makefile.interfaces.
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..50b75b7
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+AUTOCONF_FILES="Makefile.in aclocal.m4 ar-lib autom4te.cache compile \
+ config.guess config.h.in config.sub configure depcomp install-sh \
+ ltmain.sh missing *libtool test-driver"
+
+case $1 in
+ clean)
+ test -f Makefile && make maintainer-clean
+ for file in ${AUTOCONF_FILES}; do
+ find -name "$file" | xargs -r rm -rf
+ done
+ exit 0
+ ;;
+esac
+
+autoreconf -i
+echo 'Run "./configure ${CONFIGURE_FLAGS} && make"'
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..f194a38
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,37 @@
+# Initialization
+AC_PREREQ([2.69])
+AC_INIT([openpower-dbus-interfaces], [1.0], [https://github.com/openbmc/openpower-dbus-interfaces])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
+AM_SILENT_RULES([yes])
+AC_LANG([C++])
+
+# Checks for programs.
+AC_PROG_CXX
+AM_PROG_AR
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_SED
+AC_CHECK_PROG([FIND], find, find)
+AC_CHECK_PROG([BASENAME], basename, basename)
+AC_CHECK_PROG([DIRNAME], dirname, dirname)
+
+AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
+AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
+ AC_MSG_ERROR([Cannot find sdbus++]))
+
+# Check for baseline language coverage in the compiler for the C++14 standard
+AX_CXX_COMPILE_STDCXX_14([noext])
+AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
+AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
+
+# Checks for library functions.
+LT_INIT([dlopen disable-static shared])
+LT_LIB_DLLOAD
+
+# Create configured output
+AC_CONFIG_FILES([Makefile.interfaces],
+ [${srcdir}/generate_makefile.sh ${srcdir} > Makefile.interfaces])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/generate_makefile.sh b/generate_makefile.sh
new file mode 100755
index 0000000..e990966
--- /dev/null
+++ b/generate_makefile.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+cd $1
+
+toplevel_dirs=org
+interfaces=`find $toplevel_dirs -name "*.interface.yaml"`
+
+for i in ${interfaces};
+do
+ iface_path=`dirname $i`/`basename $i .interface.yaml`
+ iface=`echo $iface_path | sed 's/\//./g'`
+ cat <<MAKEFILE
+
+${i%.interface.yaml}/server.cpp: ${i} ${i%.interface.yaml}/server.hpp
+ @mkdir -p \`dirname \$@\`
+ \$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-cpp ${iface} > \$@
+
+${i%.interface.yaml}/server.hpp: ${i}
+ @mkdir -p \`dirname \$@\`
+ \$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-header ${iface} > \$@
+
+MAKEFILE
+
+done
+
+errors=`find $toplevel_dirs -name "*.errors.yaml"`
+
+for e in ${errors};
+do
+ iface_path=`dirname $e`/`basename $e .errors.yaml`
+ iface=`echo $iface_path | sed 's/\//./g'`
+ cat <<MAKEFILE
+
+${e%.errors.yaml}/error.cpp: ${e} ${e%.errors.yaml}/error.hpp
+ @mkdir -p \`dirname \$@\`
+ \$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-cpp ${iface} > \$@
+
+${e%.errors.yaml}/error.hpp: ${e}
+ @mkdir -p \`dirname \$@\`
+ \$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-header ${iface} > \$@
+
+MAKEFILE
+
+done
+
+echo "libopenpower_dbus_cpp_SOURCES = \\"
+for i in ${interfaces};
+do
+ echo " ${i%.interface.yaml}/server.cpp \\"
+done
+for e in ${errors};
+do
+ echo " ${e%.errors.yaml}/error.cpp \\"
+done
+echo
+
+echo "libopenpower_dbus_hpp_SOURCES = \\"
+for i in ${interfaces};
+do
+ echo " ${i%.interface.yaml}/server.hpp \\"
+done
+for e in ${errors};
+do
+ echo " ${e%.errors.yaml}/error.hpp\\"
+done
+
+echo
+
+cat << MAKEFILE
+libopenpower_dbus.cpp: \$(libopenpower_dbus_cpp_SOURCES)
+ cat \$^ > \$@
+
+nobase_include_HEADERS = \$(libopenpower_dbus_hpp_SOURCES)
+
+.PHONY: clean-dbus
+clean-dbus:
+ for i in \$(libopenpower_dbus_cpp_SOURCES) \\
+ \$(libopenpower_dbus_hpp_SOURCES); \\
+ do \\
+ test -e \$\$i && rm \$\$i ; \\
+ test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\
+ true; \\
+ done
+MAKEFILE
OpenPOWER on IntegriCloud