Diff between 8eda0a753507903a13af27a69df19cddf9bec23f and 0093cd61b1e4f199bca45f8c2f8eb2d5a30e847d

Changed Files

File Additions Deletions Status
.gitignore +2 -1 modified
Makefile.am +84 -5 modified
Makefile.mesh +6 -15 modified
Makefile.tools +3 -2 modified
README +31 -0 modified
bootstrap-configure +1 -0 modified
configure.ac +11 -4 modified

Full Patch

diff --git a/.gitignore b/.gitignore
index a6cb3c7..2458730 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,8 +30,9 @@ autom4te.cache
 test-driver
 test-suite.log
 coverage.info
-
 coverage
+ell
+
 lib/bluez.pc
 lib/bluetooth
 src/builtin.h
diff --git a/Makefile.am b/Makefile.am
index 4045f9f..165c3bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,7 +28,7 @@ pkgincludedir = $(includedir)/bluetooth
 
 pkginclude_HEADERS =
 
-AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS) $(UDEV_CFLAGS)
+AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS) $(UDEV_CFLAGS) $(ell_cflags)
 AM_LDFLAGS = $(MISC_LDFLAGS)
 
 if DATAFILES
@@ -73,7 +73,7 @@ extra_sources = lib/uuid.c
 
 local_headers = $(foreach file,$(lib_headers), lib/bluetooth/$(notdir $(file)))
 
-BUILT_SOURCES = $(local_headers) src/builtin.h
+BUILT_SOURCES = $(local_headers) $(ell_built_sources) src/builtin.h
 
 if LIBRARY
 pkginclude_HEADERS += $(lib_headers)
@@ -96,6 +96,66 @@ gdbus_libgdbus_internal_la_SOURCES = gdbus/gdbus.h \
 				gdbus/mainloop.c gdbus/watch.c \
 				gdbus/object.c gdbus/client.c gdbus/polkit.c
 
+if EXTERNAL_ELL
+ell_cflags = @ELL_CFLAGS@
+ell_ldadd = @ELL_LIBS@
+ell_dependencies =
+ell_built_sources =
+else
+ell_cflags =
+ell_ldadd = ell/libell-internal.la
+ell_dependencies = $(ell_ldadd)
+ell_built_sources = ell/internal ell/ell.h
+
+noinst_LTLIBRARIES += ell/libell-internal.la
+
+ell_headers = ell/util.h \
+			ell/log.h \
+			ell/queue.h \
+			ell/hashmap.h \
+			ell/random.h \
+			ell/signal.h \
+			ell/timeout.h \
+			ell/io.h \
+			ell/idle.h \
+			ell/main.h \
+			ell/strv.h \
+			ell/string.h \
+			ell/dbus.h \
+			ell/dbus-service.h \
+			ell/dbus-client.h
+
+ell_sources = ell/private.h ell/missing.h \
+			ell/util.c \
+			ell/log.c \
+			ell/queue.c \
+			ell/hashmap.c \
+			ell/random.c \
+			ell/signal.c \
+			ell/timeout.c \
+			ell/io.c \
+			ell/idle.c \
+			ell/main.c \
+			ell/strv.c \
+			ell/string.c \
+			ell/dbus-private.h \
+			ell/dbus.c \
+			ell/dbus-message.c \
+			ell/dbus-util.c \
+			ell/dbus-service.c \
+			ell/dbus-client.c \
+			ell/dbus-name-cache.c \
+			ell/dbus-filter.c \
+			ell/gvariant-private.h \
+			ell/gvariant-util.c \
+			ell/siphash-private.h \
+			ell/siphash.c
+
+ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources)
+endif
+
+CLEANFILES += $(ell_built_sources)
+
 noinst_LTLIBRARIES += src/libshared-glib.la src/libshared-mainloop.la
 
 shared_sources = src/shared/io.h src/shared/timeout.h \
@@ -137,11 +197,11 @@ src_libshared_mainloop_la_SOURCES = $(shared_sources) \
 				src/shared/timeout-mainloop.c \
 				src/shared/mainloop.h src/shared/mainloop.c
 
-if ELL
+if LIBSHARED_ELL
+noinst_LTLIBRARIES += src/libshared-ell.la
+
 src_libshared_ell_la_SOURCES = $(shared_sources) \
 				src/shared/io-ell.c
-src_libshared_ell_la_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
-noinst_LTLIBRARIES += src/libshared-ell.la
 endif
 
 attrib_sources = attrib/att.h attrib/att-database.h attrib/att.c \
@@ -482,6 +542,8 @@ DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --enable-library \
 						--enable-midi \
 						--enable-manpages \
 						--enable-android \
+						--enable-mesh \
+						--enable-btpclient \
 						--disable-systemd \
 						--disable-udev
 
@@ -513,6 +575,23 @@ lib/bluetooth/%.h: lib/%.h
 	$(AM_V_at)$(MKDIR_P) lib/bluetooth
 	$(AM_V_GEN)$(LN_S) -f $(abspath $<) $@
 
+ell/internal: Makefile
+	$(AM_V_at)$(MKDIR_P) ell
+	$(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \
+		if [ ! -f $$f ] ; then \
+			$(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
+		fi \
+	done > $@
+
+ell/ell.h: Makefile
+	$(AM_V_at)echo -n > $@
+	$(AM_V_GEN)for f in $(ell_headers) ; do \
+		echo "#include <$$f>" >> $@ ; \
+	done
+
+maintainer-clean-local:
+	-rm -rf ell
+
 if COVERAGE
 clean-coverage:
 	@lcov --directory $(top_builddir) --zerocounters
diff --git a/Makefile.mesh b/Makefile.mesh
index 9cc5b5e..a9c387e 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -1,4 +1,5 @@
 if MESH
+
 mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/net_keys.h mesh/net_keys.c \
 				mesh/mesh-io.h mesh/mesh-io.c \
@@ -21,26 +22,16 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/mesh-defs.h
 libexec_PROGRAMS += mesh/meshd
 
-mesh_meshd_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
-
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
-
-mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
-				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
-				$(DBUS_LIBS) $(ELL_LIBS) -ljson-c
+mesh_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c
+mesh_meshd_DEPENDENCIES = $(ell_dependencies)
 
 noinst_PROGRAMS += mesh/btmesh
 
-mesh_btmesh_SOURCES = $(mesh_sources) \
-						mesh/agent.h \
+mesh_btmesh_SOURCES = $(mesh_sources) mesh/agent.h \
 						mesh/agent.c \
 						mesh/btmesh.c
-
-mesh_btmesh_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
-
-mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
-				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
-				src/libshared-mainloop.la \
-				-lreadline $(ELL_LIBS) -ljson-c
+mesh_btmesh_LDADD = src/libshared-mainloop.la $(ell_ldadd) -lreadline -ljson-c
+mesh_btmesh_DEPENDENCIES = $(ell_dependencies)
 
 endif
diff --git a/Makefile.tools b/Makefile.tools
index 55e769d..0de7128 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -469,6 +469,7 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
-tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
+tools_btpclient_LDADD = lib/libbluetooth-internal.la \
+				src/libshared-ell.la $(ell_ldadd)
+tools_btpclient_DEPENDENCIES = $(ell_dependencies)
 endif
diff --git a/README b/README
index 5da6029..1c5c140 100644
--- a/README
+++ b/README
@@ -26,6 +26,37 @@ To compile and install run:
 	make && make install
 
 
+Embedded Linux library
+======================
+
+In order to compile mesh support and test client utility the development
+version of Embedded Linux library is required to be present. The development
+repositories can be found here:
+
+	git://git.kernel.org/pub/scm/libs/ell/ell.git
+	https://kernel.googlesource.com/pub/scm/libs/ell/ell.git
+
+The build systems requires that the Embedded Linux library source code
+is available on the same top level directory as the source code:
+
+	.
+	|--- ell
+	|    |--- ell
+	|    `--- unit
+	`--- bluez
+	     |--- src
+	     `--- tools
+
+It is not required to build or install Embedded Linux library. The build
+will happen when building the binaries and it will then be linked internally.
+
+When using --enable-external-ell build option, it is not required that the
+Embedded Linux library source code is available in the top level directory.
+
+When neither --enable-mesh nor --enable-btpclient is specified, then this
+part is irrelevant and Embedded Linux library is not required.
+
+
 Configuration and options
 =========================
 
diff --git a/bootstrap-configure b/bootstrap-configure
index b14b455..cc44ae7 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -24,5 +24,6 @@ fi
 		--enable-sixaxis \
 		--enable-midi \
 		--enable-mesh \
+		--enable-btpclient \
 		--enable-logger \
 		--disable-datafiles $*
diff --git a/configure.ac b/configure.ac
index ee4199f..f46e381 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,13 +248,20 @@ AC_ARG_ENABLE(btpclient, AC_HELP_STRING([--enable-btpclient],
 		[enable BTP client]), [enable_btpclient=${enableval}])
 AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
 
-if (test "${enable_btpclient}" = "yes" || test "${enable_mesh}" = "yes"); then
-	PKG_CHECK_MODULES(ELL, ell >= 0.14, enable_ell=yes,
-			  AC_MSG_ERROR(ell library >= 0.14 is required))
+AC_ARG_ENABLE([external_ell], AC_HELP_STRING([--enable-external-ell],
+				[enable external Embedded Linux library]),
+					[enable_external_ell=${enableval}])
+if (test "${enable_external_ell}" = "yes"); then
+	PKG_CHECK_MODULES(ELL, ell >= 0.14, dummy=yes,
+		AC_MSG_ERROR(Embedded Linux library >= 0.14 is required))
 	AC_SUBST(ELL_CFLAGS)
 	AC_SUBST(ELL_LIBS)
 fi
-AM_CONDITIONAL(ELL, test "${enable_ell}" = "yes")
+AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" ||
+				(test "${enable_btpclient}" != "yes" &&
+						test "${enable_mesh}" != "yes"))
+AM_CONDITIONAL(LIBSHARED_ELL, test "${enable_btpclient}" = "yes" ||
+						test "${enable_mesh}" = "yes")
 
 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
 		[disable command line client]), [enable_client=${enableval}])