public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v3 00/10] build: Add meson build system
@ 2025-10-08 10:40 Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 01/10] build: Add meson wrap for libell Bastien Nocera
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

Changes since v2:
- Fixed the 2 FIXMEs
- Note that the last patch should not be applied right now, meson 1.9.0
  is not widely available, but that's a necessary patch to restore
  parity with the autotools output

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 (10):
  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
  build: Add License field to pkg-config file

 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                               |  54 +
 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, 2667 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

-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 01/10] build: Add meson wrap for libell
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 12:17   ` build: Add meson build system bluez.test.bot
  2025-10-08 10:40 ` [PATCH BlueZ v3 02/10] " Bastien Nocera
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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

diff --git a/subprojects/ell.wrap b/subprojects/ell.wrap
new file mode 100644
index 000000000000..3e9590b4066f
--- /dev/null
+++ b/subprojects/ell.wrap
@@ -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
diff --git a/subprojects/packagefiles/0001-build-Add-meson-build-system.patch b/subprojects/packagefiles/0001-build-Add-meson-build-system.patch
new file mode 100644
index 000000000000..9099ede533fb
--- /dev/null
+++ b/subprojects/packagefiles/0001-build-Add-meson-build-system.patch
@@ -0,0 +1,922 @@
+From b9e8cba23617d6a047816fad7b0dae862f4a97f4 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Thu, 17 Jul 2025 11:31:22 +0200
+Subject: [PATCH] build: Add meson build system
+
+--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
+---
+ ell/meson.build              | 187 +++++++++++++
+ examples/meson.build         |  32 +++
+ meson.build                  |  69 +++++
+ meson_options.txt            |   5 +
+ tools/meson.build            |  18 ++
+ unit/gen-cert-expired-pem.sh |  14 +
+ unit/meson.build             | 501 +++++++++++++++++++++++++++++++++++
+ unit/xxd.sh                  |   3 +
+ 8 files changed, 829 insertions(+)
+ create mode 100644 ell/meson.build
+ create mode 100644 examples/meson.build
+ create mode 100644 meson.build
+ create mode 100644 meson_options.txt
+ create mode 100644 tools/meson.build
+ create mode 100755 unit/gen-cert-expired-pem.sh
+ create mode 100644 unit/meson.build
+ create mode 100755 unit/xxd.sh
+
+diff --git a/ell/meson.build b/ell/meson.build
+new file mode 100644
+index 000000000000..ba61a39a8cc3
+--- /dev/null
++++ b/ell/meson.build
+@@ -0,0 +1,187 @@
++lib_headers = [
++  'ell.h',
++  'util.h',
++  'test.h',
++  'strv.h',
++  'utf8.h',
++  'queue.h',
++  'hashmap.h',
++  'string.h',
++  'settings.h',
++  'main.h',
++  'idle.h',
++  'signal.h',
++  'timeout.h',
++  'io.h',
++  'ringbuf.h',
++  'log.h',
++  'checksum.h',
++  'netlink.h',
++  'genl.h',
++  'rtnl.h',
++  'dbus.h',
++  'dbus-service.h',
++  'dbus-client.h',
++  'hwdb.h',
++  'cipher.h',
++  'random.h',
++  'uintset.h',
++  'base64.h',
++  'pem.h',
++  'tls.h',
++  'uuid.h',
++  'key.h',
++  'file.h',
++  'dir.h',
++  'net.h',
++  'dhcp.h',
++  'dhcp6.h',
++  'cert.h',
++  'ecc.h',
++  'ecdh.h',
++  'time.h',
++  'gpio.h',
++  'path.h',
++  'icmp6.h',
++  'acd.h',
++  'tester.h',
++  'cleanup.h',
++  'netconfig.h',
++  'sysctl.h',
++  'minheap.h',
++  'notifylist.h'
++]
++
++lib_sources = [
++  'private.h',
++  'useful.h',
++  'missing.h',
++  'util.c',
++  'test-private.h',
++  'test.c',
++  'test-dbus.c',
++  'strv.c',
++  'utf8.c',
++  'queue.c',
++  'hashmap.c',
++  'string.c',
++  'settings.c',
++  'main-private.h',
++  'main.c',
++  'idle.c',
++  'signal.c',
++  'timeout.c',
++  'io.c',
++  'ringbuf.c',
++  'log.c',
++  'checksum.c',
++  'netlink-private.h',
++  'netlink.c',
++  'genl.c',
++  'rtnl-private.h',
++  'rtnl.c',
++  'dbus-private.h',
++  'dbus.c',
++  'dbus-message.c',
++  'dbus-util.c',
++  'dbus-service.c',
++  'dbus-client.c',
++  'dbus-name-cache.c',
++  'dbus-filter.c',
++  'gvariant-private.h',
++  'gvariant-util.c',
++  'siphash-private.h',
++  'siphash.c',
++  'hwdb.c',
++  'cipher.c',
++  'random.c',
++  'uintset.c',
++  'base64.c',
++  'asn1-private.h',
++  'pem-private.h',
++  'pem.c',
++  'tls-private.h',
++  'tls.c',
++  'tls-record.c',
++  'tls-extensions.c',
++  'tls-suites.c',
++  'uuid.c',
++  'key.c',
++  'file.c',
++  'dir.c',
++  'net-private.h',
++  'net.c',
++  'dhcp-private.h',
++  'dhcp.c',
++  'dhcp-transport.c',
++  'dhcp-lease.c',
++  'dhcp6-private.h',
++  'dhcp6.c',
++  'dhcp6-transport.c',
++  'dhcp6-lease.c',
++  'dhcp-util.c',
++  'dhcp-server.c',
++  'cert-private.h',
++  'cert.c',
++  'cert-crypto.c',
++  'ecc-private.h',
++  'ecc.h',
++  'ecc-external.c',
++  'ecc.c',
++  'ecdh.c',
++  'time.c',
++  'time-private.h',
++  'gpio.c',
++  'path.c',
++  'icmp6.c',
++  'icmp6-private.h',
++  'acd.c',
++  'tester.c',
++  'netconfig.c',
++  'sysctl.c',
++  'minheap.c',
++  'notifylist.c'
++]
++
++linux_headers = [
++  '../linux/gpio.h'
++]
++
++libell = library('ell',
++  sources: lib_headers + lib_sources + linux_headers,
++  include_directories: include_directories('..'),
++  implicit_include_directories: false,
++  gnu_symbol_visibility: 'hidden',
++  version: '0.2.0',
++  install: get_option('default_library') != 'static'
++)
++
++libell_dep = declare_dependency(include_directories: include_directories('..'),
++  link_with: libell)
++
++if get_option('default_library') != 'static'
++  install_headers(lib_headers,
++    subdir: 'ell'
++  )
++
++  pkgconfig = import('pkgconfig')
++  pkgconfig.generate(
++    name: 'ell',
++    description: 'Embedded Linux library',
++    version: meson.project_version(),
++    libraries: libell,
++    # FIXME requires meson 1.9.0
++    # license: meson.project_license()
++  )
++endif
++
++libell_private = static_library('ell_private',
++  sources: lib_headers + lib_sources + linux_headers,
++  include_directories: include_directories('..'),
++  implicit_include_directories: false,
++  install: false
++)
++
++libell_private_dep = declare_dependency(
++  link_with: libell_private
++)
+diff --git a/examples/meson.build b/examples/meson.build
+new file mode 100644
+index 000000000000..831abb58be46
+--- /dev/null
++++ b/examples/meson.build
+@@ -0,0 +1,32 @@
++examples = [
++  'dbus-service',
++  'https-client-test',
++  'https-server-test',
++  'dbus-client',
++  'dhcp-client',
++  'dhcp6-client',
++  'dhcp-server',
++  'acd-client',
++  'netconfig-test',
++]
++
++if get_option('examples')
++  foreach example: examples
++    exe = executable(example,
++      '@0@.c'.format(example),
++      include_directories: include_directories('..'),
++      dependencies: libell_private_dep,
++      install: false
++    )
++  endforeach
++endif
++
++if get_option('glib') and get_option('examples')
++  exe = executable('glib-eventloop',
++    'glib-eventloop.c',
++    include_directories: include_directories('..'),
++    dependencies: [ libell_private_dep, glib_dep ],
++    install: false
++  )
++endif
++
+diff --git a/meson.build b/meson.build
+new file mode 100644
+index 000000000000..8609c766a3e4
+--- /dev/null
++++ b/meson.build
+@@ -0,0 +1,69 @@
++# SPDX-License-Identifier: LGPL-2.1-or-later
++project(
++  'ell', 'c',
++  version: '0.80',
++  license: 'LGPL-2.1-or-later',
++  default_options: [
++    'buildtype=debugoptimized',
++    'default_library=shared'
++  ],
++  meson_version: '>= 1.3.0'
++)
++
++cc = meson.get_compiler('c')
++find_program('awk', required: true)
++config_h = configuration_data()
++
++checked_funcs = [
++  'explicit_bzero',
++  'rawmemchr',
++]
++
++foreach func: checked_funcs
++  config_h.set('HAVE_' + func.to_upper(), cc.has_function(func))
++endforeach
++
++required_funcs = [
++  'getrandom',
++  'signalfd',
++  'timerfd_create',
++  'epoll_create'
++]
++
++foreach func: required_funcs
++  cc.has_function(func, required: true)
++endforeach
++
++required_headers = [
++  'linux/types.h',
++  'linux/if_alg.h'
++]
++
++foreach header: required_headers
++  cc.has_header(header, required: true)
++endforeach
++
++glib_dep = dependency('glib-2.0', version: '>= 2.32', required: get_option('glib'))
++openssl = find_program('openssl', required: get_option('cert-tests'))
++sh = find_program('sh', required: get_option('cert-tests'))
++xxd = find_program('xxd', required: get_option('cert-tests'))
++
++if openssl.found()
++  r = run_command(openssl, 'list', '-providers', check: false)
++  if r.returncode() == 0
++    openssl_legacy = [ '-provider', 'legacy', '-provider', 'default' ]
++  else
++    openssl_legacy = ''
++  endif
++endif
++
++add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
++configure_file(
++  output: 'config.h',
++  configuration: config_h
++)
++
++subdir('ell')
++subdir('tools')
++subdir('unit')
++subdir('examples')
+diff --git a/meson_options.txt b/meson_options.txt
+new file mode 100644
+index 000000000000..5effa15916b4
+--- /dev/null
++++ b/meson_options.txt
+@@ -0,0 +1,5 @@
++option('glib', type: 'boolean', value: true, description: 'Enable ell/glib main loop example')
++option('tests', type: 'boolean', value: true, description: 'Enable unit tests compilation')
++option('cert-tests', type: 'boolean', value: true, description: 'Enable OpenSSL cert tests')
++option('tools', type: 'boolean', value: true, description: 'Enable extra tools compilation')
++option('examples', type: 'boolean', value: true, description: 'Enable code examples compilation')
+diff --git a/tools/meson.build b/tools/meson.build
+new file mode 100644
+index 000000000000..01505f266631
+--- /dev/null
++++ b/tools/meson.build
+@@ -0,0 +1,18 @@
++tools = [
++  'certchain-verify',
++  'genl-discover',
++  'genl-watch',
++  'genl-request',
++  'gpio'
++]
++
++if get_option('tools')
++  foreach tool: tools
++      exe = executable(tool,
++        '@0@.c'.format(tool),
++        include_directories: include_directories('..'),
++        dependencies: libell_private_dep,
++        install: false
++      )
++  endforeach
++endif
+diff --git a/unit/gen-cert-expired-pem.sh b/unit/gen-cert-expired-pem.sh
+new file mode 100755
+index 000000000000..f3e0b9d28424
+--- /dev/null
++++ b/unit/gen-cert-expired-pem.sh
+@@ -0,0 +1,14 @@
++#!/bin/sh -e
++
++echo -n > cert-ca-index.txt
++OUTDIR=`mktemp -d`
++openssl ca -batch \
++	-config "$4" -name example \
++	-cert "$2" \
++	-keyfile "$3" \
++	-outdir $OUTDIR \
++	-rand_serial -extensions cert_ext \
++	-extfile "$5" -md sha256 \
++	-startdate 000101120000Z -enddate 010101120000Z \
++	-preserveDN -notext -in "$1" -out "$6"
++rm -rf $OUTDIR cert-ca-index.txt*
+diff --git a/unit/meson.build b/unit/meson.build
+new file mode 100644
+index 000000000000..be9f2655f010
+--- /dev/null
++++ b/unit/meson.build
+@@ -0,0 +1,501 @@
++tests = [
++  'test-unit',
++  'test-queue',
++  'test-hashmap',
++  'test-endian',
++  'test-string',
++  'test-utf8',
++  'test-main',
++  'test-io',
++  'test-ringbuf',
++  'test-checksum',
++  'test-settings',
++  'test-netlink',
++  'test-genl-msg',
++  'test-rtnl',
++  'test-siphash',
++  'test-cipher',
++  'test-random',
++  'test-util',
++  'test-uintset',
++  'test-base64',
++  'test-uuid',
++  'test-pbkdf2',
++  'test-dhcp',
++  'test-dhcp6',
++  'test-dir-watch',
++  'test-ecc',
++  'test-ecdh',
++  'test-time',
++  'test-path',
++  'test-net',
++  'test-sysctl',
++  'test-minheap',
++  'test-notifylist',
++  'test-hwdb',
++  'test-dbus',
++  'test-dbus-util',
++  'test-dbus-message',
++  'test-dbus-message-fds',
++  'test-dbus-properties',
++  'test-dbus-service',
++  'test-dbus-watch',
++  'test-gvariant-util',
++  'test-gvariant-message'
++]
++
++gen_headers = []
++test_pem_cert_deps = []
++
++if get_option('cert-tests')
++  tests += [
++    'test-pem',
++    'test-tls',
++    'test-key'
++  ]
++
++  cert_server_key_pem_tgt = custom_target('cert-server-key.pem',
++    output: 'cert-server-key.pem',
++    command: [ openssl, 'genrsa', '-out', '@OUTPUT@' ]
++  )
++
++  ec_cert_server_key_pem_tgt = custom_target('ec-cert-server-key.pem',
++    output: 'ec-cert-server-key.pem',
++    command: [ openssl, 'ecparam', '-out', '@OUTPUT@', '-name', 'secp384r1', '-genkey' ]
++  )
++
++  cert_server_key_pkcs8_pem_tgt = custom_target('cert-server-key-pkcs8.pem',
++    input: cert_server_key_pem_tgt,
++    output: 'cert-server-key-pkcs8.pem',
++    command: [ openssl, 'pkcs8', '-topk8', '-nocrypt', '-in', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  cert_server_csr_tgt = custom_target('cert-server.csr',
++    input: cert_server_key_pem_tgt,
++    output: 'cert-server.csr',
++    command: [ openssl, 'req', '-new', '-extensions', 'cert_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=Foo Example Organization/CN=Foo Example Organization/emailAddress=foo@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  ec_cert_server_csr_tgt = custom_target('ec-cert-server.csr',
++    input: ec_cert_server_key_pem_tgt,
++    output: 'ec-cert-server.csr',
++    command: [ openssl, 'req', '-new', '-extensions', 'cert_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=Foo Example Organization/CN=Foo Example Organization/emailAddress=foo@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  cert_ca_key_pem_tgt = custom_target('cert-ca-key.pem',
++    output: 'cert-ca-key.pem',
++    command: [ openssl, 'genrsa', '-out', '@OUTPUT@', '2048' ]
++  )
++
++  cert_ca_pem_tgt = custom_target('cert-ca.pem',
++    input: cert_ca_key_pem_tgt,
++    output: 'cert-ca.pem',
++    command: [ openssl, 'req', '-x509', '-new', '-nodes', '-extensions', 'ca_ext',
++      '-config', files('gencerts.cnf'), '-subj', '/O=International Union of Example Organizations/CN=Certificate issuer guy/emailAddress=ca@mail.example',
++      '-key', '@INPUT@', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ],
++  )
++
++  cert_server_pem_tgt = custom_target('cert-server.pem',
++    input: [ cert_server_csr_tgt, cert_ca_pem_tgt, cert_ca_key_pem_tgt ],
++    output: 'cert-server.pem',
++    command: [ openssl, 'x509', '-req', '-extensions', 'server_ext',
++      '-extfile', files('gencerts.cnf'),
++      '-in', '@INPUT0@', '-CA', '@INPUT1@',
++      '-CAkey', '@INPUT2@',
++      '-CAserial', 'cert-ca.srl',
++      '-CAcreateserial', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  ec_cert_ca_key_pem_tgt = custom_target('ec-cert-ca-key.pem',
++    output: 'ec-cert-ca-key.pem',
++    command: [ openssl, 'ecparam', '-out', '@OUTPUT@', '-name', 'secp384r1', '-genkey' ]
++  )
++
++  ec_cert_ca_pem_tgt = custom_target('ec-cert-ca.pem',
++  input: ec_cert_ca_key_pem_tgt,
++  output: 'ec-cert-ca.pem',
++  command: [ openssl, 'req', '-x509', '-new', '-nodes', '-extensions', 'ca_ext',
++    '-config', files('gencerts.cnf'), '-subj', '/O=International Union of Example Organizations/CN=Certificate issuer guy/emailAddress=ca@mail.example',
++    '-key', '@INPUT@', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  ec_cert_server_pem_tgt = custom_target('ec-cert-server.pem',
++    input: [ ec_cert_server_csr_tgt, ec_cert_ca_pem_tgt, ec_cert_ca_key_pem_tgt ],
++    output: 'ec-cert-server.pem',
++    command: [ openssl, 'x509', '-req', '-extensions', 'server_ext',
++      '-extfile', files('gencerts.cnf'),
++      '-in', '@INPUT0@', '-CA', '@INPUT1@',
++      '-CAkey', '@INPUT2@',
++      '-CAserial', 'cert-ca.srl',
++      '-CAcreateserial', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  cert_client_key_pkcs1_pem_tgt = custom_target('cert-client-key-pkcs1.pem',
++    output: 'cert-client-key-pkcs1.pem',
++    command: [ openssl, 'genrsa', '-out', '@OUTPUT@' ]
++  )
++
++  cert_client_key_pkcs8_pem_tgt = custom_target('cert-client-key-pkcs8.pem',
++    input: cert_client_key_pkcs1_pem_tgt,
++    output: 'cert-client-key-pkcs8.pem',
++    command: [ openssl, 'pkcs8', '-topk8', '-nocrypt', '-in', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  cert_client_key_pkcs8_md5_des_pem_tgt = custom_target('cert-client-key-pkcs8-md5-des.pem',
++    input: cert_client_key_pkcs8_pem_tgt,
++    output: 'cert-client-key-pkcs8-md5-des.pem',
++    command: [ openssl, 'pkcs8', '-in', '@INPUT@', '-out', '@OUTPUT@',
++      '-topk8', '-v1', 'PBE-MD5-DES', '-passout', 'pass:abc', openssl_legacy ]
++  )
++
++  cert_client_key_pkcs8_v2_des_pem_tgt = custom_target('cert-client-key-pkcs8-v2-des.pem',
++    input: cert_client_key_pkcs8_pem_tgt,
++    output: 'cert-client-key-pkcs8-v2-des.pem',
++    command: [ openssl, 'pkcs8', '-in', '@INPUT@', '-out', '@OUTPUT@',
++      '-topk8', '-v2', 'des-cbc', '-v2prf', 'hmacWithSHA1', '-passout', 'pass:abc',
++      openssl_legacy ]
++  )
++
++  cert_client_key_pkcs8_v2_des_ede3_pem_tgt = custom_target('cert-client-key-pkcs8-v2-des-ede3.pem',
++    input: cert_client_key_pkcs8_pem_tgt,
++    output: 'cert-client-key-pkcs8-v2-des-ede3.pem',
++    command: [ openssl, 'pkcs8', '-in', '@INPUT@', '-out', '@OUTPUT@',
++        '-topk8', '-v2', 'des-ede3-cbc', '-v2prf', 'hmacWithSHA224', '-passout', 'pass:abc' ]
++  )
++
++  cert_client_key_pkcs8_v2_aes128_pem_tgt = custom_target('cert-client-key-pkcs8-v2-aes128.pem',
++    input: cert_client_key_pkcs8_pem_tgt,
++    output: 'cert-client-key-pkcs8-v2-aes128.pem',
++    command: [ openssl, 'pkcs8', '-in', '@INPUT@', '-out', '@OUTPUT@',
++      '-topk8', '-v2', 'aes128', '-v2prf', 'hmacWithSHA256', '-passout', 'pass:abc' ]
++  )
++
++  cert_client_key_pkcs8_sha1_des_pem_tgt = custom_target('cert-client-key-pkcs8-sha1-des.pem',
++    input: cert_client_key_pkcs8_pem_tgt,
++    output: 'cert-client-key-pkcs8-sha1-des.pem',
++    command: [ openssl, 'pkcs8', '-in', '@INPUT@', '-out', '@OUTPUT@',
++      '-topk8', '-v1', 'PBE-SHA1-DES', '-passout', 'pass:abc', openssl_legacy ]
++  )
++
++  cert_client_key_pkcs8_v2_aes256_pem_tgt = custom_target('cert-client-key-pkcs8-v2-aes256.pem',
++    input: cert_client_key_pkcs8_pem_tgt,
++    output: 'cert-client-key-pkcs8-v2-aes256.pem',
++    command: [ openssl, 'pkcs8', '-in', '@INPUT@', '-out', '@OUTPUT@',
++      '-topk8', '-v2', 'aes256', '-v2prf', 'hmacWithSHA512', '-passout', 'pass:abc' ]
++  )
++
++  cert_client_csr_tgt = custom_target('cert-client.csr',
++    input: cert_client_key_pkcs1_pem_tgt,
++    output: 'cert-client.csr',
++    command: [ openssl, 'req', '-new', '-extensions', 'cert_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=Bar Example Organization/CN=Bar Example Organization/emailAddress=bar@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@'
++    ]
++  )
++
++  cert_client_pem_tgt = custom_target('cert-client.pem',
++    input: [ cert_client_csr_tgt, cert_ca_pem_tgt, cert_ca_key_pem_tgt ],
++    output: 'cert-client.pem',
++    command: [ openssl, 'x509', '-req', '-extensions', 'cert_ext',
++      '-extfile', files('gencerts.cnf'),
++      '-in', '@INPUT0@', '-CA', '@INPUT1@',
++      '-CAkey', '@INPUT2@',
++      '-CAserial', 'cert-ca.srl',
++      '-CAcreateserial', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  cert_client_crt_tgt = custom_target('cert-client.crt',
++    input: cert_client_pem_tgt,
++    output: 'cert-client.crt',
++    command: [ openssl, 'x509', '-in', '@INPUT@', '-out', '@OUTPUT@', '-outform', 'der' ]
++  )
++
++  cert_intca_key_pem_tgt = custom_target('cert-intca-key.pem',
++    output: 'cert-intca-key.pem',
++    command: [ openssl, 'genrsa', '-out', '@OUTPUT@' ]
++  )
++
++  cert_intca_csr_tgt = custom_target('cert-intca.csr',
++    input: cert_intca_key_pem_tgt,
++    output: 'cert-intca.csr',
++    command: [ openssl, 'req', '-new', '-extensions', 'int_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=International Union of Example Organizations/CN=Certificate issuer guy/emailAddress=ca@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  cert_intca_pem_tgt = custom_target('cert-intca.pem',
++    input: [ cert_intca_csr_tgt, cert_ca_pem_tgt, cert_ca_key_pem_tgt ],
++    output: 'cert-intca.pem',
++    command: [ openssl, 'x509', '-req', '-extensions', 'int_ext',
++      '-extfile', files('gencerts.cnf'),
++      '-in', '@INPUT0@', '-CA', '@INPUT1@',
++      '-CAkey', '@INPUT2@',
++      '-CAserial', 'cert-ca.srl',
++      '-CAcreateserial', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  cat = find_program('cat')
++
++  cert_chain_pem_tgt = custom_target('cert-chain.pem',
++    input: [ cert_intca_pem_tgt, cert_ca_pem_tgt ],
++    output: 'cert-chain.pem',
++    capture: true,
++    command: [ cat, '@INPUT@' ]
++  )
++
++  cert_entity_int_key_pem_tgt = custom_target('cert-entity-int-key.pem',
++    output: 'cert-entity-int-key.pem',
++    command: [ openssl, 'genrsa', '-out', '@OUTPUT@' ]
++  )
++
++  cert_entity_int_csr_tgt = custom_target('cert-entity-int.csr',
++    input: cert_entity_int_key_pem_tgt,
++    output: 'cert-entity-int.csr',
++    command: [ openssl, 'req', '-new', '-extensions', 'cert_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=Baz Example Organization/CN=Baz Example Organization/emailAddress=baz@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  cert_entity_int_pem_tgt = custom_target('cert-entity-int.pem',
++    input: [ cert_entity_int_csr_tgt, cert_intca_pem_tgt, cert_intca_key_pem_tgt ],
++    output: 'cert-entity-int.pem',
++    command: [ openssl, 'x509', '-req', '-extensions', 'cert_ext',
++      '-extfile', files('gencerts.cnf'),
++      '-in', '@INPUT0@', '-CA', '@INPUT1@',
++      '-CAkey', '@INPUT2@',
++      '-CAserial', 'cert-intca.srl',
++      '-CAcreateserial', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  cert_ca2_pem_tgt = custom_target('cert-ca2.pem',
++    input: cert_ca_key_pem_tgt,
++    output: 'cert-ca2.pem',
++    command: [ openssl, 'req', '-x509', '-new', '-nodes', '-extensions', 'ca_no_akid_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=International Union of Example Organizations/CN=Certificate issuer guy/emailAddress=ca-no-akid@mail.example',
++      '-key', '@INPUT@', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  cert_client_key_pkcs1_des_pem_tgt = custom_target('cert-client-key-pkcs1-des.pem',
++    input: cert_client_key_pkcs1_pem_tgt,
++    output: 'cert-client-key-pkcs1-des.pem',
++    command: [ openssl, 'rsa', '-in', '@INPUT@', '-out', '@OUTPUT@', '-des', '-passout', 'pass:abc', openssl_legacy ],
++  )
++
++  cert_no_keyid_csr_tgt = custom_target('cert-no-keyid.csr',
++    input: cert_client_key_pkcs1_pem_tgt,
++    output: 'cert-no-keyid.csr',
++    command: [ openssl, 'req', '-new',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=Baz Example Organization/CN=Baz Example Organization/emailAddress=baz@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  cert_no_keyid_pem_tgt = custom_target('cert-no-keyid.pem',
++    input: [ cert_no_keyid_csr_tgt, cert_ca2_pem_tgt, cert_ca_key_pem_tgt ],
++    output: 'cert-no-keyid.pem',
++    command: [ openssl, 'x509', '-req', '-extensions', 'no_keyid_ext',
++      '-extfile', files('gencerts.cnf'),
++      '-in', '@INPUT0@', '-CA', '@INPUT1@',
++      '-CAkey', '@INPUT2@',
++      '-CAserial', 'cert-ca2.srl',
++      '-CAcreateserial', '-sha256', '-days', '10000', '-out', '@OUTPUT@' ]
++  )
++
++  cert_expired_csr_tgt = custom_target('cert-expired.csr',
++    input: cert_client_key_pkcs1_pem_tgt,
++    output: 'cert-expired.csr',
++    command: [ openssl, 'req', '-new', '-extensions', 'cert_ext',
++      '-config', files('gencerts.cnf'),
++      '-subj', '/O=Bar Example Organization/CN=Bar Example Organization/emailAddress=bar@mail.example',
++      '-key', '@INPUT@', '-out', '@OUTPUT@' ]
++  )
++
++  echo = find_program('echo')
++
++  cert_ca_cnf_tgt = custom_target('cert-ca.cnf',
++    output: 'cert-ca.cnf',
++    capture: true,
++    command: [ echo, '-e',
++      '[example]\ndatabase=cert-ca-index.txt\nserial=cert-ca.srl\npolicy=dummy\n[dummy]' ]
++  )
++
++  cert_entity_pkcs12_rc2_sha1_p12_tgt = custom_target('cert-entity-pkcs12-rc2-sha1.p12',
++    input: [ cert_entity_int_key_pem_tgt, cert_entity_int_pem_tgt, cert_chain_pem_tgt ],
++    output: 'cert-entity-pkcs12-rc2-sha1.p12',
++    command: [ openssl, 'pkcs12', '-inkey', '@INPUT0@', '-in', '@INPUT1@', '-certfile', '@INPUT2@', '-out', '@OUTPUT@', '-export',
++      '-passout', 'pass:abc', '-certpbe', 'PBE-SHA1-RC2-40', '-keypbe', 'PBE-SHA1-RC2-128', '-macalg', 'sha1', openssl_legacy ]
++  )
++
++  cert_entity_combined_pem_tgt = custom_target('cert-entity-combined.pem',
++    input: cert_entity_pkcs12_rc2_sha1_p12_tgt,
++    output: 'cert-entity-combined.pem',
++    command: [ openssl, 'pkcs12', '-in', '@INPUT@', '-out', '@OUTPUT@', '-passin', 'pass:abc', '-passout', 'pass:abc', openssl_legacy ]
++  )
++
++  gen_cert_expired_pem_sh = find_program('gen-cert-expired-pem.sh')
++  cert_expired_pem_tgt = custom_target('cert-expired.pem',
++    input: [ cert_expired_csr_tgt, cert_ca_pem_tgt, cert_ca_key_pem_tgt, cert_ca_cnf_tgt, files('gencerts.cnf') ],
++    output: 'cert-expired.pem',
++    command: [ gen_cert_expired_pem_sh, '@INPUT0@', '@INPUT1@', '@INPUT2@', '@INPUT3@', '@INPUT4@', '@OUTPUT@' ]
++  )
++
++  cert_entity_pkcs12_nomac_p12_tgt = custom_target('cert-entity-pkcs12-nomac.p12',
++    input: [ cert_entity_int_key_pem_tgt, cert_entity_int_pem_tgt ],
++    output: 'cert-entity-pkcs12-nomac.p12',
++    command: [ openssl, 'pkcs12', '-inkey', '@INPUT0@', '-in', '@INPUT1@', '-out', '@OUTPUT@', '-export', '-passout', 'pass:abc', '-nomac' ]
++  )
++
++  cert_entity_pkcs12_des_sha256_p12_tgt = custom_target('cert-entity-pkcs12-des-sha256.p12',
++    input: [ cert_entity_int_key_pem_tgt, cert_entity_int_pem_tgt, cert_chain_pem_tgt ],
++    output: 'cert-entity-pkcs12-des-sha256.p12',
++    command: [ openssl, 'pkcs12', '-inkey', '@INPUT0@', '-in', '@INPUT1@', '-certfile', '@INPUT2@', '-out', '@OUTPUT@', '-export',
++      '-passout', 'pass:abc', '-certpbe', 'PBE-SHA1-3DES', '-keypbe', 'PBE-SHA1-2DES', '-macalg', 'sha256' ]
++  )
++
++  cert_entity_pkcs12_rc4_sha384_p12_tgt = custom_target('cert-entity-pkcs12-rc4-sha384.p12',
++    input: [ cert_entity_int_key_pem_tgt, cert_entity_int_pem_tgt, cert_chain_pem_tgt ],
++    output: 'cert-entity-pkcs12-rc4-sha384.p12',
++    command: [ openssl, 'pkcs12', '-inkey', '@INPUT0@', '-in', '@INPUT1@', '-certfile', '@INPUT2@', '-out', '@OUTPUT@', '-export',
++      '-passout', 'pass:abc', '-certpbe', 'PBE-SHA1-RC4-128', '-keypbe', 'PBE-SHA1-RC2-40', '-macalg', 'sha384', openssl_legacy ]
++  )
++
++  cert_entity_pkcs12_pkcs5_sha512_p12_tgt = custom_target('cert-entity-pkcs12-pkcs5-sha512.p12',
++    input: [ cert_entity_int_key_pem_tgt, cert_entity_int_pem_tgt, cert_chain_pem_tgt ],
++    output: 'cert-entity-pkcs12-pkcs5-sha512.p12',
++    command: [ openssl, 'pkcs12', '-inkey', '@INPUT0@', '-in', '@INPUT1@', '-certfile', '@INPUT2@', '-out', '@OUTPUT@', '-export',
++      '-passout', 'pass:abc', '-certpbe', 'des-cbc', '-keypbe', 'des-cbc', '-macalg', 'sha512', openssl_legacy ]
++  )
++
++  key_ciphertext_dat_tgt = custom_target('key-ciphertext.dat',
++    input: [ 'plaintext.txt', cert_client_pem_tgt ],
++    output: 'key-ciphertext.dat',
++    command: [ openssl, 'rsautl', '-encrypt', '-pkcs', '-in', '@INPUT0@', '-certin',
++      '-inkey', '@INPUT1@', '-out', '@OUTPUT@' ]
++  )
++
++  key_signature_dat_tgt = custom_target('key-signature.dat',
++    input: 'plaintext.txt',
++    output: 'key-signature.dat',
++    command: [ openssl, 'rsautl', '-sign', '-pkcs', '-in', '@INPUT@',
++      '-inkey', cert_client_key_pkcs1_pem_tgt, '-out', '@OUTPUT@' ]
++  )
++
++  pem_rsa_files = [
++    [ 'cert-client-key-pkcs1-des3.pem', '-des3' ],
++    [ 'cert-client-key-pkcs1-aes128.pem', '-aes128' ],
++    [ 'cert-client-key-pkcs1-aes192.pem', '-aes192' ],
++    [ 'cert-client-key-pkcs1-aes256.pem', '-aes256' ],
++  ]
++
++  foreach file: pem_rsa_files
++    test_pem_cert_deps += custom_target(file[0],
++      input: cert_client_key_pkcs1_pem_tgt,
++      output: file[0],
++      command: [ openssl, 'rsa', '-in', '@INPUT@', '-out', '@OUTPUT@', file[1], '-passout', 'pass:abc' ]
++    )
++  endforeach
++
++  built_headers = [
++    [ 'plaintext.txt', 'key-plaintext.h' ],
++    [ key_ciphertext_dat_tgt, 'key-ciphertext.h' ],
++    [ key_signature_dat_tgt, 'key-signature.h' ]
++  ]
++
++  xxd_sh = find_program('xxd.sh')
++
++  foreach header: built_headers
++    gen_headers += custom_target(header[1],
++      input: header[0],
++      output: header[1],
++      command: [ xxd_sh,'@INPUT@', '@OUTPUT@' ]
++    )
++  endforeach
++
++  cert_verifs = [
++    [ cert_server_pem_tgt, cert_ca_pem_tgt ],
++    [ ec_cert_server_pem_tgt, ec_cert_ca_pem_tgt ],
++    [ cert_client_pem_tgt, cert_ca_pem_tgt ],
++    [ cert_intca_pem_tgt, cert_ca_pem_tgt ],
++    [ cert_entity_int_pem_tgt, cert_chain_pem_tgt ],
++    [ cert_no_keyid_pem_tgt, cert_ca2_pem_tgt ]
++  ]
++  foreach cert_verif: cert_verifs
++    test(cert_verif[0].full_path() + '-verify',
++      openssl,
++      args: [ 'verify', '-CAfile', cert_verif[1].full_path(), cert_verif[0].full_path() ]
++    )
++  endforeach
++
++  test_pem_cert_deps += [
++    # test_pem
++    cert_client_key_pkcs8_md5_des_pem_tgt,
++    cert_client_key_pkcs8_sha1_des_pem_tgt,
++    cert_client_key_pkcs8_v2_des_pem_tgt,
++    cert_client_key_pkcs8_v2_des_ede3_pem_tgt,
++    cert_client_key_pkcs8_v2_aes128_pem_tgt,
++    cert_client_key_pkcs8_v2_aes256_pem_tgt,
++    cert_client_key_pkcs1_des_pem_tgt,
++    cert_client_key_pkcs1_pem_tgt,
++    cert_client_key_pkcs1_des_pem_tgt,
++    cert_client_key_pkcs8_pem_tgt,
++    cert_client_key_pkcs8_sha1_des_pem_tgt,
++    cert_client_pem_tgt,
++    cert_client_crt_tgt,
++    cert_entity_combined_pem_tgt,
++    cert_entity_pkcs12_nomac_p12_tgt,
++    cert_entity_pkcs12_rc2_sha1_p12_tgt,
++    cert_entity_pkcs12_des_sha256_p12_tgt,
++    cert_entity_pkcs12_rc4_sha384_p12_tgt,
++    cert_entity_pkcs12_pkcs5_sha512_p12_tgt,
++    # test_key
++    cert_ca_pem_tgt,
++    cert_server_pem_tgt,
++    cert_intca_pem_tgt,
++    cert_entity_int_pem_tgt,
++    cert_client_pem_tgt,
++    cert_client_key_pkcs8_pem_tgt,
++    # test_tls
++    cert_chain_pem_tgt,
++    cert_expired_pem_tgt,
++    cert_ca2_pem_tgt,
++    cert_no_keyid_pem_tgt,
++    ec_cert_ca_pem_tgt,
++    ec_cert_server_pem_tgt,
++    cert_server_key_pkcs8_pem_tgt
++  ]
++endif
++
++# Mocking l_getrandom() to get a stable random seed
++libell_private_ecdh_dep = declare_dependency(
++  link_with: libell_private,
++  link_args: '-Wl,-wrap,l_getrandom'
++)
++
++if get_option('tests') or get_option('cert-tests')
++  foreach test_name: tests
++    dep = test_name == 'test-ecdh' ? libell_private_ecdh_dep : libell_private_dep
++    exe = executable(test_name,
++      [ '@0@.c'.format(test_name), gen_headers, test_pem_cert_deps ],
++      include_directories: include_directories('..'),
++      c_args: [
++        '-DUNITDIR="@0@/unit/"'.format(meson.project_source_root()),
++        '-DCERTDIR="@0@/unit/"'.format(meson.project_build_root())
++      ],
++      dependencies: dep,
++      install: false
++    )
++
++    test(test_name, exe,
++      protocol: 'tap')
++  endforeach
++endif
+diff --git a/unit/xxd.sh b/unit/xxd.sh
+new file mode 100755
+index 000000000000..3fd26d2bce90
+--- /dev/null
++++ b/unit/xxd.sh
+@@ -0,0 +1,3 @@
++#!/bin/sh
++
++xxd -i < "$1" > "$2"
+-- 
+2.51.0
+
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 02/10] build: Add meson build system
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 01/10] build: Add meson wrap for libell Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 03/10] build: Make more use of 'feature' options Bastien Nocera
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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

diff --git a/attrib/meson.build b/attrib/meson.build
new file mode 100644
index 000000000000..0b7bc97933db
--- /dev/null
+++ b/attrib/meson.build
@@ -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'
+)
diff --git a/btio/meson.build b/btio/meson.build
new file mode 100644
index 000000000000..46ae5691f1d8
--- /dev/null
+++ b/btio/meson.build
@@ -0,0 +1 @@
+btio_sources = files('btio.c')
diff --git a/client/meson.build b/client/meson.build
new file mode 100644
index 000000000000..52397d1e17de
--- /dev/null
+++ b/client/meson.build
@@ -0,0 +1,54 @@
+executable('bluetoothctl',
+  sources: [
+    'main.c',
+    'print.c',
+    'display.c',
+    'agent.c',
+    'advertising.c',
+    'adv_monitor.c',
+    'gatt.c',
+    'admin.c',
+    'player.c',
+    'mgmt.c',
+    'assistant.c',
+    'hci.c',
+  ],
+  dependencies: [
+    libbluetooth_internal_dep,
+    libgdbus_internal_dep,
+    libshared_glib_dep,
+    glib_dep,
+    udevlib_dep,
+    dbus_dep,
+    readline_dep
+  ],
+  install: true,
+)
+
+client_man_pages = [
+  'bluetoothctl.1',
+  'bluetoothctl-mgmt.1',
+  'bluetoothctl-monitor.1',
+  'bluetoothctl-admin.1',
+  'bluetoothctl-advertise.1',
+  'bluetoothctl-endpoint.1',
+  'bluetoothctl-gatt.1',
+  'bluetoothctl-player.1',
+  'bluetoothctl-scan.1',
+  'bluetoothctl-transport.1',
+  'bluetoothctl-assistant.1',
+  'bluetoothctl-hci.1'
+]
+
+if get_option('manpages').enabled()
+  foreach man_page: client_man_pages
+    man_page_name = man_page.substring(0, -2)
+    custom_target(man_page,
+      input: man_page_name + '.rst',
+      output: man_page,
+      command: rst2man_command,
+      install: true,
+      install_dir: get_option('mandir') / 'man1'
+    )
+  endforeach
+endif
diff --git a/completion/meson.build b/completion/meson.build
new file mode 100644
index 000000000000..24b71518c67d
--- /dev/null
+++ b/completion/meson.build
@@ -0,0 +1,3 @@
+install_data('zsh/_bluetoothctl',
+  install_dir: zshcompletiondir
+)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 000000000000..87bf5bb2a09b
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,41 @@
+man_pages = [
+  'hci.7',
+  'iso.7',
+  'mgmt.7',
+  'l2cap.7',
+  'rfcomm.7',
+  'sco.7',
+  'org.bluez.Adapter.5',
+  'org.bluez.Bearer.LE.5',
+  'org.bluez.Bearer.BREDR.5',
+  'org.bluez.Device.5',
+  'org.bluez.DeviceSet.5',
+  'org.bluez.AgentManager.5',
+  'org.bluez.Agent.5',
+  'org.bluez.ProfileManager.5',
+  'org.bluez.Profile.5',
+  'org.bluez.NetworkServer.5',
+  'org.bluez.Network.5',
+  'org.bluez.Input.5',
+  'org.bluez.BatteryProviderManager.5',
+  'org.bluez.BatteryProvider.5',
+  'org.bluez.Battery.5',
+  'org.bluez.AdminPolicySet.5',
+  'org.bluez.AdminPolicyStatus.5',
+  'org.bluez.Media.5',
+  'org.bluez.MediaControl.5',
+  'org.bluez.MediaPlayer.5',
+  'org.bluez.MediaFolder.5'
+]
+
+foreach man_page: man_pages
+  man_page_name = man_page.substring(0, -2)
+  man_section = man_page.substring(-1)
+  custom_target(man_page,
+    input: man_page_name + '.rst',
+    output: man_page,
+    command: rst2man_command,
+    install: true,
+    install_dir: get_option('mandir') / 'man@0@'.format(man_section)
+  )
+endforeach
diff --git a/emulator/meson.build b/emulator/meson.build
new file mode 100644
index 000000000000..59c72c4dbd4d
--- /dev/null
+++ b/emulator/meson.build
@@ -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
+
diff --git a/gdbus/meson.build b/gdbus/meson.build
new file mode 100644
index 000000000000..dc7f2887a60f
--- /dev/null
+++ b/gdbus/meson.build
@@ -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
+)
diff --git a/gobex/meson.build b/gobex/meson.build
new file mode 100644
index 000000000000..0ff6238a7b8c
--- /dev/null
+++ b/gobex/meson.build
@@ -0,0 +1,8 @@
+gobex_sources = files(
+  'gobex.c',
+  'gobex-defs.c',
+  'gobex-packet.c',
+  'gobex-header.c',
+  'gobex-transfer.c',
+  'gobex-apparam.c'
+)
diff --git a/lib/meson.build b/lib/meson.build
new file mode 100644
index 000000000000..f31c8c3a58c5
--- /dev/null
+++ b/lib/meson.build
@@ -0,0 +1,53 @@
+lib_sources = [
+  'bluetooth/bluetooth.c',
+  'bluetooth/hci.c',
+  'bluetooth/sdp.c',
+]
+
+lib_extra_sources = [
+  'bluetooth/uuid.c'
+]
+
+lib_headers = [
+  'bluetooth/bluetooth.h',
+  'bluetooth/hci.h',
+  'bluetooth/hci_lib.h',
+  'bluetooth/sco.h',
+  'bluetooth/l2cap.h',
+  'bluetooth/sdp.h',
+  'bluetooth/sdp_lib.h',
+  'bluetooth/rfcomm.h',
+  'bluetooth/bnep.h',
+  'bluetooth/cmtp.h',
+  'bluetooth/hidp.h'
+  ]
+
+if get_option('library')
+  lib_bluetooth = shared_library('bluetooth',
+    sources: lib_headers + lib_sources,
+    version: '3.19.15',
+    install: true
+  )
+
+  install_headers(lib_headers,
+    subdir: 'bluetooth'
+  )
+
+  pkgconfig = import('pkgconfig')
+  pkgconfig.generate(
+    name: 'bluez',
+    description: 'Bluetooth protocol stack for Linux',
+    version: meson.project_version(),
+    libraries: lib_bluetooth,
+  )
+endif
+
+libbluetooth_internal = static_library('bluetooth_internal',
+  sources: lib_headers + lib_sources + lib_extra_sources,
+  install: false
+)
+
+libbluetooth_internal_dep = declare_dependency(
+  link_with: libbluetooth_internal,
+  include_directories: '.'
+)
diff --git a/mesh/meson.build b/mesh/meson.build
new file mode 100644
index 000000000000..8c6f5631a9db
--- /dev/null
+++ b/mesh/meson.build
@@ -0,0 +1,75 @@
+if get_option('datafiles')
+  install_data('bluetooth-mesh.conf',
+    install_dir: dbusdir)
+  install_data('mesh-main.conf',
+    install_dir: configdir)
+endif
+
+if get_option('systemd')
+  configure_file(
+    input: 'bluetooth-mesh.service.in',
+    output: 'bluetooth-mesh.service',
+    install: true,
+    install_dir: systemdsystemunitdir,
+    configuration: service_conf
+  )
+  install_data('org.bluez.mesh.service',
+    install_dir: dbussystembusdir
+  )
+endif
+
+executable('bluetooth-meshd',
+  sources: [
+    builtin_h,
+    'main.c',
+    'mesh.c',
+    'net-keys.c',
+    'mesh-io.c',
+    'mesh-mgmt.c',
+    'mesh-io-unit.c',
+    'mesh-io-mgmt.c',
+    'mesh-io-generic.c',
+    'net.c',
+    'crypto.c',
+    'friend.c',
+    'appkey.c',
+    'node.c',
+    'model.c',
+    'cfgmod-server.c',
+    'remprv-server.c',
+    'mesh-config-json.c',
+    'util.c',
+    'dbus.c',
+    'agent.c',
+    'prov-acceptor.c',
+    'prov-initiator.c',
+    'manager.c',
+    'pb-adv.c',
+    'keyring.c',
+    'rpl.c',
+    'prvbeac-server.c'
+  ],
+  include_directories: '../lib',
+  dependencies: [ libshared_ell_dep, jsonc_dep ],
+  c_args: [
+    '-DCONFIGDIR="@0@"'.format(configdir),
+    '-DMESH_STORAGEDIR="@0@"'.format(meshstoragedir)
+  ],
+  install: true,
+  install_dir: pkglibexecdir
+)
+
+if get_option('manpages').enabled()
+  bluetooth_meshd_rst = configure_file(
+    input: 'bluetooth-meshd.rst.in',
+    output: 'bluetooth-meshd.rst',
+    configuration: man_conf
+  )
+  custom_target(
+    input: bluetooth_meshd_rst,
+    output: 'bluetooth-meshd.8',
+    command: rst2man_command,
+    install: true,
+    install_dir: get_option('mandir') / 'man8'
+  )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000000..653359841d2c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,292 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+project(
+  'bluez', 'c',
+  version: '5.83',
+  license: 'LGPL-2.1-or-later AND GPL-2.0-or-later',
+  meson_version: '>= 1.3.0'
+)
+
+datadir = get_option('datadir')
+storagedir = '/' / get_option('localstatedir') / 'lib/bluetooth'
+configdir = get_option('sysconfdir') / 'bluetooth'
+pkglibdir = get_option('libdir') / 'bluetooth'
+pkglibexecdir = get_option('libexecdir') / 'bluetooth'
+meshstoragedir = storagedir / 'mesh'
+
+service_conf = configuration_data()
+service_conf.set('PKGLIBEXECDIR', pkglibexecdir)
+
+add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
+config_h = configuration_data()
+
+cc = meson.get_compiler('c')
+
+required_funcs = [
+  'explicit_bzero',
+  'getrandom',
+  'rawmemchr',
+  'signalfd',
+]
+
+foreach func: required_funcs
+  cc.has_function(func, required: true)
+endforeach
+
+required_lib_funcs = [
+  [ 'clock_gettime', 'rt' ],
+  [ 'pthread_create', 'pthread' ],
+  [ 'dlopen', 'dl' ]
+]
+
+foreach func: required_lib_funcs
+  dep = cc.find_library(func[1], required: true)
+  cc.has_function(func[0], dependencies: dep, required: true)
+endforeach
+
+required_headers = [
+  'stdarg.h',
+  'stdio.h',
+  'string.h',
+  'linux/types.h',
+  'linux/if_alg.h',
+  'linux/uinput.h',
+  'linux/uhid.h',
+  'sys/random.h'
+]
+
+foreach header: required_headers
+  cc.has_header(header, required: true)
+endforeach
+
+# basename may be only available in libgen.h with the POSIX behavior,
+# not desired here
+config_h.set10('HAVE_DECL_BASENAME',
+  cc.has_function('basename', prefix: '#define _GNU_SOURCE 1\n#include <string.h>'))
+
+# To combine with -Wl,--gc-sections
+add_project_arguments([ '-ffunction-sections', '-fdata-sections' ] , language: 'c')
+
+# Maintainer mode
+if get_option('buildtype').contains('debug')
+  test_cflags = [
+    '-Wno-unused-parameter',
+    '-Wno-missing-field-initializers',
+    '-Wdeclaration-after-statement',
+    '-Wmissing-declarations',
+    '-Wredundant-decls',
+    '-Wcast-align',
+    '-Wswitch-enum',
+    '-Wformat',
+    '-Wformat-security',
+    '-Wstringop-overflow',
+  ]
+
+  if get_option('buildtype') == 'debugoptimized'
+    test_cflags += '-D_FORTIFY_SOURCE=3'
+  endif
+
+  common_flags = [
+    '-DG_DISABLE_DEPRECATED',
+    '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
+    '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'
+  ]
+
+  common_flags += cc.get_supported_arguments(test_cflags)
+
+  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
+endif
+
+test_cflags = [
+  '-ffunction-sections',
+  '-fdata-sections'
+]
+
+add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c')
+add_project_arguments('-I' + meson.project_build_root(), language: 'c')
+add_project_arguments('-I' + meson.project_source_root(), language: 'c')
+add_project_link_arguments('-Wl,--gc-sections', language: 'c')
+
+dummy_dep = dependency('dummy', required: false)
+glib_dep = dependency('glib-2.0', version: '>= 2.36')
+dbus_dep = dependency('dbus-1', version:'>= 1.10')
+
+cc.check_header('elfutils/libdwfl.h', required: get_option('backtrace'))
+backtrace_dep = cc.find_library('dw', required: get_option('backtrace'))
+config_h.set('HAVE_BACKTRACE_SUPPORT', backtrace_dep.found())
+
+config_h.set10('HAVE_DECL_SOF_TIMESTAMPING_TX_COMPLETION',
+  cc.has_header_symbol('linux/net_tstamp.h', '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_dep = dependency('udev', version:'>= 196', required: udev_required)
+udevlib_dep = dependency('libudev', required: udev_required)
+
+cups_dep = dependency('cups', required: get_option('cups'))
+jsonc_dep = dependency('json-c', version: '>= 0.13', required: get_option('mesh'))
+alsa_dep = dependency('alsa', required: get_option('midi'))
+ical_dep = dependency('libical', required: get_option('obex'))
+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'))
+ell_dep = dependency('ell',
+  version: '>= 0.39',
+  required: get_option('btpclient') or get_option('mesh').enabled(),
+  fallback : ['ell', 'libell_dep'],
+  default_options: [
+    'default_library=static',
+    'tests=false',
+    'cert-tests=false'
+  ]
+)
+
+rst2man = find_program('rst2man', 'rst2man.py', required: get_option('manpages'))
+if rst2man.found()
+  rst2man_command = [
+    rst2man,
+    '--strict',
+    '--no-raw',
+    '--no-generator',
+    '--no-datestamp',
+    '@INPUT@',
+    '@OUTPUT@'
+  ]
+endif
+
+man_conf = configuration_data()
+man_conf.set('CONFIGDIR', get_option('prefix') / configdir)
+man_conf.set('MESH_STORAGEDIR', get_option('prefix') / meshstoragedir)
+
+if get_option('phonebook') == 'ebook'
+  ebook_dep = dependency('libebook-1.2', '>= 3.3', required: true)
+  edataserver_dep = dependency('libedataserver-1.2', '>= 3.3', required: true)
+else
+  ebook_dep = dummy_dep
+  edataserver_dep = dummy_dep
+endif
+
+plugindir = get_option('libdir') / 'bluetooth/plugins'
+
+dbusconfdir = get_option('dbusconfdir')
+if dbusconfdir == ''
+  dbusconfdir = dbus_dep.get_variable('datadir')
+endif
+dbusdir = dbusconfdir / 'dbus-1/system.d'
+
+dbussystembusdir = get_option('dbussystembusdir')
+if dbussystembusdir == ''
+  dbussystembusdir = dbus_dep.get_variable('system_bus_services_dir')
+endif
+
+dbussessionbusdir = get_option('dbussessionbusdir')
+if dbussessionbusdir == ''
+  dbussessionbusdir = dbus_dep.get_variable('session_bus_services_dir')
+endif
+
+service_in = configuration_data()
+service_in.set_quoted('PKGLIBEXECDIR', get_option('prefix') / pkglibexecdir)
+
+if systemd_dep.found()
+  systemdsystemunitdir = get_option('systemdsystemunitdir')
+  if systemdsystemunitdir == ''
+    systemdsystemunitdir = systemd_dep.get_variable('systemdsystemunitdir')
+  endif
+  systemduserunitdir = get_option('systemduserunitdir')
+  if systemduserunitdir == ''
+    systemduserunitdir = systemd_dep.get_variable('systemduserunitdir')
+  endif
+endif
+
+zshcompletiondir = get_option('zsh-completion-dir')
+if zshcompletiondir == ''
+  zshcompletiondir = datadir / 'zsh/site-functions'
+endif
+
+fs = import('fs')
+zsh_completions = fs.is_dir(zshcompletiondir)
+
+if udev_dep.found()
+  udevdir = get_option('udevdir')
+  if udevdir == ''
+    udevdir = udev_dep.get_variable('udevdir')
+  endif
+endif
+
+if cups_dep.found()
+  cups_serverbin = get_option('cups_serverbin')
+  if cups_serverbin == ''
+    cups_serverbin = cups_dep.get_variable('cups_serverbin')
+  endif
+endif
+
+external_plugins_link_args = ''
+if get_option('external-plugins')
+  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_quoted('VERSION', meson.project_version())
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+subdir('lib')
+subdir('gdbus')
+subdir('attrib')
+subdir('btio')
+subdir('plugins')
+subdir('profiles')
+subdir('src')
+if get_option('client').enabled()
+  subdir('client')
+endif
+if get_option('monitor')
+  subdir('monitor')
+endif
+subdir('emulator')
+subdir('gobex')
+subdir('tools')
+subdir('peripheral')
+if get_option('obex').enabled()
+  subdir('obexd')
+endif
+if zsh_completions
+  subdir('completion')
+endif
+if get_option('mesh').enabled()
+  subdir('mesh')
+endif
+if get_option('manpages').enabled()
+  subdir('doc')
+endif
+if get_option('tests')
+  subdir('test')
+  subdir('unit')
+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('mesh').enabled()
+  meson.add_install_script(sh, '-c', 'install -dm700 ${DESTDIR}/' + meshstoragedir)
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 000000000000..2d9231b120ca
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,51 @@
+option('valgrind', type: 'boolean', value: false, description: 'Enable valgrind memory checks')
+option('backtrace', type: 'boolean', value: false, description: 'Enable backtrace support')
+option('library', type: 'boolean', value: true, description: 'Install Bluetooth library')
+option('examples', type: 'boolean', value: false, description: 'Enable test/example scripts')
+option('tests', type: 'boolean', value: false, description: 'Enable testing tools')
+option('tools', type: 'boolean', value: true, description: 'Enable Bluetooth tools')
+option('monitor', type: 'boolean', value: true, description: 'Enable Bluetooth monitor')
+option('client', type: 'feature', value: 'enabled', description: 'Enable command line client')
+option('systemd', type: 'boolean', value: true, description: 'Enable systemd integration')
+option('udev', type: 'feature', value: 'enabled', description: 'Enable udev device support')
+option('datafiles', type: 'boolean', value: true, description: 'Install configuration and data files')
+option('manpages', type: 'feature', value: 'auto', description: 'Enable building of manual pages')
+option('experimental', type: 'boolean', value: false, description: 'Enable experimental tools')
+option('deprecated', type: 'boolean', value: false, description: 'Enable deprecated tools')
+option('external-plugins', type: 'boolean', value: true, description: 'Enable support for external plugins')
+
+option('dbusconfdir', type: 'string', value: '', description: 'D-Bus configuration directory')
+option('dbussystembusdir', type: 'string', value: '', description: 'D-Bus system bus services dir')
+option('dbussessionbusdir', type:'string', value: '', description: 'D-Bus session bus services dir')
+option('systemdsystemunitdir', type: 'string', value: '', description: 'path to systemd system unit directory')
+option('systemduserunitdir', type: 'string', value: '', description: 'systemd user unit dir')
+option('zsh-completion-dir', type:'string', value: '', description: 'Path to install zsh completions')
+option('udevdir', type: 'string', value: '', description: 'udev directory')
+option('cups_serverbin', type: 'string', value: '', description: 'CUPS directory')
+
+option('nfc', type: 'boolean', value: false, description: 'Enable NFC pairing')
+option('sap', type: 'boolean', value: false, description: 'Enable SAP profile')
+option('a2dp', type: 'boolean', value: true, description: 'Enable A2DP profile')
+option('avrcp', type: 'boolean', value: true, description: 'Enable AVRCP profile')
+option('network', type: 'boolean', value: true, description: 'Enable network profiles')
+option('hid', type: 'boolean', value: true, description: 'Enable HID profile')
+option('hog', type: 'boolean', value: true, description: 'Enable HoG profile')
+option('health', type: 'boolean', value: false, description: 'Enable health profiles')
+option('bap', type: 'boolean', value: true, description: 'Enable BAP profile')
+option('bass', type: 'boolean', value: true, description: 'Enable BASS service')
+option('mcp', type: 'boolean', value: true, description: 'Enable MCP profile')
+option('ccp', type: 'boolean', value: true, description: 'Enable CCP profile')
+option('vcp', type: 'boolean', value: true, description: 'Enable VCP profile')
+option('micp', type: 'boolean', value: true, description: 'Enable MICP profile')
+option('csip', type: 'boolean', value: true, description: 'Enable CSIP profile')
+option('asha', type: 'boolean', value: true, description: 'Enable ASHA support')
+option('cups', type: 'feature', value: 'auto', description: 'Enable CUPS printer support')
+option('mesh', type: 'feature', value: 'auto', description: 'Enable Mesh profile support')
+option('midi', type: 'feature', value: 'auto', description: 'Enable MIDI support')
+option('obex', type: 'feature', value: 'auto', description: 'Enable OBEX profile support')
+option('btpclient', type: 'boolean', value: true, description: 'Enable BTP client')
+option('sixaxis', type: 'boolean', value: true, description: 'Enable sixaxis plugin')
+option('hid2hci', type: 'boolean', value: true, description: 'Enable hid2hci tool')
+option('logger', type: 'boolean', value: false, description: 'Enable HCI logger service')
+option('admin', type: 'boolean', value: true, description: 'Enable admin policy plugin')
+option('phonebook', type: 'combo', choices: [ 'dummy', 'ebook' ], value: 'dummy', description: 'Obexd phonebook plugin')
diff --git a/monitor/meson.build b/monitor/meson.build
new file mode 100644
index 000000000000..ad78e176d978
--- /dev/null
+++ b/monitor/meson.build
@@ -0,0 +1,47 @@
+executable('btmon',
+  sources: [
+    'main.c',
+    'display.c',
+    'hcidump.c',
+    'ellisys.c',
+    'control.c',
+    'packet.c',
+    'vendor.c',
+    'lmp.c',
+    'crc.c',
+    'll.c',
+    'l2cap.c',
+    'sdp.c',
+    'avctp.c',
+    'avdtp.c',
+    'a2dp.c',
+    'rfcomm.c',
+    'bnep.c',
+    'hwdb.c',
+    'keys.c',
+    'analyze.c',
+    'intel.c',
+    'broadcom.c',
+    'msft.c',
+    'jlink.c',
+    'att.c',
+    '../src/log.c',
+    '../src/textfile.c',
+    '../src/settings.c'
+  ],
+  c_args: [
+    '-DSTORAGEDIR="@0"'.format(storagedir)
+  ],
+  dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, udevlib_dep, glib_dep ],
+  install: true
+)
+
+if get_option('manpages').enabled()
+  custom_target(
+    input: 'btmon.rst',
+    output: 'btmon.1',
+    command: rst2man_command,
+    install: true,
+    install_dir: get_option('mandir') / 'man1'
+  )
+endif
diff --git a/obexd/meson.build b/obexd/meson.build
new file mode 100644
index 000000000000..cb658b24ed08
--- /dev/null
+++ b/obexd/meson.build
@@ -0,0 +1,121 @@
+if get_option('datafiles')
+  install_data('src/obex.conf',
+    install_dir: dbusconfdir / 'dbus-1/system.d'
+  )
+endif
+
+if get_option('systemd')
+  configure_file(
+    input: 'src/obex.service.in',
+    output: 'obex.service',
+    install: true,
+    install_dir: systemduserunitdir,
+    configuration: service_conf
+  )
+  configure_file(
+    input: 'src/org.bluez.obex.service.in',
+    output: 'org.bluez.obex.service',
+    install: true,
+    install_dir: dbussessionbusdir,
+    configuration: service_conf
+  )
+  install_symlink('dbus-org.bluez.obex.service',
+    pointing_to: dbussessionbusdir / 'org.bluez.obex.service',
+    install_dir: systemduserunitdir
+  )
+endif
+
+obexd_builtin_modules = [
+  'filesystem',
+  'bluetooth',
+  'opp',
+  'ftp',
+  'irmc',
+  'pbap',
+  'mas',
+  'mns'
+]
+
+obexd_builtin_sources = [
+  'plugins/filesystem.c',
+  'plugins/bluetooth.c',
+  'plugins/opp.c',
+  'plugins/ftp.c',
+  'plugins/irmc.c',
+  'plugins/pbap.c',
+  'plugins/vcard.c',
+  'plugins/phonebook-@0@.c'.format(get_option('phonebook')),
+  'plugins/mas.c',
+  'plugins/messages-dummy.c',
+  'client/mns.c',
+]
+
+if get_option('experimental')
+  obexd_builtin_modules += 'pcsuite'
+  obexd_builtin_sources += 'plugins/pcsuite.c'
+endif
+
+obex_plugindir = get_option('libdir') / 'obex/plugins'
+
+obexd_genbuiltin = find_program('src/genbuiltin')
+obexd_builtin_h = custom_target('obexd-builtin.h',
+  output: 'builtin.h',
+  capture: true,
+  command: [ obexd_genbuiltin, obexd_builtin_modules ]
+)
+
+executable('obexd',
+  sources: [
+    btio_sources,
+    gobex_sources,
+    obexd_builtin_sources,
+    obexd_builtin_h,
+    'src/main.c',
+    'src/plugin.c',
+    'src/log.c',
+    'src/logind.c',
+    'src/manager.c',
+    'src/obex.c',
+    'src/mimetype.c',
+    'src/service.c',
+    'src/transport.c',
+    'src/server.c',
+    'client/manager.c',
+    'client/session.c',
+    'client/bluetooth.c',
+    'client/sync.c',
+    'client/pbap.c',
+    'client/ftp.c',
+    'client/opp.c',
+    'client/map.c',
+    'client/bip.c',
+    'client/bip-common.c',
+    'client/map-event.c',
+    'client/transfer.c',
+    'client/transport.c',
+    'client/driver.c'
+  ],
+  dependencies: [
+    libbluetooth_internal_dep,
+    libgdbus_internal_dep,
+    libshared_glib_dep,
+    ical_dep,
+    dbus_dep,
+    ebook_dep,
+    edataserver_dep,
+    glib_dep,
+    libsystemd_dep.found() ? libsystemd_dep : dummy_dep
+  ],
+  c_args: [
+    '-DOBEX_PLUGIN_BUILTIN',
+    '-DPLUGINDIR="@0@"'.format(obex_plugindir),
+    '-D_FILE_OFFSET_BITS=64',
+    '-DCONFIGDIR="@0@"'.format(configdir),
+    get_option('systemd') ? '-DSYSTEMD' : ''
+  ],
+  link_args: external_plugins_link_args,
+  install: true,
+  install_dir: pkglibexecdir,
+)
+
+
diff --git a/peripheral/meson.build b/peripheral/meson.build
new file mode 100644
index 000000000000..21d6296829ea
--- /dev/null
+++ b/peripheral/meson.build
@@ -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
diff --git a/plugins/meson.build b/plugins/meson.build
new file mode 100644
index 000000000000..019e7083df16
--- /dev/null
+++ b/plugins/meson.build
@@ -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
diff --git a/profiles/meson.build b/profiles/meson.build
new file mode 100644
index 000000000000..8ac37b9e6cc8
--- /dev/null
+++ b/profiles/meson.build
@@ -0,0 +1,170 @@
+builtin_modules += [
+  'gap',
+  'scanparam',
+  'deviceinfo',
+  'battery'
+]
+
+builtin_sources += files(
+  'audio/media.c',
+  'audio/transport.c',
+  'audio/player.c',
+  'gap/gas.c',
+  'scanparam/scan.c',
+  'deviceinfo/deviceinfo.c',
+  'battery/battery.c'
+)
+
+if get_option('sap')
+  builtin_modules += 'sap'
+  builtin_sources += files(
+    'sap/main.c',
+    'sap/manager.c',
+    'sap/server.c',
+    'sap/sap-dummy.c'
+  )
+endif
+
+if get_option('a2dp')
+  builtin_modules += 'a2dp'
+  builtin_sources += files(
+    'audio/source.c',
+    'audio/sink.c',
+    'audio/a2dp.c',
+    'audio/avdtp.c'
+  )
+endif
+
+if get_option('avrcp')
+  builtin_modules += 'avrcp'
+  builtin_sources += files(
+    'audio/control.c',
+    'audio/avctp.c',
+    'audio/avctp.c',
+    'audio/avrcp.c'
+  )
+endif
+
+if get_option('network')
+  builtin_modules += 'network'
+  builtin_sources += files(
+    'network/manager.c',
+    'network/bnep.c',
+    'network/server.c',
+    'network/connection.c'
+  )
+  install_data('network/network.conf',
+    install_dir: configdir
+  )
+endif
+
+if get_option('hid')
+  builtin_modules += 'input'
+  builtin_sources += files(
+    'input/manager.c',
+    'input/server.c',
+    'input/device.c'
+  )
+
+  install_data('input/input.conf',
+    install_dir: configdir
+  )
+endif
+
+if get_option('hog')
+  builtin_modules += 'hog'
+  builtin_sources += files(
+    'input/hog.c',
+    'input/hog-lib.c',
+    'deviceinfo/dis.c',
+    'battery/bas.c',
+    'scanparam/scpp.c',
+    'input/suspend-none.c'
+  )
+endif
+
+if get_option('health')
+  builtin_modules += 'health'
+  builtin_sources += files(
+    'health/mcap.c',
+    'health/hdp_main.c',
+    'health/hdp_manager.c',
+    'health/hdp.c',
+    'health/hdp_util.c'
+  )
+endif
+
+if get_option('midi').enabled()
+  builtin_modules += 'midi'
+  builtin_sources += files(
+    'midi/midi.c',
+    'midi/libmidi.c'
+  )
+  builtin_deps += alsa_dep
+endif
+
+if get_option('bap')
+  builtin_modules += 'bap'
+  builtin_sources += files('audio/bap.c')
+endif
+
+if get_option('bass')
+  builtin_modules += 'bass'
+  builtin_sources += files('audio/bass.c')
+endif
+
+if get_option('mcp')
+  builtin_modules += 'mcp'
+  builtin_sources += files('audio/mcp.c')
+endif
+
+if get_option('vcp')
+  builtin_modules += 'vcp'
+  builtin_sources += files('audio/vcp.c')
+endif
+
+if get_option('micp')
+  builtin_modules += 'micp'
+  builtin_sources += files('audio/micp.c')
+endif
+
+if get_option('ccp')
+  builtin_modules += 'ccp'
+  builtin_sources += files('audio/ccp.c')
+endif
+
+if get_option('csip')
+  builtin_modules += 'csip'
+  builtin_sources += files('audio/csip.c')
+endif
+
+if get_option('asha')
+  builtin_modules += 'asha'
+  builtin_sources += files('audio/asha.c')
+endif
+
+if get_option('tools')
+  executable('iapd',
+    sources: 'iap/main.c',
+    dependencies: [ libgdbus_internal_dep, glib_dep, dbus_dep ]
+  )
+endif
+
+if get_option('cups').enabled()
+  executable('bluetooth',
+    sources: [
+      'cups/main.c',
+      'cups/sdp.c',
+      'cups/spp.c',
+      'cups/hcrp.c'
+    ],
+    dependencies: [
+      libbluetooth_internal_dep,
+      libgdbus_internal_dep,
+      glib_dep,
+      dbus_dep
+    ],
+    install: true,
+    install_dir: cups_serverbin / 'backend'
+  )
+endif
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 000000000000..a2aaad756b10
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,103 @@
+subdir('shared')
+
+if get_option('datafiles')
+  install_data('bluetooth.conf',
+    install_dir: dbusconfdir / 'dbus-1/system.d'
+  )
+  install_data('main.conf',
+    install_dir: configdir
+  )
+endif
+
+if get_option('systemd')
+  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
+
+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,
+    attrib_sources,
+    btio_sources,
+    builtin_h,
+    'main.c',
+    'log.c',
+    'backtrace.c',
+    'rfkill.c',
+    'sdpd-server.c',
+    'sdpd-request.c',
+    'sdpd-service.c',
+    'sdpd-database.c',
+    'gatt-database.c',
+    'sdp-xml.c',
+    'sdp-client.c',
+    'textfile.c',
+    'uuid-helper.c',
+    'plugin.c',
+    'storage.c',
+    'advertising.c',
+    'agent.c',
+    'bearer.c',
+    'error.c',
+    'adapter.c',
+    'profile.c',
+    'service.c',
+    'gatt-client.c',
+    'device.c',
+    'dbus-common.c',
+    'eir.c',
+    'adv_monitor.c',
+    'battery.c',
+    'settings.c',
+    'set.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
+)
+
+if get_option('manpages').enabled()
+  bluetoothd_rst = configure_file(
+    input: 'bluetoothd.rst.in',
+    output: 'bluetoothd.rst',
+    configuration: man_conf
+  )
+  custom_target(
+    input: bluetoothd_rst,
+    output: 'bluetoothd.8',
+    command: rst2man_command,
+    install: true,
+    install_dir: get_option('mandir') / 'man8'
+  )
+endif
diff --git a/src/shared/meson.build b/src/shared/meson.build
new file mode 100644
index 000000000000..5a7f3317ad43
--- /dev/null
+++ b/src/shared/meson.build
@@ -0,0 +1,80 @@
+shared_sources = [
+  'queue.c',
+  'util.c',
+  'mgmt.c',
+  'crypto.c',
+  'ecc.c',
+  'ringbuf.c',
+  'hci.c',
+  'hci-crypto.c',
+  'hfp.c',
+  'uhid.c',
+  'pcap.c',
+  'btsnoop.c',
+  'ad.c',
+  'att.c',
+  'gatt-helpers.c',
+  'gatt-client.c',
+  'gatt-server.c',
+  'gatt-db.c',
+  'gap.c',
+  'log.c',
+  'bap.c',
+  'bap-debug.c',
+  'mcp.c',
+  'vcp.c',
+  'micp.c',
+  'csip.c',
+  'bass.c',
+  'ccp.c',
+  'asha.c'
+]
+
+if readline_dep.found()
+  shared_sources += [ 'shell.c' ]
+endif
+
+libshared_glib = static_library('libshared-glib',
+  sources: [ shared_sources,
+    'io-glib.c',
+    'timeout-glib.c',
+    'mainloop-glib.c',
+    'mainloop-notify.c',
+    'tester.c' ],
+  include_directories: '../../lib',
+  dependencies: glib_dep
+)
+
+libshared_glib_dep = declare_dependency(
+  link_with: libshared_glib,
+  dependencies: glib_dep
+)
+
+libshared_mainloop = static_library('libshared-mainloop',
+  sources: [ shared_sources,
+    'io-mainloop.c',
+    'timeout-mainloop.c',
+    'mainloop.c',
+    'mainloop-notify.c' ],
+  include_directories: '../../lib',
+  dependencies: glib_dep
+)
+
+libshared_mainloop_dep = declare_dependency(
+  link_with: libshared_mainloop
+)
+
+if ell_dep.found()
+  libshared_ell = static_library('libshared-ell',
+    sources: [ shared_sources,
+      'io-ell.c',
+      'timeout-ell.c',
+      'mainloop-ell.c' ],
+    include_directories: [ '../..', '../../lib' ],
+    dependencies: [ glib_dep, ell_dep ]
+  )
+  libshared_ell_dep = declare_dependency(
+    link_with: libshared_ell,
+    dependencies: ell_dep
+  )
+endif
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 000000000000..2dad8138865e
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,41 @@
+test_scripts = [
+  'sap_client.py',
+  'bluezutils.py',
+  'dbusdef.py',
+  'monitor-bluetooth',
+  'list-devices',
+  'test-discovery',
+  'test-manager',
+  'test-adapter',
+  'test-device',
+  'simple-agent',
+  'simple-endpoint',
+  'test-sap-server',
+  'test-network',
+  'test-profile',
+  'test-health',
+  'test-health-sink',
+  'service-record.dtd',
+  'service-did.xml',
+  'service-spp.xml',
+  'service-opp.xml',
+  'service-ftp.xml',
+  'simple-player',
+  'test-nap',
+  'test-hfp',
+  'opp-client',
+  'ftp-client',
+  'pbap-client',
+  'map-client',
+  'example-advertisement',
+  'example-gatt-server',
+  'example-gatt-client',
+  'test-gatt-profile',
+  'test-mesh',
+  'agent.py'
+]
+
+install_data(
+  sources: test_scripts,
+  install_dir: pkglibdir / 'tests'
+)
diff --git a/tools/mesh/meson.build b/tools/mesh/meson.build
new file mode 100644
index 000000000000..85bfb00977f3
--- /dev/null
+++ b/tools/mesh/meson.build
@@ -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
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 000000000000..59e4f7d52824
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,339 @@
+tools_man_pages = []
+
+if get_option('logger')
+  executable('btmon-logger',
+    [ 'btmon-logger.c' ],
+    dependencies: libshared_mainloop_dep,
+    include_directories: '../lib/',
+    install_dir: pkglibexecdir
+  )
+
+  if get_option('systemd')
+    configure_file(
+      input: 'bluetooth-logger.service.in',
+      output: 'bluetooth-logger.service',
+      configuration: service_in,
+      install: true,
+      install_dir: systemdsystemunitdir
+    )
+  endif
+endif
+
+executable('3dsp',
+  sources: '3dsp.c',
+  dependencies: libshared_mainloop_dep
+)
+
+tester_tools = [
+  'mgmt',
+  'mesh',
+  'l2cap',
+  'rfcomm',
+  'bnep',
+  'smp',
+  'gap',
+  'sco',
+  'userchan',
+  'iso',
+  'ioctl',
+  'hci'
+]
+
+if get_option('tests')
+  foreach tool: tester_tools
+    executable(tool + '-tester',
+      sources: [ tool + '-tester.c', emulator_sources ],
+      dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, libgdbus_internal_dep, glib_dep ]
+    )
+  endforeach
+endif
+
+if get_option('btpclient')
+  executable('btpclient',
+    sources: [ 'btpclient.c', '../src/shared/btp.c' ],
+    include_directories: '..',
+    dependencies: [ libbluetooth_internal_dep, libshared_ell_dep ],
+  )
+  executable('btpclientctl',
+    sources: [ 'btpclientctl.c', '../client/display.c' ],
+    dependencies: [
+      libshared_mainloop_dep,
+      libshared_glib_dep,
+      libbluetooth_internal_dep,
+      readline_dep
+    ]
+  )
+endif
+
+if get_option('hid2hci')
+  executable('hid2hci',
+    sources: 'hid2hci.c',
+    dependencies: udevlib_dep,
+    install: true,
+    install_dir: udevdir
+  )
+  install_data('hid2hci.rules',
+    install_dir: udevdir / 'rules.d',
+    rename: '97-hid2hci.rules'
+  )
+  if get_option('manpages').enabled()
+    tools_man_pages += 'hid2hci.1'
+  endif
+endif
+
+tools_names = [
+  'avinfo',
+  'avtest',
+  'scotest',
+  'hwdb',
+  'hcieventmask',
+  'btinfo',
+  'btconfig',
+  'btsnoop',
+  'btproxy',
+  'cltest',
+  'oobtest',
+  'advtest',
+  'seq2bseq',
+  'nokfw',
+  'rtlfw',
+  'create-image',
+  'eddystone',
+  'ibeacon',
+]
+
+inst_tools_names = [
+  'rctest',
+  'l2test',
+  'l2ping',
+  'bluemoon',
+  'hex2hcd',
+  'mpris-proxy',
+  'btattach',
+  'isotest'
+]
+
+if get_option('tools')
+  foreach tool: tools_names
+    executable(tool,
+      sources: tool + '.c',
+      dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep ]
+    )
+  endforeach
+
+  foreach tool: inst_tools_names
+    executable(tool,
+      sources: tool + '.c',
+      dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, libgdbus_internal_dep, dbus_dep, glib_dep ],
+      install: true
+    )
+  endforeach
+
+  if get_option('manpages').enabled()
+    tools_man_pages += [
+      'rctest.1',
+      'l2ping.1',
+      'btattach.1',
+      'isotest.1',
+      'btmgmt.1',
+    ]
+  endif
+
+  executable('bdaddr',
+    sources: [ 'bdaddr.c', '../src/oui.c' ],
+    dependencies: [ libbluetooth_internal_dep, udevlib_dep ]
+  )
+  executable('btiotest',
+    sources: [ 'btiotest.c', btio_sources ],
+    dependencies: [ libbluetooth_internal_dep, glib_dep ]
+  )
+  executable('mcaptest',
+    sources: [ 'mcaptest.c', btio_sources, '../src/log.c', '../profiles/health/mcap.c' ],
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, glib_dep ]
+  )
+  executable('bneptest',
+    sources: [ 'bneptest.c', btio_sources, '../src/log.c', '../profiles/network/bnep.c' ],
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, glib_dep ]
+  )
+  executable('btgatt-client',
+    sources: [ 'btgatt-client.c', '../src/uuid-helper.c' ],
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep ]
+  )
+  executable('btgatt-server',
+    sources: [ 'btgatt-server.c', '../src/uuid-helper.c' ],
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep ]
+  )
+  executable('gatt-service',
+    sources: 'gatt-service.c',
+    dependencies: [ libbluetooth_internal_dep, libshared_mainloop_dep, glib_dep, libgdbus_internal_dep, udevlib_dep ]
+  )
+
+  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 ]
+    )
+    executable('obex-client-tool',
+      sources: [ 'obex-client-tool.c', gobex_sources, btio_sources ],
+      dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, readline_dep, glib_dep ]
+    )
+    executable('obex-server-tool',
+      sources: [ 'obex-server-tool.c', gobex_sources, btio_sources ],
+      dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, glib_dep ]
+    )
+    executable('bluetooth-player',
+      sources: [ 'bluetooth-player.c', '../client/print.c', '../client/player.c' ],
+      dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, libgdbus_internal_dep, readline_dep ]
+    )
+    executable('obexctl',
+      sources: [ 'obexctl.c' ],
+      dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, libgdbus_internal_dep, readline_dep ]
+    )
+    if get_option('mesh').enabled()
+      executable('mesh-cfgtest',
+        sources: 'mesh-cfgtest.c',
+        dependencies: [ libbluetooth_internal_dep, dbus_dep, ell_dep ],
+        include_directories: '..',
+        install: true
+      )
+      if get_option('deprecated')
+        executable('meshctl',
+          sources: [
+            'meshctl.c',
+            'mesh/agent.c',
+            'mesh-gatt/node.c',
+            'mesh-gatt/gatt.c',
+            'mesh-gatt/crypto.c',
+            'mesh-gatt/net.c',
+            'mesh-gatt/prov.c',
+            'mesh-gatt/util.c',
+            'mesh-gatt/prov-db.c',
+            'mesh-gatt/config-client.c',
+            'mesh-gatt/config-server.c',
+            'mesh-gatt/onoff-model.c'
+            ],
+          dependencies: [
+            libgdbus_internal_dep,
+            libshared_glib_dep,
+            libbluetooth_internal_dep,
+            glib_dep,
+            dbus_dep,
+            jsonc_dep,
+            readline_dep
+            ],
+          install: true
+        )
+      endif
+    endif
+  endif
+
+  if get_option('deprecated')
+    executable('gatttool',
+      sources: gatttool_sources,
+      dependencies: [ libbluetooth_internal_dep, libshared_glib_dep, readline_dep ],
+    )
+    executable('hciattach',
+      sources: [
+        'hciattach.c',
+        'hciattach_st.c',
+        'hciattach_ti.c',
+        'hciattach_tialt.c',
+        'hciattach_ath3k.c',
+        'hciattach_qualcomm.c',
+        'hciattach_intel.c',
+        'hciattach_bcm43xx.c'
+      ],
+      dependencies: libbluetooth_internal_dep,
+      install: true
+    )
+    executable('hcidump',
+      sources: [
+        'hcidump.c',
+        'parser/parser.c',
+        'parser/lmp.c',
+        'parser/hci.c',
+        'parser/l2cap.c',
+        'parser/smp.c',
+        'parser/att.c',
+        'parser/sdp.c',
+        'parser/rfcomm.c',
+        'parser/bnep.c',
+        'parser/cmtp.c',
+        'parser/hidp.c',
+        'parser/hcrp.c',
+        'parser/avdtp.c',
+        'parser/avctp.c',
+        'parser/avrcp.c',
+        'parser/sap.c',
+        'parser/obex.c',
+        'parser/capi.c',
+        'parser/ppp.c',
+        'parser/tcpip.c',
+        'parser/ericsson.c',
+        'parser/csr.c',
+        'parser/bpa.c'
+      ],
+      dependencies: libbluetooth_internal_dep,
+      install: true
+    )
+    executable('hcitool',
+      sources: [ 'hcitool.c', '../src/oui.c' ],
+      dependencies: [ libbluetooth_internal_dep, udevlib_dep ],
+      install: true
+    )
+    executable('sdptool',
+      sources: [ 'sdptool.c', '../src/sdp-xml.c' ],
+      dependencies: [ libbluetooth_internal_dep, glib_dep ],
+      install: true
+    )
+    deprecated_tools = [
+      'ciptool',
+      'hciconfig',
+      'rfcomm'
+    ]
+    foreach tool: deprecated_tools
+      executable(tool,
+        sources: tool + '.c',
+        dependencies: libbluetooth_internal_dep,
+        install: true
+      )
+    endforeach
+
+    if get_option('manpages').enabled()
+      tools_man_pages += [
+        'hciattach.1',
+        'hciconfig.1',
+        'hcitool.1',
+        'hcidump.1',
+        'rfcomm.1',
+        'sdptool.1',
+        'ciptool.1',
+      ]
+    endif
+  endif
+
+  if get_option('systemd')
+    configure_file(
+      input: 'mpris-proxy.service.in',
+      output: 'mpris-proxy.service',
+      configuration: service_in,
+      install: true,
+      install_dir: systemduserunitdir
+    )
+  endif
+endif
+
+if get_option('mesh').enabled()
+  subdir('mesh')
+endif
+
+foreach man_page: tools_man_pages
+  man_page_name = man_page.substring(0, -2)
+  custom_target(man_page,
+    input: man_page_name + '.rst',
+    output: man_page,
+    command: rst2man_command,
+    install: true,
+    install_dir: get_option('mandir') / 'man1'
+  )
+endforeach
diff --git a/tools/mpris-proxy.service.in b/tools/mpris-proxy.service.in
index 6ae56c6720b9..a55f0254014a 100644
--- a/tools/mpris-proxy.service.in
+++ b/tools/mpris-proxy.service.in
@@ -8,7 +8,7 @@ ConditionUser=!@system
 
 [Service]
 Type=simple
-ExecStart=@PKGBINDIR@/mpris-proxy
+ExecStart=@PKGLIBEXECDIR@/mpris-proxy
 
 [Install]
 WantedBy=default.target
diff --git a/unit/meson.build b/unit/meson.build
new file mode 100644
index 000000000000..e416c19758f7
--- /dev/null
+++ b/unit/meson.build
@@ -0,0 +1,114 @@
+
+tests1 = [
+  [ 'test-tester.c' ],
+  [ 'test-uuid.c' ],
+  [ 'test-eir.c', '../src/eir.c', '../src/uuid-helper.c' ],
+  [ 'test-sdp.c', '../src/sdpd-database.c', '../src/log.c', '../src/sdpd-service.c', '../src/sdpd-request.c' ],
+  [ 'test-avrcp.c', '../src/log.c', 'avctp.c', 'avrcp-lib.c' ],
+  [ 'test-lib.c' ],
+  [ 'test-gatt.c' ],
+  [ 'test-bap.c' ],
+  [ 'test-micp.c' ],
+  [ 'test-bass.c' ],
+  [ 'test-vcp.c' ],
+  [ 'test-hog.c',
+    btio_sources,
+    '../profiles/input/hog-lib.c',
+    '../profiles/scanparam/scpp.c',
+    '../profiles/battery/bas.c',
+    '../profiles/deviceinfo/dis.c',
+    '../src/log.c',
+    '../attrib/att.c',
+    '../attrib/gatt.c',
+    '../attrib/gattrib.c'
+  ],
+]
+
+foreach t: tests1
+  test_name = t[0].substring(0, -2)
+  exe = executable(test_name,
+    sources: t,
+    dependencies: [ libshared_glib_dep, libbluetooth_internal_dep ],
+  )
+  test(test_name, exe)
+endforeach
+
+tests2 = [
+  [ 'test-textfile.c', '../src/textfile.c' ],
+  [ 'test-crc.c', '../monitor/crc.c' ],
+  [ 'test-crypto.c' ],
+  [ 'test-ecc.c' ],
+  [ 'test-ringbuf.c' ],
+  [ 'test-queue.c' ],
+  [ 'test-mgmt.c' ],
+  [ 'test-uhid.c' ],
+  [ 'test-hfp.c' ],
+  [ 'test-avdtp.c', '../src/log.c', 'avdtp.c' ],
+  [ 'test-avctp.c', '../src/log.c', 'avctp.c' ],
+]
+
+if get_option('obex').enabled()
+  tests2 += [
+    [ 'test-gobex.c', 'util.c', gobex_sources ],
+    [ 'test-gobex-packet.c', 'util.c', gobex_sources ],
+    [ 'test-gobex-header.c', 'util.c', gobex_sources ],
+    [ 'test-gobex-transfer.c', 'util.c', gobex_sources ],
+    [ 'test-gobex-apparam.c', 'util.c', gobex_sources ],
+  ]
+endif
+
+foreach t: tests2
+  test_name = t[0].substring(0, -2)
+  exe = executable(test_name,
+    sources: t,
+    c_args: [ '-DSTORAGEDIR="@0"'.format(storagedir) ],
+    include_directories: '../lib',
+    dependencies: libshared_glib_dep
+  )
+  test(test_name, exe)
+endforeach
+
+exe = executable('test-gdbus-client',
+  sources: 'test-gdbus-client.c',
+  dependencies: [ libgdbus_internal_dep, libshared_glib_dep ]
+)
+dbus_run_session = find_program('dbus-run-session')
+if dbus_run_session.found()
+  test('test-gdbus-client', dbus_run_session, args: '--', exe)
+else
+  test('test-gdbus-client', exe)
+endif
+
+exe = executable('test-gattrib',
+  sources: [ 'test-gattrib.c', '../attrib/gattrib.c', btio_sources, '../src/log.c' ],
+  dependencies: [ libshared_glib_dep, libbluetooth_internal_dep ]
+)
+test('test-gattrib', exe)
+
+if get_option('midi').enabled()
+  exe = executable('test-midi',
+    sources: [ 'test-midi.c', '../profiles/midi/libmidi.c' ],
+    c_args: [ '-DMIDI_TEST' ],
+    dependencies: [ libshared_glib_dep, alsa_dep ]
+  )
+  test('test-midi', exe)
+endif
+
+if get_option('mesh').enabled()
+  exe = executable('test-mesh-crypto',
+    sources: [ 'test-mesh-crypto.c' ],
+    dependencies: [ ell_dep ]
+  )
+  test('test-mesh-crypto', exe)
+endif
+
+add_test_setup(
+  'valgrind',
+  exe_wrapper: [
+    'valgrind', '--quiet', '--leak-check=full', '--trace-children=yes',
+    '--suppressions=@0@'.format(meson.current_source_dir() / 'valgrind.supp'),
+    '--num-callers=30', '--show-reachable=no', '--error-exitcode=1',
+  ],
+  # default timeout in meson is 30s
+  timeout_multiplier: 4,
+)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 03/10] build: Make more use of 'feature' options
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 01/10] build: Add meson wrap for libell Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 02/10] " Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 04/10] build: Separate systemd and libsystemd dependencies Bastien Nocera
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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(-)

diff --git a/client/meson.build b/client/meson.build
index 52397d1e17de..77bc9c5d9473 100644
--- a/client/meson.build
+++ b/client/meson.build
@@ -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,
diff --git a/emulator/meson.build b/emulator/meson.build
index 59c72c4dbd4d..bc038becc567 100644
--- a/emulator/meson.build
+++ b/emulator/meson.build
@@ -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',
diff --git a/lib/meson.build b/lib/meson.build
index f31c8c3a58c5..aac809ab1c70 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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',
diff --git a/mesh/meson.build b/mesh/meson.build
index 8c6f5631a9db..5b8fd2e6a94f 100644
--- a/mesh/meson.build
+++ b/mesh/meson.build
@@ -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',
diff --git a/meson.build b/meson.build
index 653359841d2c..25a5bb780edc 100644
--- a/meson.build
+++ b/meson.build
@@ -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
diff --git a/meson_options.txt b/meson_options.txt
index 2d9231b120ca..aae4f377f0a2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,18 +1,18 @@
-option('valgrind', type: 'boolean', value: false, description: 'Enable valgrind memory checks')
-option('backtrace', type: 'boolean', value: false, description: 'Enable backtrace support')
-option('library', type: 'boolean', value: true, description: 'Install Bluetooth library')
-option('examples', type: 'boolean', value: false, description: 'Enable test/example scripts')
-option('tests', type: 'boolean', value: false, description: 'Enable testing tools')
-option('tools', type: 'boolean', value: true, description: 'Enable Bluetooth tools')
-option('monitor', type: 'boolean', value: true, description: 'Enable Bluetooth monitor')
+option('valgrind', type: 'feature', value: 'disabled', description: 'Enable valgrind memory checks')
+option('backtrace', type: 'feature', value: 'disabled', description: 'Enable backtrace support')
+option('library', type: 'feature', value: 'enabled', description: 'Install Bluetooth library')
+option('examples', type: 'feature', value: 'auto', description: 'Enable test/example scripts')
+option('tests', type: 'feature', value: 'auto', description: 'Enable testing tools')
+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: 'boolean', value: true, description: 'Enable systemd integration')
+option('systemd', type: 'feature', value: 'enabled', description: 'Enable systemd integration')
 option('udev', type: 'feature', value: 'enabled', description: 'Enable udev device support')
-option('datafiles', type: 'boolean', value: true, description: 'Install configuration and data files')
+option('datafiles', type: 'feature', value: 'enabled', description: 'Install configuration and data files')
 option('manpages', type: 'feature', value: 'auto', description: 'Enable building of manual pages')
-option('experimental', type: 'boolean', value: false, description: 'Enable experimental tools')
-option('deprecated', type: 'boolean', value: false, description: 'Enable deprecated tools')
-option('external-plugins', type: 'boolean', value: true, description: 'Enable support for external plugins')
+option('experimental', type: 'feature', value: 'disabled', description: 'Enable experimental tools')
+option('deprecated', type: 'feature', value: 'disabled', description: 'Enable deprecated tools')
+option('external-plugins', type: 'feature', value: 'enabled', description: 'Enable support for external plugins')
 
 option('dbusconfdir', type: 'string', value: '', description: 'D-Bus configuration directory')
 option('dbussystembusdir', type: 'string', value: '', description: 'D-Bus system bus services dir')
@@ -23,29 +23,29 @@ option('zsh-completion-dir', type:'string', value: '', description: 'Path to ins
 option('udevdir', type: 'string', value: '', description: 'udev directory')
 option('cups_serverbin', type: 'string', value: '', description: 'CUPS directory')
 
-option('nfc', type: 'boolean', value: false, description: 'Enable NFC pairing')
-option('sap', type: 'boolean', value: false, description: 'Enable SAP profile')
-option('a2dp', type: 'boolean', value: true, description: 'Enable A2DP profile')
-option('avrcp', type: 'boolean', value: true, description: 'Enable AVRCP profile')
-option('network', type: 'boolean', value: true, description: 'Enable network profiles')
-option('hid', type: 'boolean', value: true, description: 'Enable HID profile')
-option('hog', type: 'boolean', value: true, description: 'Enable HoG profile')
-option('health', type: 'boolean', value: false, description: 'Enable health profiles')
-option('bap', type: 'boolean', value: true, description: 'Enable BAP profile')
-option('bass', type: 'boolean', value: true, description: 'Enable BASS service')
-option('mcp', type: 'boolean', value: true, description: 'Enable MCP profile')
-option('ccp', type: 'boolean', value: true, description: 'Enable CCP profile')
-option('vcp', type: 'boolean', value: true, description: 'Enable VCP profile')
-option('micp', type: 'boolean', value: true, description: 'Enable MICP profile')
-option('csip', type: 'boolean', value: true, description: 'Enable CSIP profile')
-option('asha', type: 'boolean', value: true, description: 'Enable ASHA support')
+option('nfc', type: 'feature', value: 'disabled', description: 'Enable NFC pairing')
+option('sap', type: 'feature', value: 'disabled', description: 'Enable SAP profile')
+option('a2dp', type: 'feature', value: 'auto', description: 'Enable A2DP profile')
+option('avrcp', type: 'feature', value: 'auto', description: 'Enable AVRCP profile')
+option('network', type: 'feature', value: 'auto', description: 'Enable network profiles')
+option('hid', type: 'feature', value: 'auto', description: 'Enable HID profile')
+option('hog', type: 'feature', value: 'auto', description: 'Enable HoG profile')
+option('health', type: 'feature', value: 'disabled', description: 'Enable health profiles')
+option('bap', type: 'feature', value: 'auto', description: 'Enable BAP profile')
+option('bass', type: 'feature', value: 'auto', description: 'Enable BASS service')
+option('mcp', type: 'feature', value: 'auto', description: 'Enable MCP profile')
+option('ccp', type: 'feature', value: 'auto', description: 'Enable CCP profile')
+option('vcp', type: 'feature', value: 'auto', description: 'Enable VCP profile')
+option('micp', type: 'feature', value: 'auto', description: 'Enable MICP profile')
+option('csip', type: 'feature', value: 'auto', description: 'Enable CSIP profile')
+option('asha', type: 'feature', value: 'auto', description: 'Enable ASHA support')
 option('cups', type: 'feature', value: 'auto', description: 'Enable CUPS printer support')
 option('mesh', type: 'feature', value: 'auto', description: 'Enable Mesh profile support')
 option('midi', type: 'feature', value: 'auto', description: 'Enable MIDI support')
 option('obex', type: 'feature', value: 'auto', description: 'Enable OBEX profile support')
-option('btpclient', type: 'boolean', value: true, description: 'Enable BTP client')
-option('sixaxis', type: 'boolean', value: true, description: 'Enable sixaxis plugin')
-option('hid2hci', type: 'boolean', value: true, description: 'Enable hid2hci tool')
-option('logger', type: 'boolean', value: false, description: 'Enable HCI logger service')
-option('admin', type: 'boolean', value: true, description: 'Enable admin policy plugin')
+option('btpclient', type: 'feature', value: 'auto', description: 'Enable BTP client')
+option('sixaxis', type: 'feature', value: 'auto', description: 'Enable sixaxis plugin')
+option('hid2hci', type: 'feature', value: 'auto', description: 'Enable hid2hci tool')
+option('logger', type: 'feature', value: 'disabled', description: 'Enable HCI logger service')
+option('admin', type: 'feature', value: 'auto', description: 'Enable admin policy plugin')
 option('phonebook', type: 'combo', choices: [ 'dummy', 'ebook' ], value: 'dummy', description: 'Obexd phonebook plugin')
diff --git a/monitor/meson.build b/monitor/meson.build
index ad78e176d978..4f9a764167be 100644
--- a/monitor/meson.build
+++ b/monitor/meson.build
@@ -36,7 +36,7 @@ executable('btmon',
   install: true
 )
 
-if get_option('manpages').enabled()
+if rst2man.found()
   custom_target(
     input: 'btmon.rst',
     output: 'btmon.1',
diff --git a/obexd/meson.build b/obexd/meson.build
index cb658b24ed08..30952590f54d 100644
--- a/obexd/meson.build
+++ b/obexd/meson.build
@@ -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,
diff --git a/peripheral/meson.build b/peripheral/meson.build
index 21d6296829ea..31e5435763ef 100644
--- a/peripheral/meson.build
+++ b/peripheral/meson.build
@@ -1,4 +1,4 @@
-if get_option('tests')
+if get_option('tests').enabled()
   executable('btsensor',
     sources: [
       'main.c',
diff --git a/plugins/meson.build b/plugins/meson.build
index 019e7083df16..5485ef8eca44 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -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
diff --git a/profiles/meson.build b/profiles/meson.build
index 8ac37b9e6cc8..656126b67efa 100644
--- a/profiles/meson.build
+++ b/profiles/meson.build
@@ -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',
diff --git a/src/meson.build b/src/meson.build
index a2aaad756b10..f7e144b346c3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -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',
diff --git a/tools/mesh/meson.build b/tools/mesh/meson.build
index 85bfb00977f3..eb4039909b5c 100644
--- a/tools/mesh/meson.build
+++ b/tools/mesh/meson.build
@@ -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',
diff --git a/tools/meson.build b/tools/meson.build
index 59e4f7d52824..5e73b048c118 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -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',
diff --git a/unit/meson.build b/unit/meson.build
index e416c19758f7..9059f2e15074 100644
--- a/unit/meson.build
+++ b/unit/meson.build
@@ -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' ],
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 04/10] build: Separate systemd and libsystemd dependencies
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (2 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 03/10] build: Make more use of 'feature' options Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 05/10] tools: Install gatttool if deprecated tools are enabled Bastien Nocera
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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(-)

diff --git a/meson.build b/meson.build
index 25a5bb780edc..5fce108e4317 100644
--- a/meson.build
+++ b/meson.build
@@ -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(),
diff --git a/meson_options.txt b/meson_options.txt
index aae4f377f0a2..6a39e2ceabec 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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')
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 05/10] tools: Install gatttool if deprecated tools are enabled
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (3 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 04/10] build: Separate systemd and libsystemd dependencies Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 06/10] tools: Install avinfo tool by default Bastien Nocera
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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(+)

diff --git a/tools/meson.build b/tools/meson.build
index 5e73b048c118..3e8f7ad439dd 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -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: [
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 06/10] tools: Install avinfo tool by default
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (4 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 05/10] tools: Install gatttool if deprecated tools are enabled Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 07/10] tools: Install btmgmt along with other tools Bastien Nocera
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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(-)

diff --git a/tools/meson.build b/tools/meson.build
index 3e8f7ad439dd..66156ab0224b 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -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',
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 07/10] tools: Install btmgmt along with other tools
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (5 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 06/10] tools: Install avinfo tool by default Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 08/10] emulator: Install the emulator if built Bastien Nocera
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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(-)

