Skip to content

Commit e1d448c

Browse files
Add BlueZ in CHIP (#1608)
-- Add BlueZ in Third-party for CHIP Linux device layer BLE manager integration Issue: #741 Test: local compilation Co-authored-by: Justin Wood <woody@apple.com>
1 parent 0320920 commit e1d448c

File tree

9 files changed

+112
-7
lines changed

9 files changed

+112
-7
lines changed

.github/workflows/bloat_check.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
container:
14-
image: connectedhomeip/chip-build:0.3.0
14+
image: connectedhomeip/chip-build:0.4.0
1515

1616
steps:
1717
- name: Checkout

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
container:
20-
image: connectedhomeip/chip-build:0.3.0
20+
image: connectedhomeip/chip-build:0.4.0
2121
volumes:
2222
- "/tmp/log_output:/tmp/test_logs"
2323

.github/workflows/examples.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
container:
17-
image: connectedhomeip/chip-build-esp32:0.3.0
17+
image: connectedhomeip/chip-build-esp32:0.4.0
1818
volumes:
1919
- "/tmp/bloat_reports:/tmp/bloat_reports"
2020
- "/tmp/output_binaries:/tmp/output_binaries"
@@ -58,7 +58,7 @@ jobs:
5858
runs-on: ubuntu-latest
5959

6060
container:
61-
image: connectedhomeip/chip-build-nrf-platform:0.3.0
61+
image: connectedhomeip/chip-build-nrf-platform:0.4.0
6262
volumes:
6363
- "/tmp/bloat_reports:/tmp/bloat_reports"
6464
- "/tmp/output_binaries:/tmp/output_binaries"
@@ -102,7 +102,7 @@ jobs:
102102
runs-on: ubuntu-latest
103103

104104
container:
105-
image: connectedhomeip/chip-build:0.3.0
105+
image: connectedhomeip/chip-build:0.4.0
106106
volumes:
107107
- "/tmp/bloat_reports:/tmp/bloat_reports"
108108
- "/tmp/output_binaries:/tmp/output_binaries"

.github/workflows/qemu.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
container:
17-
image: connectedhomeip/chip-build-esp32-qemu:0.3.0
17+
image: connectedhomeip/chip-build-esp32-qemu:0.4.0
1818
volumes:
1919
- "/tmp/log_output:/tmp/test_logs"
2020

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,9 @@
5858
branch = master
5959
ignore = dirty
6060
commit = 250c6d605b83910f86fa61fcdbde9ba67dcc7d93
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 = df7d3fa5002373f7f955219defc7d0bc794a5a6c

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
@@ -1518,6 +1518,90 @@ AC_MSG_NOTICE([checking package dependencies])
15181518

15191519
AC_PATH_PROG([PKG_CONFIG],[pkg-config])
15201520

1521+
#
1522+
# Chip over Ble over Bluez Peripheral support
1523+
#
1524+
1525+
# Only a concern when the BLE layer is enabled.
1526+
1527+
CONFIG_BLE_PLATFORM_BLUEZ=0
1528+
enable_chipoble_bluez="no"
1529+
1530+
NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1531+
[BlueZ],
1532+
[BLUEZ],
1533+
[bluez],
1534+
[-lgdbus-internal -lshared-glib],
1535+
[
1536+
# actions if not external
1537+
# At this time, enable this only for linux, and only if the tests are enabled
1538+
if test "${nl_cv_build_tests}" = "yes" && test "${CONFIG_NETWORK_LAYER_BLE}" = 1 && test "${with_device_layer}" = "linux"; then
1539+
case "${target}" in
1540+
1541+
*linux*)
1542+
if test "x${HAVE_CXX11}" == "0"; then
1543+
AC_MSG_ERROR([BlueZ support requires C++11 compiler])
1544+
fi
1545+
CONFIG_BLE_PLATFORM_BLUEZ=1
1546+
enable_chipoble_bluez="yes"
1547+
;;
1548+
1549+
*)
1550+
CONFIG_BLE_PLATFORM_BLUEZ=0
1551+
enable_chipoble_bluez="no"
1552+
;;
1553+
1554+
esac
1555+
fi
1556+
]
1557+
)
1558+
1559+
# Depending on whether bluez has been configured for an internal
1560+
# location, its directory stem within this package needs to be set
1561+
# accordingly. In addition, if the location is internal, then we need
1562+
# to attempt to pull it down using the bootstrap makefile.
1563+
1564+
if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
1565+
maybe_bluez_dirstem="bluez/repo"
1566+
bluez_dirstem="third_party/${maybe_bluez_dirstem}"
1567+
1568+
AC_MSG_NOTICE([attempting to create internal ${bluez_dirstem}])
1569+
1570+
${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${bluez_dirstem}
1571+
1572+
if test $? -ne 0; then
1573+
AC_MSG_ERROR([failed to create ${bluez_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1574+
fi
1575+
1576+
echo " BOOTSTRAP ${bluez_dirstem}"
1577+
1578+
(cd ${srcdir}/${bluez_dirstem} && ./bootstrap)
1579+
1580+
else
1581+
maybe_bluez_dirstem=""
1582+
fi
1583+
1584+
AC_SUBST(BLUEZ_SUBDIRS, [${maybe_bluez_dirstem}])
1585+
AM_CONDITIONAL([CHIP_WITH_BLUEZ_INTERNAL], [test "${nl_with_bluez}" = "internal"])
1586+
1587+
AM_CONDITIONAL([CONFIG_BLE_PLATFORM_BLUEZ], [test "${enable_chipoble_bluez}" = "yes"])
1588+
AC_DEFINE_UNQUOTED([CONFIG_BLE_PLATFORM_BLUEZ],[${CONFIG_BLE_PLATFORM_BLUEZ}],[Define to 1 if you want to enable Chip over Ble over bluez.])
1589+
1590+
if test "${enable_chipoble_bluez}" = "yes"; then
1591+
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
1592+
AC_MSG_ERROR(GLib >= 2.28 is required))
1593+
AC_SUBST(GLIB_CFLAGS)
1594+
AC_SUBST(GLIB_LIBS)
1595+
1596+
PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
1597+
AC_MSG_ERROR(D-Bus >= 1.6 is required))
1598+
AC_SUBST(DBUS_CFLAGS)
1599+
AC_SUBST(DBUS_LIBS)
1600+
1601+
AX_CHECK_COMPILER_OPTIONS([C], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1602+
AX_CHECK_COMPILER_OPTIONS([C++], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1603+
fi
1604+
15211605
#
15221606
# OpenSSL
15231607
#
@@ -2310,6 +2394,10 @@ AC_CONFIG_SUBDIRS([third_party/nlfaultinjection/repo])
23102394
AC_SUBST(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlfaultinjection/repo/src"])
23112395
fi
23122396

2397+
if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
2398+
AC_CONFIG_SUBDIRS([third_party/bluez/repo])
2399+
fi
2400+
23132401
if test "${nl_with_mbedtls}" = "internal"; then
23142402
AC_CONFIG_SUBDIRS([third_party/mbedtls/repo])
23152403
fi
@@ -2430,6 +2518,8 @@ AC_MSG_NOTICE([
24302518
Doxygen : ${DOXYGEN:--}
24312519
GraphViz dot : ${DOT:--}
24322520
PERL : ${PERL:--}
2521+
CHIP over BlueZ support : ${enable_chipoble_bluez:--}
2522+
BlueZ source : ${nl_with_bluez:--}
24332523
Valgrind : ${VALGRIND:--}
24342524
LwIP source : ${nl_with_lwip:--}
24352525
LwIP compile flags : ${LWIP_CPPFLAGS:--}

third_party/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ DIST_SUBDIRS = \
5252
# of the 'distclean' target. Consequently, we conditionally include
5353
# them in DIST_SUBDIRS on invocation of 'distclean-recursive'
5454

55-
distclean-recursive: DIST_SUBDIRS += $(NLASSERT_SUBDIRS) $(NLFAULTINJECTION_SUBDIRS) $(NLIO_SUBDIRS) $(NLUNIT_TEST_SUBDIRS) $(MBEDTLS_SUBDIRS) $(OPENTHREAD_SUBDIRS) $(OT_BR_POSIX_SUBDIRS)
55+
distclean-recursive: DIST_SUBDIRS += $(BLUEZ_SUBDIRS) $(NLASSERT_SUBDIRS) $(NLFAULTINJECTION_SUBDIRS) $(NLIO_SUBDIRS) $(NLUNIT_TEST_SUBDIRS) $(MBEDTLS_SUBDIRS) $(OPENTHREAD_SUBDIRS) $(OT_BR_POSIX_SUBDIRS)
5656

5757
# Always build (e.g. for 'make all') these subdirectories.
5858
#
@@ -61,6 +61,7 @@ distclean-recursive: DIST_SUBDIRS += $(NLASSERT_SUBDIRS) $(NLFAULTINJECTION_SUBD
6161
# the third-party packages listed in repos.conf>=internal
6262

6363
SUBDIRS = \
64+
$(BLUEZ_SUBDIRS) \
6465
$(NLASSERT_SUBDIRS) \
6566
$(NLFAULTINJECTION_SUBDIRS) \
6667
$(NLIO_SUBDIRS) \

third_party/bluez/repo

Submodule repo added at df7d3fa

0 commit comments

Comments
 (0)