Skip to contentSkip to conversation

build: Add meson build system

PATCH In review Bastien Nocera 2 participants 11 messages Oct 13, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover build: Add meson build system

Changes since v4:
- Dropped patch not intended for immediate merging
- Fix running unit tests under dbus-session

Changes since v3:
- Fixed project version (thanks George)

Changes since v2:
- Fixed the 2 FIXMEs

Changes since v1:
- A couple of bug fixes in the base patch (and we found a few bugs in the upstream code along the way)
- Added the option to disable bluetoothd build
- The ell subproject was replaced by a Meson Wrap, this means that tarball builds of bluez would require either an internet connection or a system installation of ell.

This version does not rely on forks of upstream projects, so I would consider this ready for merging.

Bastien Nocera (9):
build: Add meson wrap for libell
build: Add meson build system
build: Make more use of 'feature' options
build: Separate systemd and libsystemd dependencies
tools: Install gatttool if deprecated tools are enabled
tools: Install avinfo tool by default
tools: Install btmgmt along with other tools
emulator: Install the emulator if built
build: Add option to allow disabling bluetoothd

 attrib/meson.build                            |  17 +
 btio/meson.build                              |   1 +
 client/meson.build                            |  54 +
 completion/meson.build                        |   3 +
 doc/meson.build                               |  41 +
 emulator/meson.build                          |  36 +
 gdbus/meson.build                             |  19 +
 gobex/meson.build                             |   8 +
 lib/meson.build                               |  53 +
 mesh/meson.build                              |  75 ++
 meson.build                                   | 297 ++++++
 meson_options.txt                             |  53 +
 monitor/meson.build                           |  47 +
 obexd/meson.build                             | 121 +++
 peripheral/meson.build                        |  13 +
 plugins/meson.build                           |  29 +
 profiles/meson.build                          | 170 ++++
 src/meson.build                               | 103 ++
 src/shared/meson.build                        |  80 ++
 subprojects/ell.wrap                          |  11 +
 .../0001-build-Add-meson-build-system.patch   | 922 ++++++++++++++++++
 test/meson.build                              |  41 +
 tools/mesh/meson.build                        |  16 +
 tools/meson.build                             | 341 +++++++
 tools/mpris-proxy.service.in                  |   2 +-
 unit/meson.build                              | 114 +++
 26 files changed, 2666 insertions(+), 1 deletion(-)
 create mode 100644 attrib/meson.build
 create mode 100644 btio/meson.build
 create mode 100644 client/meson.build
 create mode 100644 completion/meson.build
 create mode 100644 doc/meson.build
 create mode 100644 emulator/meson.build
 create mode 100644 gdbus/meson.build
 create mode 100644 gobex/meson.build
 create mode 100644 lib/meson.build
 create mode 100644 mesh/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 monitor/meson.build
 create mode 100644 obexd/meson.build
 create mode 100644 peripheral/meson.build
 create mode 100644 plugins/meson.build
 create mode 100644 profiles/meson.build
 create mode 100644 src/meson.build
 create mode 100644 src/shared/meson.build
 create mode 100644 subprojects/ell.wrap
 create mode 100644 subprojects/packagefiles/0001-build-Add-meson-build-system.patch
 create mode 100644 test/meson.build
 create mode 100644 tools/mesh/meson.build
 create mode 100644 tools/meson.build
 create mode 100644 unit/meson.build
Signature · 1 line
2.51.0
#1 lore raw

PATCH v5 1/9 build: Add meson wrap for libell

Rather than relying on libell being able to build with meson from upstream, apply the meson build patches on top of the latest upstream release.

The build should still fallback to the system libell if available, and will fail to build if a system libell is not available, and no network access is available, as in many build systems.

---
 subprojects/ell.wrap                          |  11 +
 .../0001-build-Add-meson-build-system.patch   | 922 ++++++++++++++++++
 2 files changed, 933 insertions(+)
 create mode 100644 subprojects/ell.wrap
 create mode 100644 subprojects/packagefiles/0001-build-Add-meson-build-system.patch
subprojects/ell.wrap new file +11 -0
new file mode 100644
index 000000000000..3e9590b4066f
@@ -0,0 +1,11 @@
+[wrap-file]
+directory = ell-0.80
+source_url = https://www.kernel.org/pub/linux/libs/ell/ell-0.80.tar.xz
+source_filename = ell-0.80.tar.xz
+source_hash = 6efc70ae6d3e2ca1ec255ecd855a3d5fadefe59897f4307816e3ba7a771f3d00
+
+# Maintained in https://github.com/hadess/ell/tree/wip/hadess/add-meson
+diff_files = 0001-build-Add-meson-build-system.patch
+
+[provide]
+dependency_names = ell
subprojects/packagefiles/0001-build-Add-meson-build-system.patch new file +922 -0

922 lines not on this page · raw message

Signature · 1 line
2.51.0
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1010619

---Test result---

Test Summary:

CheckPatch                    PENDING   0.33 seconds
GitLint                       PENDING   0.32 seconds
BuildEll                      PASS      20.53 seconds
BluezMake                     PASS      2756.76 seconds
MakeCheck                     PASS      20.14 seconds
MakeDistcheck                 PASS      190.31 seconds
CheckValgrind                 PASS      242.62 seconds
CheckSmatch                   PASS      315.00 seconds
bluezmakeextell               PASS      131.51 seconds
IncrementalBuild              PENDING   0.28 seconds
ScanBuild                     PASS      945.85 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH v5 2/9 build: Add meson build system

In reply to Bastien Nocera

The options default were selected to try and match the existing autotools default as best as possible. Further commits will likely change those defaults, but at least it should be clear what defaults were changed from.

However, a number of options were removed:

--enable-pie is replaced by the meson base option "b_pie":
https://mesonbuild.com/Builtin-options.html#base-options

--enable-maintainer-mode is replaced by the "debug" build-types:
https://mesonbuild.com/Builtin-options.html#core-options

--enable-debug and --disable-optimization are replaced by the debug build type:
https://mesonbuild.com/Builtin-options.html#details-for-buildtype

Each of the sanitisers have their own b_sanitize option:
- asan: b_sanitize=address
- lsan: b_sanitize=leak
- ubsan: b_sanitize=address,undefined
https://mesonbuild.com/Builtin-options.html#base-options

--enable-coverage is replaced by the b_coverage option:
https://mesonbuild.com/Builtin-options.html#base-options

--enable-valgrind can be replicated by running the test suite with:
meson test --setup valgrind

---
 attrib/meson.build           |  17 ++
 btio/meson.build             |   1 +
 client/meson.build           |  54 ++++++
 completion/meson.build       |   3 +
 doc/meson.build              |  41 +++++
 emulator/meson.build         |  34 ++++
 gdbus/meson.build            |  19 ++
 gobex/meson.build            |   8 +
 lib/meson.build              |  53 ++++++
 mesh/meson.build             |  75 ++++++++
 meson.build                  | 292 ++++++++++++++++++++++++++++++
 meson_options.txt            |  51 ++++++
 monitor/meson.build          |  47 +++++
 obexd/meson.build            | 121 +++++++++++++
 peripheral/meson.build       |  13 ++
 plugins/meson.build          |  29 +++
 profiles/meson.build         | 170 ++++++++++++++++++
 src/meson.build              | 103 +++++++++++
 src/shared/meson.build       |  80 +++++++++
 test/meson.build             |  41 +++++
 tools/mesh/meson.build       |  16 ++
 tools/meson.build            | 339 +++++++++++++++++++++++++++++++++++
 tools/mpris-proxy.service.in |   2 +-
 unit/meson.build             | 114 ++++++++++++
 24 files changed, 1722 insertions(+), 1 deletion(-)
 create mode 100644 attrib/meson.build
 create mode 100644 btio/meson.build
 create mode 100644 client/meson.build
 create mode 100644 completion/meson.build
 create mode 100644 doc/meson.build
 create mode 100644 emulator/meson.build
 create mode 100644 gdbus/meson.build
 create mode 100644 gobex/meson.build
 create mode 100644 lib/meson.build
 create mode 100644 mesh/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 monitor/meson.build
 create mode 100644 obexd/meson.build
 create mode 100644 peripheral/meson.build
 create mode 100644 plugins/meson.build
 create mode 100644 profiles/meson.build
 create mode 100644 src/meson.build
 create mode 100644 src/shared/meson.build
 create mode 100644 test/meson.build
 create mode 100644 tools/mesh/meson.build
 create mode 100644 tools/meson.build
 create mode 100644 unit/meson.build
attrib/meson.build new file +17 -0
new file mode 100644
index 000000000000..0b7bc97933db
@@ -0,0 +1,17 @@
+attrib_sources = files(
+  'att.c',
+  'gatt.c',
+  'gattrib.c'
+)
+
+gatttool_sources = files(
+  'gatttool.c',
+  'att.c',
+  'gatt.c',
+  'gattrib.c',
+  'interactive.c',
+  'utils.c',
+  '../client/display.c',
+  '../btio/btio.c',
+  '../src/log.c'
+)
btio/meson.build new file +1 -0
new file mode 100644
index 000000000000..46ae5691f1d8
@@ -0,0 +1 @@
+btio_sources = files('btio.c')
client/meson.build new file +54 -0

54 lines not on this page · raw message

completion/meson.build new file +3 -0
new file mode 100644
index 000000000000..24b71518c67d
@@ -0,0 +1,3 @@
+install_data('zsh/_bluetoothctl',
+  install_dir: zshcompletiondir
+)
doc/meson.build new file +41 -0

41 lines not on this page · raw message

emulator/meson.build new file +34 -0
new file mode 100644
index 000000000000..59c72c4dbd4d
@@ -0,0 +1,34 @@
+emulator_sources = files(
+  'hciemu.c',
+  'vhci.c',
+  'btdev.c',
+  'bthost.c',
+  'smp.c',
+)
+
+if get_option('tests')
+  executable('btvirt',
+    sources: [ 'main.c',
+      'serial.c',
+      'server.c',
+      'vhci.c',
+      'btdev.c',
+      'bthost.c',
+      'smp.c',
+      'phy.c',
+      'le.c' ],
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, glib_dep ]
+  )
+
+  executable('b1ee',
+    sources: 'b1ee.c',
+    include_directories: '../lib',
+    dependencies: libshared_mainloop_dep
+  )
+
+  executable('hfp',
+    sources: 'hfp.c',
+    dependencies: libshared_mainloop_dep
+  )
+endif
+
gdbus/meson.build new file +19 -0
new file mode 100644
index 000000000000..dc7f2887a60f
@@ -0,0 +1,19 @@
+gdbus_sources = [
+  'gdbus.h',
+  'mainloop.c',
+  'watch.c',
+  'object.c',
+  'client.c',
+  'polkit.c'
+]
+
+libgdbus_internal = static_library('gdbus_internal',
+  sources: gdbus_sources,
+  dependencies: [ glib_dep, dbus_dep ],
+  install: false
+)
+
+libgdbus_internal_dep = declare_dependency(
+  dependencies: dbus_dep,
+  link_with: libgdbus_internal
+)
gobex/meson.build new file +8 -0
new file mode 100644
index 000000000000..0ff6238a7b8c
@@ -0,0 +1,8 @@
+gobex_sources = files(
+  'gobex.c',
+  'gobex-defs.c',
+  'gobex-packet.c',
+  'gobex-header.c',
+  'gobex-transfer.c',
+  'gobex-apparam.c'
+)
lib/meson.build new file +53 -0

53 lines not on this page · raw message

mesh/meson.build new file +75 -0

75 lines not on this page · raw message

meson.build new file +292 -0

292 lines not on this page · raw message

meson_options.txt new file +51 -0

51 lines not on this page · raw message

monitor/meson.build new file +47 -0

47 lines not on this page · raw message

obexd/meson.build new file +121 -0

121 lines not on this page · raw message

peripheral/meson.build new file +13 -0
new file mode 100644
index 000000000000..21d6296829ea
@@ -0,0 +1,13 @@
+if get_option('tests')
+  executable('btsensor',
+    sources: [
+      'main.c',
+      'efivars.c',
+      'attach.c',
+      'log.c',
+      'gap.c',
+      'gatt.c',
+    ],
+    dependencies: [ libshared_mainloop_dep, libbluetooth_internal_dep ]
+  )
+endif
plugins/meson.build new file +29 -0
new file mode 100644
index 000000000000..019e7083df16
@@ -0,0 +1,29 @@
+builtin_modules = [
+  'hostname',
+  'autopair',
+  'policy',
+]
+
+builtin_sources = files(
+  'hostname.c',
+  'autopair.c',
+  'policy.c'
+)
+
+builtin_deps = []
+
+if get_option('admin')
+  builtin_modules += 'admin'
+  builtin_sources += files('admin.c')
+endif
+
+if get_option('nfc')
+  builtin_modules += 'neard'
+  builtin_sources += files('neard.c')
+endif
+
+if get_option('sixaxis')
+  builtin_modules += 'sixaxis'
+  builtin_sources += files('sixaxis.c')
+  builtin_deps += udev_dep
+endif
profiles/meson.build new file +170 -0

170 lines not on this page · raw message

src/meson.build new file +103 -0

103 lines not on this page · raw message

src/shared/meson.build new file +80 -0

80 lines not on this page · raw message

test/meson.build new file +41 -0

41 lines not on this page · raw message

tools/mesh/meson.build new file +16 -0
new file mode 100644
index 000000000000..85bfb00977f3
@@ -0,0 +1,16 @@
+if get_option('tools') and readline_dep.found()
+  executable('mesh-cfgclient',
+    sources: [ '../mesh-cfgclient.c',
+      'cfgcli.c',
+      'keys.c',
+      'util.c',
+      'remote.c',
+      'agent.c',
+      'mesh-db.c',
+      '../../mesh/util.c',
+      '../../mesh/crypto.c',
+    ],
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, ell_dep, dbus_dep, jsonc_dep, readline_dep ],
+    install: true
+  )
+endif
tools/meson.build new file +339 -0

339 lines not on this page · raw message

tools/mpris-proxy.service.in +1 -1
index 6ae56c6720b9..a55f0254014a 100644
@@ -8,7 +8,7 @@ ConditionUser=!@system
 
 [Service]
 Type=simple
-ExecStart=@PKGBINDIR@/mpris-proxy
+ExecStart=@PKGLIBEXECDIR@/mpris-proxy
 
 [Install]
 WantedBy=default.target
unit/meson.build new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.51.0
#4 lore raw

PATCH v5 3/9 build: Make more use of 'feature' options

In reply to Bastien Nocera

This allows finer control around what is built and what is not, trying to build as much as possible by default.

This also makes it easier to enable all the "auto" features which would then fail if dependencies are missing (maximalist builds, for testing), or disable everything by default, and only enable select options, which minimises side-effects for distributions.

---
 client/meson.build     |  2 +-
 emulator/meson.build   |  2 +-
 lib/meson.build        |  2 +-
 mesh/meson.build       |  6 ++--
 meson.build            | 30 +++++++++----------
 meson_options.txt      | 66 +++++++++++++++++++++---------------------
 monitor/meson.build    |  2 +-
 obexd/meson.build      |  8 ++---
 peripheral/meson.build |  2 +-
 plugins/meson.build    |  6 ++--
 profiles/meson.build   | 36 +++++++++++------------
 src/meson.build        |  6 ++--
 tools/mesh/meson.build |  2 +-
 tools/meson.build      | 24 +++++++--------
 unit/meson.build       |  4 +--
 15 files changed, 98 insertions(+), 100 deletions(-)
client/meson.build +1 -1
index 52397d1e17de..77bc9c5d9473 100644
@@ -40,7 +40,7 @@ client_man_pages = [
   'bluetoothctl-hci.1'
 ]
 
-if get_option('manpages').enabled()
+if rst2man.found()
   foreach man_page: client_man_pages
     man_page_name = man_page.substring(0, -2)
     custom_target(man_page,
emulator/meson.build +1 -1
index 59c72c4dbd4d..bc038becc567 100644
@@ -6,7 +6,7 @@ emulator_sources = files(
   'smp.c',
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
   executable('btvirt',
     sources: [ 'main.c',
       'serial.c',
lib/meson.build +1 -1
index f31c8c3a58c5..aac809ab1c70 100644
@@ -22,7 +22,7 @@ lib_headers = [
   'bluetooth/hidp.h'
   ]
 
-if get_option('library')
+if get_option('library').enabled()
   lib_bluetooth = shared_library('bluetooth',
     sources: lib_headers + lib_sources,
     version: '3.19.15',
mesh/meson.build +3 -3
index 8c6f5631a9db..5b8fd2e6a94f 100644
@@ -1,11 +1,11 @@
-if get_option('datafiles')
+if get_option('datafiles').enabled()
   install_data('bluetooth-mesh.conf',
     install_dir: dbusdir)
   install_data('mesh-main.conf',
     install_dir: configdir)
 endif
 
-if get_option('systemd')
+if systemd_dep.found()
   configure_file(
     input: 'bluetooth-mesh.service.in',
     output: 'bluetooth-mesh.service',
@@ -59,7 +59,7 @@ executable('bluetooth-meshd',
   install_dir: pkglibexecdir
 )
 
-if get_option('manpages').enabled()
+if rst2man.found()
   bluetooth_meshd_rst = configure_file(
     input: 'bluetooth-meshd.rst.in',
     output: 'bluetooth-meshd.rst',
meson.build +14 -16
index 3c49d2f6a08b..0bda065489c9 100644
@@ -95,10 +95,8 @@ if get_option('buildtype').contains('debug')
 
   add_project_arguments(common_flags, language: 'c')
 
-  if get_option('valgrind')
-    config_h.set('HAVE_VALGRIND_MEMCHECK_H',
-      cc.has_header('valgrind/memcheck.h', required: false))
-  endif
+  config_h.set('HAVE_VALGRIND_MEMCHECK_H',
+    cc.has_header('valgrind/memcheck.h', required: get_option('valgrind').enabled()))
 endif
 
 test_cflags = [
@@ -124,8 +122,8 @@ config_h.set10('HAVE_DECL_SOF_TIMESTAMPING_TX_COMPLETION',
 config_h.set10('HAVE_DECL_SCM_TSTAMP_COMPLETION',
   cc.has_header_symbol('linux/errqueue.h', 'SCM_TSTAMP_COMPLETION', prefix: '#include <time.h>'))
 
-udev_required = get_option('udev').enabled() or get_option('sixaxis') or
-    get_option('hid2hci')
+udev_required = get_option('udev').enabled() or get_option('sixaxis').enabled() or
+    get_option('hid2hci').enabled()
 udev_dep = dependency('udev', version:'>= 196', required: udev_required)
 udevlib_dep = dependency('libudev', required: udev_required)
 
@@ -140,7 +138,7 @@ systemd_dep = dependency('systemd', required: get_option('systemd'))
 libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
 ell_dep = dependency('ell',
   version: '>= 0.39',
-  required: get_option('btpclient') or get_option('mesh').enabled(),
+  required: get_option('btpclient').enabled() or get_option('mesh').enabled(),
   fallback : ['ell', 'libell_dep'],
   default_options: [
     'default_library=static',
@@ -229,18 +227,18 @@ if cups_dep.found()
 endif
 
 external_plugins_link_args = ''
-if get_option('external-plugins')
+if get_option('external-plugins').enabled()
   external_plugins_link_args = [
     '-Wl,--export-dynamic',
     '-Wl,--version-script=' + meson.project_source_root() / 'src/bluetooth.ver'
   ]
 endif
 
-config_h.set('HAVE_A2DP', get_option('a2dp'))
-config_h.set('HAVE_AVRCP', get_option('avrcp'))
-config_h.set('HAVE_ASHA', get_option('asha'))
-config_h.set('HAVE_VCP', get_option('vcp'))
-config_h.set10('EXTERNAL_PLUGINS', get_option('external-plugins'))
+config_h.set('HAVE_A2DP', get_option('a2dp').enabled())
+config_h.set('HAVE_AVRCP', get_option('avrcp').enabled())
+config_h.set('HAVE_ASHA', get_option('asha').enabled())
+config_h.set('HAVE_VCP', get_option('vcp').enabled())
+config_h.set10('EXTERNAL_PLUGINS', get_option('external-plugins').enabled())
 config_h.set_quoted('VERSION', meson.project_version())
 
 configure_file(
@@ -258,7 +256,7 @@ subdir('src')
 if get_option('client').enabled()
   subdir('client')
 endif
-if get_option('monitor')
+if get_option('monitor').enabled()
   subdir('monitor')
 endif
 subdir('emulator')
@@ -274,10 +272,10 @@ endif
 if get_option('mesh').enabled()
   subdir('mesh')
 endif
-if get_option('manpages').enabled()
+if rst2man.found()
   subdir('doc')
 endif
-if get_option('tests')
+if not get_option('tests').disabled()
   subdir('test')
   subdir('unit')
 endif
meson_options.txt +33 -33

80 lines not on this page · raw message

monitor/meson.build +1 -1
index ad78e176d978..4f9a764167be 100644
@@ -36,7 +36,7 @@ executable('btmon',
   install: true
 )
 
-if get_option('manpages').enabled()
+if rst2man.found()
   custom_target(
     input: 'btmon.rst',
     output: 'btmon.1',
obexd/meson.build +4 -4
index cb658b24ed08..30952590f54d 100644
@@ -1,10 +1,10 @@
-if get_option('datafiles')
+if get_option('datafiles').enabled()
   install_data('src/obex.conf',
     install_dir: dbusconfdir / 'dbus-1/system.d'
   )
 endif
 
-if get_option('systemd')
+if systemd_dep.found()
   configure_file(
     input: 'src/obex.service.in',
     output: 'obex.service',
@@ -50,7 +50,7 @@ obexd_builtin_sources = [
   'client/mns.c',
 ]
 
-if get_option('experimental')
+if get_option('experimental').enabled()
   obexd_builtin_modules += 'pcsuite'
   obexd_builtin_sources += 'plugins/pcsuite.c'
 endif
@@ -111,7 +111,7 @@ executable('obexd',
     '-DPLUGINDIR="@0@"'.format(obex_plugindir),
     '-D_FILE_OFFSET_BITS=64',
     '-DCONFIGDIR="@0@"'.format(configdir),
-    get_option('systemd') ? '-DSYSTEMD' : ''
+    libsystemd_dep.found() ? '-DSYSTEMD' : ''
   ],
   link_args: external_plugins_link_args,
   install: true,
peripheral/meson.build +1 -1
index 21d6296829ea..31e5435763ef 100644
@@ -1,4 +1,4 @@
-if get_option('tests')
+if get_option('tests').enabled()
   executable('btsensor',
     sources: [
       'main.c',
plugins/meson.build +3 -3
index 019e7083df16..5485ef8eca44 100644
@@ -12,17 +12,17 @@ builtin_sources = files(
 
 builtin_deps = []
 
-if get_option('admin')
+if get_option('admin').enabled()
   builtin_modules += 'admin'
   builtin_sources += files('admin.c')
 endif
 
-if get_option('nfc')
+if get_option('nfc').enabled()
   builtin_modules += 'neard'
   builtin_sources += files('neard.c')
 endif
 
-if get_option('sixaxis')
+if get_option('sixaxis').enabled()
   builtin_modules += 'sixaxis'
   builtin_sources += files('sixaxis.c')
   builtin_deps += udev_dep
profiles/meson.build +18 -18
index 8ac37b9e6cc8..656126b67efa 100644
@@ -15,7 +15,7 @@ builtin_sources += files(
   'battery/battery.c'
 )
 
-if get_option('sap')
+if get_option('sap').enabled()
   builtin_modules += 'sap'
   builtin_sources += files(
     'sap/main.c',
@@ -25,7 +25,7 @@ if get_option('sap')
   )
 endif
 
-if get_option('a2dp')
+if get_option('a2dp').enabled()
   builtin_modules += 'a2dp'
   builtin_sources += files(
     'audio/source.c',
@@ -35,7 +35,7 @@ if get_option('a2dp')
   )
 endif
 
-if get_option('avrcp')
+if get_option('avrcp').enabled()
   builtin_modules += 'avrcp'
   builtin_sources += files(
     'audio/control.c',
@@ -45,7 +45,7 @@ if get_option('avrcp')
   )
 endif
 
-if get_option('network')
+if get_option('network').enabled()
   builtin_modules += 'network'
   builtin_sources += files(
     'network/manager.c',
@@ -58,7 +58,7 @@ if get_option('network')
   )
 endif
 
-if get_option('hid')
+if get_option('hid').enabled()
   builtin_modules += 'input'
   builtin_sources += files(
     'input/manager.c',
@@ -71,7 +71,7 @@ if get_option('hid')
   )
 endif
 
-if get_option('hog')
+if get_option('hog').enabled()
   builtin_modules += 'hog'
   builtin_sources += files(
     'input/hog.c',
@@ -83,7 +83,7 @@ if get_option('hog')
   )
 endif
 
-if get_option('health')
+if get_option('health').enabled()
   builtin_modules += 'health'
   builtin_sources += files(
     'health/mcap.c',
@@ -94,7 +94,7 @@ if get_option('health')
   )
 endif
 
-if get_option('midi').enabled()
+if alsa_dep.found()
   builtin_modules += 'midi'
   builtin_sources += files(
     'midi/midi.c',
@@ -103,54 +103,54 @@ if get_option('midi').enabled()
   builtin_deps += alsa_dep
 endif
 
-if get_option('bap')
+if get_option('bap').enabled()
   builtin_modules += 'bap'
   builtin_sources += files('audio/bap.c')
 endif
 
-if get_option('bass')
+if get_option('bass').enabled()
   builtin_modules += 'bass'
   builtin_sources += files('audio/bass.c')
 endif
 
-if get_option('mcp')
+if get_option('mcp').enabled()
   builtin_modules += 'mcp'
   builtin_sources += files('audio/mcp.c')
 endif
 
-if get_option('vcp')
+if get_option('vcp').enabled()
   builtin_modules += 'vcp'
   builtin_sources += files('audio/vcp.c')
 endif
 
-if get_option('micp')
+if get_option('micp').enabled()
   builtin_modules += 'micp'
   builtin_sources += files('audio/micp.c')
 endif
 
-if get_option('ccp')
+if get_option('ccp').enabled()
   builtin_modules += 'ccp'
   builtin_sources += files('audio/ccp.c')
 endif
 
-if get_option('csip')
+if get_option('csip').enabled()
   builtin_modules += 'csip'
   builtin_sources += files('audio/csip.c')
 endif
 
-if get_option('asha')
+if get_option('asha').enabled()
   builtin_modules += 'asha'
   builtin_sources += files('audio/asha.c')
 endif
 
-if get_option('tools')
+if get_option('tools').enabled()
   executable('iapd',
     sources: 'iap/main.c',
     dependencies: [ libgdbus_internal_dep, glib_dep, dbus_dep ]
   )
 endif
 
-if get_option('cups').enabled()
+if cups_dep.found()
   executable('bluetooth',
     sources: [
       'cups/main.c',
src/meson.build +3 -3
index a2aaad756b10..f7e144b346c3 100644
@@ -1,6 +1,6 @@
 subdir('shared')
 
-if get_option('datafiles')
+if get_option('datafiles').enabled()
   install_data('bluetooth.conf',
     install_dir: dbusconfdir / 'dbus-1/system.d'
   )
@@ -9,7 +9,7 @@ if get_option('datafiles')
   )
 endif
 
-if get_option('systemd')
+if systemd_dep.found()
   configure_file(
     input: 'bluetooth.service.in',
     output: 'bluetooth.service',
@@ -87,7 +87,7 @@ executable('bluetoothd',
   install_dir: pkglibexecdir
 )
 
-if get_option('manpages').enabled()
+if rst2man.found()
   bluetoothd_rst = configure_file(
     input: 'bluetoothd.rst.in',
     output: 'bluetoothd.rst',
tools/mesh/meson.build +1 -1
index 85bfb00977f3..eb4039909b5c 100644
@@ -1,4 +1,4 @@
-if get_option('tools') and readline_dep.found()
+if get_option('tools').enabled() and readline_dep.found()
   executable('mesh-cfgclient',
     sources: [ '../mesh-cfgclient.c',
       'cfgcli.c',
tools/meson.build +12 -12
index 59e4f7d52824..5e73b048c118 100644
@@ -1,6 +1,6 @@
 tools_man_pages = []
 
-if get_option('logger')
+if get_option('logger').enabled()
   executable('btmon-logger',
     [ 'btmon-logger.c' ],
     dependencies: libshared_mainloop_dep,
@@ -8,7 +8,7 @@ if get_option('logger')
     install_dir: pkglibexecdir
   )
 
-  if get_option('systemd')
+  if systemd_dep.found()
     configure_file(
       input: 'bluetooth-logger.service.in',
       output: 'bluetooth-logger.service',
@@ -39,7 +39,7 @@ tester_tools = [
   'hci'
 ]
 
-if get_option('tests')
+if get_option('tests').enabled()
   foreach tool: tester_tools
     executable(tool + '-tester',
       sources: [ tool + '-tester.c', emulator_sources ],
@@ -48,7 +48,7 @@ if get_option('tests')
   endforeach
 endif
 
-if get_option('btpclient')
+if get_option('btpclient').enabled()
   executable('btpclient',
     sources: [ 'btpclient.c', '../src/shared/btp.c' ],
     include_directories: '..',
@@ -65,7 +65,7 @@ if get_option('btpclient')
   )
 endif
 
-if get_option('hid2hci')
+if get_option('hid2hci').enabled()
   executable('hid2hci',
     sources: 'hid2hci.c',
     dependencies: udevlib_dep,
@@ -76,7 +76,7 @@ if get_option('hid2hci')
     install_dir: udevdir / 'rules.d',
     rename: '97-hid2hci.rules'
   )
-  if get_option('manpages').enabled()
+  if rst2man.found()
     tools_man_pages += 'hid2hci.1'
   endif
 endif
@@ -113,7 +113,7 @@ inst_tools_names = [
   'isotest'
 ]
 
-if get_option('tools')
+if get_option('tools').enabled()
   foreach tool: tools_names
     executable(tool,
       sources: tool + '.c',
@@ -129,7 +129,7 @@ if get_option('tools')
     )
   endforeach
 
-  if get_option('manpages').enabled()
+  if rst2man.found()
     tools_man_pages += [
       'rctest.1',
       'l2ping.1',
@@ -196,7 +196,7 @@ if get_option('tools')
         include_directories: '..',
         install: true
       )
-      if get_option('deprecated')
+      if get_option('deprecated').enabled()
         executable('meshctl',
           sources: [
             'meshctl.c',
@@ -227,7 +227,7 @@ if get_option('tools')
     endif
   endif
 
-  if get_option('deprecated')
+  if get_option('deprecated').enabled()
     executable('gatttool',
       sources: gatttool_sources,
       dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, readline_dep ],
@@ -299,7 +299,7 @@ if get_option('tools')
       )
     endforeach
 
-    if get_option('manpages').enabled()
+    if rst2man.found()
       tools_man_pages += [
         'hciattach.1',
         'hciconfig.1',
@@ -312,7 +312,7 @@ if get_option('tools')
     endif
   endif
 
-  if get_option('systemd')
+  if systemd_dep.found()
     configure_file(
       input: 'mpris-proxy.service.in',
       output: 'mpris-proxy.service',
unit/meson.build +2 -2
index ced8822923bb..b10d0c10d145 100644
@@ -47,7 +47,7 @@ tests2 = [
   [ 'test-avctp.c', '../src/log.c', 'avctp.c' ],
 ]
 
-if get_option('obex').enabled()
+if ical_dep.found()
   tests2 += [
     [ 'test-gobex.c', 'util.c', gobex_sources ],
     [ 'test-gobex-packet.c', 'util.c', gobex_sources ],
@@ -85,7 +85,7 @@ exe = executable('test-gattrib',
 )
 test('test-gattrib', exe)
 
-if get_option('midi').enabled()
+if alsa_dep.found()
   exe = executable('test-midi',
     sources: [ 'test-midi.c', '../profiles/midi/libmidi.c' ],
     c_args: [ '-DMIDI_TEST' ],
Signature · 1 line
2.51.0
#5 lore raw

PATCH v5 4/9 build: Separate systemd and libsystemd dependencies

In reply to Bastien Nocera

One is to install systemd service files, the other to enable deeper logind integration into obexd.

---
 meson.build       | 3 ++-
 meson_options.txt | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
meson.build +2 -1
index 0bda065489c9..58e17c947570 100644
@@ -135,7 +135,8 @@ readline_dep = dependency('readline',
   required: get_option('client').enabled() or
     get_option('mesh').enabled())
 systemd_dep = dependency('systemd', required: get_option('systemd'))
-libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
+libsystemd_dep = dependency('libsystemd',
+  required: get_option('obex').enabled() and get_option('logind').enabled())
 ell_dep = dependency('ell',
   version: '>= 0.39',
   required: get_option('btpclient').enabled() or get_option('mesh').enabled(),
meson_options.txt +2 -1
index aae4f377f0a2..6a39e2ceabec 100644
@@ -6,7 +6,8 @@ option('tests', type: 'feature', value: 'auto', description: 'Enable testing too
 option('tools', type: 'feature', value: 'enabled', description: 'Enable Bluetooth tools')
 option('monitor', type: 'feature', value: 'enabled', description: 'Enable Bluetooth monitor')
 option('client', type: 'feature', value: 'enabled', description: 'Enable command line client')
-option('systemd', type: 'feature', value: 'enabled', description: 'Enable systemd integration')
+option('systemd', type: 'feature', value: 'enabled', description: 'Install systemd service files')
+option('logind', type: 'feature', value: 'enabled', description: 'Enable logind integration in obexd')
 option('udev', type: 'feature', value: 'enabled', description: 'Enable udev device support')
 option('datafiles', type: 'feature', value: 'enabled', description: 'Install configuration and data files')
 option('manpages', type: 'feature', value: 'auto', description: 'Enable building of manual pages')
Signature · 1 line
2.51.0
#6 lore raw

PATCH v5 5/9 tools: Install gatttool if deprecated tools are enabled

In reply to Bastien Nocera

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1141909
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720486

---
 tools/meson.build | 1 +
 1 file changed, 1 insertion(+)
tools/meson.build +1 -0
index 5e73b048c118..3e8f7ad439dd 100644
@@ -231,6 +231,7 @@ if get_option('tools').enabled()
     executable('gatttool',
       sources: gatttool_sources,
       dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, readline_dep ],
+      install: true
     )
     executable('hciattach',
       sources: [
Signature · 1 line
2.51.0
#7 lore raw

PATCH v5 6/9 tools: Install avinfo tool by default

In reply to Bastien Nocera

It's used for checking which audio codecs are supported by a Bluetooth audio device, which is more useful now that PulseAudio/PipeWire support alternative codecs like LDAC or aptX).

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1699680

---
 tools/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/meson.build +1 -1
index 3e8f7ad439dd..66156ab0224b 100644
@@ -82,7 +82,6 @@ if get_option('hid2hci').enabled()
 endif
 
 tools_names = [
-  'avinfo',
   'avtest',
   'scotest',
   'hwdb',
@@ -103,6 +102,7 @@ tools_names = [
 ]
 
 inst_tools_names = [
+  'avinfo',
   'rctest',
   'l2test',
   'l2ping',
Signature · 1 line
2.51.0
#8 lore raw

PATCH v5 7/9 tools: Install btmgmt along with other tools

In reply to Bastien Nocera

btmgmt is not installed by default, but it is useful for debugging some issues and to set the MAC address on HCIs which don't have their MAC address configured.

---
 tools/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/meson.build +2 -1
index 66156ab0224b..9ca76079325e 100644
@@ -171,7 +171,8 @@ if get_option('tools').enabled()
   if readline_dep.found()
     executable('btmgmt',
       sources: [ 'btmgmt.c', '../src/uuid-helper.c', '../client/display.c', '../client/mgmt.c' ],
-      dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, readline_dep ]
+      dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, readline_dep ],
+      install: true
     )
     executable('obex-client-tool',
       sources: [ 'obex-client-tool.c', gobex_sources, btio_sources ],
Signature · 1 line
2.51.0
#9 lore raw

PATCH v5 8/9 emulator: Install the emulator if built

In reply to Bastien Nocera

It's useful for testing.

---
 emulator/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
emulator/meson.build +3 -1
index bc038becc567..55d77e40319d 100644
@@ -17,7 +17,9 @@ if get_option('tests').enabled()
       'smp.c',
       'phy.c',
       'le.c' ],
-    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, glib_dep ]
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, glib_dep ],
+    install: true,
+    install_dir: pkglibexecdir
   )
 
   executable('b1ee',
Signature · 1 line
2.51.0
#10 lore raw

PATCH v5 9/9 build: Add option to allow disabling bluetoothd

In reply to Bastien Nocera

This makes it possible to build, for example, just the library, or the command-line client, without also building and installing bluetoothd.

---
 meson.build       | 12 +++++++++---
 meson_options.txt |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)
meson.build +9 -3
index 58e17c947570..b5f9be1532fa 100644
@@ -253,7 +253,9 @@ subdir('attrib')
 subdir('btio')
 subdir('plugins')
 subdir('profiles')
-subdir('src')
+if get_option('daemon').enabled()
+  subdir('src')
+endif
 if get_option('client').enabled()
   subdir('client')
 endif
@@ -284,8 +286,12 @@ endif
 # Fix permissions on install
 install = find_program('install')
 sh = find_program('sh')
-meson.add_install_script(sh, '-c', 'install -dm755 ${DESTDIR}/' + configdir)
-meson.add_install_script(sh, '-c', 'install -dm700 ${DESTDIR}/' + storagedir)
+if get_option('daemon').enabled()
+  meson.add_install_script(sh, '-c', 'install -dm755 ${DESTDIR}/' + configdir)
+endif
+if get_option('daemon').enabled() or get_option('mesh').enabled()
+  meson.add_install_script(sh, '-c', 'install -dm700 ${DESTDIR}/' + storagedir)
+endif
 if get_option('mesh').enabled()
   meson.add_install_script(sh, '-c', 'install -dm700 ${DESTDIR}/' + meshstoragedir)
 endif
meson_options.txt +1 -0
index 6a39e2ceabec..9e9587f3ef6e 100644
@@ -6,6 +6,7 @@ option('tests', type: 'feature', value: 'auto', description: 'Enable testing too
 option('tools', type: 'feature', value: 'enabled', description: 'Enable Bluetooth tools')
 option('monitor', type: 'feature', value: 'enabled', description: 'Enable Bluetooth monitor')
 option('client', type: 'feature', value: 'enabled', description: 'Enable command line client')
+option('daemon', type: 'feature', value: 'enabled', description: 'Enable bluetoothd daemon')
 option('systemd', type: 'feature', value: 'enabled', description: 'Install systemd service files')
 option('logind', type: 'feature', value: 'enabled', description: 'Enable logind integration in obexd')
 option('udev', type: 'feature', value: 'enabled', description: 'Enable udev device support')
Signature · 1 line
2.51.0