diff --git a/tools/meson.build b/tools/meson.build
index 66156ab0224b..9ca76079325e 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -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 ],
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 08/10] emulator: Install the emulator if built
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (6 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 07/10] tools: Install btmgmt along with other tools Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 09/10] build: Add option to allow disabling bluetoothd Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 10/10] build: Add License field to pkg-config file Bastien Nocera
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

It's useful for testing.
---
 emulator/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/emulator/meson.build b/emulator/meson.build
index bc038becc567..55d77e40319d 100644
--- a/emulator/meson.build
+++ b/emulator/meson.build
@@ -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',
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 09/10] build: Add option to allow disabling bluetoothd
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (7 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 08/10] emulator: Install the emulator if built Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:40 ` [PATCH BlueZ v3 10/10] build: Add License field to pkg-config file Bastien Nocera
  9 siblings, 0 replies; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

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(-)

diff --git a/meson.build b/meson.build
index 5fce108e4317..c429864b9c8b 100644
--- a/meson.build
+++ b/meson.build
@@ -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
diff --git a/meson_options.txt b/meson_options.txt
index 6a39e2ceabec..9e9587f3ef6e 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')
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH BlueZ v3 10/10] build: Add License field to pkg-config file
  2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
                   ` (8 preceding siblings ...)
  2025-10-08 10:40 ` [PATCH BlueZ v3 09/10] build: Add option to allow disabling bluetoothd Bastien Nocera
@ 2025-10-08 10:40 ` Bastien Nocera
  2025-10-08 10:50   ` [BlueZ,v3,10/10] " bluez.test.bot
  9 siblings, 1 reply; 13+ messages in thread
From: Bastien Nocera @ 2025-10-08 10:40 UTC (permalink / raw)
  To: linux-bluetooth

And require a much newer version of meson.
---
 lib/meson.build | 1 +
 meson.build     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/meson.build b/lib/meson.build
index aac809ab1c70..a0bc18bc0654 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -39,6 +39,7 @@ if get_option('library').enabled()
     description: 'Bluetooth protocol stack for Linux',
     version: meson.project_version(),
     libraries: lib_bluetooth,
+    license: 'GPL-2.0-or-later'
   )
 endif
 
diff --git a/meson.build b/meson.build
index c429864b9c8b..05efc4141d97 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
   'bluez', 'c',
   version: '5.83',
   license: 'LGPL-2.1-or-later AND GPL-2.0-or-later',
-  meson_version: '>= 1.3.0'
+  meson_version: '>= 1.9.0'
 )
 
 datadir = get_option('datadir')
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [BlueZ,v3,10/10] build: Add License field to pkg-config file
  2025-10-08 10:40 ` [PATCH BlueZ v3 10/10] build: Add License field to pkg-config file Bastien Nocera
@ 2025-10-08 10:50   ` bluez.test.bot
  0 siblings, 0 replies; 13+ messages in thread
From: bluez.test.bot @ 2025-10-08 10:50 UTC (permalink / raw)
  To: linux-bluetooth, hadess

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: lib/meson.build: does not exist in index
error: meson.build: does not exist in index
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: build: Add meson build system
  2025-10-08 10:40 ` [PATCH BlueZ v3 01/10] build: Add meson wrap for libell Bastien Nocera
@ 2025-10-08 12:17   ` bluez.test.bot
  0 siblings, 0 replies; 13+ messages in thread
From: bluez.test.bot @ 2025-10-08 12:17 UTC (permalink / raw)
  To: linux-bluetooth, hadess

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

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=1009338

---Test result---

Test Summary:
CheckPatch                    PENDING   0.31 seconds
GitLint                       PENDING   0.30 seconds
BuildEll                      PASS      19.92 seconds
BluezMake                     PASS      2675.00 seconds
MakeCheck                     PASS      19.91 seconds
MakeDistcheck                 PASS      182.81 seconds
CheckValgrind                 PASS      235.15 seconds
CheckSmatch                   PASS      306.36 seconds
bluezmakeextell               PASS      127.95 seconds
IncrementalBuild              PENDING   0.30 seconds
ScanBuild                     PASS      907.15 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-10-08 12:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 10:40 [PATCH BlueZ v3 00/10] build: Add meson build system Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 01/10] build: Add meson wrap for libell Bastien Nocera
2025-10-08 12:17   ` build: Add meson build system bluez.test.bot
2025-10-08 10:40 ` [PATCH BlueZ v3 02/10] " Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 03/10] build: Make more use of 'feature' options Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 04/10] build: Separate systemd and libsystemd dependencies Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 05/10] tools: Install gatttool if deprecated tools are enabled Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 06/10] tools: Install avinfo tool by default Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 07/10] tools: Install btmgmt along with other tools Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 08/10] emulator: Install the emulator if built Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 09/10] build: Add option to allow disabling bluetoothd Bastien Nocera
2025-10-08 10:40 ` [PATCH BlueZ v3 10/10] build: Add License field to pkg-config file Bastien Nocera
2025-10-08 10:50   ` [BlueZ,v3,10/10] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox