summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bus/legacy-config/meson.build35
-rw-r--r--bus/meson.build179
-rw-r--r--bus/systemd-user/meson.build33
-rw-r--r--bus/sysusers.d/meson.build26
-rw-r--r--bus/tmpfiles.d/meson.build26
-rw-r--r--cmake/meson.build43
-rw-r--r--dbus/meson.build231
-rw-r--r--doc/maintainer-upload-docs.sh41
-rw-r--r--doc/meson.build247
-rw-r--r--doc/meson_post_install.py44
-rw-r--r--meson.build1056
-rw-r--r--meson_options.txt276
-rwxr-xr-xmeson_post_install.py118
-rw-r--r--meson_post_install_systemd.py54
-rwxr-xr-xtest/data/copy_data_for_tests.py34
-rw-r--r--test/data/meson.build204
-rw-r--r--test/meson.build604
-rw-r--r--test/meta_template.test.in4
-rw-r--r--test/name-test/meson.build79
-rwxr-xr-xtest/name-test/run-test-systemserver.sh11
-rwxr-xr-xtest/name-test/run-test.sh10
-rwxr-xr-xtools/build-timestamp.py24
-rw-r--r--tools/disable-uac.rc1
-rw-r--r--tools/meson.build107
24 files changed, 3481 insertions, 6 deletions
diff --git a/bus/legacy-config/meson.build b/bus/legacy-config/meson.build
new file mode 100644
index 00000000..8d3a2b91
--- /dev/null
+++ b/bus/legacy-config/meson.build
@@ -0,0 +1,35 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+if platform_unix
+ configure_file(
+ input: 'system.conf.in',
+ output: 'system.conf',
+ configuration: data_config,
+ install_dir: get_option('sysconfdir') / 'dbus-1',
+ )
+endif
+
+configure_file(
+ input: 'session.conf.in',
+ output: 'session.conf',
+ configuration: data_config,
+ install_dir: get_option('sysconfdir') / 'dbus-1',
+)
diff --git a/bus/meson.build b/bus/meson.build
new file mode 100644
index 00000000..1d7d7ce6
--- /dev/null
+++ b/bus/meson.build
@@ -0,0 +1,179 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+session_conf = configure_file(
+ input: 'session.conf.in',
+ output: 'session.conf',
+ configuration: data_config,
+ install_dir: get_option('datadir') / 'dbus-1',
+)
+
+if platform_unix
+ configure_file(
+ input: 'system.conf.in',
+ output: 'system.conf',
+ configuration: data_config,
+ install_dir: get_option('datadir') / 'dbus-1',
+ )
+endif
+
+configure_file(
+ input: 'example-system-enable-stats.conf.in',
+ output: 'example-system-enable-stats.conf',
+ configuration: data_config,
+ install_dir: get_option('datadir') / 'doc' / 'dbus' / 'examples',
+)
+
+configure_file(
+ input: 'example-session-disable-stats.conf.in',
+ output: 'example-session-disable-stats.conf',
+ configuration: data_config,
+ install_dir: get_option('datadir') / 'doc' / 'dbus' / 'examples',
+)
+
+if use_launchd
+ configure_file(
+ input: 'org.freedesktop.dbus-session.plist.in',
+ output: 'org.freedesktop.dbus-session.plist',
+ configuration: data_config,
+ install_dir: launchd_agent_dir,
+ )
+endif
+
+if use_systemd
+ configure_file(
+ input: 'dbus.service.in',
+ output: 'dbus.service',
+ configuration: data_config,
+ install_dir: systemd_system_unitdir,
+ )
+ configure_file(
+ input: 'dbus.socket.in',
+ output: 'dbus.socket',
+ configuration: data_config,
+ install_dir: systemd_system_unitdir,
+ )
+ subdir('sysusers.d')
+ subdir('tmpfiles.d')
+
+ if enable_user_session
+ subdir('systemd-user')
+ endif
+endif
+
+subdir('legacy-config')
+
+
+libdbus_daemon_internal_sources = [
+ 'activation.c',
+ 'apparmor.c',
+ 'audit.c',
+ 'bus.c',
+ 'config-loader-expat.c',
+ 'config-parser-common.c',
+ 'config-parser.c',
+ 'connection.c',
+ 'containers.c',
+ 'desktop-file.c',
+ 'dispatch.c',
+ 'driver.c',
+ 'expirelist.c',
+ 'policy.c',
+ 'selinux.c',
+ 'services.c',
+ 'signals.c',
+ 'stats.c',
+ 'test.c',
+ 'utils.c',
+]
+
+if use_kqueue
+ libdbus_daemon_internal_sources += 'dir-watch-kqueue.c'
+elif use_inotify
+ libdbus_daemon_internal_sources += 'dir-watch-inotify.c'
+else
+ libdbus_daemon_internal_sources += 'dir-watch-default.c'
+endif
+
+libdbus_daemon_internal = static_library('dbus-daemon-internal',
+ libdbus_daemon_internal_sources,
+ include_directories: root_include,
+ dependencies: [
+ adt_libs,
+ apparmor,
+ expat,
+ network_libs,
+ selinux,
+ threads,
+ ],
+ link_with: [
+ libdbus,
+ libdbus_internal,
+ ],
+)
+
+dbus_daemon = executable('dbus-daemon',
+ 'main.c',
+ include_directories: root_include,
+ link_with: libdbus_daemon_internal,
+ install: true,
+)
+
+
+if platform_unix and use_traditional_activation
+ liblaunch_helper_internal_sources = [
+ 'config-loader-expat.c',
+ 'config-parser-common.c',
+ 'config-parser-trivial.c',
+ 'desktop-file.c',
+ 'utils.c',
+ ]
+ liblaunch_helper_internal = static_library('launch-helper-internal',
+ liblaunch_helper_internal_sources,
+ include_directories: root_include,
+ link_with: [
+ libdbus,
+ libdbus_internal,
+ ],
+ dependencies: [
+ expat,
+ network_libs,
+ threads,
+ ],
+ install: false,
+ )
+
+ dbus_daemon_launch_helper_sources = [
+ 'activation-helper.c',
+ 'activation-helper-bin.c',
+ ]
+
+ # This is the installed launch helper with the setuid checks
+ # All files that have special cases #ifdef ACTIVATION_LAUNCHER_TEST must
+ # be listed here and included in test/bus/launch-helper-for-tests.c,
+ # not in liblaunch_helper_internal.
+ dbus_daemon_launch_helper = executable('dbus-daemon-launch-helper',
+ dbus_daemon_launch_helper_sources,
+ include_directories: root_include,
+ link_with: liblaunch_helper_internal,
+ install: true,
+ install_dir: get_option('libexecdir'),
+ )
+endif
diff --git a/bus/systemd-user/meson.build b/bus/systemd-user/meson.build
new file mode 100644
index 00000000..dca415a4
--- /dev/null
+++ b/bus/systemd-user/meson.build
@@ -0,0 +1,33 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+configure_file(
+ input: 'dbus.service.in',
+ output: 'dbus.service',
+ configuration: data_config,
+ install_dir: systemd_user_unitdir,
+)
+
+configure_file(
+ input: 'dbus.socket.in',
+ output: 'dbus.socket',
+ configuration: data_config,
+ install_dir: systemd_user_unitdir,
+)
diff --git a/bus/sysusers.d/meson.build b/bus/sysusers.d/meson.build
new file mode 100644
index 00000000..452c547b
--- /dev/null
+++ b/bus/sysusers.d/meson.build
@@ -0,0 +1,26 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+configure_file(
+ input: 'dbus.conf.in',
+ output: 'dbus.conf',
+ configuration: data_config,
+ install_dir: get_option('prefix') / 'lib' / 'sysusers.d',
+)
diff --git a/bus/tmpfiles.d/meson.build b/bus/tmpfiles.d/meson.build
new file mode 100644
index 00000000..c19360da
--- /dev/null
+++ b/bus/tmpfiles.d/meson.build
@@ -0,0 +1,26 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+configure_file(
+ input: 'dbus.conf.in',
+ output: 'dbus.conf',
+ configuration: data_config,
+ install_dir: get_option('prefix') / 'lib' / 'tmpfiles.d',
+)
diff --git a/cmake/meson.build b/cmake/meson.build
new file mode 100644
index 00000000..799f5d24
--- /dev/null
+++ b/cmake/meson.build
@@ -0,0 +1,43 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+cmake_config = configuration_data()
+cmake_config.set('CMAKE_INSTALL_INCLUDEDIR',get_option('prefix') / get_option('includedir'))
+cmake_config.set('CMAKE_INSTALL_LIBDIR', get_option('prefix') / get_option('libdir'))
+cmake_config.set('DBUS_PREFIX', get_option('prefix'))
+cmake_config.set('DBUS_RELOCATABLE', relocation)
+cmake_config.set('DBUS_VERSION', version)
+
+cmake_files = [
+ configure_file(
+ input: 'DBus1Config.cmake.in',
+ output: 'DBus1Config.cmake',
+ configuration: cmake_config,
+ ),
+ configure_file(
+ input: 'DBus1ConfigVersion.cmake.in',
+ output: 'DBus1ConfigVersion.cmake',
+ configuration: cmake_config,
+ )
+]
+
+install_data(cmake_files,
+ install_dir: get_option('libdir') / 'cmake' / 'DBus1',
+)
diff --git a/dbus/meson.build b/dbus/meson.build
new file mode 100644
index 00000000..c06952f2
--- /dev/null
+++ b/dbus/meson.build
@@ -0,0 +1,231 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+dbus_dependencies = [
+ threads,
+ network_libs,
+ systemd,
+ valgrind,
+]
+
+# source code that goes in the installed client library
+# and is specific to library functionality
+dbus_lib_sources = [
+ 'dbus-address.c',
+ 'dbus-auth.c',
+ 'dbus-bus.c',
+ 'dbus-connection.c',
+ 'dbus-credentials.c',
+ 'dbus-errors.c',
+ 'dbus-keyring.c',
+ 'dbus-marshal-byteswap.c',
+ 'dbus-marshal-header.c',
+ 'dbus-marshal-recursive.c',
+ 'dbus-marshal-validate.c',
+ 'dbus-message.c',
+ 'dbus-misc.c',
+ 'dbus-nonce.c',
+ 'dbus-object-tree.c',
+ 'dbus-pending-call.c',
+ 'dbus-resources.c',
+ 'dbus-server-debug-pipe.c',
+ 'dbus-server-socket.c',
+ 'dbus-server.c',
+ 'dbus-sha.c',
+ 'dbus-signature.c',
+ 'dbus-syntax.c',
+ 'dbus-threads.c',
+ 'dbus-timeout.c',
+ 'dbus-transport-socket.c',
+ 'dbus-transport.c',
+ 'dbus-watch.c',
+]
+
+# source code that goes in the installed client library
+# AND is generic utility functionality used by the
+# daemon or test programs (all symbols in here should
+# be underscore-prefixed)
+
+dbus_shared_sources = [
+ 'dbus-dataslot.c',
+ 'dbus-file.c',
+ 'dbus-hash.c',
+ 'dbus-internals.c',
+ 'dbus-list.c',
+ 'dbus-marshal-basic.c',
+ 'dbus-memory.c',
+ 'dbus-mempool.c',
+ 'dbus-pipe.c',
+ 'dbus-string.c',
+ 'dbus-sysdeps.c',
+]
+
+if embedded_tests
+ dbus_shared_sources += 'dbus-test-tap.c'
+endif
+
+
+# source code that is generic utility functionality used
+# by the bus daemon or test apps, but is NOT included
+# in the D-Bus client library (all symbols in here
+# should be underscore-prefixed but don't really need
+# to be unless they move to DBUS_SHARED_SOURCES later)
+
+dbus_util_sources = [
+ 'dbus-asv-util.c',
+ 'dbus-mainloop.c',
+ 'dbus-message-util.c',
+ 'dbus-pollable-set-poll.c',
+ 'dbus-pollable-set.c',
+ 'dbus-shell.c',
+ 'dbus-string-util.c',
+ 'dbus-sysdeps-util.c',
+]
+
+if platform_windows
+ dbus_lib_sources += [
+ 'dbus-init-win.cpp',
+ 'dbus-server-win.c',
+ ]
+
+ dbus_lib_sources += windows.compile_resources(configure_file(
+ input: 'versioninfo.rc.in',
+ output: 'versioninfo.rc',
+ configuration: data_config,
+ ))
+
+ dbus_shared_sources += [
+ 'dbus-file-win.c',
+ 'dbus-pipe-win.c',
+ 'dbus-sysdeps-thread-win.c',
+ 'dbus-sysdeps-win.c',
+ 'dbus-transport-win.c',
+ ]
+
+ if platform_win32ce
+ dbus_shared_sources += 'dbus-sysdeps-wince-glue.c'
+ endif
+
+ dbus_util_sources += 'dbus-sysdeps-util-win.c'
+
+ if use_traditional_activation
+ dbus_util_sources += 'dbus-spawn-win.c'
+ endif
+
+else # Unix
+
+ dbus_lib_sources += [
+ 'dbus-uuidgen.c',
+ 'dbus-server-unix.c',
+ ]
+
+ dbus_shared_sources += [
+ 'dbus-file-unix.c',
+ 'dbus-pipe-unix.c',
+ 'dbus-sysdeps-pthread.c',
+ 'dbus-sysdeps-unix.c',
+ 'dbus-transport-unix.c',
+ 'dbus-userdb.c',
+ ]
+
+ if use_launchd
+ dbus_shared_sources += 'dbus-server-launchd.c'
+ endif
+
+ dbus_util_sources += [
+ 'dbus-sysdeps-util-unix.c',
+ 'dbus-userdb-util.c',
+ ]
+
+ if use_traditional_activation
+ dbus_util_sources += 'dbus-spawn-unix.c'
+ endif
+
+endif
+
+
+if use_linux_epoll
+ dbus_util_sources += 'dbus-pollable-set-epoll.c'
+endif
+
+version_script = configure_file(
+ input: 'Version.in',
+ output: 'version_script',
+ configuration: data_config,
+)
+
+version_flags = '-Wl,--version-script,@0@'.format(version_script)
+if not cc.has_link_argument(version_flags)
+ version_flags = []
+endif
+
+libdbus = library('dbus-1',
+ dbus_lib_sources,
+ dbus_shared_sources,
+
+ include_directories: root_include,
+ c_args: '-Ddbus_1_EXPORTS',
+
+ link_args: version_flags,
+ soversion: soversion,
+ version: version_info,
+
+ dependencies: dbus_dependencies,
+ install: true,
+)
+
+libdbus_internal = static_library('dbus-internal',
+ dbus_util_sources,
+
+ include_directories: root_include,
+ link_with: libdbus,
+ dependencies: dbus_dependencies,
+)
+
+
+install_headers(
+ 'dbus-address.h',
+ 'dbus-bus.h',
+ 'dbus-connection.h',
+ 'dbus-errors.h',
+ 'dbus-macros.h',
+ 'dbus-memory.h',
+ 'dbus-message.h',
+ 'dbus-misc.h',
+ 'dbus-pending-call.h',
+ 'dbus-protocol.h',
+ 'dbus-server.h',
+ 'dbus-shared.h',
+ 'dbus-signature.h',
+ 'dbus-syntax.h',
+ 'dbus-threads.h',
+ 'dbus-types.h',
+ 'dbus.h',
+ subdir: 'dbus-1.0' / 'dbus',
+)
+
+dbus_arch_deps_h = configure_file(
+ input: 'dbus-arch-deps.h.in',
+ output: 'dbus-arch-deps.h',
+ configuration: arch_config,
+)
+install_data(dbus_arch_deps_h,
+ install_dir: get_option('libdir') / 'dbus-1.0' / 'include' / 'dbus',
+)
diff --git a/doc/maintainer-upload-docs.sh b/doc/maintainer-upload-docs.sh
new file mode 100644
index 00000000..373315c0
--- /dev/null
+++ b/doc/maintainer-upload-docs.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+set -ex
+
+DOC_SERVER=dbus.freedesktop.org
+DOC_WWW_DIR=/srv/dbus.freedesktop.org/www
+
+SPECIFICATION_SERVER=specifications.freedesktop.org
+SPECIFICATION_PATH=/srv/specifications.freedesktop.org/www/dbus/1.0
+
+TMPDIR=$(mktemp -d)
+
+mkdir -p "$TMPDIR/api"
+cp -r doc/api/html "$TMPDIR/api"
+cp -r "$@" "$TMPDIR"
+mv "$TMPDIR" dbus-docs
+tar --xz -c -f dbus-docs.tar.xz dbus-docs
+
+scp dbus-docs.tar.xz "$DOC_SERVER:$DOC_WWW_DIR/"
+rsync -rpvzP --chmod=Dg+s,ug+rwX,o=rX dbus-docs/ "$DOC_SERVER:$DOC_WWW_DIR/doc/"
+
+scp -p ../doc/*.dtd "$SPECIFICATION_SERVER:$SPECIFICATION_PATH/"
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 00000000..254eff9f
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,247 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# XML files used for Man and html doc
+xmls_mans_htmls_names = [
+ 'dbus-cleanup-sockets.1',
+ 'dbus-daemon.1',
+ 'dbus-launch.1',
+ 'dbus-monitor.1',
+ 'dbus-run-session.1',
+ 'dbus-send.1',
+ 'dbus-test-tool.1',
+ 'dbus-update-activation-environment.1',
+ 'dbus-uuidgen.1',
+]
+xml_files = []
+man_html_list = []
+foreach xml_in : xmls_mans_htmls_names
+ xml_file = configure_file(
+ input : xml_in + '.xml.in',
+ output: xml_in + '.xml',
+ configuration: data_config,
+ )
+ man_html_list += {
+ 'xml' : xml_file,
+ 'man' : xml_in,
+ 'html' : xml_in + '.html',
+ }
+ xml_files += xml_file
+endforeach
+
+# XML files used for html doc
+xmls_names = [
+ 'dbus-faq',
+ 'dbus-specification',
+ 'dbus-test-plan',
+ 'dbus-tutorial',
+]
+html_list = []
+foreach xml_in : xmls_names
+ html_list += {
+ 'xml' : xml_in + '.xml',
+ 'html' : xml_in + '.html',
+ }
+endforeach
+
+# uploaded and distributed, but not installed
+static_docs = files(
+ 'dbus-api-design.duck',
+ 'dbus-faq.xml',
+ 'dbus-specification.xml',
+ 'dbus-test-plan.xml',
+ 'dbus-tutorial.xml',
+ 'dcop-howto.txt',
+ 'introspect.xsl',
+)
+
+###############################################################################
+# Install man files
+
+if build_xml_docs
+ foreach man: man_html_list
+ custom_target(man.get('man'),
+ input: man.get('xml'),
+ output: man.get('man'),
+ command: [
+ xsltproc,
+ '--nonet',
+ '--xinclude',
+ '--stringparam', 'man.output.quietly', '1',
+ '-o', '@OUTPUT@',
+ 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+ '@INPUT@',
+ ],
+ install: true,
+ install_dir: get_option('mandir') / 'man1',
+ )
+ endforeach
+endif
+
+###############################################################################
+# Install html doc files
+
+html_files = []
+if build_xml_docs
+ foreach man: man_html_list + html_list
+ html_files += custom_target(man.get('html'),
+ input: man.get('xml'),
+ output: man.get('html'),
+ command: [
+ xsltproc,
+ '--nonet',
+ '--xinclude',
+ '--stringparam', 'generate.consistent.ids', '1',
+ '-o', '@OUTPUT@',
+ 'http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl',
+ '@INPUT@',
+ ],
+ install: true,
+ install_dir: docs_dir,
+ )
+ endforeach
+endif
+
+docs_files = [
+ 'system-activation.txt',
+ 'diagram.png',
+ 'diagram.svg',
+]
+
+install_data(
+ sources: docs_files,
+ install_dir: docs_dir,
+)
+
+configure_file(
+ input: 'index.html.in',
+ output: 'index.html',
+ configuration: data_config,
+ install_dir: docs_dir,
+)
+
+###############################################################################
+# Install dtd files
+
+
+xml_dir = get_option('datadir') / 'xml' / 'dbus-1'
+dtd_files = [
+ 'busconfig.dtd',
+ 'introspect.dtd',
+ 'introspect.xsl',
+]
+
+install_data(
+ sources: dtd_files,
+ install_dir: xml_dir,
+)
+
+configure_file(
+ input: 'catalog.xml.in',
+ output: 'catalog.xml',
+ install_dir: xml_dir,
+ configuration: {'DBUS_DTD_DIR': xml_dir},
+)
+
+###############################################################################
+# Doxygen
+if doxygen.found()
+ qch_dir = get_option('qch_dir')
+ if qch_dir == ''
+ qch_dir = docs_dir
+ endif
+
+ doxyfile = configure_file(
+ input: '../Doxyfile.in',
+ output: 'Doxyfile',
+ configuration: data_config,
+ )
+
+ dbus_srcs = run_command(
+ python,
+ '-c',
+ '''from glob import glob;print('\n'.join(glob('@0@/*.[ch]')))'''.format(meson.project_source_root() / 'dbus'),
+ check: true).stdout().strip().split('\n')
+ dbus_srcs += dbus_arch_deps_h
+
+ doxygen_tgt = custom_target('doxygen',
+ input: doxyfile,
+ output: 'api',
+ depend_files: dbus_srcs,
+ command: [doxygen, doxyfile],
+ )
+ alias_target('doxygen', doxygen_tgt)
+
+ meson.add_install_script(
+ 'meson_post_install.py',
+ meson.current_build_dir(),
+ docs_dir,
+ meson.current_build_dir() / 'api/qch/dbus-@0@.qch'.format(version),
+ qch_dir,
+ # ignored further arguments, but for dependency
+ doxygen_tgt,
+ )
+
+ if xsltproc.found()
+ custom_target('dbus.devhelp2',
+ input: 'doxygen_to_devhelp.xsl',
+ output: 'dbus.devhelp2',
+ depends: [doxygen_tgt],
+ command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@', meson.current_build_dir() / 'api/xml/index.xml' ],
+ install: true,
+ install_dir: docs_dir,
+ )
+ endif
+
+ if ducktype.found() and yelpbuild.found()
+ design_page = custom_target('dbus-api-design.page',
+ input: 'dbus-api-design.duck',
+ output: 'dbus-api-design.page',
+ command: [ ducktype, '-o', '@OUTPUT@', '@INPUT@' ],
+ )
+ html_files += custom_target('dbus-api-design.html',
+ input: design_page,
+ output: [
+ 'dbus-api-design.html',
+ 'yelp.js',
+ 'C.css',
+ 'highlight.pack.js',
+ ],
+ command: [ yelpbuild, 'html', '@INPUT@', '-o', meson.current_build_dir() ],
+ install: true,
+ install_dir: docs_dir,
+ )
+ endif
+endif
+
+if can_upload_docs
+ run_target('maintainer-upload-docs',
+ command: [
+ find_program('maintainer-upload-docs.sh'),
+ docs_files,
+ dtd_files,
+ static_docs,
+ html_files,
+ xml_files,
+ bonus_files,
+ ],
+ depends: doxygen_tgt,
+ )
+endif
diff --git a/doc/meson_post_install.py b/doc/meson_post_install.py
new file mode 100644
index 00000000..be8e3b29
--- /dev/null
+++ b/doc/meson_post_install.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+import os
+import sys
+import shutil
+from pathlib import Path
+
+
+if __name__ == "__main__":
+ arg_builddir = sys.argv[1]
+ arg_docdir = sys.argv[2]
+ arg_qch = sys.argv[3]
+ arg_qchdir = sys.argv[4]
+ env_destdir = os.getenv('MESON_INSTALL_DESTDIR_PREFIX')
+
+ builddir = Path(arg_builddir)
+ docdir = Path(arg_docdir)
+ qch = Path(arg_qch)
+ qchdir = Path(arg_qchdir)
+ destdir = Path(env_destdir)
+ apidir = Path(destdir /docdir / 'api')
+ shutil.rmtree(apidir, ignore_errors=True)
+ shutil.copytree(builddir / 'api/html', apidir)
+ if qch.is_file():
+ shutil.copy(qch, destdir / qchdir)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..8b871c44
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1056 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+project('dbus',
+ 'c', 'cpp',
+ version: '1.14.99',
+ meson_version: '>=0.56',
+)
+
+project_url = 'https://gitlab.freedesktop.org/dbus/dbus'
+
+cc = meson.get_compiler('c')
+cpp = meson.get_compiler('cpp')
+
+windows = import('windows')
+pkgconfig = import('pkgconfig')
+
+config = configuration_data()
+# Used for dbus-arch-deps.h, separated from config.h
+arch_config = configuration_data()
+# Non-quoted variables
+data_config = configuration_data()
+
+# Those will be checked for compiler compatibility and added at the end
+compile_args = []
+link_args = []
+
+###############################################################################
+# Project configuration
+
+not_found = dependency('', required: false)
+
+version = meson.project_version()
+config.set_quoted('VERSION', version)
+data_config.set('VERSION', version)
+data_config.set('DBUS_VERSION', version)
+
+ver_array = version.split('.')
+arch_config.set('DBUS_VERSION', version)
+arch_config.set('DBUS_MAJOR_VERSION', ver_array[0])
+arch_config.set('DBUS_MINOR_VERSION', ver_array[1])
+arch_config.set('DBUS_MICRO_VERSION', ver_array[2])
+
+config.set_quoted('DBUS_DAEMON_NAME', 'dbus-daemon')
+
+###############################################################################
+# libtool versioning - this applies to libdbus
+# http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91
+
+## increment if the interface has additions, changes, removals.
+lt_current = 36
+## increment any time the source changes;
+## set to 0 if you increment CURRENT
+lt_revision = 0
+## increment if any interfaces have been added;
+## set to 0 if any interfaces have been changed or removed.
+## removal has precedence over adding, so set to 0 if both happened.
+lt_age = 33
+
+soversion = (lt_current - lt_age)
+version_info = '@0@.@1@.@2@'.format(soversion, lt_age, lt_revision)
+
+data_config.set('SOVERSION', soversion)
+
+###############################################################################
+# System detection
+
+python = find_program('python3')
+
+host_os = host_machine.system()
+
+platform_windows = host_os.contains('windows')
+
+platform_cygwin = host_os.contains('cygwin')
+
+# TODO: meson doesn't actually have WinCE support
+platform_win32ce = host_os.contains('mingw32ce')
+
+platform_unix = not platform_windows
+
+config.set('DBUS_UNIX', platform_unix)
+config.set('DBUS_CYGWIN', platform_cygwin)
+config.set('DBUS_WIN', platform_windows)
+config.set('DBUS_WINCE', platform_win32ce)
+
+if platform_unix
+ platform = 'Unix'
+elif platform_cygwin
+ platform = 'cygwin'
+elif platform_win32ce
+ platform = 'win32ce'
+elif platform_windows
+ platform = 'windows'
+else
+ platform = 'unknown'
+endif
+message('Detected platform : @0@ (@1@)'.format(platform, host_os))
+
+if platform_windows
+ config.set('FD_SETSIZE', 8192,
+ description: 'The maximum number of connections that can be handled at once'
+ )
+ if platform_win32ce
+ config.set('_WIN32_WCE', '0x0502', description: 'Get newer W32 CE APIs')
+ else
+ config.set('_WIN32_WINNT', '0x0600',
+ description: 'Define to the minimum supported Windows version (Vista)'
+ )
+ endif
+
+ # TODO: make this respect SOURCE_DATE_EPOCH
+ build_timestamp = run_command(
+ find_program('tools/build-timestamp.py'),
+ check: true,
+ ).stdout().strip()
+
+ data_config.set('BUILD_TIMESTAMP', build_timestamp)
+ data_config.set('BUILD_FILEVERSION', ','.join(version.split('.')))
+
+ data_config.set('DBUS_VER_FILE_TYPE', 'VFT_DLL')
+ data_config.set('DBUS_VER_INTERNAL_NAME', 'libdbus-1-@0@' .format(soversion))
+ data_config.set('DBUS_VER_ORIGINAL_NAME', 'libdbus-1-@0@.dll' .format(soversion))
+endif
+
+if platform_windows
+ conf_maybe_external = '<!--<auth>EXTERNAL</auth>-->'
+else
+ conf_maybe_external = '<auth>EXTERNAL</auth>'
+endif
+data_config.set('DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL', conf_maybe_external)
+
+if host_os.contains('solaris')
+ compile_args += [
+ # Solaris' C library apparently needs these runes to be threadsafe...
+ '-D_POSIX_PTHREAD_SEMANTICS',
+ # ... this opt-in to get sockaddr_in6 and sockaddr_storage...
+ '-D__EXTENSIONS__',
+ # ... and this opt-in to get file descriptor passing support
+ ' -D_XOPEN_SOURCE=500',
+ ]
+endif
+
+if host_machine.endian() == 'big'
+ config.set('WORDS_BIGENDIAN', 1)
+endif
+
+# Integer sizes
+int_types = [
+ {
+ 'type': 'short',
+ 'size': cc.sizeof('short'),
+ }, {
+ 'type': 'int',
+ 'size': cc.sizeof('int'),
+ 'type_c': '(val)',
+ 'type_u_c': '(val)',
+ 'type_m': '',
+ }, {
+ 'type': 'long',
+ 'size': cc.sizeof('long'),
+ 'type_c': '(val##L)',
+ 'type_u_c': '(val##UL)',
+ 'type_m': 'l',
+ }, {
+ 'type': 'long long',
+ 'size': cc.sizeof('long long'),
+ 'type_c': '(val##LL)',
+ 'type_u_c': '(val##ULL)',
+ 'type_m': 'll',
+ }, {
+ 'type': '__int64',
+ 'size': cc.sizeof('__int64'),
+ 'type_c': '(val##i64)',
+ 'type_u_c': '(val##ui64)',
+ 'type_m': 'I64',
+ }, {
+ 'type': 'err'
+ },
+]
+
+foreach type : int_types
+ if type.get('type') == 'err'
+ error('Could not find a 64-bit integer type.')
+ endif
+ if type.get('size') == 8
+ arch_config.set('DBUS_INT64_TYPE', type.get('type'))
+ arch_config.set('DBUS_INT64_CONSTANT', type.get('type_c'))
+ arch_config.set('DBUS_UINT64_CONSTANT', type.get('type_u_c'))
+ if platform_windows
+ arch_config.set('DBUS_INT64_MODIFIER', 'I64')
+ else
+ arch_config.set('DBUS_INT64_MODIFIER', type.get('type_m'))
+ endif
+ break
+ endif
+endforeach
+
+foreach type : int_types
+ if type.get('type') == 'err'
+ error('Could not find a 32-bit integer type.')
+ endif
+ if type.get('size') == 4
+ arch_config.set('DBUS_INT32_TYPE', type.get('type'))
+ break
+ endif
+endforeach
+
+foreach type : int_types
+ if type.get('type') == 'err'
+ error('Could not find a 16-bit integer type.')
+ endif
+ if type.get('size') == 2
+ arch_config.set('DBUS_INT16_TYPE', type.get('type'))
+ break
+ endif
+endforeach
+
+###############################################################################
+# Dependencies
+
+xsltproc = find_program('xsltproc', required: get_option('xml_docs'))
+build_xml_docs = false
+
+if xsltproc.found()
+ build_xml_docs = true
+ foreach fmt: [ 'html', 'manpages' ]
+ xsl = 'http://docbook.sourceforge.net/release/xsl/current/@0@/docbook.xsl'.format(fmt)
+ if run_command([xsltproc, '--nonet', xsl], check : false).returncode() == 0
+ continue
+ endif
+
+ build_xml_docs = false
+ if get_option('xml_docs').enabled()
+ error('Docbook XSL "@0@" not found'.format(fmt))
+ else
+ message('Docbook XSL "@0@" not found, disabled automatically'.format(fmt))
+ endif
+ endforeach
+endif
+
+# For doxygen
+doxygen = find_program('doxygen', required: get_option('doxygen_docs'))
+ducktype = find_program('ducktype', required: get_option('ducktype_docs'))
+yelpbuild = find_program('yelp-build', required: get_option('doxygen_docs'))
+
+can_upload_docs = doxygen.found() and xsltproc.found() and ducktype.found()
+
+qhelpgen = find_program('qhelpgenerator', 'qhelpgenerator-qt5', required: get_option('qt_help'))
+qt_help_generate = doxygen.found() and qhelpgen.found()
+
+data_config.set('DBUS_GENERATE_MAN', platform_windows ? 'NO' : 'YES')
+data_config.set('DOXYGEN_QCH_FILE', meson.current_build_dir()
+ / 'doc' / 'api' / 'qch' / 'dbus-@0@.qch'.format(version))
+if qhelpgen.found()
+ data_config.set('DOXYGEN_QHG_LOCATION', qhelpgen.full_path())
+ data_config.set('DOXYGEN_GENERATE_QHP', 'YES')
+else
+ data_config.set('DOXYGEN_QHG_LOCATION', '')
+ data_config.set('DOXYGEN_GENERATE_QHP', 'NO')
+endif
+data_config.set('top_srcdir', meson.project_source_root())
+data_config.set('top_builddir', meson.project_build_root())
+
+
+threads = dependency('threads')
+config.set('HAVE_MONOTONIC_CLOCK', cc.has_header_symbol('pthread.h', 'CLOCK_MONOTONIC'))
+
+glib = dependency('glib-2.0', version: '>=2.40', required: false)
+if platform_windows
+ gio = dependency('gio-windows-2.0', required: false)
+else
+ gio = dependency('gio-unix-2.0', required: false)
+endif
+use_glib = glib.found() and gio.found()
+config.set('DBUS_WITH_GLIB', use_glib)
+
+expat = dependency('expat')
+config.set('HAVE_XML_SETHASHSALT', cc.has_function('XML_SetHashSalt', dependencies: expat))
+
+selinux = dependency('libselinux', version: '>=2.0.86', required: get_option('selinux'))
+
+# the selinux code creates threads which requires libpthread even on linux
+# TODO: smcv: actually we've stopped doing that. We still include <pthread.h> in
+# selinux.c (but probably shouldn't), and we don't actually create the thread;
+# so this can probably be simplified.
+config.set('HAVE_SELINUX', selinux.found() and threads.found())
+
+apparmor = dependency('libapparmor', version: '>=2.8.95', required: get_option('apparmor'))
+config.set('HAVE_APPARMOR', apparmor.found())
+config.set('HAVE_APPARMOR_2_10', apparmor.version().version_compare('>=2.10'))
+
+if get_option('inotify').disabled()
+ use_inotify = false
+else
+ use_inotify = cc.has_header('sys/inotify.h')
+ if get_option('inotify').enabled() and not use_inotify
+ error('inotify support requested but not found')
+ endif
+endif
+
+if get_option('epoll').disabled()
+ use_linux_epoll = false
+else
+ use_linux_epoll = (
+ cc.has_header('sys/epoll.h') and
+ cc.has_function('epoll_create1', prefix: '#include <sys/epoll.h>')
+ )
+ if get_option('epoll').enabled() and not use_linux_epoll
+ error('epoll support requested but not found')
+ endif
+endif
+config.set('DBUS_HAVE_LINUX_EPOLL', use_linux_epoll)
+
+if get_option('kqueue').disabled()
+ use_kqueue = false
+else
+ use_kqueue = (
+ cc.has_header('sys/event.h') and
+ cc.has_function('kqueue', prefix: '#include <sys/event.h>')
+ )
+ if get_option('kqueue').enabled() and not use_kqueue
+ error('kqueue support requested but not found')
+ endif
+endif
+config.set('DBUS_BUS_ENABLE_KQUEUE', use_kqueue)
+
+if get_option('launchd').disabled()
+ use_launchd = false
+else
+ launchctl = find_program('launchctl', required: get_option('launchd'))
+ use_launchd = cc.has_header('launch.h') and launchctl.found()
+ if get_option('launchd').enabled() and not use_launchd
+ error('launchd support requested but not found')
+ endif
+endif
+config.set('DBUS_BUS_ENABLE_LAUNCHD', use_launchd)
+
+if use_launchd
+ launchd_agent_dir = get_option('launchd_agent_dir')
+ if launchd_agent_dir == ''
+ launchd_agent_dir = '/Library/LaunchAgents'
+ endif
+endif
+
+systemd = dependency('libsystemd', version: '>=209', required: get_option('systemd'))
+use_systemd = systemd.found()
+config.set('HAVE_SYSTEMD', use_systemd)
+
+if use_systemd
+ # If not found in $PATH, we might still have systemd and systemctl at runtime
+ # (perhaps dbus is being compiled in a minimal chroot with no systemd).
+ # Assume the upstream-recommended location. Distributors with split /usr
+ # can override this with --native-file (see https://mesonbuild.com/Machine-files.html)
+ systemctl = find_program('systemctl', required: false)
+ if systemctl.found()
+ systemctl = systemctl.full_path()
+ else
+ systemctl = '/usr/bin/systemctl'
+ endif
+
+ systemd_system_unitdir = get_option('systemd_system_unitdir')
+ systemd_user_unitdir = get_option('systemd_user_unitdir')
+
+ systemd_dirs = dependency('systemd', required: false)
+ if systemd_system_unitdir == ''
+ systemd_system_unitdir = (systemd_dirs.found()
+ ? systemd_dirs.get_variable(pkgconfig: 'systemdsystemunitdir')
+ : '/lib/systemd/system'
+ )
+ endif
+ if systemd_user_unitdir == ''
+ systemd_user_unitdir = (systemd_dirs.found()
+ ? systemd_dirs.get_variable(pkgconfig: 'systemduserunitdir')
+ : '/usr/lib/systemd/user'
+ )
+ endif
+else
+ systemctl = ''
+endif
+data_config.set('SYSTEMCTL', systemctl)
+
+
+
+use_traditional_activation = get_option('traditional_activation')
+config.set('ENABLE_TRADITIONAL_ACTIVATION', use_traditional_activation)
+
+if not (use_systemd or use_traditional_activation)
+ warning('Traditional activation and systemd activation are both disabled, '
+ + 'so service activation (automatically starting services that '
+ + 'receive messages) will not work')
+endif
+
+
+have_console_owner_file = false
+console_owner_file = get_option('solaris_console_owner_file')
+if console_owner_file != ''
+ if not host_os.contains('solaris')
+ error('solaris_console_owner_file is only supported on Solaris)')
+ endif
+ have_console_owner_file = true
+ if console_owner_file == 'auto'
+ console_owner_file = '/dev/console'
+ else
+ endif
+endif
+config.set('HAVE_CONSOLE_OWNER_FILE', have_console_owner_file)
+config.set_quoted('DBUS_CONSOLE_OWNER_FILE', console_owner_file)
+
+if get_option('libaudit').disabled()
+ have_libaudit = false
+else
+ libaudit = cc.find_library('audit', required: false)
+ libaudit_ok = cc.has_function('audit_log_user_avc_message', dependencies: libaudit)
+ cap_ng = cc.find_library('cap-ng', required: false)
+ cap_ng_ok = cc.has_function('capng_clear', dependencies: cap_ng)
+ have_libaudit = libaudit_ok and cap_ng_ok
+ if get_option('libaudit').enabled() and not have_libaudit
+ error('libaudit support requested but not found')
+ endif
+endif
+config.set('HAVE_LIBAUDIT', have_libaudit)
+
+if have_libaudit
+ selinux = [ selinux, libaudit, cap_ng ]
+endif
+
+# Check for ADT API (Solaris Basic Security Mode auditing)
+adt_api_check = cc.compiles('''
+#include <bsm/adt.h>
+int main() {
+ adt_user_context = ADT_USER;
+ return 0;
+}
+''')
+config.set('HAVE_ADT', adt_api_check)
+if adt_api_check
+ adt_libs = cc.find_library('bsm')
+else
+ adt_libs = dependency('', required: false)
+endif
+
+# Check for SCM_RIGHTS
+has_scm_rights = cc.compiles('''
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+int main() {
+ static int x = SCM_RIGHTS;
+ return 0;
+}
+''')
+config.set('HAVE_UNIX_FD_PASSING', has_scm_rights)
+
+valgrind = dependency('valgrind', version: '>=3.6', required: false)
+config.set('WITH_VALGRIND', valgrind.found())
+
+if platform_win32ce
+ network_libs = [
+ cc.find_library('ws2'),
+ ]
+elif platform_windows
+ network_libs = [
+ cc.find_library('ws2_32'),
+ cc.find_library('iphlpapi'),
+ cc.find_library('dbghelp'),
+ ]
+else
+ network_libs = []
+endif
+
+if get_option('x11_autolaunch').disabled()
+ use_x11_autolaunch = false
+else
+ if get_option('x11_autolaunch').enabled() and platform_windows
+ error('X11 autolaunch is not supported on Windows')
+ endif
+
+ x11 = dependency('x11', required: false)
+ use_x11_autolaunch = x11.found()
+
+ if get_option('x11_autolaunch').enabled() and not use_x11_autolaunch
+ error('X11 autolaunch support requested but not found')
+ endif
+endif
+config.set('DBUS_BUILD_X11', use_x11_autolaunch)
+config.set('DBUS_ENABLE_X11_AUTOLAUNCH', use_x11_autolaunch)
+
+
+check_functions = [
+ 'accept4',
+ 'clearenv',
+ 'closefrom',
+ 'close_range',
+ 'dirfd',
+ 'fpathconf',
+ 'getgrouplist',
+ 'getpeereid',
+ 'getpeerucred',
+ 'getpwnam_r',
+ 'getrandom',
+ 'getresuid',
+ 'getrlimit',
+ 'inotify_init1',
+ 'issetugid',
+ 'localeconv',
+ 'nanosleep',
+ 'pipe2',
+ 'poll',
+ 'prctl',
+ 'prlimit',
+ 'raise',
+ 'setenv',
+ 'setlocale',
+ 'setresuid',
+ 'setrlimit',
+ 'socketpair',
+ 'strtoll',
+ 'strtoull',
+ 'unsetenv',
+ 'usleep',
+]
+
+foreach function : check_functions
+ macro = 'HAVE_' + function.underscorify().to_upper()
+ config.set(macro, cc.has_function(function) ? 1 : false)
+endforeach
+
+check_headers = [
+ 'alloca.h',
+ 'byteswap.h',
+ 'crt_externs.h',
+ 'dirent.h',
+ 'errno.h',
+ 'inttypes.h',
+ 'linux/close_range.h',
+ 'locale.h',
+ 'signal.h',
+ 'stdint.h',
+ 'syslog.h',
+ 'sys/prctl.h',
+ 'sys/random.h',
+ 'sys/resource.h',
+ 'sys/syscall.h',
+ 'sys/syslimits.h',
+ 'sys/time.h',
+ 'unistd.h',
+ 'ws2tcpip.h',
+]
+
+foreach header : check_headers
+ macro = 'HAVE_' + header.underscorify().to_upper()
+ config.set(macro, cc.has_header(header) ? 1 : false)
+endforeach
+
+execinfo = cc.find_library('execinfo', required: false)
+have_backtrace = (cc.has_header('execinfo.h')
+ and cc.has_function('backtrace', dependencies: execinfo)
+)
+config.set('HAVE_BACKTRACE', have_backtrace)
+
+
+# **********************************
+# *** va_copy checks (from GLib) ***
+# **********************************
+# we currently check for all three va_copy possibilities, so we get
+# all results in config.log for bug reports.
+
+has_va_copy = cc.has_function('va_copy')
+has___va_copy = cc.has_function('__va_copy')
+if has_va_copy
+ va_copy = 'va_copy'
+elif has___va_copy
+ va_copy = '__va_copy'
+elif cc.get_id() == 'msvc'
+ va_copy = '_DBUS_VA_COPY_ASSIGN'
+ config.set('_DBUS_VA_COPY_ASSIGN(a1,a2)', '{ a1 = a2; }')
+else
+ error('dbus requires an ISO C99-compatible va_copy() macro, '
+ + 'or a compatible __va_copy()')
+endif
+config.set('DBUS_VA_COPY', va_copy)
+
+
+#### Atomic integers
+config.set10('DBUS_USE_SYNC', cc.has_function('__sync_sub_and_fetch') ? 1 : false)
+
+config.set('HAVE_DECL_MSG_NOSIGNAL',
+ cc.has_header_symbol('sys/socket.h', 'MSG_NOSIGNAL') ? 1 : false
+)
+config.set('HAVE_SOCKLEN_T',
+ cc.has_type('socklen_t', prefix: '#include <sys/socket.h>')
+)
+config.set('HAVE_CMSGCRED',
+ cc.has_type('struct cmsgcred', prefix: '#include <sys/socket.h>')
+)
+
+config.set('HAVE_WRITEV',
+ cc.has_header_symbol('sys/uio.h', 'writev')
+)
+
+config.set('HAVE_UNPCBID',
+ cc.has_member('struct unpcbid', 'unp_pid', prefix: '#include <sys/un.h>')
+)
+
+
+###############################################################################
+# Project options
+
+# Verbose mode
+verbose_mode = get_option('verbose_mode')
+config.set('DBUS_ENABLE_VERBOSE_MODE', verbose_mode)
+
+# Asserts defaults to developer mode
+asserts = get_option('asserts')
+config.set('DBUS_ENABLE_ASSERTS', asserts)
+
+config.set('DBUS_ENABLE_ASSERT', asserts ? 1 : false)
+config.set('DBUS_DISABLE_ASSERT', not asserts ? 1 : false)
+
+# -rdynamic is needed for glibc's backtrace_symbols to work.
+# No clue how much overhead this adds, but it's useful
+# to do this on any assertion failure,
+# so for now it's enabled anytime asserts are (currently not
+# in production builds).
+# To get -rdynamic you pass -export-dynamic to libtool.
+config.set('DBUS_BUILT_R_DYNAMIC', asserts ? 1 : false)
+if asserts
+ link_args += '-export-dynamic'
+endif
+
+if not asserts
+ compile_args += [
+ '-Wno-unused-but-set-variable',
+ '-Wno-unused-variable',
+ '-Wno-unused-function',
+ ]
+endif
+
+
+checks = get_option('checks')
+config.set('DBUS_ENABLE_CHECKS', checks ? 1 : false)
+config.set('DBUS_DISABLE_CHECKS', not checks ? 1 : false)
+config.set('G_DISABLE_CHECKS', not checks ? 1 : false)
+
+
+dbus_static_flags = ( get_option('default_library') == 'static'
+ ? '-DDBUS_STATIC_BUILD'
+ : []
+)
+compile_args += dbus_static_flags
+
+
+# DBUS_ENABLE_EMBEDDED_TESTS controls unit tests built in to .c files
+# and some stuff in the test/ subdir.
+embedded_tests = get_option('embedded_tests')
+config.set('DBUS_ENABLE_EMBEDDED_TESTS', embedded_tests)
+
+
+# DBUS_ENABLE_MODULAR_TESTS controls tests that work based on public API.
+# These use GTest, from GLib, because life's too short. They're enabled by
+# default (unless you don't have GLib), because they don't bloat the library
+# or binaries.
+dbus_enable_modular_tests = (
+ get_option('modular_tests')
+ and glib.version().version_compare('>=2.40')
+ and gio.found()
+)
+
+###############################################################################
+# Paths and directories
+
+docs_dir = get_option('datadir') / 'doc' / 'dbus'
+
+data_config.set('EXPANDED_LOCALSTATEDIR', '/' / get_option('localstatedir'))
+data_config.set('EXPANDED_SYSCONFDIR', '/' / get_option('sysconfdir'))
+data_config.set('EXPANDED_RUNSTATEDIR', '/' / 'run')
+data_config.set('EXPANDED_BINDIR', get_option('prefix') / get_option('bindir'))
+data_config.set('EXPANDED_DATADIR', get_option('prefix') / get_option('datadir'))
+
+data_config.set('DBUS_PREFIX', get_option('prefix'))
+config.set_quoted('DBUS_PREFIX', get_option('prefix'))
+config.set_quoted('DBUS_BINDIR', get_option('prefix') / get_option('bindir'))
+config.set_quoted('DBUS_DATADIR',get_option('prefix') / get_option('datadir'))
+data_config.set('DBUS_LIBEXECDIR', get_option('prefix') / get_option('libexecdir'))
+
+config.set_quoted('DBUS_RUNSTATEDIR',
+ get_option('localstatedir')
+)
+config.set_quoted('DBUS_MACHINE_UUID_FILE',
+ get_option('localstatedir') / 'lib'/'dbus'/'machine-id'
+)
+config.set_quoted('DBUS_SYSTEM_CONFIG_FILE',
+ get_option('prefix') / get_option('datadir') / 'dbus-1' / 'system.conf'
+)
+config.set_quoted('DBUS_SESSION_CONFIG_FILE',
+ get_option('prefix') / get_option('datadir') / 'dbus-1' / 'session.conf'
+)
+
+
+system_socket = get_option('system_socket')
+if system_socket == ''
+ # We don't use runstatedir for this (yet?), because /var/run has been the
+ # interoperable system bus socket for 10+ years.
+ # See https://bugs.freedesktop.org/show_bug.cgi?id=101628
+ system_socket = '/' / get_option('localstatedir')/'run'/'dbus'/'system_bus_socket'
+endif
+data_config.set('DBUS_SYSTEM_SOCKET', system_socket)
+
+## System bus only listens on local domain sockets, and never
+## on an abstract socket (so only root can create the socket).
+##
+## This won't work on Windows. It's not meant to - the system bus is
+## meaningless on Windows anyway.
+##
+## This has to be suitable for hard-coding in client libraries as well as
+## in the dbus-daemon's configuration, so it has to be valid to listen on
+## and also to connect to. If this ever changes, it'll need to be split into
+## two variables, one for the listening address and one for the connecting
+## address.
+system_bus_default_address = 'unix:path=@0@'.format(system_socket)
+data_config.set('DBUS_SYSTEM_BUS_DEFAULT_ADDRESS', system_bus_default_address)
+config.set_quoted('DBUS_SYSTEM_BUS_DEFAULT_ADDRESS', system_bus_default_address)
+
+
+system_pid_file = get_option('system_pid_file')
+if system_pid_file == ''
+ system_pid_file = '/run'/'dbus'/'pid'
+endif
+data_config.set('DBUS_SYSTEM_PID_FILE', system_pid_file)
+
+
+dbus_user = get_option('dbus_user')
+data_config.set('DBUS_USER', dbus_user)
+config.set_quoted('DBUS_USER', dbus_user)
+
+test_user = get_option('test_user')
+config.set_quoted('DBUS_TEST_USER', test_user)
+
+daemon_dir = get_option('dbus_daemondir')
+if daemon_dir == ''
+ daemon_dir = get_option('prefix') / get_option('bindir')
+endif
+data_config.set('DBUS_DAEMONDIR', daemon_dir)
+config.set_quoted('DBUS_DAEMONDIR', daemon_dir)
+
+
+
+# Relocation is disabled by default, let's check if we need to enable it
+relocation = false
+if get_option('relocation').enabled()
+ # Manually forced at true
+ relocation = true
+endif
+if get_option('relocation').auto() and platform_windows
+ # By default, on Windows we are relocatable if possible
+ relocation = true
+endif
+
+# Now check if it's not possible
+# Meson does not separate exec_prefix and prefix (hopefully)
+if relocation and not (get_option('libdir') in [ 'lib', 'lib64', ])
+ message = (
+ 'Relocatable pkg-config metadata requires default libdir, '
+ + 'not @0@'.format(get_option('libdir'))
+ )
+ if get_option('relocation').enabled()
+ error(message)
+ else
+ warning(message)
+ endif
+endif
+
+#### Directory to source sysconfdir configuration from
+
+# On Windows this is relative to where we put the bus setup, in
+# ${datadir}/dbus-1. For simplicity, we only do this if
+# ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share.
+#
+# On Unix, or on Windows with weird install layouts, it's the absolute path.
+if (platform_windows
+ and data_config.get('EXPANDED_SYSCONFDIR') == get_option('prefix') / 'etc'
+ and data_config.get('EXPANDED_DATADIR') == get_option('prefix') / 'share'
+)
+ sysconfdir_from_pkgdatadir = '../../etc'
+ datadir_from_pkgsysconfdir = '../../share'
+else
+ sysconfdir_from_pkgdatadir = data_config.get('EXPANDED_SYSCONFDIR')
+ datadir_from_pkgsysconfdir = data_config.get('EXPANDED_DATADIR')
+endif
+data_config.set('SYSCONFDIR_FROM_PKGDATADIR', sysconfdir_from_pkgdatadir)
+data_config.set('DATADIR_FROM_PKGSYSCONFDIR', datadir_from_pkgsysconfdir)
+
+#### Find socket directories
+values = run_command(python, '-c',
+ 'import os; [print(os.getenv(e, "")) for e in ["TMPDIR", "TEMP", "TMP"]]',
+ check: true,
+).stdout()
+values += '/tmp'
+default_socket_dir = values.strip().split('\n')[0]
+
+test_socket_dir = get_option('test_socket_dir')
+if test_socket_dir == ''
+ test_socket_dir = default_socket_dir
+endif
+test_listen = platform_unix ? 'unix:tmpdir=' + test_socket_dir : 'tcp:host=localhost'
+config.set_quoted('TEST_LISTEN', test_listen)
+data_config.set('TEST_LISTEN', test_listen)
+
+session_socket_dir = get_option('session_socket_dir')
+if session_socket_dir == ''
+ session_socket_dir = default_socket_dir
+endif
+config.set_quoted('DBUS_SESSION_SOCKET_DIR', session_socket_dir)
+
+session_bus_listen_address = get_option('dbus_session_bus_listen_address')
+if session_bus_listen_address == ''
+ if platform_windows
+ session_bus_listen_address = 'autolaunch:'
+ elif use_launchd
+ session_bus_listen_address = 'launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET'
+ else
+ session_bus_listen_address = 'unix:tmpdir=@0@'.format(session_socket_dir)
+ endif
+endif
+data_config.set('DBUS_SESSION_BUS_LISTEN_ADDRESS', session_bus_listen_address)
+
+
+
+session_bus_connect_address = get_option('dbus_session_bus_connect_address')
+if session_bus_connect_address == ''
+ session_bus_connect_address = 'autolaunch:'
+endif
+config.set_quoted('DBUS_SESSION_BUS_CONNECT_ADDRESS', session_bus_connect_address)
+
+
+config.set('DBUS_ENABLE_STATS', get_option('stats'))
+config.set('DBUS_ENABLE_CONTAINERS', get_option('containers'))
+enable_user_session = get_option('user_session')
+
+
+# Add this only for the correct targets
+config.set('DBUS_COMPILATION', true)
+
+exe_ext = platform_windows ? '.exe' : ''
+config.set_quoted('DBUS_EXEEXT', exe_ext)
+
+compile_args_c = []
+compile_args += [
+ '-D_GNU_SOURCE',
+]
+
+if cc.get_id() == 'msvc'
+ compile_args += [
+ # once
+ '/wo4018', # 'expression' : signed/unsigned mismatch
+ # disabled
+ '/wd4090', # 'operation' : different 'modifier' qualifiers
+ '/wd4101', # 'identifier' : unreferenced local variable
+ '/wd4127', # conditional expression is constant
+ '/wd4244', # 'argument' : conversion from 'type1' to 'type2', possible loss of data
+ # error
+ '/we4002', # too many actual parameters for macro 'identifier'
+ '/we4003', # not enough actual parameters for macro 'identifier'
+ '/we4013', # 'function' undefined; assuming extern returning int
+ '/we4028', # formal parameter 'number' different from declaration
+ '/we4031', # second formal parameter list longer than the first list
+ '/we4047', # operator' : 'identifier1' differs in levels of indirection from 'identifier2'
+ '/we4114', # same type qualifier used more than once
+ '/we4133', # 'type' : incompatible types - from 'type1' to 'type2'
+ ]
+else
+ compile_args += [
+ '-Wno-missing-field-initializers',
+ '-Wno-unused-parameter',
+ '-Wchar-subscripts',
+ '-Wfloat-equal',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ compile_args_c += [
+ '-Wpointer-sign',
+ ]
+endif
+
+compile_args_c = cc .get_supported_arguments(compile_args + compile_args_c)
+compile_args_cpp= cpp.get_supported_arguments(compile_args)
+link_args = cc.get_supported_link_arguments(link_args)
+add_project_arguments(compile_args_c, language: 'c')
+add_project_arguments(compile_args_cpp, language: 'cpp')
+add_project_link_arguments(link_args, language: [ 'c', 'cpp' ])
+
+root_include = include_directories('.')
+
+configure_file(
+ output: 'config.h',
+ configuration: config,
+)
+
+bonus_files = files(
+ 'AUTHORS',
+ 'CONTRIBUTING.md',
+ 'COPYING',
+ 'NEWS',
+ 'README',
+)
+
+subdir('dbus')
+subdir('bus')
+subdir('tools')
+subdir('test')
+subdir('doc')
+subdir('cmake')
+
+meson.add_install_script('meson_post_install.py',
+ '@0@'.format(platform_unix),
+ '@0@'.format(relocation),
+ '@0@'.format(use_systemd),
+)
+
+if use_systemd
+ meson.add_install_script('meson_post_install_systemd.py',
+ systemd_system_unitdir,
+ systemd_user_unitdir,
+ )
+endif
+
+pkgconfig.generate(
+ libdbus,
+ name: 'dbus',
+ filebase: 'dbus-1',
+ description: 'Free desktop message bus',
+ subdirs: [ 'dbus-1.0' ],
+ extra_cflags: [
+ '-I${libdir}/dbus-1.0/include',
+ ] + dbus_static_flags,
+ variables: {
+ 'original_prefix': get_option('prefix'),
+
+ 'exec_prefix': '${prefix}',
+ 'bindir': '${prefix}' / get_option('bindir'),
+ 'datadir': '${prefix}' / get_option('datadir'),
+ 'datarootdir': '${prefix}' / get_option('datadir'),
+ 'sysconfdir': '/' / get_option('sysconfdir'),
+
+ 'daemondir': '${bindir}',
+ 'system_bus_default_address': system_bus_default_address,
+ 'session_bus_services_dir': '${datadir}/dbus-1/services',
+ 'system_bus_services_dir': '${datadir}/dbus-1/system-services',
+ 'interfaces_dir': '${datadir}/dbus-1/interfaces',
+ }
+)
+
+summary_dict = {
+ 'prefix': get_option('prefix'),
+ 'exec_prefix': get_option('prefix'),
+ 'libdir': get_option('prefix') / get_option('libdir'),
+ 'libexecdir': get_option('prefix') / get_option('libexecdir'),
+ 'bindir': get_option('prefix') / get_option('bindir'),
+ 'sysconfdir': data_config.get('EXPANDED_SYSCONFDIR'),
+ 'localstatedir': data_config.get('EXPANDED_LOCALSTATEDIR'),
+ 'runstatedir': data_config.get('EXPANDED_RUNSTATEDIR'),
+ 'datadir': data_config.get('EXPANDED_DATADIR'),
+ 'source code location': meson.project_source_root(),
+ 'compiler': cc.get_id(),
+ 'cflags': compile_args_c,
+ 'cxxflags': compile_args_cpp,
+ 'ldflags': (link_args.length() == 0) ? '[]' : link_args,
+ '64-bit int': arch_config.get('DBUS_INT64_TYPE'),
+ '32-bit int': arch_config.get('DBUS_INT32_TYPE'),
+ '16-bit int': arch_config.get('DBUS_INT16_TYPE'),
+ 'xsltproc': xsltproc.found() ? xsltproc.full_path() : '',
+ 'Doxygen': doxygen.found() ? doxygen.full_path() : '',
+ 'ducktype': ducktype.found() ? ducktype.full_path() : '',
+ 'yelp-build': yelpbuild.found() ? yelpbuild.full_path() : '',
+
+ 'gcc coverage': get_option('b_coverage'),
+ 'gcc profiling': get_option('b_pgo'),
+ 'Building embedded tests': embedded_tests,
+ 'Building modular tests': dbus_enable_modular_tests,
+ '- with GLib': use_glib,
+ 'Installing tests': get_option('installed_tests'),
+ 'Building verbose mode': verbose_mode,
+ 'Building assertions': asserts,
+ 'Building checks': checks,
+ 'Building bus stats API': get_option('stats'),
+ 'Building container API': get_option('containers'),
+ 'Building SELinux support': config.get('HAVE_SELINUX'),
+ 'Building AppArmor support': apparmor.found(),
+ 'Building inotify support': use_inotify,
+ 'Building kqueue support': use_kqueue,
+ 'Building systemd support': use_systemd,
+ 'Traditional activation': use_traditional_activation,
+ 'Building X11 code': config.get('DBUS_BUILD_X11'),
+ 'Building Doxygen docs': doxygen.found(),
+ 'Building Qt help file': qt_help_generate,
+ 'Building Ducktype docs': ducktype.found(),
+ 'Building XML docs': build_xml_docs,
+ 'Building launchd support': use_launchd,
+ 'System bus socket': data_config.get('DBUS_SYSTEM_SOCKET'),
+ 'System bus address': config.get('DBUS_SYSTEM_BUS_DEFAULT_ADDRESS'),
+ 'System bus PID file': data_config.get('DBUS_SYSTEM_PID_FILE'),
+ 'Session bus listens on': data_config.get('DBUS_SESSION_BUS_LISTEN_ADDRESS'),
+ 'Session clients connect to': config.get('DBUS_SESSION_BUS_CONNECT_ADDRESS'),
+ 'System bus user': dbus_user,
+ 'Session bus services dir':
+ get_option('prefix') / get_option('datadir') / 'dbus-1' / 'services',
+ 'Tests socket dir': test_socket_dir,
+}
+
+if host_os.contains('solaris')
+ summary_dict += {
+ 'Console owner file': console_owner_file,
+ }
+endif
+
+summary(summary_dict, bool_yn: true)
+
+if embedded_tests
+ warning('building with unit tests increases the size of the installed library and renders it insecure.')
+ if not asserts
+ warning('building with embedded tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)')
+ endif
+endif
+
+if get_option('b_coverage')
+ warning('Building with coverage profiling is definitely for developers only.')
+endif
+
+if verbose_mode
+ warning('building with verbose mode increases library size, may slightly increase security risk, and decreases performance.')
+endif
+
+if asserts
+ warning('building with assertions increases library size and decreases performance.')
+endif
+
+if not checks
+ warning('building without checks for arguments passed to public API makes it harder to debug apps using D-Bus, but will slightly decrease D-Bus library size and _very_ slightly improve performance.')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..56969b2a
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,276 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+option(
+ 'apparmor',
+ type: 'feature',
+ value: 'auto',
+ description: 'AppArmor support'
+)
+
+option(
+ 'asserts',
+ type: 'boolean',
+ value: false,
+ description: 'Include assertion checks'
+)
+
+option(
+ 'checks',
+ type: 'boolean',
+ value: true,
+ description: 'Check for usage errors at public API'
+)
+
+option(
+ 'containers',
+ type: 'boolean',
+ value: false,
+ description: 'Enable restricted servers for app containers'
+)
+
+option(
+ 'dbus_daemondir',
+ type: 'string',
+ description: 'Directory for installing the dbus-daemon'
+)
+
+option(
+ 'dbus_user',
+ type: 'string',
+ description: 'User for running the system dbus-daemon',
+ value: 'messagebus'
+)
+
+option(
+ 'dbus_session_bus_connect_address',
+ type: 'string',
+ value: '',
+ description: 'Fallback address for a session bus client to connect to',
+)
+
+option(
+ 'dbus_session_bus_listen_address',
+ type: 'string',
+ value: '',
+ description: 'Default address for a session bus to listen on',
+)
+
+option(
+ 'doxygen_docs',
+ type: 'feature',
+ value: 'auto',
+ description: 'Build Doxygen documentation'
+)
+
+option(
+ 'ducktype_docs',
+ type: 'feature',
+ value: 'auto',
+ description: 'Build Ducktype documentation'
+)
+
+option(
+ 'embedded_tests',
+ type: 'boolean',
+ value: false,
+ description: 'Enable unit test code in the library and binaries'
+)
+
+option(
+ 'epoll',
+ type: 'feature',
+ value: 'auto',
+ description: 'Use epoll(4) on Linux'
+)
+
+option(
+ 'inotify',
+ type: 'feature',
+ value: 'auto',
+ description: 'Inotify support on Linux'
+)
+
+option(
+ 'installed_tests',
+ type: 'boolean',
+ value: false,
+ description: 'Install automated tests for "as-installed" testing'
+)
+
+option(
+ 'kqueue',
+ type: 'feature',
+ value: 'auto',
+ description: 'Kqueue support'
+)
+
+option(
+ 'launchd',
+ type: 'feature',
+ value: 'auto',
+ description: 'Launchd auto-launch support'
+)
+
+option(
+ 'launchd_agent_dir',
+ type: 'string',
+ description: 'Directory to put the launchd agent'
+)
+
+option(
+ 'libaudit',
+ type: 'feature',
+ value: 'auto',
+ description: 'Audit logging support for SELinux and AppArmor'
+)
+
+option(
+ 'modular_tests',
+ type: 'boolean',
+ value: false,
+ description: 'Enable modular regression tests (requires GLib)'
+)
+
+option(
+ 'qch_dir',
+ type: 'string',
+ description: 'Directory to put the Qt help file'
+)
+
+option(
+ 'qt_help',
+ type: 'feature',
+ value: 'auto',
+ description: 'Build Qt help documentation'
+)
+
+option(
+ 'relocation',
+ type: 'feature',
+ value: 'auto',
+ description: 'Make pkg-config metadata relocatable'
+)
+
+option(
+ 'selinux',
+ type: 'feature',
+ value: 'auto',
+ description: 'SELinux support'
+)
+
+option(
+ 'session_socket_dir',
+ type: 'string',
+ description: 'Where to put sockets for the per-login-session message bus'
+)
+
+option(
+ 'solaris_console_owner_file',
+ type: 'string',
+ value: '',
+ description: 'File to determine current console owner on Solaris (or "auto")'
+)
+
+option(
+ 'stats',
+ type: 'boolean',
+ value: true,
+ description: 'Enable bus daemon usage statistics'
+)
+
+option(
+ 'system_pid_file',
+ type: 'string',
+ description: 'PID file for systemwide daemon'
+)
+
+option(
+ 'system_socket',
+ type: 'string',
+ description: 'UNIX domain socket for systemwide daemon'
+)
+
+option(
+ 'systemd_system_unitdir',
+ type: 'string',
+ description: 'Directory for systemd system service files'
+)
+
+option(
+ 'systemd_user_unitdir',
+ type: 'string',
+ description: 'Directory for systemd user service files'
+)
+
+option(
+ 'systemd',
+ type: 'feature',
+ value: 'auto',
+ description: 'Systemd at_console support'
+)
+
+option(
+ 'test_socket_dir',
+ type: 'string',
+ description: 'Where to put sockets for make check'
+)
+
+option(
+ 'test_user',
+ type: 'string',
+ description: 'Unprivileged user for regression tests, other than root and the dbus_user',
+ value: 'nobody'
+)
+
+option(
+ 'traditional_activation',
+ type: 'boolean',
+ value: true,
+ description: 'Build support for service activation without using SystemdService'
+)
+
+option(
+ 'user_session',
+ type: 'boolean',
+ value: true,
+ description: 'Enable user-session semantics for session bus under systemd'
+)
+
+option(
+ 'verbose_mode',
+ type: 'boolean',
+ value: false,
+ description: 'Support verbose debug mode'
+)
+
+option(
+ 'x11_autolaunch',
+ type: 'feature',
+ value: 'auto',
+ description: 'Build with X11 auto-launch support'
+)
+
+option(
+ 'xml_docs',
+ type: 'feature',
+ value: 'auto',
+ description: 'Build XML documentation'
+)
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100755
index 00000000..78133103
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python3
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+import os, sys, stat
+from pathlib import Path
+import shlex, subprocess, json
+
+meson = shlex.split(os.environ.get('MESONINTROSPECT', ''))
+introspection = json.loads(subprocess.check_output(meson + ['-a']).decode())
+build_options = introspection['buildoptions']
+targets = introspection['targets']
+
+def get_option(name):
+ for i in build_options:
+ if i['name'] == name:
+ return i['value']
+ return None
+
+def get_target(name):
+ for i in targets:
+ if i['name'] == name:
+ return i
+ return None
+
+destdir = Path(os.getenv('DESTDIR')) if 'DESTDIR' in os.environ else None
+prefix = Path(get_option('prefix'))
+destdir_prefix = Path(os.getenv('MESON_INSTALL_DESTDIR_PREFIX'))
+
+def to_destdir(path):
+ path_abs = prefix / path
+ if destdir:
+ path_rel_root = path_abs.relative_to(path_abs.anchor)
+ path_final = destdir / path_rel_root
+ return path_final
+ else:
+ return path_abs
+
+###############################################################################
+
+# Define paths here
+abs_libdir = destdir_prefix / get_option('libdir')
+dbus_data_dir = destdir_prefix / get_option('datadir') / 'dbus-1'
+
+platform_unix = sys.argv[1].lower() == 'true'
+relocation = sys.argv[2].lower() == 'true'
+
+def post_install_data():
+ (dbus_data_dir / 'session.d').mkdir(parents=True, exist_ok=True)
+ (dbus_data_dir / 'services').mkdir(parents=True, exist_ok=True)
+ (dbus_data_dir / 'session.d').mkdir(parents=True, exist_ok=True)
+
+ localstatedir = Path(get_option('localstatedir'))
+ if destdir:
+ localstatedir = destdir / localstatedir.relative_to(localstatedir.anchor)
+ if platform_unix:
+ (localstatedir / 'run' / 'dbus').mkdir(parents=True, exist_ok=True)
+ (dbus_data_dir / 'system.d').mkdir(parents=True, exist_ok=True)
+ (dbus_data_dir / 'system-services').mkdir(parents=True, exist_ok=True)
+
+def post_install_relocation():
+ # Edit pkg-config file to replace the prefix
+ #
+ # TODO: Meson >=0.63 has a new feature, -Dpkgconfig.relocatable=true.
+
+ pc_filepath = next(
+ v for (k,v) in introspection['installed'].items() if k.endswith('.pc')
+ )
+ # Find the really installed path
+ pc_filepath = to_destdir(pc_filepath)
+
+ with open(pc_filepath, 'r') as pcfile:
+ lines = pcfile.readlines()
+ with open(pc_filepath, 'w') as pcfile:
+ for line in lines:
+ if line.startswith('prefix='):
+ line = 'prefix=${pcfiledir}/../..\n'
+ pcfile.write(line)
+
+def post_install_exe():
+ # Setuid, chmod and chown for dbus-daemon-launch-helper
+ daemon_launch_helper = get_target('dbus-daemon-launch-helper')
+ if daemon_launch_helper:
+ import grp
+ exe_name = os.path.basename(daemon_launch_helper['install_filename'][0])
+ exe_path = abs_libdir / 'dbus-1.0' / exe_name
+ dbus_user = get_option('dbus_user')
+ if os.getuid() == 0:
+ os.chmod(exe_path, stat.S_ISUID | stat.S_IXUSR | stat.S_IXGRP)
+ os.chown(exe_path, 0, grp.getgrnam(dbus_user).gr_gid)
+ else:
+ print('Not installing {0} binary setuid!'.format(exe_path))
+ print('You\'ll need to manually set permissions to root:{0} and permissions 4750'
+ .format(dbus_user)
+ )
+
+
+if __name__ == "__main__":
+ post_install_data()
+ post_install_relocation()
+ post_install_exe()
diff --git a/meson_post_install_systemd.py b/meson_post_install_systemd.py
new file mode 100644
index 00000000..0bab9900
--- /dev/null
+++ b/meson_post_install_systemd.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+from meson_post_install import *
+
+import os, sys
+
+###############################################################################
+
+systemd_system_dir = to_destdir(sys.argv[1])
+systemd_user_dir = to_destdir(sys.argv[2])
+
+def force_symlink(src, dst):
+ try:
+ os.unlink(dst)
+ except OSError:
+ pass
+ os.symlink(src, dst)
+
+def post_install_data():
+ # Install dbus.socket as default implementation of a D-Bus stack.
+ # Unconditionally enable D-Bus on systemd installations
+ #
+ # TODO meson >=0.61 has install_symlink()
+
+ (systemd_system_dir / 'sockets.target.wants') .mkdir(parents=True, exist_ok=True)
+ (systemd_system_dir / 'multi-user.target.wants').mkdir(parents=True, exist_ok=True)
+ force_symlink('../dbus.socket', systemd_system_dir / 'sockets.target.wants' / 'dbus.socket')
+ force_symlink('../dbus.service', systemd_system_dir / 'multi-user.target.wants' / 'dbus.service')
+
+ if get_option('user_session'):
+ (systemd_user_dir / 'sockets.target.wants') .mkdir(parents=True, exist_ok=True)
+ force_symlink('../dbus.socket',systemd_user_dir / 'sockets.target.wants' / 'dbus.socket')
+
+if __name__ == "__main__":
+ post_install_data()
diff --git a/test/data/copy_data_for_tests.py b/test/data/copy_data_for_tests.py
new file mode 100755
index 00000000..d8d4b7fa
--- /dev/null
+++ b/test/data/copy_data_for_tests.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+import sys, os, shutil
+
+def pairs(args):
+ while args:
+ yield (args[0], args[1])
+ args = args[2:]
+
+for src, dst in pairs(sys.argv[1:]):
+ os.makedirs(os.path.dirname(dst), exist_ok=True)
+ try:
+ shutil.copy(src, dst)
+ except (IOError, OSError) as e:
+ print(e.filename)
diff --git a/test/data/meson.build b/test/data/meson.build
new file mode 100644
index 00000000..b02c86f2
--- /dev/null
+++ b/test/data/meson.build
@@ -0,0 +1,204 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+data_to_install = [
+ 'auth/anonymous-client-successful.auth-script',
+ 'auth/anonymous-server-successful.auth-script',
+ 'auth/cancel.auth-script',
+ 'auth/client-out-of-mechanisms.auth-script',
+ 'auth/cookie-sha1-username.auth-script',
+ 'auth/cookie-sha1.auth-script',
+ 'auth/external-auto.auth-script',
+ 'auth/external-failed.auth-script',
+ 'auth/external-root.auth-script',
+ 'auth/external-silly.auth-script',
+ 'auth/external-successful.auth-script',
+ 'auth/external-username.auth-script',
+ 'auth/extra-bytes.auth-script',
+ 'auth/fail-after-n-attempts.auth-script',
+ 'auth/fallback.auth-script',
+ 'auth/invalid-command-client.auth-script',
+ 'auth/invalid-command.auth-script',
+ 'auth/invalid-hex-encoding.auth-script',
+ 'auth/mechanisms.auth-script',
+ 'equiv-config-files/basic/basic-1.conf',
+ 'equiv-config-files/basic/basic-2.conf',
+ 'equiv-config-files/basic/basic.d/basic.conf',
+ 'equiv-config-files/entities/basic.d/basic.conf',
+ 'equiv-config-files/entities/entities-1.conf',
+ 'equiv-config-files/entities/entities-2.conf',
+ 'invalid-config-files/apparmor-bad-attribute.conf',
+ 'invalid-config-files/apparmor-bad-mode.conf',
+ 'invalid-config-files/bad-attribute-2.conf',
+ 'invalid-config-files/bad-attribute.conf',
+ 'invalid-config-files/bad-element.conf',
+ 'invalid-config-files/bad-limit.conf',
+ 'invalid-config-files/badselinux-1.conf',
+ 'invalid-config-files/badselinux-2.conf',
+ 'invalid-config-files/circular-1.conf',
+ 'invalid-config-files/circular-2.conf',
+ 'invalid-config-files/circular-3.conf',
+ 'invalid-config-files/double-attribute.conf',
+ 'invalid-config-files/impossible-send.conf',
+ 'invalid-config-files/limit-no-name.conf',
+ 'invalid-config-files/ludicrous-limit.conf',
+ 'invalid-config-files/negative-limit.conf',
+ 'invalid-config-files/non-numeric-limit.conf',
+ 'invalid-config-files/not-well-formed.conf',
+ 'invalid-config-files/policy-bad-at-console.conf',
+ 'invalid-config-files/policy-bad-attribute.conf',
+ 'invalid-config-files/policy-bad-context.conf',
+ 'invalid-config-files/policy-bad-rule-attribute.conf',
+ 'invalid-config-files/policy-contradiction.conf',
+ 'invalid-config-files/policy-member-no-path.conf',
+ 'invalid-config-files/policy-mixed.conf',
+ 'invalid-config-files/policy-no-attributes.conf',
+ 'invalid-config-files/policy-no-rule-attribute.conf',
+ 'invalid-config-files/send-and-receive.conf',
+ 'invalid-config-files/truncated-file.conf',
+ 'invalid-config-files/unknown-limit.conf',
+ 'invalid-messages/boolean-has-no-value.message-raw',
+ 'sha-1/bit-hashes.sha1',
+ 'sha-1/bit-messages.sha1',
+ 'sha-1/byte-hashes.sha1',
+ 'sha-1/byte-messages.sha1',
+ 'sha-1/Readme.txt',
+ 'systemd-activation/com.example.ReceiveDenied.service',
+ 'systemd-activation/com.example.SendDenied.service',
+ 'systemd-activation/com.example.SendDeniedByAppArmorName.service',
+ 'systemd-activation/com.example.SendPrefixDenied.internal.service',
+ 'systemd-activation/com.example.SendPrefixDenied.SendPrefixAllowed.internal.service',
+ 'systemd-activation/com.example.SendPrefixDenied.service',
+ 'systemd-activation/com.example.SystemdActivatable1.service',
+ 'systemd-activation/com.example.SystemdActivatable2.service',
+ 'systemd-activation/org.freedesktop.systemd1.service',
+ 'valid-config-files-system/many-rules.conf',
+ 'valid-config-files-system/system.d/test.conf',
+ 'valid-config-files/basic.conf',
+ 'valid-config-files/basic.d/basic.conf',
+ 'valid-config-files/check-own-rules.conf',
+ 'valid-config-files/entities.conf',
+ 'valid-config-files/listen-unix-runtime.conf',
+ 'valid-config-files/many-rules.conf',
+ 'valid-config-files/minimal.conf',
+ 'valid-config-files/standard-session-dirs.conf',
+]
+
+data_in_to_install = [
+ 'dbus-installed-tests.aaprofile',
+ 'invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service',
+ 'invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service',
+ 'invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service',
+ 'systemd-activation/com.example.ReceiveDeniedByAppArmorLabel.service',
+ 'systemd-activation/com.example.SendDeniedByAppArmorLabel.service',
+ 'systemd-activation/com.example.SendDeniedByNonexistentAppArmorLabel.service',
+ 'systemd-activation/com.example.SystemdActivatable3.service',
+ 'valid-config-files-system/debug-allow-all-fail.conf',
+ 'valid-config-files-system/debug-allow-all-pass.conf',
+ 'valid-config-files-system/tmp-session-like-system.conf',
+ 'valid-config-files/as-another-user.conf',
+ 'valid-config-files/count-fds.conf',
+ 'valid-config-files/debug-allow-all-sha1.conf',
+ 'valid-config-files/debug-allow-all.conf',
+ 'valid-config-files/finite-timeout.conf',
+ 'valid-config-files/forbidding.conf',
+ 'valid-config-files/incoming-limit.conf',
+ 'valid-config-files/limit-containers.conf',
+ 'valid-config-files/max-completed-connections.conf',
+ 'valid-config-files/max-connections-per-user.conf',
+ 'valid-config-files/max-containers.conf',
+ 'valid-config-files/max-match-rules-per-connection.conf',
+ 'valid-config-files/max-names-per-connection.conf',
+ 'valid-config-files/max-replies-per-connection.conf',
+ 'valid-config-files/multi-user.conf',
+ 'valid-config-files/pending-fd-timeout.conf',
+ 'valid-config-files/send-destination-prefix-rules.conf',
+ 'valid-config-files/systemd-activation.conf',
+ 'valid-config-files/tmp-session.conf',
+ 'valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service',
+ 'valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service',
+ 'valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service',
+ 'valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service',
+ 'valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service',
+ 'valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service',
+ 'valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service',
+ 'valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service',
+ 'valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service',
+ 'valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service',
+]
+
+foreach file : data_to_install
+ if install_tests
+ install_data(file,
+ rename: file,
+ install_dir: test_exec_dir / 'data',
+ )
+ endif
+endforeach
+
+foreach file : data_in_to_install
+ # Underscorify the output name because Meson doesn't allow subdir output files
+ configured_file = configure_file(
+ input : file + '.in',
+ output: file.underscorify(),
+ configuration: test_data_config,
+ )
+ if install_tests
+ install_data(configured_file,
+ rename: file,
+ install_dir: test_exec_dir / 'data',
+ )
+ endif
+endforeach
+
+
+###############################################################################
+# Copy files into correct places in build directory for tests
+
+files = []
+foreach file : data_to_install
+ src = meson.current_source_dir() / file
+ dst = meson.current_build_dir() / file
+ files += src
+ files += dst
+endforeach
+
+foreach file : data_in_to_install
+ src = meson.current_build_dir() / file.underscorify()
+ dst = meson.current_build_dir() / file
+ files += src
+ files += dst
+endforeach
+
+files += meson.project_build_root() / 'bus' / 'session.conf'
+files += meson.current_build_dir() / 'valid-config-files/session.conf'
+
+if platform_unix
+ files += meson.project_build_root() / 'bus' / 'system.conf'
+ files += meson.current_build_dir() / 'valid-config-files-system/system.conf'
+endif
+
+
+run_result = run_command(find_program('copy_data_for_tests.py'), files, check: true)
+
+files_not_found = run_result.stdout().split()
+if files_not_found.length() > 0
+ error('Those files could not be copied for test : @0@'.format(files_not_found))
+endif
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 00000000..22855857
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,604 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+###############################################################################
+# Tests installation
+
+install_tests = get_option('installed_tests')
+
+test_exec_dir = get_option('libexecdir') / 'installed-tests' / 'dbus'
+test_meta_dir = get_option('datadir') / 'installed-tests' / 'dbus'
+
+###############################################################################
+# Test configuration needs some specific keys
+
+test_data_config = configuration_data()
+test_data_config.merge_from(data_config)
+
+test_data_config.set('DBUS_SESSION_BUS_LISTEN_ADDRESS', test_listen)
+test_data_config.set('EXEEXT', exe_ext)
+# / '' to convert \-separated dir to /-separated dir on win32
+test_data_config.set('DBUS_TEST_EXEC', meson.current_build_dir() / '')
+test_data_config.set('DBUS_TEST_DATA', meson.current_build_dir() / 'data')
+
+
+test_env = environment()
+
+test_env.set('DBUS_TOP_SRCDIR', meson.project_source_root())
+test_env.set('DBUS_TEST_HOMEDIR', meson.project_source_root() / 'dbus')
+test_env.set('HOME', meson.project_source_root() / 'dbus')
+test_env.set('DBUS_TEST_SRCDIR', meson.current_source_dir())
+
+test_env.set('DBUS_TOP_BUILDDIR', meson.project_build_root())
+test_env.set('DBUS_TEST_BUILDDIR', meson.current_build_dir())
+test_env.set('DBUS_TEST_EXEC', meson.current_build_dir())
+test_env.set('DBUS_TEST_DATA', meson.current_build_dir() / 'data')
+
+test_env.set('DBUS_TEST_DAEMON', dbus_daemon.full_path())
+test_env.set('DBUS_TEST_DBUS_LAUNCH', dbus_launch.full_path())
+test_env.set('DBUS_TEST_DBUS_MONITOR', dbus_monitor.full_path())
+test_env.set('DBUS_TEST_DBUS_SEND', dbus_send.full_path())
+
+if platform_unix
+ test_env.set('DBUS_TEST_DBUS_UUIDGEN', dbus_uuidgen.full_path())
+endif
+
+
+test_env.set('XDG_DATA_HOME', meson.current_build_dir() / 'XDG_DATA_HOME')
+test_env.set('XDG_RUNTIME_DIR', meson.current_build_dir() / 'XDG_RUNTIME_DIR')
+xdg_data_dirs = [
+ meson.current_build_dir() / 'XDG_DATA_DIRS',
+ meson.current_build_dir() / 'XDG_DATA_DIRS2'
+]
+test_env.set('XDG_DATA_DIRS', xdg_data_dirs)
+
+test_env.set('DBUS_SESSION_BUS_ADDRESS', 'do-not-use-real-session:')
+
+test_env.set('DBUS_FATAL_WARNINGS', '1')
+test_env.set('DBUS_TEST_UNINSTALLED', '1')
+
+xdgdir = custom_target('gen-xdgdir',
+ command: [
+ python, '-c', 'import os; os.makedirs("@0@", exist_ok=True)'.format(meson.current_build_dir() / 'XDG_RUNTIME_DIR')
+ ],
+ output: 'XDG_RUNTIME_DIR'
+)
+
+###############################################################################
+# Dbus testutils
+
+
+libdbus_testutils_sources = [
+ 'disable-crash-handling.c',
+ 'test-utils.c',
+]
+
+if use_glib
+ libdbus_testutils_sources += 'test-utils-glib.c'
+endif
+
+libdbus_testutils = static_library('dbus-testutils',
+ libdbus_testutils_sources,
+
+ include_directories: root_include,
+ link_with: [
+ libdbus,
+ libdbus_internal,
+ ],
+ dependencies: [
+ glib,
+ dbus_dependencies,
+ ],
+)
+
+
+###############################################################################
+# Test tools
+
+# these binaries are used in tests but are not themselves tests
+test_exit = executable('test-exit',
+ 'test-exit.c',
+ include_directories: root_include,
+ link_with: libdbus_testutils,
+ dependencies: dbus_dependencies,
+)
+test_names = executable('test-names',
+ 'test-names.c',
+ include_directories: root_include,
+ link_with: libdbus_testutils,
+ dependencies: dbus_dependencies,
+)
+test_privserver = executable('test-privserver',
+ 'test-privserver.c',
+ include_directories: root_include,
+ link_with: libdbus_testutils,
+ dependencies: dbus_dependencies,
+)
+# This helper is meant to crash, so if we're compiling the rest with
+# AddressSanitizer, we need to stop it from catching the SIGSEGV and
+# turning it into _exit(1); so don't give it SANITIZE_CFLAGS.
+# CODE_COVERAGE_CFLAGS are fairly pointless here, too.
+# TODO
+test_segfault = executable('test-segfault',
+ 'test-segfault.c', 'disable-crash-handling.c',
+ include_directories: root_include,
+ dependencies: dbus_dependencies,
+)
+test_shell_service = executable('test-shell-service',
+ 'test-shell-service.c',
+ include_directories: root_include,
+ link_with: libdbus_testutils,
+ dependencies: dbus_dependencies,
+)
+
+if use_traditional_activation
+ test_spawn = executable('test-spawn',
+ 'spawn-test.c',
+ include_directories: root_include,
+ link_with: libdbus_testutils,
+ dependencies: dbus_dependencies,
+ )
+endif
+if use_traditional_activation and platform_unix
+ launch_helper_for_tests = executable('launch-helper-for-tests',
+ 'bus/launch-helper-for-tests.c',
+ include_directories: root_include,
+ link_with: liblaunch_helper_internal,
+ dependencies: dbus_dependencies,
+ )
+ test_data_config.set('TEST_LAUNCH_HELPER_BINARY', launch_helper_for_tests.full_path())
+else
+ # Dummy value, should not be used in practice
+ test_data_config.set('TEST_LAUNCH_HELPER_BINARY', '/bin/false')
+endif
+
+if platform_unix and use_glib
+ test_apparmor_activation = executable('test-apparmor-activation',
+ 'sd-activation.c',
+ include_directories: root_include,
+ c_args: '-DDBUS_TEST_APPARMOR_ACTIVATION',
+ link_with: libdbus_testutils,
+ dependencies: [
+ glib, gio,
+ apparmor,
+ ],
+ install: install_tests,
+ install_dir: test_exec_dir,
+ )
+endif
+
+###############################################################################
+# Subdirectories need utilities above.
+
+subdir('data')
+
+# the "name-test" subdir in fact contains a bunch of tests now that need a
+# temporary bus to be running to do stuff with. The directory should be renamed.
+subdir('name-test')
+
+tests = []
+
+if embedded_tests
+
+ tests += [
+ {
+ 'name': 'bus',
+ 'srcs': [ 'bus/main.c' ],
+ 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
+ 'install': false,
+ },
+ {
+ 'name': 'bus-dispatch-sha1',
+ 'srcs': [ 'bus/dispatch-sha1.c' ],
+ 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
+ 'install': false,
+ 'timeout': 120,
+ },
+ {
+ 'name': 'bus-dispatch',
+ 'srcs': [ 'bus/dispatch.c' ],
+ 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
+ 'install': false,
+ 'timeout': 120,
+ },
+ {
+ 'name': 'marshal-recursive',
+ 'srcs': [
+ 'internals/dbus-marshal-recursive-util.c',
+ 'internals/marshal-recursive.c',
+ ],
+ 'link': [ libdbus_testutils, ],
+ 'install': false,
+ },
+ {
+ 'name': 'message-internals',
+ 'srcs': [
+ 'internals/dbus-marshal-recursive-util.c',
+ 'internals/dbus-message-factory.c',
+ 'internals/dbus-message-util.c',
+ 'internals/message-internals.c',
+ ],
+ 'link': [ libdbus_testutils, ],
+ 'install': false,
+ },
+ ]
+
+ if use_traditional_activation and platform_unix
+ tests += [
+ {
+ 'name': 'bus-launch-helper-oom',
+ 'srcs': [ 'bus/launch-helper-oom.c' ],
+ 'link': [ libdbus_testutils, liblaunch_helper_internal, ],
+ 'install': false,
+ },
+ {
+ 'name': 'bus-system',
+ 'srcs': [ 'bus/system.c', ],
+ 'link': [ libdbus_testutils, liblaunch_helper_internal, ],
+ 'install': false,
+ },
+ {
+ 'name': 'spawn-oom',
+ 'srcs': [ 'internals/spawn-oom.c', ],
+ 'link': [ libdbus_testutils, ],
+ 'install': false,
+ }
+ ]
+ endif
+endif
+
+tests += [
+ {
+ 'name': 'service',
+ 'srcs': [ 'test-service.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'install': true,
+ 'test': false,
+ },
+ {
+ 'name': 'sleep-forever',
+ 'srcs': [ 'test-sleep-forever.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'install': true,
+ 'test': false,
+ }
+]
+
+tests += [
+ {
+ 'name': 'atomic',
+ 'srcs': [ 'internals/atomic.c' ],
+ 'link': [ libdbus_testutils, ],
+ },
+ {
+ 'name': 'hash',
+ 'srcs': [ 'internals/hash.c' ],
+ 'link': [ libdbus_testutils, ],
+ },
+ {
+ 'name': 'misc-internals',
+ 'srcs': [
+ 'internals/address.c',
+ 'internals/dbus-auth-script.c',
+ 'internals/dbus-auth-util.c',
+ 'internals/dbus-credentials-util.c',
+ 'internals/dbus-marshal-byteswap-util.c',
+ 'internals/dbus-marshal-recursive-util.c',
+ 'internals/dbus-marshal-validate-util.c',
+ 'internals/dbus-string-util.c',
+ 'internals/dbus-sysdeps-util.c',
+ 'internals/mempool.c',
+ 'internals/misc-internals.c',
+ 'internals/sha.c',
+ ],
+ 'link': [ libdbus_testutils, ],
+ },
+ {
+ 'name': 'shell',
+ 'srcs': [ 'shell-test.c' ],
+ 'link': [ libdbus_testutils, ],
+ },
+ {
+ 'name': 'printf',
+ 'srcs': [ 'internals/printf.c' ],
+ 'link': [ libdbus_testutils, ],
+ },
+ {
+ 'name': 'manual-backtrace',
+ 'srcs': [ 'manual-backtrace.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'test': false,
+ },
+ {
+ 'name': 'manual-dir-iter',
+ 'srcs': [ 'manual-dir-iter.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'test': false,
+ },
+ {
+ 'name': 'manual-tcp',
+ 'srcs': [ 'manual-tcp.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'test': false,
+ }
+]
+
+if platform_windows
+ tests += [
+ {
+ 'name': 'manual-paths',
+ 'srcs': [ 'manual-paths.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'test': false,
+ }
+ ]
+endif
+
+if use_glib
+ tests += [
+ {
+ 'name': 'assertions',
+ 'srcs': [ 'internals/assertions.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'corrupt',
+ 'srcs': [ 'corrupt.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'dbus-daemon',
+ 'srcs': [ 'dbus-daemon.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'dbus-daemon-eavesdrop',
+ 'srcs': [ 'dbus-daemon-eavesdrop.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'desktop-file',
+ 'srcs': [ 'internals/desktop-file.c' ],
+ 'link': [ libdbus_testutils, libdbus_internal, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'fdpass',
+ 'srcs': [ 'fdpass.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'header-fields',
+ 'srcs': [ 'header-fields.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ 'timeout': 120,
+ },
+ {
+ 'name': 'message',
+ 'srcs': [ 'message.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'monitor',
+ 'srcs': [ 'monitor.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'loopback',
+ 'srcs': [ 'loopback.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'marshal',
+ 'srcs': [ 'marshal.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'refs',
+ 'srcs': [ 'internals/refs.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'relay',
+ 'srcs': [ 'relay.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'server-oom',
+ 'srcs': [ 'internals/server-oom.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'syntax',
+ 'srcs': [ 'syntax.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'sysdeps',
+ 'srcs': [ 'internals/sysdeps.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'syslog',
+ 'srcs': [ 'internals/syslog.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'uid-permissions',
+ 'srcs': [ 'uid-permissions.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'variant',
+ 'srcs': [ 'internals/variant.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ {
+ 'name': 'manual-authz',
+ 'srcs': [ 'manual-authz.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ 'test': false,
+ },
+ {
+ 'name': 'manual-test-thread-blocking',
+ 'srcs': [ 'thread-blocking.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ 'test': false,
+ },
+ ]
+
+ if platform_unix
+ tests += [
+ { 'name': 'containers',
+ 'srcs': [ 'containers.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ { 'name': 'sd-activation',
+ 'srcs': [ 'sd-activation.c' ],
+ 'link': [ libdbus_testutils, ],
+ 'deps': [ glib, gio, ],
+ },
+ ]
+
+ endif
+endif
+
+foreach test: tests
+ name = test.get('name')
+ srcs = test.get('srcs')
+ link = test.get('link', [])
+ deps = test.get('deps', [])
+ timeout = test.get('timeout', 30)
+ install = test.get('install', true)
+ test_now = test.get('test', true)
+
+ test_exe = executable('test-' + name,
+ srcs,
+ link_with: link,
+ dependencies: deps,
+ include_directories: root_include,
+ install: install_tests and install,
+ install_dir: test_exec_dir,
+ )
+
+ if test_now
+ test(name,
+ test_exe,
+ args: ['--tap'],
+ env: test_env,
+ protocol: 'tap',
+ timeout: timeout,
+ )
+ endif
+endforeach
+
+
+###############################################################################
+# Scripts
+
+scripts = []
+
+if platform_unix and use_glib
+ scripts += [
+ { 'name': 'test-dbus-daemon-fork.sh', },
+ { 'name': 'transient-services.sh',
+ 'exec': 'integration/transient-services.sh', },
+ { 'name': 'test-apparmor-activation.sh' },
+ ]
+
+ if embedded_tests
+ scripts += { 'name': 'test-dbus-launch-eval.sh' }
+ endif
+ if embedded_tests and use_x11_autolaunch
+ scripts += { 'name': 'test-dbus-launch-x11.sh' }
+ endif
+endif
+
+foreach script: scripts
+ name = script.get('name')
+ exec = script.get('exec', script.get('name'))
+
+ if install_tests
+ install_data(exec,
+ install_mode: 'rwxr-xr-x',
+ install_dir: test_exec_dir,
+ )
+ endif
+
+ test(name,
+ find_program(exec),
+ env: test_env,
+ depends: xdgdir,
+ )
+endforeach
+
+
+foreach exe : scripts + tests
+ name = exe.get('name')
+ install = exe.get('install', true)
+
+ meta_config = configuration_data()
+ meta_config.set('command',
+ 'env @0@/@1@ --tap'.format(
+ get_option('prefix') / test_exec_dir, name
+ ))
+ configure_file(
+ input : 'meta_template.test.in',
+ output: name + '.test',
+ configuration: meta_config,
+ install: install_tests and install,
+ install_dir: test_meta_dir
+ )
+
+ meta_config = configuration_data()
+ meta_config.set('command',
+ 'env DBUS_TEST_EXEC=@0@ DBUS_TEST_DATA=@0@/data @0@/@1@ --tap'.format(
+ get_option('prefix') / test_exec_dir, name
+ ))
+ configure_file(
+ input : 'meta_template.test.in',
+ output: name + '_with_config.test',
+ configuration: meta_config,
+ install: install_tests,
+ install_dir: test_meta_dir
+ )
+
+endforeach
diff --git a/test/meta_template.test.in b/test/meta_template.test.in
new file mode 100644
index 00000000..31915278
--- /dev/null
+++ b/test/meta_template.test.in
@@ -0,0 +1,4 @@
+[Test]
+Type=session
+Output=TAP
+Exec=@command@
diff --git a/test/name-test/meson.build b/test/name-test/meson.build
new file mode 100644
index 00000000..5039c216
--- /dev/null
+++ b/test/name-test/meson.build
@@ -0,0 +1,79 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+if embedded_tests
+
+ tests = [
+ 'test-autolaunch',
+ 'test-ids',
+ 'test-pending-call-disconnected',
+ 'test-shutdown',
+ ]
+
+ if use_traditional_activation
+ tests += [
+ 'test-pending-call-dispatch',
+ 'test-pending-call-timeout',
+ 'test-threads-init',
+ 'test-privserver-client',
+ ]
+ endif
+
+ foreach test: tests
+ test_exe = executable(test,
+ test + '.c',
+ include_directories: root_include,
+ link_with: [
+ libdbus,
+ libdbus_internal,
+ libdbus_testutils,
+ ],
+ dependencies: dbus_dependencies,
+ )
+
+ test(test,
+ dbus_run_session,
+ args: [
+ '--config-file=@0@'.format(
+ meson.project_build_root()/'test/data/valid-config-files/tmp-session.conf'),
+ '--dbus-daemon=@0@'.format(dbus_daemon.full_path()),
+ '--',
+ test_exe,
+ ],
+ env: test_env,
+ )
+ endforeach
+
+
+ if platform_unix
+ test('run-test',
+ find_program('run-test.sh'),
+ env: test_env,
+ protocol: 'tap',
+ )
+
+ test('run-test-systemserver',
+ find_program('run-test-systemserver.sh'),
+ env: test_env,
+ protocol: 'tap',
+ )
+ endif
+endif
diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh
index d8515a8c..c114322c 100755
--- a/test/name-test/run-test-systemserver.sh
+++ b/test/name-test/run-test-systemserver.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
SCRIPTNAME=$0
MODE=$1
@@ -14,7 +14,7 @@ if test -z "$DBUS_TEST_NAME_IN_SYS_RUN_TEST"; then
DBUS_TEST_NAME_IN_SYS_RUN_TEST=1
export DBUS_TEST_NAME_IN_SYS_RUN_TEST
exec $DBUS_TOP_SRCDIR/tools/run-with-tmp-session-bus.sh $SCRIPTNAME $MODE
-fi
+fi
if test -n "$DBUS_TEST_MONITOR"; then
dbus-monitor --session >&2 &
@@ -52,7 +52,12 @@ dbus_send_test () {
shift 3
e=0
echo "# running test $t"
- "${DBUS_TOP_BUILDDIR}/libtool" --mode=execute $DEBUG "$DBUS_TOP_BUILDDIR/tools/dbus-send" "$@" > output.tmp 2>&1 || e=$?
+ if [ -f "${DBUS_TOP_BUILDDIR}/libtool" ]; then
+ "${DBUS_TOP_BUILDDIR}/libtool" --mode=execute $DEBUG "$DBUS_TOP_BUILDDIR/tools/dbus-send" "$@" > output.tmp 2>&1 || e=$?
+ else
+ "$DBUS_TOP_BUILDDIR/tools/dbus-send" "$@" > output.tmp 2>&1 || e=$?
+ fi
+
if [ $e != $expected_exit ]; then
sed -e 's/^/# /' < output.tmp
interpret_result "1" "$t" "$@" "(expected exit status $expected_exit, got $e)"
diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh
index 9c6a55cc..a96db46a 100755
--- a/test/name-test/run-test.sh
+++ b/test/name-test/run-test.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
SCRIPTNAME=$0
MODE=$1
@@ -12,7 +12,7 @@ if test -z "$DBUS_TEST_NAME_IN_RUN_TEST"; then
DBUS_TEST_NAME_IN_RUN_TEST=1
export DBUS_TEST_NAME_IN_RUN_TEST
exec $DBUS_TOP_SRCDIR/tools/run-with-tmp-session-bus.sh $SCRIPTNAME $MODE
-fi
+fi
if test -n "$DBUS_TEST_MONITOR"; then
dbus-monitor --session >&2 &
@@ -48,7 +48,11 @@ c_test () {
shift
e=0
echo "# running test $t"
- "${DBUS_TOP_BUILDDIR}/libtool" --mode=execute $DEBUG "$DBUS_TOP_BUILDDIR/test/name-test/$t" "$@" >&2 || e=$?
+ if [ -f "${DBUS_TOP_BUILDDIR}/libtool" ]; then
+ "${DBUS_TOP_BUILDDIR}/libtool" --mode=execute $DEBUG "$DBUS_TOP_BUILDDIR/test/name-test/$t" "$@" >&2 || e=$?
+ else
+ "$DBUS_TOP_BUILDDIR/test/name-test/$t" "$@" >&2 || e=$?
+ fi
echo "# exit status $e"
interpret_result "$e" "$t" "$@"
}
diff --git a/tools/build-timestamp.py b/tools/build-timestamp.py
new file mode 100755
index 00000000..6c5d5d9f
--- /dev/null
+++ b/tools/build-timestamp.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+import datetime
+
+print(datetime.datetime.now().isoformat(timespec='minutes'))
diff --git a/tools/disable-uac.rc b/tools/disable-uac.rc
new file mode 100644
index 00000000..af23c7e8
--- /dev/null
+++ b/tools/disable-uac.rc
@@ -0,0 +1 @@
+1 24 "Win32.Manifest"
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 00000000..40bd47e5
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,107 @@
+# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+if not platform_windows
+ dbus_cleanup_sockets = executable('dbus-cleanup-sockets',
+ 'dbus-cleanup-sockets.c',
+ include_directories: root_include,
+ install: true,
+ )
+endif
+
+if platform_windows
+ dbus_launch_sources = [
+ 'dbus-launch-win.c'
+ ]
+else
+ dbus_launch_sources = [
+ 'dbus-launch.c',
+ 'dbus-launch-x11.c',
+ 'tool-common.c',
+ ]
+endif
+
+dbus_launch = executable('dbus-launch',
+ dbus_launch_sources,
+ include_directories: root_include,
+ link_with: libdbus,
+ dependencies: [ x11, ],
+ install: true,
+)
+
+
+dbus_monitor = executable('dbus-monitor',
+ 'dbus-print-message.c',
+ 'dbus-monitor.c',
+ 'tool-common.c',
+ include_directories: root_include,
+ link_with: libdbus,
+ install: true,
+)
+
+dbus_run_session = executable('dbus-run-session',
+ 'dbus-run-session.c',
+ 'tool-common.c',
+ include_directories: root_include,
+ link_with: libdbus_internal,
+ install: true,
+)
+
+dbus_send = executable('dbus-send',
+ 'dbus-print-message.c',
+ 'dbus-send.c',
+ 'tool-common.c',
+ include_directories: root_include,
+ link_with: libdbus,
+ install: true,
+)
+
+dbus_test_tool = executable('dbus-test-tool',
+ 'dbus-echo.c',
+ 'dbus-spam.c',
+ 'test-tool.c',
+ 'tool-common.c',
+ include_directories: root_include,
+ link_with: libdbus,
+ install: true,
+)
+
+dbus_update_activation_environment = executable('dbus-update-activation-environment',
+ 'dbus-update-activation-environment.c',
+ 'tool-common.c',
+ platform_windows ? windows.compile_resources('disable-uac.rc') : [],
+ include_directories: root_include,
+ link_with: libdbus,
+ install: true,
+)
+
+if not platform_windows
+ dbus_uuidgen = executable('dbus-uuidgen',
+ 'dbus-uuidgen.c',
+ include_directories: root_include,
+ link_with: libdbus,
+ install: true,
+ )
+endif
+
+
+install_data('GetAllMatchRules.py',
+ install_dir: docs_dir / 'examples',
+)