Linux bluetooth development
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: [BlueZ v11 06/14] build: Add option to allow disabling bluetoothd
Date: Tue, 24 Nov 2026 16:50:37 +0100	[thread overview]
Message-ID: <20261124155319.1752879-7-hadess@hadess.net> (raw)
In-Reply-To: <20261124155319.1752879-1-hadess@hadess.net>

This makes it possible to build, for example, just the library, or the
command-line client, without also building and installing bluetoothd.
---
 doc/meson.build   |   3 +-
 meson.build       |   8 +++-
 meson_options.txt |   1 +
 src/meson.build   | 115 ++++++++++++++++++++++++----------------------
 unit/meson.build  |  10 +++-
 5 files changed, 78 insertions(+), 59 deletions(-)

diff --git a/doc/meson.build b/doc/meson.build
index 467b07c1572f..6d78545f6541 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -148,7 +148,8 @@ bluetoothd_rst = configure_file(
   output: 'bluetoothd.rst',
   configuration: man_conf
 )
-if rst2man.found()
+
+if get_option('daemon').enabled() and rst2man.found()
   custom_target(
     input: bluetoothd_rst,
     output: 'bluetoothd.8',
diff --git a/meson.build b/meson.build
index a842ab37ea96..cbd337f2ab32 100644
--- a/meson.build
+++ b/meson.build
@@ -303,8 +303,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
diff --git a/meson_options.txt b/meson_options.txt
index 54cfdbb0d7c1..79e75e33ddaf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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 in tools')
diff --git a/src/meson.build b/src/meson.build
index f5edf4264e0e..7748c1becbc1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,40 +1,37 @@
 subdir('shared')
 
-if get_option('datafiles').allowed()
-  install_data('bluetooth.conf',
-    install_dir: dbusconfdir / 'dbus-1/system.d'
-  )
-  install_data('main.conf',
-    install_dir: configdir
-  )
-endif
+if get_option('daemon').allowed()
+  if get_option('datafiles').allowed()
+    install_data('bluetooth.conf',
+      install_dir: dbusconfdir / 'dbus-1/system.d'
+    )
+    install_data('main.conf',
+      install_dir: configdir
+    )
+  endif
 
-if systemd_dep.found()
-  configure_file(
-    input: 'bluetooth.service.in',
-    output: 'bluetooth.service',
-    install: true,
-    install_dir: systemdsystemunitdir,
-    configuration: service_conf
-  )
+  if systemd_dep.found()
+    configure_file(
+      input: 'bluetooth.service.in',
+      output: 'bluetooth.service',
+      install: true,
+      install_dir: systemdsystemunitdir,
+      configuration: service_conf
+    )
 
-  install_data('org.bluez.service',
-    install_dir: dbussystembusdir
-  )
-endif
+    install_data('org.bluez.service',
+      install_dir: dbussystembusdir
+    )
+  endif
 
-genbuiltin = find_program('genbuiltin')
-builtin_h = custom_target('src-builtin.h',
-  output: 'builtin.h',
-  capture: true,
-  command: [ genbuiltin, builtin_modules ]
-)
+  genbuiltin = find_program('genbuiltin')
+  builtin_h = custom_target('src-builtin.h',
+    output: 'builtin.h',
+    capture: true,
+    command: [ genbuiltin, builtin_modules ]
+  )
 
-executable('bluetoothd',
-  sources: [ builtin_sources,
-    btio_sources,
-    builtin_h,
-    'main.c',
+  bluetoothd_internal_sources = files(
     'log.c',
     'backtrace.c',
     'rfkill.c',
@@ -47,7 +44,6 @@ executable('bluetoothd',
     'sdp-client.c',
     'textfile.c',
     'uuid-helper.c',
-    'plugin.c',
     'storage.c',
     'advertising.c',
     'agent.c',
@@ -65,25 +61,36 @@ executable('bluetoothd',
     'settings.c',
     'set.c',
     'ranging.c',
-  ],
-  dependencies: [
-    libbluetooth_internal_dep,
-    libgdbus_internal_dep,
-    libshared_glib_dep,
-    backtrace_dep,
-    glib_dep,
-    dbus_dep,
-    udevlib_dep,
-    builtin_deps
-  ],
-  override_options: [ 'b_lundef=false' ],
-  c_args: [
-    '-DBLUETOOTH_PLUGIN_BUILTIN',
-    '-DPLUGINDIR="@0@"'.format(plugindir),
-    '-DSTORAGEDIR="@0@"'.format(storagedir),
-    '-DCONFIGDIR="@0@"'.format(configdir)
-  ],
-  link_args: [ '-Wl,--gc-sections', external_plugins_link_args ],
-  install: true,
-  install_dir: pkglibexecdir
-)
+  )
+
+  executable('bluetoothd',
+    sources: [
+      builtin_sources,
+      builtin_h,
+      btio_sources,
+      bluetoothd_internal_sources,
+      'main.c',
+      'plugin.c',
+    ],
+    dependencies: [
+      libbluetooth_internal_dep,
+      libgdbus_internal_dep,
+      libshared_glib_dep,
+      backtrace_dep,
+      glib_dep,
+      dbus_dep,
+      udevlib_dep,
+      builtin_deps
+    ],
+    override_options: [ 'b_lundef=false' ],
+    c_args: [
+      '-DBLUETOOTH_PLUGIN_BUILTIN',
+      '-DPLUGINDIR="@0@"'.format(plugindir),
+      '-DSTORAGEDIR="@0@"'.format(storagedir),
+      '-DCONFIGDIR="@0@"'.format(configdir)
+    ],
+    link_args: [ '-Wl,--gc-sections', external_plugins_link_args ],
+    install: true,
+    install_dir: pkglibexecdir
+  )
+endif
diff --git a/unit/meson.build b/unit/meson.build
index 4b8f18802a30..317f138b97d9 100644
--- a/unit/meson.build
+++ b/unit/meson.build
@@ -81,8 +81,14 @@ else
 endif
 
 exe = executable('test-profile',
-  sources: [ 'test-profile.c', 'btd.c', '../src/profile.c' ],
-  dependencies: [ dbus_dep, libshared_glib_dep, libbluetooth_internal_dep ]
+  sources: [ 'test-profile.c', 'btd.c', bluetoothd_internal_sources, btio_sources ],
+  c_args: [ '-DSTORAGEDIR="@0"'.format(storagedir) ],
+  dependencies: [
+    libgdbus_internal_dep,
+    libshared_glib_dep,
+    libbluetooth_internal_dep,
+    backtrace_dep
+  ]
 )
 test('test-profile', exe)
 
-- 
2.56.0


  parent reply	other threads:[~2026-11-24 15:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:50 [BlueZ v11 00/14] Add meson build system, tool unit tests, and HTML docs Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 01/14] build: Add meson wrap for libell Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 02/14] build: Add meson build system Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 03/14] build: Separate systemd and libsystemd dependencies Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 04/14] tools: Install avinfo tool by default Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 05/14] emulator: Install the emulator if built Bastien Nocera
2026-11-24 15:50 ` Bastien Nocera [this message]
2026-11-24 15:50 ` [BlueZ v11 07/14] build: Only build profiles if the daemon is built Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 08/14] unit: Run test-bap tests concurrently Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 09/14] unit: Make gobex-transfer tests run concurrently Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 10/14] build: Only build gdbus library if there is a user Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 11/14] unit: Add command-line tool tests Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 12/14] doc: Add HTML documentation Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 13/14] github: Add docs deployment Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 14/14] doc: Add introduction to GATT Bastien Nocera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124155319.1752879-7-hadess@hadess.net \
    --to=hadess@hadess.net \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox