Skip to content

Commit 7aa9712

Browse files
Add BlueZ in CHIP
-- Add BlueZ in Third-party for CHIP Linux device layer BLE manager integration -- Add linux bluez dependancy packages for compilation Issue: #741 Test: local compilation
1 parent bca8b6e commit 7aa9712

File tree

6 files changed

+112
-2
lines changed

6 files changed

+112
-2
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,9 @@
5858
branch = master
5959
ignore = dirty
6060
commit = 38e91052d1fb12a55c4e34073f9e399471650b4b
61+
[submodule "bluez"]
62+
path = third_party/bluez/repo
63+
url = git://git.kernel.org/pub/scm/bluetooth/bluez.git
64+
branch = master
65+
ignore = dirty
66+
commit = 5b890a196276b325f2c627ef6a8a0aaece0fd61d

Makefile.am

+7
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ $(builddir)/.local-version.min: $(builddir)/.local-version
192192

193193
DISTCHECK_CONFIGURE_FLAGS = `chmod u+w ../.. ../../third_party`
194194

195+
#
196+
# BlueZ is not well set-up without patching to handle 'make distcheck';
197+
# disable it for that target.
198+
#
199+
200+
DISTCHECK_CONFIGURE_FLAGS += --without-bluez
201+
195202
all-recursive check-recursive coverage-recursive install-recursive pretty-recursive pretty-check-recursive dist distcheck distdir install-headers: $(BUILT_SOURCES)
196203

197204
dist-hook: $(distdir)/.dist-version

configure.ac

+90
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,90 @@ AC_MSG_NOTICE([checking package dependencies])
14891489

14901490
AC_PATH_PROG([PKG_CONFIG],[pkg-config])
14911491

1492+
#
1493+
# Chip over Ble over Bluez Peripheral support
1494+
#
1495+
1496+
# Only a concern when the BLE layer is enabled.
1497+
1498+
CONFIG_BLE_PLATFORM_BLUEZ=0
1499+
enable_chipoble_bluez="no"
1500+
1501+
NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1502+
[BlueZ],
1503+
[BLUEZ],
1504+
[bluez],
1505+
[-lgdbus-internal -lshared-glib],
1506+
[
1507+
# actions if not external
1508+
# At this time, enable this only for linux, and only if the tests are enabled
1509+
if test "${nl_cv_build_tests}" = "yes" && test "${CONFIG_NETWORK_LAYER_BLE}" = 1 && test "${with_device_layer}" = "linux"; then
1510+
case "${target}" in
1511+
1512+
*linux*)
1513+
if test "x${HAVE_CXX11}" == "0"; then
1514+
AC_MSG_ERROR([BlueZ support requires C++11 compiler])
1515+
fi
1516+
CONFIG_BLE_PLATFORM_BLUEZ=1
1517+
enable_chipoble_bluez="yes"
1518+
;;
1519+
1520+
*)
1521+
CONFIG_BLE_PLATFORM_BLUEZ=0
1522+
enable_chipoble_bluez="no"
1523+
;;
1524+
1525+
esac
1526+
fi
1527+
]
1528+
)
1529+
1530+
# Depending on whether bluez has been configured for an internal
1531+
# location, its directory stem within this package needs to be set
1532+
# accordingly. In addition, if the location is internal, then we need
1533+
# to attempt to pull it down using the bootstrap makefile.
1534+
1535+
if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
1536+
maybe_bluez_dirstem="bluez/repo"
1537+
bluez_dirstem="third_party/${maybe_bluez_dirstem}"
1538+
1539+
AC_MSG_NOTICE([attempting to create internal ${bluez_dirstem}])
1540+
1541+
${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${bluez_dirstem}
1542+
1543+
if test $? -ne 0; then
1544+
AC_MSG_ERROR([failed to create ${bluez_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1545+
fi
1546+
1547+
echo " BOOTSTRAP ${bluez_dirstem}"
1548+
1549+
(cd ${srcdir}/${bluez_dirstem} && ./bootstrap)
1550+
1551+
else
1552+
maybe_bluez_dirstem=""
1553+
fi
1554+
1555+
AC_SUBST(BLUEZ_SUBDIRS, [${maybe_bluez_dirstem}])
1556+
AM_CONDITIONAL([CHIP_WITH_BLUEZ_INTERNAL], [test "${nl_with_bluez}" = "internal"])
1557+
1558+
AM_CONDITIONAL([CONFIG_BLE_PLATFORM_BLUEZ], [test "${enable_chipoble_bluez}" = "yes"])
1559+
AC_DEFINE_UNQUOTED([CONFIG_BLE_PLATFORM_BLUEZ],[${CONFIG_BLE_PLATFORM_BLUEZ}],[Define to 1 if you want to enable Chip over Ble over bluez.])
1560+
1561+
if test "${enable_chipoble_bluez}" = "yes"; then
1562+
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
1563+
AC_MSG_ERROR(GLib >= 2.28 is required))
1564+
AC_SUBST(GLIB_CFLAGS)
1565+
AC_SUBST(GLIB_LIBS)
1566+
1567+
PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
1568+
AC_MSG_ERROR(D-Bus >= 1.6 is required))
1569+
AC_SUBST(DBUS_CFLAGS)
1570+
AC_SUBST(DBUS_LIBS)
1571+
1572+
AX_CHECK_COMPILER_OPTIONS([C], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1573+
AX_CHECK_COMPILER_OPTIONS([C++], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1574+
fi
1575+
14921576
#
14931577
# OpenSSL
14941578
#
@@ -2281,6 +2365,10 @@ AC_CONFIG_SUBDIRS([third_party/nlfaultinjection/repo])
22812365
AC_SUBST(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlfaultinjection/repo/src"])
22822366
fi
22832367

2368+
if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
2369+
AC_CONFIG_SUBDIRS([third_party/bluez/repo])
2370+
fi
2371+
22842372
if test "${nl_with_mbedtls}" = "internal"; then
22852373
AC_CONFIG_SUBDIRS([third_party/mbedtls/repo])
22862374
fi
@@ -2400,6 +2488,8 @@ AC_MSG_NOTICE([
24002488
Doxygen : ${DOXYGEN:--}
24012489
GraphViz dot : ${DOT:--}
24022490
PERL : ${PERL:--}
2491+
CHIP over BlueZ support : ${enable_chipoble_bluez:--}
2492+
BlueZ source : ${nl_with_bluez:--}
24032493
Valgrind : ${VALGRIND:--}
24042494
LwIP source : ${nl_with_lwip:--}
24052495
LwIP compile flags : ${LWIP_CPPFLAGS:--}

integrations/docker/images/chip-build/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ RUN set -x \
4040
libglib2.0-dev \
4141
libpixman-1-dev \
4242
libdbus-1-dev \
43+
libdbus-glib-1-dev \
44+
libical-dev \
45+
libudev-dev \
46+
libusb-dev \
47+
libreadline-dev \
48+
systemd \
4349
ninja-build \
4450
&& rm -rf /var/lib/apt/lists/ \
4551
&& : # last line
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.4.0

third_party/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ DIST_SUBDIRS = \
4444
# of the 'distclean' target. Consequently, we conditionally include
4545
# them in DIST_SUBDIRS on invocation of 'distclean-recursive'
4646

47-
distclean-recursive: DIST_SUBDIRS += $(NLASSERT_SUBDIRS) $(NLFAULTINJECTION_SUBDIRS) $(NLIO_SUBDIRS) $(NLUNIT_TEST_SUBDIRS) $(MBEDTLS_SUBDIRS) $(OPENTHREAD_SUBDIRS) $(OTBR_CLIENT_SUBDIRS)
47+
distclean-recursive: DIST_SUBDIRS += $(BLUEZ_SUBDIRS) $(NLASSERT_SUBDIRS) $(NLFAULTINJECTION_SUBDIRS) $(NLIO_SUBDIRS) $(NLUNIT_TEST_SUBDIRS) $(MBEDTLS_SUBDIRS) $(OPENTHREAD_SUBDIRS) $(OTBR_CLIENT_SUBDIRS)
4848

4949
# Always build (e.g. for 'make all') these subdirectories.
5050
#
@@ -53,6 +53,7 @@ distclean-recursive: DIST_SUBDIRS += $(NLASSERT_SUBDIRS) $(NLFAULTINJECTION_SUBD
5353
# the third-party packages listed in repos.conf>=internal
5454

5555
SUBDIRS = \
56+
$(BLUEZ_SUBDIRS) \
5657
$(NLASSERT_SUBDIRS) \
5758
$(NLFAULTINJECTION_SUBDIRS) \
5859
$(NLIO_SUBDIRS) \

0 commit comments

Comments
 (0)