From cd2e38261058f552fc51e14e0ac5af93411b3de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 23 Jan 2020 13:12:15 +0100 Subject: [PATCH 01/99] Add Meson build system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Félix Piédallu Signed-off-by: Marc-André Lureau --- bus/legacy-config/meson.build | 35 + bus/meson.build | 179 ++++ bus/systemd-user/meson.build | 33 + bus/sysusers.d/meson.build | 26 + bus/tmpfiles.d/meson.build | 26 + cmake/meson.build | 43 + dbus/meson.build | 231 +++++ doc/maintainer-upload-docs.sh | 41 + doc/meson.build | 247 ++++++ doc/meson_post_install.py | 44 + meson.build | 1056 +++++++++++++++++++++++ meson_options.txt | 276 ++++++ meson_post_install.py | 118 +++ meson_post_install_systemd.py | 54 ++ test/data/copy_data_for_tests.py | 34 + test/data/meson.build | 204 +++++ test/meson.build | 604 +++++++++++++ test/meta_template.test.in | 4 + test/name-test/meson.build | 79 ++ test/name-test/run-test-systemserver.sh | 11 +- test/name-test/run-test.sh | 10 +- tools/build-timestamp.py | 24 + tools/disable-uac.rc | 1 + tools/meson.build | 107 +++ 24 files changed, 3481 insertions(+), 6 deletions(-) create mode 100644 bus/legacy-config/meson.build create mode 100644 bus/meson.build create mode 100644 bus/systemd-user/meson.build create mode 100644 bus/sysusers.d/meson.build create mode 100644 bus/tmpfiles.d/meson.build create mode 100644 cmake/meson.build create mode 100644 dbus/meson.build create mode 100644 doc/maintainer-upload-docs.sh create mode 100644 doc/meson.build create mode 100644 doc/meson_post_install.py create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100755 meson_post_install.py create mode 100644 meson_post_install_systemd.py create mode 100755 test/data/copy_data_for_tests.py create mode 100644 test/data/meson.build create mode 100644 test/meson.build create mode 100644 test/meta_template.test.in create mode 100644 test/name-test/meson.build create mode 100755 tools/build-timestamp.py create mode 100644 tools/disable-uac.rc create mode 100644 tools/meson.build 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 = '' +else + conf_maybe_external = 'EXTERNAL' +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 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 ') + ) + 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 ') + ) + 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 +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 +#include +#include +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 ') +) +config.set('HAVE_CMSGCRED', + cc.has_type('struct cmsgcred', prefix: '#include ') +) + +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 ') +) + + +############################################################################### +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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', +) From e7c1646661100ee46821cfbb55fc264fed85a8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 25 May 2022 11:29:40 +0200 Subject: [PATCH 02/99] README: update for meson build-sys --- README | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/README b/README index fe16284b..183ee49a 100644 --- a/README +++ b/README @@ -80,28 +80,62 @@ Development snapshots make no ABI stability guarantees for new ABI introduced since the last stable release. Development snapshots are likely to have more bugs than stable releases, obviously. -Configuration +Configuration === -dbus could be build by using autotools or cmake. +This branch of dbus can be built by using Autotools, CMake or Meson. +The Meson build system is currently considered experimental, but is +likely to become the recommended build system in future. -When using autotools the configure step is initiated by running ./configure +Older versions of dbus required Autotools or CMake, with Autotools +recommended for Unix systems and CMake recommended for Windows systems. + +When using Autotools, the configure step is initiated by running ./configure with or without additional configuration flags. dbus requires GNU Make (on BSD systems, this is typically called gmake) or a "make" implementation with compatible extensions. -When using cmake the configure step is initiated by running the cmake -program with or without additional configuration flags. +When using CMake, the configure step is initiated by running the cmake +program with or without additional configuration flags. + +Meson only supports out-of-tree builds, and must be passed a directory to put +built and generated sources into. We'll call that directory "build" here. It's +recommended to create a separate build directory for each configuration you +might want to use. + +Basic configuration is done with: + +``` sh +meson build/ +``` + +This will create the build directory. If any dependencies are missing, you can +install them, or try to remove the dependency with a Meson configuration option +(see below). Configuration flags === -When using autotools, run "./configure --help" to see the possible +When using Autotools, run "./configure --help" to see the possible configuration options and environment variables. -When using cmake, inspect README.cmake to see the possible +When using CMake, inspect README.cmake to see the possible configuration options and environment variables. - + +When using Meson, to review the options which Meson chose, run: + +``` sh +meson configure build/ +``` + +With additional arguments meson configure can be used to change options for a +previously configured build directory. All options passed to this command are in +the form `-D "option"="value"`. For example: + +``` sh +meson configure build/ -Dprefix=/tmp/install +``` + API/ABI Policy === From 0fa6060ea5576adbf76e8066ce797b1df53f375b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 12:42:42 +0100 Subject: [PATCH 03/99] .gitignore: Ignore __pycache__ directories anywhere in the tree The Meson build system adds several Python scripts, some of which import code from other Python scripts, which will result in __pycache__ directories appearing in the source tree. Signed-off-by: Simon McVittie --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 72923bda..e16b972e 100644 --- a/.gitignore +++ b/.gitignore @@ -48,5 +48,6 @@ file*.lst .libs/ Makefile Makefile.in +__pycache__/ cscope.out tags From 3bfd184ab71b403252afe09501318adf7de2a020 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 18:55:08 +0100 Subject: [PATCH 04/99] tools: Ship disable-uac.rc instead of generating it at build time The Meson build system ships it anyway. Signed-off-by: Simon McVittie --- tools/Makefile.am | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index f8660c06..e88ecffa 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -137,10 +137,7 @@ SUFFIXES = .rc .rc.o: $(RC) $< -o $@ -nodist_dbus_update_activation_environment_SOURCES = disable-uac.rc - -disable-uac.rc: Win32.Manifest - echo '1 24 "$<"' > $@ +dbus_update_activation_environment_SOURCES += disable-uac.rc endif EXTRA_DIST = run-with-tmp-session-bus.sh strtoll.c strtoull.c Win32.Manifest From 83fbc01dca7445b2d6b62405a9ebef277eeb025d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 19:02:43 +0100 Subject: [PATCH 05/99] test: Sort test executables Signed-off-by: Simon McVittie --- test/name-test/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/name-test/meson.build b/test/name-test/meson.build index 5039c216..11a05f70 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -32,8 +32,8 @@ if embedded_tests tests += [ 'test-pending-call-dispatch', 'test-pending-call-timeout', - 'test-threads-init', 'test-privserver-client', + 'test-threads-init', ] endif From 43927ea002e46c389faa524119a291ad59d79dd8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 19:05:33 +0100 Subject: [PATCH 06/99] test: Don't run test-autolaunch directly It's intended to be run from run-test.sh. Signed-off-by: Simon McVittie --- test/name-test/meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/name-test/meson.build b/test/name-test/meson.build index 11a05f70..982349dc 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -49,6 +49,11 @@ if embedded_tests dependencies: dbus_dependencies, ) + if test == 'test-autolaunch' + # This one is run from run-test.sh, not directly + continue + endif + test(test, dbus_run_session, args: [ From 4bce2c36f0f65b29a182432f49653dd1ac150708 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 19:05:58 +0100 Subject: [PATCH 07/99] test: Expect TAP output for tests in name-test Signed-off-by: Simon McVittie --- test/name-test/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/test/name-test/meson.build b/test/name-test/meson.build index 982349dc..e71149b6 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -64,6 +64,7 @@ if embedded_tests test_exe, ], env: test_env, + protocol: 'tap', ) endforeach From 22b12cdb3fecb548fb9d5d509abb2a65afd6fab1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 19:27:05 +0100 Subject: [PATCH 08/99] test: Disable sanitizers for test-segfault This resolves the TODO comment. Signed-off-by: Simon McVittie --- test/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/meson.build b/test/meson.build index 22855857..e1d14fec 100644 --- a/test/meson.build +++ b/test/meson.build @@ -133,13 +133,12 @@ test_privserver = executable('test-privserver', ) # 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 +# turning it into _exit(1). test_segfault = executable('test-segfault', 'test-segfault.c', 'disable-crash-handling.c', include_directories: root_include, dependencies: dbus_dependencies, + override_options: ['b_sanitize=none'], ) test_shell_service = executable('test-shell-service', 'test-shell-service.c', From 60afeaa5d6430636bbd6e91a5b7c3a09e6facb66 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 19:27:24 +0100 Subject: [PATCH 09/99] test: Avoid arbitrary Python injection if compiled in a path with quotes Signed-off-by: Simon McVittie --- test/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index e1d14fec..e65c5c38 100644 --- a/test/meson.build +++ b/test/meson.build @@ -76,7 +76,9 @@ 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') + python, '-c', + 'import os, sys; os.makedirs(sys.argv[1], exist_ok=True)', + meson.current_build_dir() / 'XDG_RUNTIME_DIR', ], output: 'XDG_RUNTIME_DIR' ) From 29a20c32845e4db702d5ffb7202b24c915eec854 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 20:03:47 +0100 Subject: [PATCH 10/99] build: Make modular_tests an auto feature These don't alter the contents of the non-test executables, so we can safely enable them whenever GLib is available. Signed-off-by: Simon McVittie --- meson.build | 10 ++++++---- meson_options.txt | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 8b871c44..adcd1556 100644 --- a/meson.build +++ b/meson.build @@ -282,11 +282,13 @@ 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) +glib = dependency( + 'glib-2.0', version: '>=2.40', required: get_option('modular_tests'), +) if platform_windows - gio = dependency('gio-windows-2.0', required: false) + gio = dependency('gio-windows-2.0', required: glib.found()) else - gio = dependency('gio-unix-2.0', required: false) + gio = dependency('gio-unix-2.0', required: glib.found()) endif use_glib = glib.found() and gio.found() config.set('DBUS_WITH_GLIB', use_glib) @@ -678,7 +680,7 @@ config.set('DBUS_ENABLE_EMBEDDED_TESTS', embedded_tests) # default (unless you don't have GLib), because they don't bloat the library # or binaries. dbus_enable_modular_tests = ( - get_option('modular_tests') + not get_option('modular_tests').disabled() and glib.version().version_compare('>=2.40') and gio.found() ) diff --git a/meson_options.txt b/meson_options.txt index 56969b2a..d628ad1f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -144,8 +144,8 @@ option( option( 'modular_tests', - type: 'boolean', - value: false, + type: 'feature', + value: 'auto', description: 'Enable modular regression tests (requires GLib)' ) From 67b651d1c68095c9ed6b14d6818c7593e997f5cc Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 20:08:21 +0100 Subject: [PATCH 11/99] build-timestamp.py: Respect SOURCE_DATE_EPOCH Signed-off-by: Simon McVittie --- meson.build | 1 - tools/build-timestamp.py | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index adcd1556..e10a4448 100644 --- a/meson.build +++ b/meson.build @@ -125,7 +125,6 @@ if platform_windows ) endif - # TODO: make this respect SOURCE_DATE_EPOCH build_timestamp = run_command( find_program('tools/build-timestamp.py'), check: true, diff --git a/tools/build-timestamp.py b/tools/build-timestamp.py index 6c5d5d9f..8a188a59 100755 --- a/tools/build-timestamp.py +++ b/tools/build-timestamp.py @@ -20,5 +20,12 @@ # SOFTWARE. import datetime +import os -print(datetime.datetime.now().isoformat(timespec='minutes')) +if 'SOURCE_DATE_EPOCH' in os.environ: + stamp = int(os.environ['SOURCE_DATE_EPOCH']) + dt = datetime.datetime.utcfromtimestamp(stamp) +else: + dt = datetime.datetime.now() + +print(dt.isoformat(timespec='minutes')) From fa764fe4e96540c8292eeca379c57ed7447f6678 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 20:26:55 +0100 Subject: [PATCH 12/99] test/data: Generate a separate installable set of data files Some of the strings we need to substitute into these files are not the same for as-installed testing as for build-time testing. Signed-off-by: Simon McVittie --- test/data/installable/meson.build | 45 +++++++++++++++++++++++++++++++ test/data/meson.build | 13 +++++---- 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 test/data/installable/meson.build diff --git a/test/data/installable/meson.build b/test/data/installable/meson.build new file mode 100644 index 00000000..68bc8705 --- /dev/null +++ b/test/data/installable/meson.build @@ -0,0 +1,45 @@ +# Copyright © 2019-2020 Salamandar +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT +# +# 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. + +# Some configuration parameters used in installed-tests are not the same +# as the configuration parameters used during build-time testing. +installed_tests_config = configuration_data() +installed_tests_config.merge_from(data_config) +installed_tests_config.set('DBUS_TEST_DATA', get_option('prefix') / test_exec_dir / 'data') +installed_tests_config.set('DBUS_TEST_EXEC', get_option('prefix') / test_exec_dir) +installed_tests_config.set('EXEEXT', exe_ext) +installed_tests_config.set('TEST_LAUNCH_HELPER_BINARY', '/bin/false') + +foreach file : data_in_to_install + # Underscorify the output name because Meson doesn't allow subdir output files + configured_file = configure_file( + input : files('../' + file + '.in'), + output: file.underscorify(), + configuration: installed_tests_config, + ) + if install_tests + install_data(configured_file, + rename: file, + install_dir: test_exec_dir / 'data', + ) + endif +endforeach diff --git a/test/data/meson.build b/test/data/meson.build index b02c86f2..f2545a87 100644 --- a/test/data/meson.build +++ b/test/data/meson.build @@ -160,15 +160,10 @@ foreach file : data_in_to_install output: file.underscorify(), configuration: test_data_config, ) - if install_tests - install_data(configured_file, - rename: file, - install_dir: test_exec_dir / 'data', - ) - endif + # We don't install this version: see test/data/installable/ for the + # version that we *do* install. endforeach - ############################################################################### # Copy files into correct places in build directory for tests @@ -202,3 +197,7 @@ 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 + +if install_tests + subdir('installable') +endif From c02d34555ad690ceb36dcf0e09c03de41a136677 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 11:12:12 +0100 Subject: [PATCH 13/99] cmake: Generate the same DBus1Config with Meson as with Autotools DBus1Config.cmake.in relies on DBus1Targets.cmake, which is generated by CMake. DBus1Config.pkgconfig.in uses pkg-config and is independent of CMake. Signed-off-by: Simon McVittie --- cmake/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/meson.build b/cmake/meson.build index 799f5d24..863e6ee3 100644 --- a/cmake/meson.build +++ b/cmake/meson.build @@ -27,7 +27,7 @@ cmake_config.set('DBUS_VERSION', version) cmake_files = [ configure_file( - input: 'DBus1Config.cmake.in', + input: 'DBus1Config.pkgconfig.in', output: 'DBus1Config.cmake', configuration: cmake_config, ), From 6b2d1d65f39addb82eb83bb4765d40b876f1f362 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:16:28 +0100 Subject: [PATCH 14/99] doc: Build Ducktype documentation even if doxygen is not found Signed-off-by: Simon McVittie --- doc/meson.build | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index 254eff9f..f7184791 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -209,26 +209,26 @@ if doxygen.found() install_dir: docs_dir, ) endif +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 +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 if can_upload_docs From 5e6706a530bb71153c05082ee987b7337854c4a7 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:19:58 +0100 Subject: [PATCH 15/99] build: Require yelp-build for ducktype docs, not Doxygen docs Signed-off-by: Simon McVittie --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e10a4448..96476add 100644 --- a/meson.build +++ b/meson.build @@ -257,7 +257,7 @@ 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')) +yelpbuild = find_program('yelp-build', required: get_option('ducktype_docs')) can_upload_docs = doxygen.found() and xsltproc.found() and ducktype.found() From c2b2e0e728b37667f89bb050c4733a6eaabf33ce Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:47:25 +0100 Subject: [PATCH 16/99] build: Resolve localstatedir, sysconfdir relative to prefix If the prefix is something like /opt/dbus, then --localstatedir=var should result in using /opt/dbus/var, and so on. However, if configured with --localstatedir=/var, then the prefix is ignored. Meson special-cases these to default to /var and /etc (respectively), as absolute paths, if the prefix is /usr; so distribution builds will typically still end up using /var and /etc. Signed-off-by: Simon McVittie --- meson.build | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 96476add..a703db3a 100644 --- a/meson.build +++ b/meson.build @@ -689,8 +689,8 @@ dbus_enable_modular_tests = ( 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_LOCALSTATEDIR', get_option('prefix') / get_option('localstatedir')) +data_config.set('EXPANDED_SYSCONFDIR', get_option('prefix') / 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')) @@ -720,7 +720,11 @@ 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' + system_socket = ( + get_option('prefix') + / get_option('localstatedir') + /'run'/'dbus'/'system_bus_socket' + ) endif data_config.set('DBUS_SYSTEM_SOCKET', system_socket) @@ -958,7 +962,7 @@ pkgconfig.generate( 'bindir': '${prefix}' / get_option('bindir'), 'datadir': '${prefix}' / get_option('datadir'), 'datarootdir': '${prefix}' / get_option('datadir'), - 'sysconfdir': '/' / get_option('sysconfdir'), + 'sysconfdir': '${prefix}' / get_option('sysconfdir'), 'daemondir': '${bindir}', 'system_bus_default_address': system_bus_default_address, From eefdbe86f858139463fa3a58a7dbf722bc47c48e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:47:58 +0100 Subject: [PATCH 17/99] build: Make the DBUS_MACHINE_UUID_FILE correctly absolute get_option('localstatedir') might be relative. Signed-off-by: Simon McVittie --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a703db3a..63e50daa 100644 --- a/meson.build +++ b/meson.build @@ -705,7 +705,7 @@ config.set_quoted('DBUS_RUNSTATEDIR', get_option('localstatedir') ) config.set_quoted('DBUS_MACHINE_UUID_FILE', - get_option('localstatedir') / 'lib'/'dbus'/'machine-id' + get_option('prefix') / get_option('localstatedir') / 'lib'/'dbus'/'machine-id' ) config.set_quoted('DBUS_SYSTEM_CONFIG_FILE', get_option('prefix') / get_option('datadir') / 'dbus-1' / 'system.conf' From 1582f713a34abb9dd6d46fcdbc345b41915b4d80 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:49:32 +0100 Subject: [PATCH 18/99] build: Distribute Meson build system in release tarballs As long as we are treating Autotools as a first-class citizen, what we release will be `make distcheck` output. Signed-off-by: Simon McVittie --- Makefile.am | 4 ++++ bus/Makefile.am | 5 +++++ dbus/Makefile.am | 2 ++ doc/Makefile.am | 4 ++++ test/Makefile.am | 6 ++++++ test/name-test/Makefile.am | 2 ++ tools/Makefile.am | 3 +++ 7 files changed, 26 insertions(+) diff --git a/Makefile.am b/Makefile.am index 6078e33c..37415bab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,6 +27,10 @@ EXTRA_DIST = \ bus/CMakeLists.txt \ dbus/CMakeLists.txt \ doc/CMakeLists.txt \ + meson.build \ + meson_options.txt \ + meson_post_install.py \ + meson_post_install_systemd.py \ test/CMakeLists.txt \ test/name-test/CMakeLists.txt \ tools/CMakeLists.txt \ diff --git a/bus/Makefile.am b/bus/Makefile.am index 1595432c..51a8de81 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -220,10 +220,15 @@ endif DBUS_UNIX EXTRA_DIST += \ dbus.service.in \ dbus.socket.in \ + legacy-config/meson.build \ + meson.build \ systemd-user/dbus.service.in \ systemd-user/dbus.socket.in \ + systemd-user/meson.build \ sysusers.d/dbus.conf.in \ + sysusers.d/meson.build \ tmpfiles.d/dbus.conf.in \ + tmpfiles.d/meson.build \ $(NULL) if HAVE_SYSTEMD diff --git a/dbus/Makefile.am b/dbus/Makefile.am index fbd81758..7e3e82e0 100644 --- a/dbus/Makefile.am +++ b/dbus/Makefile.am @@ -329,6 +329,8 @@ endif noinst_PROGRAMS = +EXTRA_DIST += meson.build + # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE include $(top_srcdir)/aminclude_static.am diff --git a/doc/Makefile.am b/doc/Makefile.am index 471ac2b5..5fe9b190 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -223,3 +223,7 @@ clean-local: rm -rf dbus-docs dbus-docs.tmp rm -f *.1.html rm -f doxygen.stamp + +EXTRA_DIST += maintainer-upload-docs.sh +EXTRA_DIST += meson.build +EXTRA_DIST += meson_post_install.py diff --git a/test/Makefile.am b/test/Makefile.am index e89d8ad4..9886f285 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -850,5 +850,11 @@ $(installable_test_meta_with_config): %_with_config.test: %$(EXEEXT) Makefile echo 'Exec=env DBUS_TEST_EXEC=$(testexecdir) DBUS_TEST_DATA=$(testexecdir)/data $(testexecdir)/$* --tap'; \ ) > $@.tmp && mv $@.tmp $@ +EXTRA_DIST += data/copy_data_for_tests.py +EXTRA_DIST += data/installable/meson.build +EXTRA_DIST += data/meson.build +EXTRA_DIST += meson.build +EXTRA_DIST += meta_template.test.in + # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE include $(top_srcdir)/aminclude_static.am diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 527dbbff..e1cc82d2 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -121,3 +121,5 @@ test_autolaunch_LDADD = \ $(NULL) endif endif + +EXTRA_DIST += meson.build diff --git a/tools/Makefile.am b/tools/Makefile.am index e88ecffa..2a5f7df3 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -151,3 +151,6 @@ install-data-local: installcheck-local: test -d $(DESTDIR)$(localstatedir)/lib/dbus + +EXTRA_DIST += build-timestamp.py +EXTRA_DIST += meson.build From e6e2370e9e154c596c4c531046e1fe79ee2cca11 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:15:14 +0100 Subject: [PATCH 19/99] doc: avoid Python injection if filenames contain quotes Signed-off-by: Simon McVittie --- doc/Makefile.am | 1 + doc/list-doc-source.py | 9 +++++++++ doc/meson.build | 7 ++++--- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 doc/list-doc-source.py diff --git a/doc/Makefile.am b/doc/Makefile.am index 5fe9b190..315c9349 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -224,6 +224,7 @@ clean-local: rm -f *.1.html rm -f doxygen.stamp +EXTRA_DIST += list-doc-source.py EXTRA_DIST += maintainer-upload-docs.sh EXTRA_DIST += meson.build EXTRA_DIST += meson_post_install.py diff --git a/doc/list-doc-source.py b/doc/list-doc-source.py new file mode 100644 index 00000000..2ed442ca --- /dev/null +++ b/doc/list-doc-source.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +# Copyright © 2019-2020 Salamandar +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT + +import glob +import sys + +print('\n'.join(glob.glob(sys.argv[1] + '/*.[ch]'))) diff --git a/doc/meson.build b/doc/meson.build index f7184791..3b97f4bd 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -176,9 +176,10 @@ if doxygen.found() 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') + files('list-doc-source.py'), + meson.project_source_root() / 'dbus', + check: true + ).stdout().strip().split('\n') dbus_srcs += dbus_arch_deps_h doxygen_tgt = custom_target('doxygen', From d9194ffb4d4a2759a33519bdb232e0cd1d5d1f90 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 19:44:27 +0100 Subject: [PATCH 20/99] test: Try to create temporary XDG_RUNTIME_DIR with correct mode Signed-off-by: Simon McVittie --- test/Makefile.am | 1 + test/meson.build | 4 ++-- test/mkdir-m700.py | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 test/mkdir-m700.py diff --git a/test/Makefile.am b/test/Makefile.am index 9886f285..9a25924d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -855,6 +855,7 @@ EXTRA_DIST += data/installable/meson.build EXTRA_DIST += data/meson.build EXTRA_DIST += meson.build EXTRA_DIST += meta_template.test.in +EXTRA_DIST += mkdir-m700.py # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE include $(top_srcdir)/aminclude_static.am diff --git a/test/meson.build b/test/meson.build index e65c5c38..9fb62597 100644 --- a/test/meson.build +++ b/test/meson.build @@ -76,8 +76,8 @@ test_env.set('DBUS_TEST_UNINSTALLED', '1') xdgdir = custom_target('gen-xdgdir', command: [ - python, '-c', - 'import os, sys; os.makedirs(sys.argv[1], exist_ok=True)', + python, + files('mkdir-m700.py'), meson.current_build_dir() / 'XDG_RUNTIME_DIR', ], output: 'XDG_RUNTIME_DIR' diff --git a/test/mkdir-m700.py b/test/mkdir-m700.py new file mode 100755 index 00000000..d8ebddbe --- /dev/null +++ b/test/mkdir-m700.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT + +import os +import sys + +# Note that we can't create the XDG_RUNTIME_DIR with permissions 0700 +# on MSYS2, which rejects attempts to change permissions, hence "|| true". +os.makedirs(sys.argv[1], exist_ok=True) + +try: + os.chmod(sys.argv[1], 0o700) +except OSError: + pass From 7445af51a4361eb193fad0f9e0b98f60b77ad711 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:50:23 +0100 Subject: [PATCH 21/99] build: Add machine-readable licensing markers to the Meson build system Signed-off-by: Simon McVittie --- bus/legacy-config/meson.build | 1 + bus/meson.build | 1 + bus/systemd-user/meson.build | 1 + bus/sysusers.d/meson.build | 1 + bus/tmpfiles.d/meson.build | 1 + cmake/meson.build | 1 + dbus/meson.build | 1 + doc/maintainer-upload-docs.sh | 1 + meson_options.txt | 1 + meson_post_install_systemd.py | 1 + test/data/copy_data_for_tests.py | 1 + test/data/meson.build | 1 + test/meson.build | 1 + test/name-test/meson.build | 1 + tools/build-timestamp.py | 1 + tools/meson.build | 1 + 16 files changed, 16 insertions(+) diff --git a/bus/legacy-config/meson.build b/bus/legacy-config/meson.build index 8d3a2b91..1e635713 100644 --- a/bus/legacy-config/meson.build +++ b/bus/legacy-config/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bus/meson.build b/bus/meson.build index 1d7d7ce6..c56800df 100644 --- a/bus/meson.build +++ b/bus/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bus/systemd-user/meson.build b/bus/systemd-user/meson.build index dca415a4..1f95c4ee 100644 --- a/bus/systemd-user/meson.build +++ b/bus/systemd-user/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bus/sysusers.d/meson.build b/bus/sysusers.d/meson.build index 452c547b..1e03896c 100644 --- a/bus/sysusers.d/meson.build +++ b/bus/sysusers.d/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bus/tmpfiles.d/meson.build b/bus/tmpfiles.d/meson.build index c19360da..f866879c 100644 --- a/bus/tmpfiles.d/meson.build +++ b/bus/tmpfiles.d/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cmake/meson.build b/cmake/meson.build index 863e6ee3..bba68c23 100644 --- a/cmake/meson.build +++ b/cmake/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/dbus/meson.build b/dbus/meson.build index c06952f2..93ef6190 100644 --- a/dbus/meson.build +++ b/dbus/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/doc/maintainer-upload-docs.sh b/doc/maintainer-upload-docs.sh index 373315c0..dfffcdc6 100644 --- a/doc/maintainer-upload-docs.sh +++ b/doc/maintainer-upload-docs.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/meson_options.txt b/meson_options.txt index d628ad1f..ce293453 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/meson_post_install_systemd.py b/meson_post_install_systemd.py index 0bab9900..9530e271 100644 --- a/meson_post_install_systemd.py +++ b/meson_post_install_systemd.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/data/copy_data_for_tests.py b/test/data/copy_data_for_tests.py index d8d4b7fa..7a49c4c0 100755 --- a/test/data/copy_data_for_tests.py +++ b/test/data/copy_data_for_tests.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/data/meson.build b/test/data/meson.build index f2545a87..55039584 100644 --- a/test/data/meson.build +++ b/test/data/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/meson.build b/test/meson.build index 9fb62597..9cb939ba 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/name-test/meson.build b/test/name-test/meson.build index e71149b6..68f0bd27 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tools/build-timestamp.py b/tools/build-timestamp.py index 8a188a59..f4dc5a00 100755 --- a/tools/build-timestamp.py +++ b/tools/build-timestamp.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tools/meson.build b/tools/meson.build index 40bd47e5..2146142b 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -1,4 +1,5 @@ # Copyright © 2019-2020 Salamandar +# SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 0793e3be3d96595b9980bdb35d79486e763fedcb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:51:12 +0100 Subject: [PATCH 22/99] build: Propagate some comments from Autotools build into Meson Comments like these represent hard-won knowledge which we should not discard. Signed-off-by: Simon McVittie --- meson.build | 15 ++++++++++++++- test/meson.build | 8 +++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 63e50daa..469a267a 100644 --- a/meson.build +++ b/meson.build @@ -203,6 +203,7 @@ foreach type : int_types arch_config.set('DBUS_INT64_CONSTANT', type.get('type_c')) arch_config.set('DBUS_UINT64_CONSTANT', type.get('type_u_c')) if platform_windows + # MSVCRT.dll printf() doesn't support %lld arch_config.set('DBUS_INT64_MODIFIER', 'I64') else arch_config.set('DBUS_INT64_MODIFIER', type.get('type_m')) @@ -834,20 +835,30 @@ if session_socket_dir == '' endif config.set_quoted('DBUS_SESSION_SOCKET_DIR', session_socket_dir) +# This must be a listening address. It doesn't necessarily need to be an +# address you can connect to - it can be something vague like +# "nonce-tcp:". session_bus_listen_address = get_option('dbus_session_bus_listen_address') if session_bus_listen_address == '' if platform_windows + # On Windows, you can (and should) listen on autolaunch addresses, + # because autolaunching is not the same as X11 autolaunching. session_bus_listen_address = 'autolaunch:' elif use_launchd + # macOS default is to use launchd session_bus_listen_address = 'launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET' else + # The default on all other Unix platforms (notably Linux) + # is to create a randomly named socket in /tmp or similar 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) - +# This must be an address you can connect to. It doesn't necessarily +# need to be an address you can listen on - it can be "autolaunch:", +# even on Unix. session_bus_connect_address = get_option('dbus_session_bus_connect_address') if session_bus_connect_address == '' session_bus_connect_address = 'autolaunch:' @@ -896,6 +907,8 @@ else '-Wno-unused-parameter', '-Wchar-subscripts', '-Wfloat-equal', + # On Windows, we expect to be using msvcrt.dll-compatible printf + # (%I64u instead of %llu) '-D__USE_MINGW_ANSI_STDIO=0', ] diff --git a/test/meson.build b/test/meson.build index 9cb939ba..b41f5836 100644 --- a/test/meson.build +++ b/test/meson.build @@ -48,6 +48,7 @@ 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()) +# Tests in bus/config-parser.c rely on this specific value 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') @@ -61,7 +62,7 @@ if platform_unix test_env.set('DBUS_TEST_DBUS_UUIDGEN', dbus_uuidgen.full_path()) endif - +# Tests in bus/config-parser.c rely on these specific values for XDG_* 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 = [ @@ -137,6 +138,9 @@ test_privserver = executable('test-privserver', # 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). +# We have to compile a separate copy of disable-crash-handling.c for +# test-segfault rather than using libdbus-testutils, because +# otherwise it would fail to link when using the AddressSanitizer. test_segfault = executable('test-segfault', 'test-segfault.c', 'disable-crash-handling.c', include_directories: root_include, @@ -521,6 +525,7 @@ foreach test: tests install_dir: test_exec_dir, ) + # Some binaries are used in tests but are not themselves tests if test_now test(name, test_exe, @@ -546,6 +551,7 @@ if platform_unix and use_glib { 'name': 'test-apparmor-activation.sh' }, ] + # Testing dbus-launch relies on special code in that binary. if embedded_tests scripts += { 'name': 'test-dbus-launch-eval.sh' } endif From fad7a62c39656de6cdf923ab37cfbb9dbe9be9ce Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:59:40 +0100 Subject: [PATCH 23/99] test: Don't run integration tests at build-time Some items listed in the tests array are helper executables rather than actually being tests, and should not be run as a test at any time. Those have {"test": false}. Expand this special case to the scripts array for completeness (although currently, no scripts need this). Meanwhile, some items listed in the scripts array are "as-installed" integration tests which cannot safely be run at build-time, because they make assertions about the state of the installed system. Introduce {"build_time_test": false} for these, and expand this special case to the tests array for completeness (although currently, no compiled executables need this). Signed-off-by: Simon McVittie --- test/meson.build | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/meson.build b/test/meson.build index b41f5836..78755642 100644 --- a/test/meson.build +++ b/test/meson.build @@ -514,7 +514,6 @@ foreach test: tests 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, @@ -525,8 +524,10 @@ foreach test: tests install_dir: test_exec_dir, ) - # Some binaries are used in tests but are not themselves tests - if test_now + # Some binaries are used in tests but are not themselves tests, + # and some might be "as-installed" integration tests that aren't + # guaranteed to work at build-time + if test.get('build_time_test', true) and test.get('test', true) test(name, test_exe, args: ['--tap'], @@ -547,8 +548,10 @@ 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' }, + 'exec': 'integration/transient-services.sh', + 'build_time_test': false }, + { 'name': 'test-apparmor-activation.sh', + 'build_time_test': false }, ] # Testing dbus-launch relies on special code in that binary. @@ -571,11 +574,16 @@ foreach script: scripts ) endif - test(name, - find_program(exec), - env: test_env, - depends: xdgdir, - ) + # Some scripts might be used in tests but not themselves tests, + # and some are "as-installed" integration tests that aren't + # guaranteed to work at build-time + if script.get('build_time_test', true) and script.get('test', true) + test(name, + find_program(exec), + env: test_env, + depends: xdgdir, + ) + endif endforeach From c8ecf552c8cce8219912918a625bc6346d470a71 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:00:28 +0100 Subject: [PATCH 24/99] test: Allow for scripts that don't get installed At the moment there aren't any like this, but it seems reasonable that we might get some later. Signed-off-by: Simon McVittie --- test/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index 78755642..fa2338cc 100644 --- a/test/meson.build +++ b/test/meson.build @@ -566,8 +566,9 @@ endif foreach script: scripts name = script.get('name') exec = script.get('exec', script.get('name')) + install = script.get('install', true) - if install_tests + if install_tests and install install_data(exec, install_mode: 'rwxr-xr-x', install_dir: test_exec_dir, From e75d8a7cbc98c13a1e75360e7ea6a36123ad849d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:01:54 +0100 Subject: [PATCH 25/99] test: Correct generation of .test metadata If a helper executable is not, in itself, a test-case, then we should not generate metadata that tells ginsttest-runner to run it as a test-case. Meanwhile, we were previously generating foo_with_config.test metadata for tests that don't get installed; stop doing that. We also need to distinguish between the abstract name of the test (which usually does not start with test-), the name of the .test file (which does start with test- for compiled executables), and the name of the executable (which may include .exe as well). To make validation against the Autotools build system as straightforward as possible, generate exactly the same names as in Autotools. We can consider removing the test- prefix later, if we remove the Autotools build system. Signed-off-by: Simon McVittie --- test/meson.build | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test/meson.build b/test/meson.build index fa2338cc..42370715 100644 --- a/test/meson.build +++ b/test/meson.build @@ -85,6 +85,8 @@ xdgdir = custom_target('gen-xdgdir', output: 'XDG_RUNTIME_DIR' ) +installed_tests = [] + ############################################################################### # Dbus testutils @@ -536,6 +538,13 @@ foreach test: tests timeout: timeout, ) endif + + if install and test.get('test', true) + installed_tests += [{ + 'name': 'test-' + test.get('name'), + 'exe': 'test-' + test.get('name') + exe_ext, + }] + endif endforeach @@ -573,6 +582,10 @@ foreach script: scripts install_mode: 'rwxr-xr-x', install_dir: test_exec_dir, ) + installed_tests += [{ + 'name': name, + 'exe': name, + }] endif # Some scripts might be used in tests but not themselves tests, @@ -588,27 +601,27 @@ foreach script: scripts endforeach -foreach exe : scripts + tests - name = exe.get('name') - install = exe.get('install', true) +foreach test_case: installed_tests + name = test_case.get('name') + exe = test_case.get('exe', name) meta_config = configuration_data() meta_config.set('command', 'env @0@/@1@ --tap'.format( - get_option('prefix') / test_exec_dir, name + get_option('prefix') / test_exec_dir, exe, )) configure_file( input : 'meta_template.test.in', output: name + '.test', configuration: meta_config, - install: install_tests and install, + install: install_tests, 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 + get_option('prefix') / test_exec_dir, exe, )) configure_file( input : 'meta_template.test.in', From ff92efa389a57a5250c6996df6614234d4d462e0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:17:26 +0100 Subject: [PATCH 26/99] build: Implement a runtime_dir option If the prefix is /usr, then this defaults to /run, similar to the special cases for /var and /etc built into Meson. This is correct for typical modern Linux distributions implementing FHS 3.0. This is intentionally not consistent with Autotools and CMake: if distributions are transitioning to a different way to build dbus, then that's a good time to re-evaluate their build options. Otherwise, this defaults to LOCALSTATEDIR/run, consistent with Autotools and CMake. Signed-off-by: Simon McVittie --- meson.build | 18 +++++++++++++++--- meson_options.txt | 9 +++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 469a267a..0c21e865 100644 --- a/meson.build +++ b/meson.build @@ -690,9 +690,21 @@ dbus_enable_modular_tests = ( docs_dir = get_option('datadir') / 'doc' / 'dbus' +# TODO: If a future Meson version gets a runstatedir option, try both. +# https://github.com/mesonbuild/meson/issues/4141 +runstatedir = get_option('runtime_dir') + +if runstatedir == '' + if get_option('prefix') == '/usr' + runstatedir = '/run' + else + runstatedir = get_option('localstatedir') / 'run' + endif +endif + data_config.set('EXPANDED_LOCALSTATEDIR', get_option('prefix') / get_option('localstatedir')) data_config.set('EXPANDED_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) -data_config.set('EXPANDED_RUNSTATEDIR', '/' / 'run') +data_config.set('EXPANDED_RUNSTATEDIR', get_option('prefix') / runstatedir) data_config.set('EXPANDED_BINDIR', get_option('prefix') / get_option('bindir')) data_config.set('EXPANDED_DATADIR', get_option('prefix') / get_option('datadir')) @@ -703,7 +715,7 @@ 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') + get_option('prefix') / runstatedir ) config.set_quoted('DBUS_MACHINE_UUID_FILE', get_option('prefix') / get_option('localstatedir') / 'lib'/'dbus'/'machine-id' @@ -747,7 +759,7 @@ 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' + system_pid_file = get_option('prefix') / runstatedir / 'dbus'/'pid' endif data_config.set('DBUS_SYSTEM_PID_FILE', system_pid_file) diff --git a/meson_options.txt b/meson_options.txt index ce293453..4babdd65 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -170,6 +170,15 @@ option( description: 'Make pkg-config metadata relocatable' ) +# Deliberately not named runstatedir to avoid colliding with +# https://github.com/mesonbuild/meson/issues/4141 +option( + 'runtime_dir', + type: 'string', + value: '', + description: 'Directory for transient runtime state [default: LOCALSTATEDIR/run or /run]' +) + option( 'selinux', type: 'feature', From 6e5f42be4dc408dc2354760b213c6172fe887671 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:27:33 +0100 Subject: [PATCH 27/99] build: Remove a misleading comment It's fine to define DBUS_COMPILATION for anything that is being compiled as part of dbus. Signed-off-by: Simon McVittie --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index 0c21e865..6244db65 100644 --- a/meson.build +++ b/meson.build @@ -883,7 +883,6 @@ 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' : '' From 9a64c6c095562a35bd8bc319fdf858b4d6614850 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:41:27 +0100 Subject: [PATCH 28/99] build: Make update-authors convenience target runnable from Meson Signed-off-by: Simon McVittie --- Makefile.am | 2 +- maint/update-authors.sh | 11 +++++++++++ meson.build | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 maint/update-authors.sh diff --git a/Makefile.am b/Makefile.am index 37415bab..1587dc7c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,7 @@ EXTRA_DIST = \ all-local: Doxyfile update-authors: - ( cd $(srcdir) && git shortlog -s -e ) | cut -c 8- | sort > $(srcdir)/AUTHORS + cd $(srcdir) && ./maint/update-authors.sh DISTCHECK_CONFIGURE_FLAGS = \ --enable-xml-docs \ diff --git a/maint/update-authors.sh b/maint/update-authors.sh new file mode 100755 index 00000000..9718811e --- /dev/null +++ b/maint/update-authors.sh @@ -0,0 +1,11 @@ +# Copyright 2010 Lennart Poettering +# Copyright 2022 Simon McVittie +# SPDX-License-Identifier: MIT + +set -eux + +if [ -n "${MESON_SOURCE_ROOT-}" ]; then + cd "${MESON_SOURCE_ROOT}" +fi + +git shortlog -s -e | cut -c 8- | sort > AUTHORS diff --git a/meson.build b/meson.build index 6244db65..ac8ba6cf 100644 --- a/meson.build +++ b/meson.build @@ -950,6 +950,13 @@ bonus_files = files( 'README', ) +if platform_unix + run_target( + 'maintainer-update-authors', + command: 'maint/update-authors.sh', + ) +endif + subdir('dbus') subdir('bus') subdir('tools') From 0c948dc7443a63e3e2f624125846fb00d4e87fa0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:46:12 +0100 Subject: [PATCH 29/99] maintainer-upload-docs: Allow servers and directories to be overridden This lets maintainers test the script without putting changes directly into production! Signed-off-by: Simon McVittie --- doc/maintainer-upload-docs.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/maintainer-upload-docs.sh b/doc/maintainer-upload-docs.sh index dfffcdc6..307fa6dd 100644 --- a/doc/maintainer-upload-docs.sh +++ b/doc/maintainer-upload-docs.sh @@ -22,11 +22,11 @@ set -ex -DOC_SERVER=dbus.freedesktop.org -DOC_WWW_DIR=/srv/dbus.freedesktop.org/www +: "${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 +: "${SPECIFICATION_SERVER:=specifications.freedesktop.org}" +: "${SPECIFICATION_PATH:=/srv/specifications.freedesktop.org/www/dbus/1.0}" TMPDIR=$(mktemp -d) From 4655d00952001a794bd152b2aaf797e5f478de37 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:46:38 +0100 Subject: [PATCH 30/99] maintainer-upload-docs: Fail if an undefined variable is referenced "Unofficial strict mode" for shell scripting. Signed-off-by: Simon McVittie --- doc/maintainer-upload-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/maintainer-upload-docs.sh b/doc/maintainer-upload-docs.sh index 307fa6dd..da304087 100644 --- a/doc/maintainer-upload-docs.sh +++ b/doc/maintainer-upload-docs.sh @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -set -ex +set -eux : "${DOC_SERVER:=dbus.freedesktop.org}" : "${DOC_WWW_DIR:=/srv/dbus.freedesktop.org/www}" From 37e1728638c5caaac393a0db756ce304aa611db1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:21:15 +0100 Subject: [PATCH 31/99] maintainer-upload-docs: Remove assumptions about source, build dirs Signed-off-by: Simon McVittie --- doc/maintainer-upload-docs.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/maintainer-upload-docs.sh b/doc/maintainer-upload-docs.sh index da304087..f090cf46 100644 --- a/doc/maintainer-upload-docs.sh +++ b/doc/maintainer-upload-docs.sh @@ -28,6 +28,17 @@ set -eux : "${SPECIFICATION_SERVER:=specifications.freedesktop.org}" : "${SPECIFICATION_PATH:=/srv/specifications.freedesktop.org/www/dbus/1.0}" +if [ -n "${MESON_BUILD_ROOT-}" ]; then + cd "${MESON_BUILD_ROOT}" +fi + +if [ -n "${MESON_SOURCE_ROOT-}" ]; then + top_srcdir="${MESON_SOURCE_ROOT}" +else + # assume build directory is inside source directory + top_srcdir=".." +fi + TMPDIR=$(mktemp -d) mkdir -p "$TMPDIR/api" @@ -39,4 +50,4 @@ 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/" +scp -p "$top_srcdir"/doc/*.dtd "$SPECIFICATION_SERVER:$SPECIFICATION_PATH/" From 4fbdb149878431e71efed1977508d00d7d77376e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:27:10 +0100 Subject: [PATCH 32/99] subprojects: Allow expat and GLib to be built as subprojects This should let us build everything with a mingw-w64 toolchain, without having to use prebuilt dependencies from MSYS. Signed-off-by: Simon McVittie --- Makefile.am | 2 ++ meson.build | 16 ++++++++++++++-- subprojects/expat.wrap | 14 ++++++++++++++ subprojects/glib.wrap | 13 +++++++++++++ tools/ci-install.sh | 1 + 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 subprojects/expat.wrap create mode 100644 subprojects/glib.wrap diff --git a/Makefile.am b/Makefile.am index 1587dc7c..f37865e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,6 +31,8 @@ EXTRA_DIST = \ meson_options.txt \ meson_post_install.py \ meson_post_install_systemd.py \ + subprojects/expat.wrap \ + subprojects/glib.wrap \ test/CMakeLists.txt \ test/name-test/CMakeLists.txt \ tools/CMakeLists.txt \ diff --git a/meson.build b/meson.build index ac8ba6cf..4c3690a2 100644 --- a/meson.build +++ b/meson.build @@ -283,7 +283,12 @@ 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: get_option('modular_tests'), + 'glib-2.0', version: '>=2.40', + required: get_option('modular_tests'), + fallback: ['glib', 'libglib_dep'], + default_options: [ + 'tests=false', + ], ) if platform_windows gio = dependency('gio-windows-2.0', required: glib.found()) @@ -294,7 +299,14 @@ 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)) +if expat.type_name() == 'internal' + # Configure-time checks can't act on subprojects that haven't been + # built yet, but we know that subprojects/expat.wrap is a new enough + # version to have this + config.set('HAVE_XML_SETHASHSALT', true) +else + config.set('HAVE_XML_SETHASHSALT', cc.has_function('XML_SetHashSalt', dependencies: expat)) +endif selinux = dependency('libselinux', version: '>=2.0.86', required: get_option('selinux')) diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap new file mode 100644 index 00000000..26fe9677 --- /dev/null +++ b/subprojects/expat.wrap @@ -0,0 +1,14 @@ +# Copyright 2022 Meson contributors +# SPDX-License-Identifier: MIT + +[wrap-file] +directory = expat-2.4.8 +source_url = https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.xz +source_filename = expat-2.4.8.tar.bz2 +source_hash = f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25 +patch_filename = expat_2.4.8-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.4.8-1/get_patch +patch_hash = 9aec253a2c6d1c0feb852c5c6920298d14701eeec7acc6832bb402438b52112a + +[provide] +expat = expat_dep diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap new file mode 100644 index 00000000..b01294b6 --- /dev/null +++ b/subprojects/glib.wrap @@ -0,0 +1,13 @@ +# Copyright 2022 Meson contributors +# SPDX-License-Identifier: MIT + +[wrap-file] +directory = glib-2.72.2 +source_url = https://download.gnome.org/sources/glib/2.72/glib-2.72.2.tar.xz +source_filename = glib-2.72.2.tar.xz +source_hash = 78d599a133dba7fe2036dfa8db8fb6131ab9642783fc9578b07a20995252d2de +wrapdb_version = 2.72.2-1 + +[provide] +dependency_names = gthread-2.0, gobject-2.0, gmodule-no-export-2.0, gmodule-export-2.0, gmodule-2.0, glib-2.0, gio-2.0, gio-windows-2.0, gio-unix-2.0 +program_names = glib-genmarshal, glib-mkenums, glib-compile-schemas, glib-compile-resources, gio-querymodules, gdbus-codegen diff --git a/tools/ci-install.sh b/tools/ci-install.sh index 40dde892..48197c52 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -159,6 +159,7 @@ case "$ci_distro" in ducktype g++ gcc + git gnome-desktop-testing libapparmor-dev libaudit-dev From 78d359dbb664063ed2dca2d91b18551e730a13c9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 15:20:12 +0100 Subject: [PATCH 33/99] test: Make environment variables consistent with Autotools DBUS_SESSION_BUS_LISTEN_ADDRESS is the same as in non-test files: the test data distinguishes between DBUS_SESSION_BUS_LISTEN_ADDRESS, the real session bus configuration, and TEST_LISTEN, the test-only configuration. DBUS_TEST_HOMEDIR and HOME should be in the build directory, not the source directory. Signed-off-by: Simon McVittie --- test/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/meson.build b/test/meson.build index 42370715..6546f702 100644 --- a/test/meson.build +++ b/test/meson.build @@ -33,7 +33,6 @@ test_meta_dir = get_option('datadir') / 'installed-tests' / 'dbus' 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() / '') @@ -43,11 +42,11 @@ 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_HOMEDIR', meson.project_build_root() / 'dbus') +test_env.set('HOME', meson.project_build_root() / 'dbus') # Tests in bus/config-parser.c rely on this specific value test_env.set('DBUS_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('DBUS_TEST_EXEC', meson.current_build_dir()) From 179669fa7c7647b6810a6a0d25f1726c6de4c953 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 17:53:12 +0100 Subject: [PATCH 34/99] build: Define x11 to an empty dependency if X11 autolaunch is disabled Otherwise, we can't build successfully for Windows with X11 autolaunch explicitly disabled. Signed-off-by: Simon McVittie --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 4c3690a2..937f6438 100644 --- a/meson.build +++ b/meson.build @@ -501,6 +501,7 @@ endif if get_option('x11_autolaunch').disabled() use_x11_autolaunch = false + x11 = not_found else if get_option('x11_autolaunch').enabled() and platform_windows error('X11 autolaunch is not supported on Windows') From 77312171b99313e29bde52c17ecc351129931965 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 18:14:21 +0100 Subject: [PATCH 35/99] test: libdbus-testutils depends on GIO, not just GLib This matters when we build against GLib as a Meson subproject. Signed-off-by: Simon McVittie --- test/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/test/meson.build b/test/meson.build index 6546f702..52c5961c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -109,6 +109,7 @@ libdbus_testutils = static_library('dbus-testutils', ], dependencies: [ glib, + gio, dbus_dependencies, ], ) From 29ae675978a122ed265381c2d7edb3b9c497e525 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 11:53:20 +0100 Subject: [PATCH 36/99] doc: Write absolute path to DTDS into XML catalog Signed-off-by: Simon McVittie --- doc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/meson.build b/doc/meson.build index 3b97f4bd..458dbacb 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -157,7 +157,7 @@ configure_file( input: 'catalog.xml.in', output: 'catalog.xml', install_dir: xml_dir, - configuration: {'DBUS_DTD_DIR': xml_dir}, + configuration: {'DBUS_DTD_DIR': get_option('prefix') / xml_dir}, ) ############################################################################### From c74504fb7ebc395c28f8f4eab5c5ddc881e17a12 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 12:54:52 +0100 Subject: [PATCH 37/99] doc: Make Meson yelp-build invocation compatible with older versions Older versions of yelp-build like the one in Debian 11 do not allow permuting arguments, so all options (in this case -o) must appear before all positional parameters. Signed-off-by: Simon McVittie --- doc/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/meson.build b/doc/meson.build index 458dbacb..2b49502f 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -226,7 +226,11 @@ if ducktype.found() and yelpbuild.found() 'C.css', 'highlight.pack.js', ], - command: [ yelpbuild, 'html', '@INPUT@', '-o', meson.current_build_dir() ], + command: [ + yelpbuild, 'html', + '-o', meson.current_build_dir(), + '@INPUT@', + ], install: true, install_dir: docs_dir, ) From 08348e9e4689c32336b1138005324b05b3dbffa3 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 14:26:12 +0100 Subject: [PATCH 38/99] test: Install transient-services.sh into a subdirectory This is what we do with Autotools, and keeping Meson the same means we can diff the installed trees more easily. Signed-off-by: Simon McVittie --- test/meson.build | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/test/meson.build b/test/meson.build index 52c5961c..7c838067 100644 --- a/test/meson.build +++ b/test/meson.build @@ -557,7 +557,7 @@ if platform_unix and use_glib scripts += [ { 'name': 'test-dbus-daemon-fork.sh', }, { 'name': 'transient-services.sh', - 'exec': 'integration/transient-services.sh', + 'subdir': 'integration', 'build_time_test': false }, { 'name': 'test-apparmor-activation.sh', 'build_time_test': false }, @@ -574,17 +574,23 @@ endif foreach script: scripts name = script.get('name') - exec = script.get('exec', script.get('name')) install = script.get('install', true) + test_subdir = script.get('subdir', '') + + if test_subdir == '' + install_dir = test_exec_dir + else + install_dir = test_exec_dir / test_subdir + endif if install_tests and install - install_data(exec, + install_data(test_subdir / name, install_mode: 'rwxr-xr-x', - install_dir: test_exec_dir, + install_dir: install_dir, ) installed_tests += [{ 'name': name, - 'exe': name, + 'subdir': test_subdir, }] endif @@ -593,7 +599,7 @@ foreach script: scripts # guaranteed to work at build-time if script.get('build_time_test', true) and script.get('test', true) test(name, - find_program(exec), + find_program(script.get('subdir', '.') / name), env: test_env, depends: xdgdir, ) @@ -604,23 +610,31 @@ endforeach foreach test_case: installed_tests name = test_case.get('name') exe = test_case.get('exe', name) + test_subdir = test_case.get('subdir', '') + + if test_subdir == '' + exe = get_option('prefix') / test_exec_dir / exe + install_dir = test_meta_dir + else + exe = get_option('prefix') / test_exec_dir / test_subdir / exe + install_dir = test_meta_dir / test_subdir + endif meta_config = configuration_data() meta_config.set('command', - 'env @0@/@1@ --tap'.format( - get_option('prefix') / test_exec_dir, exe, - )) + 'env @0@ --tap'.format(exe), + ) configure_file( input : 'meta_template.test.in', output: name + '.test', configuration: meta_config, install: install_tests, - install_dir: test_meta_dir + install_dir: install_dir, ) meta_config = configuration_data() meta_config.set('command', - 'env DBUS_TEST_EXEC=@0@ DBUS_TEST_DATA=@0@/data @0@/@1@ --tap'.format( + 'env DBUS_TEST_EXEC=@0@ DBUS_TEST_DATA=@0@/data @1@ --tap'.format( get_option('prefix') / test_exec_dir, exe, )) configure_file( @@ -628,7 +642,7 @@ foreach test_case: installed_tests output: name + '_with_config.test', configuration: meta_config, install: install_tests, - install_dir: test_meta_dir + install_dir: install_dir, ) endforeach From b47263d0ab72cdd652bbf0d7a436a547d87f540d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 14:52:54 +0100 Subject: [PATCH 39/99] bus: Install example systemd hardening when using Meson Signed-off-by: Simon McVittie --- bus/meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bus/meson.build b/bus/meson.build index c56800df..7d09e738 100644 --- a/bus/meson.build +++ b/bus/meson.build @@ -49,6 +49,11 @@ configure_file( install_dir: get_option('datadir') / 'doc' / 'dbus' / 'examples', ) +install_data( + 'example-system-hardening-without-traditional-activation.conf', + install_dir: get_option('datadir') / 'doc' / 'dbus' / 'examples', +) + if use_launchd configure_file( input: 'org.freedesktop.dbus-session.plist.in', From 47deeb4a9e0cf3f00770c5244596c9ae6ad4fe2b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 14:54:33 +0100 Subject: [PATCH 40/99] doc: Don't install introspect.xsl for now Maybe this should be installed, but for now maintain parity with Autotools. Signed-off-by: Simon McVittie --- doc/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/meson.build b/doc/meson.build index 2b49502f..ee2de680 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -145,7 +145,6 @@ xml_dir = get_option('datadir') / 'xml' / 'dbus-1' dtd_files = [ 'busconfig.dtd', 'introspect.dtd', - 'introspect.xsl', ] install_data( From abef7950816d423b3b65fcf36bfa0cf0e36c4ebf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 15:14:18 +0100 Subject: [PATCH 41/99] build: Don't replace prefix in .pc file if relocation is disabled Replacing the prefix with a path relative to ${pcfiledir} can be harmful if the number of path components between the prefix and the ${libdir} is not what we expect, in particular on Debian-derived systems where the ${libdir} is normally lib/x86_64-linux-gnu or similar. Signed-off-by: Simon McVittie --- meson_post_install.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meson_post_install.py b/meson_post_install.py index 78133103..22f0539a 100755 --- a/meson_post_install.py +++ b/meson_post_install.py @@ -80,6 +80,9 @@ def post_install_relocation(): # # TODO: Meson >=0.63 has a new feature, -Dpkgconfig.relocatable=true. + if not relocation: + return + pc_filepath = next( v for (k,v) in introspection['installed'].items() if k.endswith('.pc') ) From e2f2c5dd42e193d4bddb0bda49b07bf254cff248 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 15:12:54 +0100 Subject: [PATCH 42/99] build: Change how we create symlinks from Meson Use install_symlink() in Meson versions that support it, or a script with similar invocation in versions that do not. This will make it straightforward to migrate to install_symlink() when we drop support for Meson versions older than 0.61.0. Based on an implementation in the game-data-packager package, which used a shell script. Signed-off-by: Simon McVittie --- Makefile.am | 1 - bus/meson.build | 25 ++++++++++++ meson.build | 34 +++++++++++++---- meson_post_install_systemd.py | 55 --------------------------- tools/Makefile.am | 1 + tools/meson-compat-install-symlink.py | 22 +++++++++++ 6 files changed, 75 insertions(+), 63 deletions(-) delete mode 100644 meson_post_install_systemd.py create mode 100755 tools/meson-compat-install-symlink.py diff --git a/Makefile.am b/Makefile.am index f37865e8..6fb53c9a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,7 +30,6 @@ EXTRA_DIST = \ meson.build \ meson_options.txt \ meson_post_install.py \ - meson_post_install_systemd.py \ subprojects/expat.wrap \ subprojects/glib.wrap \ test/CMakeLists.txt \ diff --git a/bus/meson.build b/bus/meson.build index 7d09e738..06e293b8 100644 --- a/bus/meson.build +++ b/bus/meson.build @@ -183,3 +183,28 @@ if platform_unix and use_traditional_activation install_dir: get_option('libexecdir'), ) endif + +if use_systemd + install_symlinks += [ + { + 'link_name': 'dbus.service', + 'install_dir': systemd_system_unitdir / 'multi-user.target.wants', + 'pointing_to': '../dbus.service', + }, + { + 'link_name': 'dbus.socket', + 'install_dir': systemd_system_unitdir / 'sockets.target.wants', + 'pointing_to': '../dbus.socket', + }, + ] +endif + +if use_systemd and get_option('user_session') + install_symlinks += [ + { + 'link_name': 'dbus.socket', + 'install_dir': systemd_user_unitdir / 'sockets.target.wants', + 'pointing_to': '../dbus.socket', + }, + ] +endif diff --git a/meson.build b/meson.build index 937f6438..edd20dfa 100644 --- a/meson.build +++ b/meson.build @@ -42,6 +42,8 @@ data_config = configuration_data() compile_args = [] link_args = [] +install_symlinks = [] + ############################################################################### # Project configuration @@ -983,13 +985,6 @@ meson.add_install_script('meson_post_install.py', '@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', @@ -1016,6 +1011,31 @@ pkgconfig.generate( } ) +foreach symlink : install_symlinks + if not platform_unix + warning( + 'Not creating symbolic link @0@/@1@ -> @2@'.format( + symlink['install_dir'], + symlink['link_name'], + symlink['pointing_to'], + ) + ) + elif meson.version().version_compare('>=0.61.0') + install_symlink( + symlink['link_name'], + install_dir : symlink['install_dir'], + pointing_to : symlink['pointing_to'], + ) + else + meson.add_install_script( + 'tools/meson-compat-install-symlink.py', + symlink['link_name'], + symlink['install_dir'], + symlink['pointing_to'], + ) + endif +endforeach + summary_dict = { 'prefix': get_option('prefix'), 'exec_prefix': get_option('prefix'), diff --git a/meson_post_install_systemd.py b/meson_post_install_systemd.py deleted file mode 100644 index 9530e271..00000000 --- a/meson_post_install_systemd.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 -# Copyright © 2019-2020 Salamandar -# SPDX-License-Identifier: MIT -# -# 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/tools/Makefile.am b/tools/Makefile.am index 2a5f7df3..e9c066ba 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -154,3 +154,4 @@ installcheck-local: EXTRA_DIST += build-timestamp.py EXTRA_DIST += meson.build +EXTRA_DIST += meson-compat-install-symlink.py diff --git a/tools/meson-compat-install-symlink.py b/tools/meson-compat-install-symlink.py new file mode 100755 index 00000000..6e7ac333 --- /dev/null +++ b/tools/meson-compat-install-symlink.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2022 Simon McVittie +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT + +# Compatibility shim for installing symlinks with Meson < 0.61 + +import os +import sys +from pathlib import Path + +link_name, d, pointing_to = sys.argv[1:] + +if os.path.isabs(d): + p = Path(d) + d = p.relative_to(p.anchor) + dest = os.path.join(os.environ['DESTDIR'], d) +else: + dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d) + +os.makedirs(dest, mode=0o755, exist_ok=True) +os.symlink(pointing_to, os.path.join(dest, link_name)) From 398820d1fe45f85ac0a22971b88ce8a9903e4d70 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 15:37:17 +0100 Subject: [PATCH 43/99] build: Change how we create empty directories from Meson Use install_emptydir() in Meson versions that support it, or a script with similar invocation in versions that do not. This will make it straightforward to migrate to install_emptydir() when we drop support for Meson versions older than 0.60.0. Signed-off-by: Simon McVittie --- bus/meson.build | 13 +++++++++++++ meson.build | 14 ++++++++++++-- meson_post_install.py | 18 +----------------- tools/Makefile.am | 1 + tools/meson-compat-install-emptydirs.py | 19 +++++++++++++++++++ 5 files changed, 46 insertions(+), 19 deletions(-) create mode 100755 tools/meson-compat-install-emptydirs.py diff --git a/bus/meson.build b/bus/meson.build index 06e293b8..1aaaf48d 100644 --- a/bus/meson.build +++ b/bus/meson.build @@ -184,6 +184,19 @@ if platform_unix and use_traditional_activation ) endif +install_emptydirs += [ + get_option('datadir') / 'dbus-1' / 'session.d', + get_option('datadir') / 'dbus-1' / 'services', +] + +if platform_unix + install_emptydirs += [ + get_option('localstatedir') / 'run' / 'dbus', + get_option('datadir') / 'dbus-1' / 'system.d', + get_option('datadir') / 'dbus-1' / 'system-services', + ] +endif + if use_systemd install_symlinks += [ { diff --git a/meson.build b/meson.build index edd20dfa..ad0e6d7b 100644 --- a/meson.build +++ b/meson.build @@ -42,6 +42,7 @@ data_config = configuration_data() compile_args = [] link_args = [] +install_emptydirs = [] install_symlinks = [] ############################################################################### @@ -980,9 +981,7 @@ subdir('doc') subdir('cmake') meson.add_install_script('meson_post_install.py', - '@0@'.format(platform_unix), '@0@'.format(relocation), - '@0@'.format(use_systemd), ) pkgconfig.generate( @@ -1011,6 +1010,17 @@ pkgconfig.generate( } ) +if meson.version().version_compare('>=0.60.0') + foreach dir : install_emptydirs + install_emptydir(dir) + endforeach +else + meson.add_install_script( + 'tools/meson-compat-install-emptydirs.py', + ':'.join(install_emptydirs), + ) +endif + foreach symlink : install_symlinks if not platform_unix warning( diff --git a/meson_post_install.py b/meson_post_install.py index 22f0539a..3b083130 100755 --- a/meson_post_install.py +++ b/meson_post_install.py @@ -57,23 +57,8 @@ def to_destdir(path): # 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) +relocation = sys.argv[1].lower() == 'true' def post_install_relocation(): # Edit pkg-config file to replace the prefix @@ -116,6 +101,5 @@ def post_install_exe(): if __name__ == "__main__": - post_install_data() post_install_relocation() post_install_exe() diff --git a/tools/Makefile.am b/tools/Makefile.am index e9c066ba..dee5f862 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -154,4 +154,5 @@ installcheck-local: EXTRA_DIST += build-timestamp.py EXTRA_DIST += meson.build +EXTRA_DIST += meson-compat-install-emptydirs.py EXTRA_DIST += meson-compat-install-symlink.py diff --git a/tools/meson-compat-install-emptydirs.py b/tools/meson-compat-install-emptydirs.py new file mode 100755 index 00000000..0fc76287 --- /dev/null +++ b/tools/meson-compat-install-emptydirs.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT + +# Compatibility shim for installing empty directories with Meson < 0.60 + +import os +import sys +from pathlib import Path + +for d in sys.argv[1].split(':'): + if os.path.isabs(d) and 'DESTDIR' in os.environ: + p = Path(d) + d = p.relative_to(p.anchor) + dest = os.path.join(os.environ['DESTDIR'], d) + else: + dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d) + + os.makedirs(dest, mode=0o755, exist_ok=True) From 6eefa5da3453e560aaf311fd4801c14b10428c84 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 15:39:19 +0100 Subject: [PATCH 44/99] meson_post_install.py: Call chmod after chown If we call chmod before chown, then chown will remove the setuid bit. Signed-off-by: Simon McVittie --- meson_post_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_post_install.py b/meson_post_install.py index 3b083130..9c558c99 100755 --- a/meson_post_install.py +++ b/meson_post_install.py @@ -91,8 +91,8 @@ def post_install_exe(): 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) + os.chmod(exe_path, stat.S_ISUID | stat.S_IXUSR | stat.S_IXGRP) else: print('Not installing {0} binary setuid!'.format(exe_path)) print('You\'ll need to manually set permissions to root:{0} and permissions 4750' From 6f6fd74a315d7e5f8c7ac57a82cc999a9b34195e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 15:41:04 +0100 Subject: [PATCH 45/99] meson_post_install.py: Correct path to dbus-daemon-launch-helper It's installed in the ${libexecdir} for both Autotools and Meson. Signed-off-by: Simon McVittie --- meson_post_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson_post_install.py b/meson_post_install.py index 9c558c99..30cb7bdf 100755 --- a/meson_post_install.py +++ b/meson_post_install.py @@ -56,7 +56,7 @@ def to_destdir(path): ############################################################################### # Define paths here -abs_libdir = destdir_prefix / get_option('libdir') +abs_libexecdir = destdir_prefix / get_option('libexecdir') relocation = sys.argv[1].lower() == 'true' @@ -88,7 +88,7 @@ def post_install_exe(): 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 + exe_path = abs_libexecdir / exe_name dbus_user = get_option('dbus_user') if os.getuid() == 0: os.chown(exe_path, 0, grp.getgrnam(dbus_user).gr_gid) From 1dc8cf5875f3af5b8d6076f0bb855737a4f9992e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 15:53:18 +0100 Subject: [PATCH 46/99] test: Add missing session.conf, system.conf to Meson build For as-installed testing on Unix, we want these to be symlinks to the production versions of the same file. Signed-off-by: Simon McVittie --- test/data/meson.build | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/data/meson.build b/test/data/meson.build index 55039584..692cf570 100644 --- a/test/data/meson.build +++ b/test/data/meson.build @@ -201,4 +201,23 @@ endif if install_tests subdir('installable') + + if platform_unix + install_symlinks += [ + { + 'link_name': 'session.conf', + 'install_dir': test_exec_dir / 'data' / 'valid-config-files', + 'pointing_to': + get_option('prefix') / get_option('datadir') / + 'dbus-1' / 'session.conf', + }, + { + 'link_name': 'system.conf', + 'install_dir': test_exec_dir / 'data' / 'valid-config-files-system', + 'pointing_to': + get_option('prefix') / get_option('datadir') / + 'dbus-1' / 'system.conf', + }, + ] + endif endif From 64711328ec616c8d091dcc7204e858eb62fd9419 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 18:25:06 +0100 Subject: [PATCH 47/99] test: Group together tests that run the dbus-daemon These have slightly different requirements on CI, and are harder to get working on Windows. Signed-off-by: Simon McVittie --- test/meson.build | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/meson.build b/test/meson.build index 7c838067..32f866f7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -378,12 +378,14 @@ if use_glib 'srcs': [ 'dbus-daemon.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['runs-dbus-daemon'], }, { 'name': 'dbus-daemon-eavesdrop', 'srcs': [ 'dbus-daemon-eavesdrop.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['runs-dbus-daemon'], }, { 'name': 'desktop-file', @@ -403,6 +405,7 @@ if use_glib 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], 'timeout': 120, + 'suite': ['runs-dbus-daemon'], }, { 'name': 'message', @@ -415,6 +418,7 @@ if use_glib 'srcs': [ 'monitor.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['runs-dbus-daemon'], }, { 'name': 'loopback', @@ -469,6 +473,7 @@ if use_glib 'srcs': [ 'uid-permissions.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['runs-dbus-daemon'], }, { 'name': 'variant', @@ -498,11 +503,13 @@ if use_glib 'srcs': [ 'containers.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['runs-dbus-daemon'], }, { 'name': 'sd-activation', 'srcs': [ 'sd-activation.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['runs-dbus-daemon'], }, ] @@ -514,6 +521,7 @@ foreach test: tests srcs = test.get('srcs') link = test.get('link', []) deps = test.get('deps', []) + suites = test.get('suite', ['dbus']) timeout = test.get('timeout', 30) install = test.get('install', true) @@ -535,6 +543,7 @@ foreach test: tests args: ['--tap'], env: test_env, protocol: 'tap', + suite: suites, timeout: timeout, ) endif @@ -575,6 +584,7 @@ endif foreach script: scripts name = script.get('name') install = script.get('install', true) + suites = script.get('suite', ['dbus']) test_subdir = script.get('subdir', '') if test_subdir == '' @@ -602,6 +612,7 @@ foreach script: scripts find_program(script.get('subdir', '.') / name), env: test_env, depends: xdgdir, + suite: suites, ) endif endforeach From b228b478a4b43aeb61406c8879baa69604fb0fbf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 18:28:29 +0100 Subject: [PATCH 48/99] dbus: Only use compile flags from valgrind, not libraries Recent versions of valgrind have library code, which we don't need (or want) to link to; all we actually want is and . I had hoped that this would suppress the Requires.private when generating our .pc file, but it doesn't seem to. Signed-off-by: Simon McVittie --- dbus/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus/meson.build b/dbus/meson.build index 93ef6190..a4342d2d 100644 --- a/dbus/meson.build +++ b/dbus/meson.build @@ -23,7 +23,7 @@ dbus_dependencies = [ threads, network_libs, systemd, - valgrind, + valgrind.partial_dependency(compile_args: true), ] # source code that goes in the installed client library From 09ebed95ea6db98aec2a9fcea6bc86202798e96b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 15:10:40 +0100 Subject: [PATCH 49/99] test: Extend some timeouts Group slow tests (those taking about a minute or more in one of the configurations built on Gitlab-CI) into a new 'slow' suite, which can be used with `meson test --no-suite=slow` to run just the faster tests. They default to a 5 minute timeout (usually enough) unless overridden (bus/dispatch.c can be *very* slow when OOM testing is enabled, and gets a 30 minute timeout). For the remaining tests, default to Meson's usual 30 second timeout, but bump up the timeout a bit in some cases to have a safety margin (my method was to take the slowest run on our Gitlab-CI, and make sure we're allowing about 3 times that long). Signed-off-by: Simon McVittie --- test/meson.build | 24 ++++++++++++++++++------ test/name-test/meson.build | 12 ++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/test/meson.build b/test/meson.build index 32f866f7..00d0cbfa 100644 --- a/test/meson.build +++ b/test/meson.build @@ -217,14 +217,15 @@ if embedded_tests 'srcs': [ 'bus/dispatch-sha1.c' ], 'link': [ libdbus_testutils, libdbus_daemon_internal, ], 'install': false, - 'timeout': 120, + 'suite': ['slow'], }, { 'name': 'bus-dispatch', 'srcs': [ 'bus/dispatch.c' ], 'link': [ libdbus_testutils, libdbus_daemon_internal, ], 'install': false, - 'timeout': 120, + 'suite': ['slow'], + 'timeout': 3000, }, { 'name': 'marshal-recursive', @@ -234,6 +235,7 @@ if embedded_tests ], 'link': [ libdbus_testutils, ], 'install': false, + 'timeout': 60, }, { 'name': 'message-internals', @@ -245,6 +247,7 @@ if embedded_tests ], 'link': [ libdbus_testutils, ], 'install': false, + 'suite': ['slow'], }, ] @@ -378,7 +381,7 @@ if use_glib 'srcs': [ 'dbus-daemon.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], - 'suite': ['runs-dbus-daemon'], + 'suite': ['runs-dbus-daemon', 'slow'], }, { 'name': 'dbus-daemon-eavesdrop', @@ -404,8 +407,7 @@ if use_glib 'srcs': [ 'header-fields.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], - 'timeout': 120, - 'suite': ['runs-dbus-daemon'], + 'suite': ['runs-dbus-daemon', 'slow'], }, { 'name': 'message', @@ -419,6 +421,7 @@ if use_glib 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], 'suite': ['runs-dbus-daemon'], + 'timeout': 45, }, { 'name': 'loopback', @@ -437,12 +440,14 @@ if use_glib 'srcs': [ 'internals/refs.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'suite': ['slow'], }, { 'name': 'relay', 'srcs': [ 'relay.c' ], 'link': [ libdbus_testutils, ], 'deps': [ glib, gio, ], + 'timeout': 60, }, { 'name': 'server-oom', @@ -522,9 +527,16 @@ foreach test: tests link = test.get('link', []) deps = test.get('deps', []) suites = test.get('suite', ['dbus']) - timeout = test.get('timeout', 30) install = test.get('install', true) + if 'slow' in suites + timeout = 300 + else + timeout = 30 + endif + + timeout = test.get('timeout', timeout) + test_exe = executable('test-' + name, srcs, link_with: link, diff --git a/test/name-test/meson.build b/test/name-test/meson.build index 68f0bd27..1d1893f4 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -55,6 +55,14 @@ if embedded_tests continue endif + if test == 'test-pending-call-timeout' + timeout = 75 + suites = ['name-test', 'slow'] + else + timeout = 30 + suites = ['name-test'] + endif + test(test, dbus_run_session, args: [ @@ -66,6 +74,8 @@ if embedded_tests ], env: test_env, protocol: 'tap', + suite: suites, + timeout: timeout, ) endforeach @@ -75,12 +85,14 @@ if embedded_tests find_program('run-test.sh'), env: test_env, protocol: 'tap', + suite: 'name-test', ) test('run-test-systemserver', find_program('run-test-systemserver.sh'), env: test_env, protocol: 'tap', + suite: 'name-test', ) endif endif From 9c9fae18dda62e0d73c92b139984f5143063f9f5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 11:52:02 +0100 Subject: [PATCH 50/99] meson: Don't define DBUS_ENABLE_ASSERTS The other build systems don't define this, and it's too confusing to have both DBUS_ENABLE_ASSERTS and DBUS_ENABLE_ASSERT. Signed-off-by: Simon McVittie --- meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/meson.build b/meson.build index ad0e6d7b..4f2632fe 100644 --- a/meson.build +++ b/meson.build @@ -647,8 +647,6 @@ 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) From 4f966cc1b4431cbb6405cad429b74235c52ad764 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:00:43 +0100 Subject: [PATCH 51/99] meson: Don't check for dirfd We never actually look at HAVE_DIRFD. Signed-off-by: Simon McVittie --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index 4f2632fe..7a8788ac 100644 --- a/meson.build +++ b/meson.build @@ -526,7 +526,6 @@ check_functions = [ 'clearenv', 'closefrom', 'close_range', - 'dirfd', 'fpathconf', 'getgrouplist', 'getpeereid', From ec3edd80a6536d1a8772377e889f5e4cdbeb33e0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:28:08 +0100 Subject: [PATCH 52/99] meson: Always define HAVE_DECL_MSG_NOSIGNAL to 1 or 0 This is consistent with Autotools AC_CHECK_DECLS. Signed-off-by: Simon McVittie --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 7a8788ac..2ae2050c 100644 --- a/meson.build +++ b/meson.build @@ -618,8 +618,8 @@ 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.set10('HAVE_DECL_MSG_NOSIGNAL', + cc.has_header_symbol('sys/socket.h', 'MSG_NOSIGNAL') ) config.set('HAVE_SOCKLEN_T', cc.has_type('socklen_t', prefix: '#include ') From 35eca11708e2c511f54c7bfb4bc9b4eb34fc2c8d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:30:55 +0100 Subject: [PATCH 53/99] meson: Replicate Autotools check for __sync_sub_and_fetch The built-in atomic intrinsics are not exactly functions, so it's incorrect to use has_function to check for them. Signed-off-by: Simon McVittie --- meson.build | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 2ae2050c..16dcb67e 100644 --- a/meson.build +++ b/meson.build @@ -615,8 +615,19 @@ endif config.set('DBUS_VA_COPY', va_copy) -#### Atomic integers -config.set10('DBUS_USE_SYNC', cc.has_function('__sync_sub_and_fetch') ? 1 : false) +# Can't use cc.has_function here because atomic operations are not +# exactly functions +config.set10( + 'DBUS_USE_SYNC', + cc.links(''' + int main(void) + { + int a = 4; + int b = __sync_sub_and_fetch (&a, 4); + return b; + } + ''') +) config.set10('HAVE_DECL_MSG_NOSIGNAL', cc.has_header_symbol('sys/socket.h', 'MSG_NOSIGNAL') From d78d742f412aa2ce19608a782a5de2f6e1a614f4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:41:51 +0100 Subject: [PATCH 54/99] meson: Check for environ declaration We use this in various places. Signed-off-by: Simon McVittie --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 16dcb67e..5a51b808 100644 --- a/meson.build +++ b/meson.build @@ -629,6 +629,7 @@ config.set10( ''') ) +config.set10('HAVE_DECL_ENVIRON', cc.has_header_symbol('unistd.h', 'environ')) config.set10('HAVE_DECL_MSG_NOSIGNAL', cc.has_header_symbol('sys/socket.h', 'MSG_NOSIGNAL') ) From 17e12ccfb08debec5b88b7c2bfafbe02daf0e569 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:42:09 +0100 Subject: [PATCH 55/99] meson: Check for LOG_PERROR We use this when writing to the system log. Signed-off-by: Simon McVittie --- meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meson.build b/meson.build index 5a51b808..d7aeb61f 100644 --- a/meson.build +++ b/meson.build @@ -630,6 +630,9 @@ config.set10( ) config.set10('HAVE_DECL_ENVIRON', cc.has_header_symbol('unistd.h', 'environ')) +config.set10('HAVE_DECL_LOG_PERROR', + cc.has_header_symbol('syslog.h', 'LOG_PERROR') +) config.set10('HAVE_DECL_MSG_NOSIGNAL', cc.has_header_symbol('sys/socket.h', 'MSG_NOSIGNAL') ) From 6a4835e6270e276c1f52d68012f471752ebef0fb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:50:06 +0100 Subject: [PATCH 56/99] meson: Define HAVE_GIO_UNIX Some of the tests check for this. Signed-off-by: Simon McVittie --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index d7aeb61f..f9d25bba 100644 --- a/meson.build +++ b/meson.build @@ -295,8 +295,10 @@ glib = dependency( ) if platform_windows gio = dependency('gio-windows-2.0', required: glib.found()) + have_gio_unix = false else gio = dependency('gio-unix-2.0', required: glib.found()) + have_gio_unix = gio.found() endif use_glib = glib.found() and gio.found() config.set('DBUS_WITH_GLIB', use_glib) @@ -688,7 +690,7 @@ 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) - +config.set('HAVE_GIO_UNIX', have_gio_unix ? 1 : false) dbus_static_flags = ( get_option('default_library') == 'static' ? '-DDBUS_STATIC_BUILD' From 154cc9d5ca0bfd09a34cc834b68105b25c0bad30 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 12:50:32 +0100 Subject: [PATCH 57/99] meson: Add GLib version macros This helps to avoid unintended dependencies on newer versions of GLib. Signed-off-by: Simon McVittie --- meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meson.build b/meson.build index f9d25bba..7fde9c9c 100644 --- a/meson.build +++ b/meson.build @@ -691,6 +691,9 @@ 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) config.set('HAVE_GIO_UNIX', have_gio_unix ? 1 : false) +# Ignore post-2.38 deprecations, prevent use of post-2.44 APIs. +config.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_38') +config.set('GLIB_VERSION_MAX_ALLOWED', 'G_ENCODE_VERSION(2,44)') dbus_static_flags = ( get_option('default_library') == 'static' ? '-DDBUS_STATIC_BUILD' From 64e490afe76706b64c8a4153bbc9a424e2b8f797 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 13:06:35 +0100 Subject: [PATCH 58/99] meson: Fix the check for --version-script support At the time we do this check, version_script has not yet been generated, so we have to use something else. Signed-off-by: Simon McVittie --- dbus/Makefile.am | 1 + dbus/meson.build | 13 ++++++++++--- dbus/test-version-script | 10 ++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 dbus/test-version-script diff --git a/dbus/Makefile.am b/dbus/Makefile.am index 7e3e82e0..3c2ea87c 100644 --- a/dbus/Makefile.am +++ b/dbus/Makefile.am @@ -330,6 +330,7 @@ endif noinst_PROGRAMS = EXTRA_DIST += meson.build +EXTRA_DIST += test-version-script # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE include $(top_srcdir)/aminclude_static.am diff --git a/dbus/meson.build b/dbus/meson.build index a4342d2d..2fd7cc72 100644 --- a/dbus/meson.build +++ b/dbus/meson.build @@ -172,9 +172,16 @@ version_script = configure_file( configuration: data_config, ) -version_flags = '-Wl,--version-script,@0@'.format(version_script) -if not cc.has_link_argument(version_flags) - version_flags = [] +# We can't use version_script to check for support, because it hasn't been +# generated yet, so use a static source file instead. +if cc.has_link_argument( + '-Wl,--version-script,@0@'.format( + meson.current_source_dir() / 'test-version-script' + ) +) + version_flags = ['-Wl,--version-script,@0@'.format(version_script)] +else + version_flags = [] endif libdbus = library('dbus-1', diff --git a/dbus/test-version-script b/dbus/test-version-script new file mode 100644 index 00000000..c0f8462d --- /dev/null +++ b/dbus/test-version-script @@ -0,0 +1,10 @@ +NOT_REALLY_LIBDBUS_1_3 { + global: + dbus_*; + local: + *; +}; +NOT_REALLY_LIBDBUS_PRIVATE_1.2.3 { + global: + _dbus_*; +}; From 9215dbea53f629c53063053c72d592dc00cfd5fb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 28 Jun 2022 13:23:31 +0100 Subject: [PATCH 59/99] meson: Allow disabling Valgrind instrumentation This would currently result in a hard dependency on Valgrind headers when linking dependent projects to libdbus (see https://github.com/mesonbuild/meson/pull/10544 for an attempt to avoid this), so distributions likely don't want to enable this feature in their main builds of valgrind (although they could enable it in special debug builds like the one in Debian's dbus-tests package if desired). Signed-off-by: Simon McVittie --- meson.build | 6 +++++- meson_options.txt | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 7fde9c9c..923c12a9 100644 --- a/meson.build +++ b/meson.build @@ -487,7 +487,11 @@ int main() { ''') config.set('HAVE_UNIX_FD_PASSING', has_scm_rights) -valgrind = dependency('valgrind', version: '>=3.6', required: false) +valgrind = dependency( + 'valgrind', + version: '>=3.6', + required: get_option('valgrind'), +) config.set('WITH_VALGRIND', valgrind.found()) if platform_win32ce diff --git a/meson_options.txt b/meson_options.txt index 4babdd65..770082ea 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -264,6 +264,13 @@ option( description: 'Enable user-session semantics for session bus under systemd' ) +option( + 'valgrind', + type: 'feature', + value: 'disabled', + description: 'Build with Valgrind instrumentation (note that this currently adds a hard dependency on valgrind)' +) + option( 'verbose_mode', type: 'boolean', From ac9d36836ef655779676c270b7d39c8690cef2c8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Jul 2022 19:02:44 +0100 Subject: [PATCH 60/99] test: Set PATH or WINEPATH to find dbus-daemon.exe in build-time tests When building for Windows, either natively or cross-compiling and running tests with Wine, test-autolaunch-win expects to be able to find the just-built dbus-daemon.exe in the PATH. Signed-off-by: Simon McVittie --- test/meson.build | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/meson.build b/test/meson.build index 00d0cbfa..43ae3e93 100644 --- a/test/meson.build +++ b/test/meson.build @@ -61,6 +61,21 @@ if platform_unix test_env.set('DBUS_TEST_DBUS_UUIDGEN', dbus_uuidgen.full_path()) endif +if platform_windows + # test-autolaunch-win relies on being able to find the just-built + # dbus-daemon in the PATH + if build_machine.system().contains('windows') + test_env.prepend('PATH', meson.project_build_root() / 'bus') + else + # Assume we'll use Wine to run tests while cross-compiling + test_env.prepend( + 'WINEPATH', + 'Z:' + meson.project_build_root() / 'bus', + separator: ';', + ) + endif +endif + # Tests in bus/config-parser.c rely on these specific values for XDG_* 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') From 9aa751f59ec2d8d29719ae6918b92c98f1086bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 8 Jul 2022 16:02:41 +0400 Subject: [PATCH 61/99] meson: add test-autolaunch-win MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- test/data/meson.build | 1 + test/name-test/meson.build | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/data/meson.build b/test/data/meson.build index 692cf570..602fac7f 100644 --- a/test/data/meson.build +++ b/test/data/meson.build @@ -122,6 +122,7 @@ data_in_to_install = [ 'valid-config-files/forbidding.conf', 'valid-config-files/incoming-limit.conf', 'valid-config-files/limit-containers.conf', + 'valid-config-files/listen-autolaunch-win.conf', 'valid-config-files/max-completed-connections.conf', 'valid-config-files/max-connections-per-user.conf', 'valid-config-files/max-containers.conf', diff --git a/test/name-test/meson.build b/test/name-test/meson.build index 1d1893f4..8e26e1b7 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -23,12 +23,17 @@ if embedded_tests tests = [ - 'test-autolaunch', 'test-ids', 'test-pending-call-disconnected', 'test-shutdown', ] + if platform_windows + tests += ['test-autolaunch-win'] + else + tests += ['test-autolaunch'] + endif + if use_traditional_activation tests += [ 'test-pending-call-dispatch', From f893b86e524b9f414f19d5aaec771365404b29d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 8 Jul 2022 17:41:49 +0400 Subject: [PATCH 62/99] autotools: dist listen-autolaunch-win.conf.in as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- test/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Makefile.am b/test/Makefile.am index 9a25924d..1ee9dd21 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -610,6 +610,7 @@ in_data = \ data/valid-config-files/forbidding.conf.in \ data/valid-config-files/incoming-limit.conf.in \ data/valid-config-files/limit-containers.conf.in \ + data/valid-config-files/listen-autolaunch-win.conf.in \ data/valid-config-files/max-completed-connections.conf.in \ data/valid-config-files/max-connections-per-user.conf.in \ data/valid-config-files/max-containers.conf.in \ From ffc063a95ce23a25bab10a082eca1b327c01df5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 8 Jul 2022 19:29:06 +0400 Subject: [PATCH 63/99] meson: add windows_output_debug_string option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau [smcv: Rename to avoid using "Win32" to refer to both 32- and 64-bit] Signed-off-by: Simon McVittie --- meson.build | 3 +++ meson_options.txt | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/meson.build b/meson.build index 923c12a9..874be1d1 100644 --- a/meson.build +++ b/meson.build @@ -699,6 +699,9 @@ config.set('HAVE_GIO_UNIX', have_gio_unix ? 1 : false) config.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_38') config.set('GLIB_VERSION_MAX_ALLOWED', 'G_ENCODE_VERSION(2,44)') +windows_output_debug = get_option('windows_output_debug_string') +config.set('DBUS_USE_OUTPUT_DEBUG_STRING', windows_output_debug) + dbus_static_flags = ( get_option('default_library') == 'static' ? '-DDBUS_STATIC_BUILD' : [] diff --git a/meson_options.txt b/meson_options.txt index 770082ea..68f91f19 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -291,3 +291,10 @@ option( value: 'auto', description: 'Build XML documentation' ) + +option( + 'windows_output_debug_string', + type: 'boolean', + value: false, + description: 'use OutputDebugString() to log messages to Windows debug port' +) From e986c2b5b6e8f966d4f277c0c3b0779cb7b92c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 8 Jul 2022 19:47:34 +0400 Subject: [PATCH 64/99] meson: add missing header checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 874be1d1..f9995ed4 100644 --- a/meson.build +++ b/meson.build @@ -572,6 +572,8 @@ check_headers = [ 'dirent.h', 'errno.h', 'inttypes.h', + 'io.h', + 'locale.h', 'linux/close_range.h', 'locale.h', 'signal.h', From f0a4d9249078b5ce7f37aea254a4911e481ef584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 8 Jul 2022 19:38:18 +0400 Subject: [PATCH 65/99] cmake: drop needless headers checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- cmake/ConfigureChecks.cmake | 13 ------------- cmake/config.h.cmake | 25 ------------------------- 2 files changed, 38 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 8009effa..57986d08 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -10,36 +10,23 @@ check_include_file(alloca.h HAVE_ALLOCA_H) check_include_file(byteswap.h HAVE_BYTESWAP_H) check_include_file(crt/externs.h HAVE_CRT_EXTERNS_H) check_include_file(dirent.h HAVE_DIRENT_H) # dbus-sysdeps-util.c -check_include_file(dlfcn.h HAVE_DLFCN_H) -check_include_file(execinfo.h HAVE_EXECINFO_H) check_include_file(errno.h HAVE_ERRNO_H) # dbus-sysdeps.c -check_include_file(expat.h HAVE_EXPAT_H) -check_include_file(grp.h HAVE_GRP_H) # dbus-sysdeps-util-win.c check_include_file(inttypes.h HAVE_INTTYPES_H) # dbus-pipe.h check_include_file(io.h HAVE_IO_H) # internal check_include_file(linux/close_range.h HAVE_LINUX_CLOSE_RANGE_H) check_include_file(locale.h HAVE_LOCALE_H) -check_include_file(memory.h HAVE_MEMORY_H) check_include_file(signal.h HAVE_SIGNAL_H) check_include_file(stdint.h HAVE_STDINT_H) # dbus-pipe.h -check_include_file(stdlib.h HAVE_STDLIB_H) check_include_file(stdio.h HAVE_STDIO_H) # dbus-sysdeps.h -check_include_file(string.h HAVE_STRING_H) -check_include_file(strings.h HAVE_STRINGS_H) check_include_file(syslog.h HAVE_SYSLOG_H) check_include_files("stdint.h;sys/types.h;sys/event.h" HAVE_SYS_EVENT_H) check_include_file(sys/inotify.h HAVE_SYS_INOTIFY_H) check_include_file(sys/random.h HAVE_SYS_RANDOM_H) check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(sys/syscall.h HAVE_SYS_SYSCALL_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(sys/uio.h HAVE_SYS_UIO_H) check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H) check_include_file(sys/syslimits.h HAVE_SYS_SYSLIMITS_H) # dbus-sysdeps-unix.c check_include_file(sys/time.h HAVE_SYS_TIME_H)# dbus-sysdeps-win.c -check_include_file(sys/wait.h HAVE_SYS_WAIT_H)# dbus-sysdeps-win.c -check_include_file(time.h HAVE_TIME_H) # dbus-sysdeps-win.c check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)# dbus-sysdeps-win.c check_include_file(unistd.h HAVE_UNISTD_H) # dbus-sysdeps-util-win.c check_include_file(sys/inotify.h DBUS_BUS_ENABLE_INOTIFY) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index f0fb75e2..69f88fea 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -101,17 +101,9 @@ /* Define to 1 if you have dirent.h */ #cmakedefine HAVE_DIRENT_H 1 -#cmakedefine HAVE_DLFCN_H 1 - /* Define to 1 if you have errno.h */ #cmakedefine HAVE_ERRNO_H 1 -#cmakedefine HAVE_EXECINFO_H 1 -#cmakedefine HAVE_EXPAT_H 1 - -/* Define to 1 if you have grp.h */ -#cmakedefine HAVE_GRP_H 1 - /* Define to 1 if you have inttypes.h */ #cmakedefine HAVE_INTTYPES_H 1 @@ -121,8 +113,6 @@ /* Define to 1 if you have locale.h */ #cmakedefine HAVE_LOCALE_H 1 -#cmakedefine HAVE_MEMORY_H 1 - /* Define to 1 if you have poll */ #cmakedefine HAVE_POLL 1 @@ -132,20 +122,15 @@ /* Define to 1 if you have stdint.h */ #cmakedefine HAVE_STDINT_H 1 -#cmakedefine HAVE_STDLIB_H 1 - /* Define to 1 if you have stdio.h */ #cmakedefine HAVE_STDIO_H 1 -#cmakedefine HAVE_STRINGS_H 1 -#cmakedefine HAVE_STRING_H 1 #cmakedefine HAVE_SYSLOG_H 1 #cmakedefine HAVE_SYS_EVENTS_H 1 #cmakedefine HAVE_SYS_INOTIFY_H 1 #cmakedefine HAVE_SYS_PRCTL_H 1 #cmakedefine HAVE_SYS_RANDOM_H 1 #cmakedefine HAVE_SYS_RESOURCE_H 1 -#cmakedefine HAVE_SYS_STAT_H 1 /* Define to 1 if you have sys/syslimits.h */ #cmakedefine HAVE_SYS_SYSLIMITS_H 1 @@ -153,16 +138,6 @@ /* Define to 1 if you have sys/time.h */ #cmakedefine HAVE_SYS_TIME_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 - -#cmakedefine HAVE_SYS_UIO_H 1 - -/* Define to 1 if you have sys/wait.h */ -#cmakedefine HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have time.h */ -#cmakedefine HAVE_TIME_H 1 - /* Define to 1 if you have unistd.h */ #cmakedefine HAVE_UNISTD_H 1 From 95df73b4638b754a069e423ffe03041241b2de8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 11 Jul 2022 10:59:33 +0400 Subject: [PATCH 66/99] cmake/autotools: remove HAVE_DIRFD/HAVE_DDFD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dirfd() is assumed to be present on Linux, dd_fd is never used. Signed-off-by: Marc-André Lureau --- cmake/ConfigureChecks.cmake | 26 -------------------------- cmake/config.h.cmake | 6 ------ configure.ac | 35 ----------------------------------- 3 files changed, 67 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 57986d08..e1540653 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -134,32 +134,6 @@ int main() { } " DBUS_USE_SYNC) -CHECK_C_SOURCE_COMPILES(" -#include -#include -int main( - DIR *dirp; - dirp = opendir(\".\"); - dirfd(dirp); - closedir(dirp); -) -" HAVE_DIRFD) - -if(NOT HAVE_DIRFD) - CHECK_C_SOURCE_COMPILES(" - #include - #include - int main() - { - DIR *dirp; - int fd; - dirp = opendir(\".\"); - fd = dirp->dd_fd; - closedir(dirp); - } - " HAVE_DDFD) -endif() - check_type_size("short" SIZEOF_SHORT) check_type_size("int" SIZEOF_INT) check_type_size("long" SIZEOF_LONG) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 69f88fea..a0acc5b7 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -201,12 +201,6 @@ #cmakedefine HAVE_ACCEPT4 1 -/* Have dirfd function */ -#cmakedefine HAVE_DIRFD 1 - -/* Have the ddfd member of DIR */ -#cmakedefine HAVE_DDFD 1 - #cmakedefine HAVE_INOTIFY_INIT1 1 #cmakedefine HAVE_GETRANDOM 1 #cmakedefine HAVE_GETRLIMIT 1 diff --git a/configure.ac b/configure.ac index 3b225a29..d72d8f7c 100644 --- a/configure.ac +++ b/configure.ac @@ -647,41 +647,6 @@ if test "x$ac_cv_header_syslog_h" = "xyes"; then AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include ]]) fi -AC_MSG_CHECKING(for dirfd) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], [[ -DIR *dirp; -dirp = opendir("."); -dirfd(dirp); -closedir(dirp); -]])], -[dbus_have_dirfd=yes], -[dbus_have_dirfd=no]) -AC_MSG_RESULT($dbus_have_dirfd) -if test "$dbus_have_dirfd" = yes; then - AC_DEFINE(HAVE_DIRFD,1,[Have dirfd function]) -else - AC_MSG_CHECKING(for DIR *dirp->dd_fd) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include - ]], [[ -DIR *dirp; -int fd; -dirp = opendir("."); -fd = dirp->dd_fd; -closedir(dirp); - ]])], - [dbus_have_ddfd=yes], - [dbus_have_ddfd=no]) - AC_MSG_RESULT($dbus_have_ddfd) - if test "$dbus_have_ddfd" = yes; then - AC_DEFINE(HAVE_DDFD,1,[Have the ddfd member of DIR]) - fi -fi - AC_CHECK_HEADERS([execinfo.h], [AC_SEARCH_LIBS([backtrace], [execinfo], [AC_DEFINE([HAVE_BACKTRACE], [1], From a5c8dda5cfe1ba3baa1fb585ad9b3eba7e000ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 11 Jul 2022 11:02:42 +0400 Subject: [PATCH 67/99] cmake: drop unused HAVE_VASPRINTF/HAVE_VSNPRINTF checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- cmake/ConfigureChecks.cmake | 2 -- cmake/config.h.cmake | 4 ---- 2 files changed, 6 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index e1540653..01c80437 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -62,8 +62,6 @@ check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM) check_symbol_exists(getrlimit "sys/resource.h;sys/time.h" HAVE_GETRLIMIT) check_symbol_exists(prlimit "sys/resource.h;sys/time.h" HAVE_PRLIMIT) check_symbol_exists(setrlimit "sys/resource.h;sys/time.h" HAVE_SETRLIMIT) -check_symbol_exists(vasprintf "stdio.h" HAVE_VASPRINTF) -check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF) check_symbol_exists(MSG_NOSIGNAL "sys/socket.h" HAVE_DECL_MSG_NOSIGNAL) check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON) check_symbol_exists(LOG_PERROR "syslog.h" HAVE_DECL_LOG_PERROR) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index a0acc5b7..f5a1659b 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -210,16 +210,12 @@ #cmakedefine HAVE_SETRLIMIT 1 #cmakedefine HAVE_UNIX_FD_PASSING 1 #cmakedefine HAVE_SYSTEMD -#cmakedefine HAVE_VASPRINTF 1 -#cmakedefine HAVE_VSNPRINTF 1 /* Define to use epoll(4) on Linux */ #cmakedefine DBUS_HAVE_LINUX_EPOLL 1 /* Use the gcc __sync extension */ #cmakedefine01 DBUS_USE_SYNC -#cmakedefine HAVE_VASPRINTF 1 -#cmakedefine HAVE_VSNPRINTF 1 #cmakedefine HAVE_SETRESUID 1 #cmakedefine HAVE_GETRESUID 1 From 9016b48cf912cb15cb79522f1937269bbafcf212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 11 Jul 2022 11:17:12 +0400 Subject: [PATCH 68/99] cmake: drop DBUS_VERBOSE_C_S MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently, not used anywhere. Signed-off-by: Marc-André Lureau --- CMakeLists.txt | 4 ---- cmake/config.h.cmake | 7 ------- 2 files changed, 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47953aa3..c7090d01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,10 +209,6 @@ include(ConfigureChecks) # make some more macros available include(MacroLibrary) -if(VCS) - set(DBUS_VERBOSE_C_S 1 CACHE STRING "verbose mode" FORCE) -endif() - if(MSVC) # controll folders in msvc projects include(ProjectSourceGroup) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index f5a1659b..75509524 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -279,13 +279,6 @@ #define SIGHUP 1 #endif -#cmakedefine DBUS_VERBOSE_C_S 1 -#ifdef DBUS_VERBOSE_C_S -#define _dbus_verbose_C_S printf -#else -#define _dbus_verbose_C_S _dbus_verbose -#endif - # if defined(_MSC_VER) && !defined(inline) #define inline __inline #endif From cfa56a666c616a1d37c606b47678e7834a78002d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Jul 2022 17:55:27 +0100 Subject: [PATCH 69/99] meson: Don't use cc.has_function to check for va_copy va_copy is not an ordinary function (an extern symbol), so we can't treat it as one. Instead, use the same compilation/linking check as in the Autotools build system. Signed-off-by: Simon McVittie --- meson.build | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index f9995ed4..fa269d3b 100644 --- a/meson.build +++ b/meson.build @@ -607,8 +607,35 @@ config.set('HAVE_BACKTRACE', have_backtrace) # 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') +# Can't use cc.has_function here because va_copy is not +# exactly a function +va_copy_check = ''' +#include +#include + +static void f (int i, ...) +{ + va_list args1, args2; + va_start (args1, i); + @0@ (args2, args1); + + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + + va_end (args1); + va_end (args2); +} + +int main() +{ + f (0, 42); + return 0; +} +''' + +has_va_copy = cc.links(va_copy_check.format('va_copy')) +has___va_copy = cc.links(va_copy_check.format('__va_copy')) + if has_va_copy va_copy = 'va_copy' elif has___va_copy From 5d3756f6fbc8fd03065f5f5e9db29aeb795e92bf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Jul 2022 19:28:41 +0100 Subject: [PATCH 70/99] meson: Create /var/lib/dbus This holds the machine ID created by dbus-uuidgen. Signed-off-by: Simon McVittie --- tools/meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/meson.build b/tools/meson.build index 2146142b..4c3d9d22 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -106,3 +106,8 @@ endif install_data('GetAllMatchRules.py', install_dir: docs_dir / 'examples', ) + +# Create the empty directory to hold the machine ID +install_emptydirs += [ + get_option('localstatedir') / 'lib' / 'dbus', +] From 60a88f360ca42abd76d791c7e246197bda731e5f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Jul 2022 19:31:33 +0100 Subject: [PATCH 71/99] test: Don't prepend test- to the names of manual tests This makes them consistent with what we do in Autotools. Signed-off-by: Simon McVittie --- test/meson.build | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/meson.build b/test/meson.build index 43ae3e93..e6360900 100644 --- a/test/meson.build +++ b/test/meson.build @@ -292,14 +292,14 @@ endif tests += [ { - 'name': 'service', + 'name': 'test-service', 'srcs': [ 'test-service.c' ], 'link': [ libdbus_testutils, ], 'install': true, 'test': false, }, { - 'name': 'sleep-forever', + 'name': 'test-sleep-forever', 'srcs': [ 'test-sleep-forever.c' ], 'link': [ libdbus_testutils, ], 'install': true, @@ -544,6 +544,12 @@ foreach test: tests suites = test.get('suite', ['dbus']) install = test.get('install', true) + if test.get('test', true) + exe_name = 'test-' + name + else + exe_name = name + endif + if 'slow' in suites timeout = 300 else @@ -552,7 +558,7 @@ foreach test: tests timeout = test.get('timeout', timeout) - test_exe = executable('test-' + name, + test_exe = executable(exe_name, srcs, link_with: link, dependencies: deps, @@ -577,8 +583,8 @@ foreach test: tests if install and test.get('test', true) installed_tests += [{ - 'name': 'test-' + test.get('name'), - 'exe': 'test-' + test.get('name') + exe_ext, + 'name': exe_name, + 'exe': exe_name + exe_ext, }] endif endforeach From 07ddd3597e0ee4dfad35629eaaa80f6936fc8609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sun, 6 Feb 2022 02:44:59 +0400 Subject: [PATCH 72/99] Add meson build CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- .gitlab-ci.yml | 50 ++++++++++++++++++++++++++++++++- tools/ci-build.sh | 19 +++++++++++++ tools/ci-install.sh | 5 +++- tools/docker/windows/Dockerfile | 2 +- 4 files changed, 73 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5591da74..ee993cf1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,7 +44,7 @@ variables: # If you are hacking on them or need a them to rebuild, its enough # to change any part of the string of the image you want. ### - WINDOWS_TAG: "2022-01-07.1" + WINDOWS_TAG: "2022-02-06.2" UPSTREAM_BRANCH: 'master' UPSTREAM_REPO: 'dbus/dbus' @@ -77,6 +77,17 @@ variables: reports: junit: $CI_PROJECT_DIR/test-results.xml +.meson-common: + variables: + ci_buildsys: "meson" + artifacts: + reports: + junit: "$builddir/meson-logs/testlog.junit.xml" + name: "dbus-$CI_JOB_NAME" + when: always + paths: + - "$builddir/meson-logs/testlog.txt" + windows amd64 image: stage: "build docker" variables: @@ -165,6 +176,13 @@ debian cmake: variables: ci_buildsys: "cmake-dist" +debian meson: + extends: + - .meson-common + - .debian-build + variables: + builddir: "ci-build-production-native" + debian mingw32 autotools debug: extends: .debian-build variables: @@ -240,6 +258,16 @@ opensuse mingw64 cmake debug: ci_local_packages: "no" ci_variant: "debug" +opensuse mingw64 meson debug: + extends: + - .meson-common + - .suse-build + variables: + ci_host: "x86_64-w64-mingw32" + ci_local_packages: "no" + ci_variant: "debug" + builddir: "ci-build-$ci_variant-$ci_host" + .ubuntu-build: extends: .unix-host-build image: "ubuntu:latest" @@ -290,4 +318,24 @@ windows vs15-64 cmake: # FIXME: a few tests timeout on gitlab runner for unknown reason - cd build ; ctest -C Debug -VV --timeout 1200 -E '(dbus-daemon|monitor)' --output-junit $ci_cmake_junit_output +windows-meson-mingw-ucrt64: + extends: .win-build + script: + - $env:MSYSTEM = "UCRT64" + - $env:CHERE_INVOKING = "1" + - $env:MSYS2_PATH_TYPE = "inherit" + - $env:PATH += ";C:\msys64\usr\bin" + # FIXME: -j1: for some reason on CI ninja: fatal: pipe: Too many open files + - C:\msys64\usr\bin\bash -lc " + meson build && + ninja -j1 -C build && + meson test -C build" + +windows-meson-vs15-x86: + extends: .win-build + script: + - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=x86 && + meson build && + meson test -C build" + # vim:set sw=2 sts=2 et: diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 3772daad..7b8f1e71 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -427,6 +427,25 @@ case "$ci_buildsys" in ${make} install DESTDIR=$(pwd)/DESTDIR ( cd DESTDIR && find . -ls) ;; + + (meson) + # The test coverage for OOM-safety is too verbose to be useful on + # travis-ci, and too slow when running under wine. + export DBUS_TEST_MALLOC_FAILURES=0 + + meson=meson + case "$ci_host" in + (*-w64-mingw32) + meson=mingw64-meson + ;; + esac + # FIXME: ducktype target fails on debian CI.. + $meson setup -Dducktype_docs=disabled + $meson compile + [ "$ci_test" = no ] || $meson test + DESTDIR=DESTDIR $meson install + ( cd DESTDIR && find . -ls) + ;; esac # vim:set sw=4 sts=4 et: diff --git a/tools/ci-install.sh b/tools/ci-install.sh index 48197c52..0d93566b 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -169,6 +169,8 @@ case "$ci_distro" in libselinux1-dev libsystemd-dev libx11-dev + meson + ninja-build sudo valgrind wget @@ -206,6 +208,7 @@ case "$ci_distro" in automake cmake libtool + meson ) # docs @@ -272,7 +275,7 @@ case "$ci_distro" in "${packages[@]}" mingw${bits}-cross-gcc-c++ mingw${bits}-libexpat-devel - mingw${bits}-glib2-devel + mingw${bits}-cross-meson ) ;; diff --git a/tools/docker/windows/Dockerfile b/tools/docker/windows/Dockerfile index c9a91200..bff4c501 100644 --- a/tools/docker/windows/Dockerfile +++ b/tools/docker/windows/Dockerfile @@ -29,7 +29,7 @@ RUN (New-Object System.Net.WebClient).DownloadString('https://wrapdb.mesonbuild. RUN (New-Object System.Net.WebClient).DownloadString('https://zlib.net/fossils/') >$null # MinGW environment -RUN c:\msys64\usr\bin\bash -lc 'pacman -S --noconfirm mingw-w64-ucrt-x86_64-toolchain expat glib2-devel' +RUN c:\msys64\usr\bin\bash -lc 'pacman -S --noconfirm mingw-w64-ucrt-x86_64-toolchain expat glib2-devel ninja' # Visual Studio can't be installed with choco. # It depends on dotnetfx v4.8.0.20190930, which requires a reboot: dotnetfx (exit code 3010) From c9c2ed8ebf89565a70dab211e5ee6cb4c5a31e27 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 23 Jun 2022 18:52:32 +0100 Subject: [PATCH 73/99] CI: Use mingw32-meson if that's what we're targeting Signed-off-by: Simon McVittie --- tools/ci-build.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 7b8f1e71..590a74ba 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -435,7 +435,10 @@ case "$ci_buildsys" in meson=meson case "$ci_host" in - (*-w64-mingw32) + (i686-w64-mingw32) + meson=mingw32-meson + ;; + (x86_64-w64-mingw32) meson=mingw64-meson ;; esac From 1e5badb071429ad475cc575fcd71db22976ff0a2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:07:19 +0100 Subject: [PATCH 74/99] CI: Reinstate mingw*-glib2-devel Signed-off-by: Simon McVittie --- tools/ci-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci-install.sh b/tools/ci-install.sh index 0d93566b..be9e0619 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -275,6 +275,7 @@ case "$ci_distro" in "${packages[@]}" mingw${bits}-cross-gcc-c++ mingw${bits}-libexpat-devel + mingw${bits}-glib2-devel mingw${bits}-cross-meson ) ;; From be17ca80fe225d3e6aba371a6f14e5cd7ea8fc7e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:09:01 +0100 Subject: [PATCH 75/99] CI: Add repository for word-size-independent mingw stuff windows:mingw:win64 depends on packages from windows:mingw. Signed-off-by: Simon McVittie --- tools/ci-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/ci-install.sh b/tools/ci-install.sh index be9e0619..c2d697da 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -267,6 +267,8 @@ case "$ci_distro" in ( p=$(zypper lr | grep "windows_mingw_win${bits}" || true) if [ -z "$p" ]; then + $zypper ar --refresh --no-gpgcheck \ + "https://download.opensuse.org/repositories/windows:/mingw/$repo/windows:mingw.repo" $zypper ar --refresh --no-gpgcheck \ "https://download.opensuse.org/repositories/windows:/mingw:/win${bits}/$repo/windows:mingw:win${bits}.repo" fi From aaf0be63bdac30c4debf39ea7fcb17f480aef08f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 15:07:27 +0100 Subject: [PATCH 76/99] CI: Collect all Meson logs, not just the test log Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee993cf1..698ddc4b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -86,7 +86,7 @@ variables: name: "dbus-$CI_JOB_NAME" when: always paths: - - "$builddir/meson-logs/testlog.txt" + - "$builddir/meson-logs/*.txt" windows amd64 image: stage: "build docker" From 600926adce7ecc7d93af323749c7d02621f0cf08 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:15:27 +0100 Subject: [PATCH 77/99] CI: Consistently build in ./build This will make it easier to capture log files. All our CI builds happen in an expendable checkout, so we can safely remove and re-create ./build. Signed-off-by: Simon McVittie --- .gitignore | 2 ++ .gitlab-ci.yml | 8 +++----- tools/ci-build.sh | 21 +++++++++++++-------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index e16b972e..931e60a2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /aclocal.m4 /aminclude_static.am /autom4te.cache +/build/ /build-aux/ /bus/tmpfiles.d/dbus.conf /ci-build*/ @@ -25,6 +26,7 @@ file*.lst /libtool /m4/libtool.m4 /m4/lt*.m4 +/src-from-dist/ /stamp-h /stamp-h.in /stamp-h1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 698ddc4b..e973fd70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,7 @@ stages: - build variables: + builddir: "build" ci_in_docker: "yes" ci_local_packages: "yes" ci_parallel: "2" @@ -82,11 +83,11 @@ variables: ci_buildsys: "meson" artifacts: reports: - junit: "$builddir/meson-logs/testlog.junit.xml" + junit: "build/meson-logs/testlog.junit.xml" name: "dbus-$CI_JOB_NAME" when: always paths: - - "$builddir/meson-logs/*.txt" + - "build/meson-logs/*.txt" windows amd64 image: stage: "build docker" @@ -180,8 +181,6 @@ debian meson: extends: - .meson-common - .debian-build - variables: - builddir: "ci-build-production-native" debian mingw32 autotools debug: extends: .debian-build @@ -266,7 +265,6 @@ opensuse mingw64 meson debug: ci_host: "x86_64-w64-mingw32" ci_local_packages: "no" ci_variant: "debug" - builddir: "ci-build-$ci_variant-$ci_host" .ubuntu-build: extends: .unix-host-build diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 590a74ba..2f309c19 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -175,10 +175,13 @@ maybe_fail_tests () { # own checks. NOCONFIGURE=1 ./autogen.sh +# clean up directories from possible previous builds +rm -rf "$builddir" +rm -rf ci-build-dist +rm -rf src-from-dist + case "$ci_buildsys" in (cmake-dist) - # clean up directories from possible previous builds - rm -rf ci-build-dist # Do an Autotools `make dist`, then build *that* with CMake, # to assert that our official release tarballs will be enough # to build with CMake. @@ -186,10 +189,17 @@ case "$ci_buildsys" in ( cd ci-build-dist; ../configure ) make -C ci-build-dist dist tar --xz -xvf ci-build-dist/dbus-1.*.tar.xz - cd dbus-1.*/ + mv dbus-1.*/ src-from-dist + srcdir="$(pwd)/src-from-dist" + ;; + (*) + srcdir="$(pwd)" ;; esac +mkdir -p "$builddir" +builddir="$(realpath "$builddir")" + # # cross compile setup # @@ -219,11 +229,6 @@ case "$ci_host" in ;; esac -srcdir="$(pwd)" -builddir="ci-build-${ci_variant}-${ci_host}" -# clean up directories from possible previous builds -rm -rf "$builddir" -mkdir -p "$builddir" cd "$builddir" make="make -j${ci_parallel} V=1 VERBOSE=1" From 5eee2d552a27688a1ff33e3a587f45e6406c85cf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 12:41:41 +0100 Subject: [PATCH 78/99] CI: Verify that Autotools `make dist` includes everything needed for Meson This is similar to what we have done for CMake since dbus/dbus!87 (commit 1063bba "CI: Do the CMake native debug build from an Autotools `make dist`"). Our official source releases are Autotools `make dist` tarballs, so our CI should assert that such tarballs contain everything necessary to do a CMake or Meson build, so that downstream distributions using our tarballs as source can choose their preferred build system. When the Meson build system is ready to be recommended as more preferred than Autotools, we can do as GLib did: stop releasing `make dist` tarballs, and start releasing `meson dist` tarballs instead (which will change nothing for Meson or CMake users, but Autotools users will have to run autoreconf or autogen.sh before building). Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 2 ++ tools/ci-build.sh | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e973fd70..81ccc6f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -181,6 +181,8 @@ debian meson: extends: - .meson-common - .debian-build + variables: + ci_buildsys: "meson-dist" debian mingw32 autotools debug: extends: .debian-build diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 2f309c19..694fc128 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -181,10 +181,10 @@ rm -rf ci-build-dist rm -rf src-from-dist case "$ci_buildsys" in - (cmake-dist) - # Do an Autotools `make dist`, then build *that* with CMake, + (cmake-dist|meson-dist) + # Do an Autotools `make dist`, then build *that* with CMake or Meson, # to assert that our official release tarballs will be enough - # to build with CMake. + # to build with CMake or Meson. mkdir -p ci-build-dist ( cd ci-build-dist; ../configure ) make -C ci-build-dist dist @@ -433,7 +433,7 @@ case "$ci_buildsys" in ( cd DESTDIR && find . -ls) ;; - (meson) + (meson|meson-dist) # The test coverage for OOM-safety is too verbose to be useful on # travis-ci, and too slow when running under wine. export DBUS_TEST_MALLOC_FAILURES=0 From da94d0c0290fab5635713a8f587ad091e9b8ab2f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 16:48:46 +0100 Subject: [PATCH 79/99] CI: Only use openSUSE mingw*-meson as a replacement for `meson setup` These pass a lot of configure arguments taken from RPM macros, which are only accepted by the meson command if we don't explicitly select a mode. Signed-off-by: Simon McVittie --- tools/ci-build.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 694fc128..8a0ddcc0 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -438,20 +438,28 @@ case "$ci_buildsys" in # travis-ci, and too slow when running under wine. export DBUS_TEST_MALLOC_FAILURES=0 - meson=meson + meson_setup= + + # openSUSE has convenience wrappers that run Meson with appropriate + # cross options case "$ci_host" in (i686-w64-mingw32) - meson=mingw32-meson + meson_setup=mingw32-meson ;; (x86_64-w64-mingw32) - meson=mingw64-meson + meson_setup=mingw64-meson ;; esac + + if [ -z "$meson_setup" ]; then + meson_setup="meson setup" + fi + # FIXME: ducktype target fails on debian CI.. - $meson setup -Dducktype_docs=disabled - $meson compile - [ "$ci_test" = no ] || $meson test - DESTDIR=DESTDIR $meson install + $meson_setup -Dducktype_docs=disabled + meson compile + [ "$ci_test" = no ] || meson test + DESTDIR=DESTDIR meson install ( cd DESTDIR && find . -ls) ;; esac From c21d47836cd73def920183633e326e337eee57b4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:21:30 +0100 Subject: [PATCH 80/99] CI: Add glue to build with mingw-w64 toolchain on Debian Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 17 +++++++++ LICENSES/Apache-2.0.txt | 73 ++++++++++++++++++++++++++++++++++++ Makefile.am | 1 + maint/i686-w64-mingw32.txt | 33 ++++++++++++++++ maint/x86_64-w64-mingw32.txt | 33 ++++++++++++++++ tools/ci-build.sh | 15 +++++++- 6 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 LICENSES/Apache-2.0.txt create mode 100644 maint/i686-w64-mingw32.txt create mode 100644 maint/x86_64-w64-mingw32.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 81ccc6f1..54c30bed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -198,6 +198,14 @@ debian mingw32 cmake: variables: ci_host: "i686-w64-mingw32" +debian mingw32 meson: + extends: + - .meson-common + - .debian-build + when: manual + variables: + ci_host: "i686-w64-mingw32" + debian mingw64 autotools: extends: .debian-build variables: @@ -213,6 +221,15 @@ debian mingw64 cmake debug: ci_host: "x86_64-w64-mingw32" ci_variant: "debug" +debian mingw64 meson debug: + extends: + - .meson-common + - .debian-build + when: manual + variables: + ci_host: "x86_64-w64-mingw32" + ci_variant: "debug" + debian buster autotools: extends: .debian-build when: manual diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 100644 index 00000000..137069b8 --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1,73 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/Makefile.am b/Makefile.am index 6fb53c9a..d9371958 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,6 +13,7 @@ EXTRA_DIST = \ dbus-1.pc.in \ cleanup-man-pages.sh \ LICENSES/AFL-2.1.txt \ + LICENSES/Apache-2.0.txt \ LICENSES/GPL-2.0-or-later.txt \ LICENSES/MIT.txt \ NEWS.pre-1-0 \ diff --git a/maint/i686-w64-mingw32.txt b/maint/i686-w64-mingw32.txt new file mode 100644 index 00000000..dd92c458 --- /dev/null +++ b/maint/i686-w64-mingw32.txt @@ -0,0 +1,33 @@ +# Copyright 2018-2020 Meson contributors +# SPDX-License-Identifier: Apache-2.0 + +[binaries] +c = '/usr/bin/i686-w64-mingw32-gcc' +cpp = '/usr/bin/i686-w64-mingw32-g++' +objc = '/usr/bin/i686-w64-mingw32-gcc' +ar = '/usr/bin/i686-w64-mingw32-ar' +strip = '/usr/bin/i686-w64-mingw32-strip' +pkgconfig = '/usr/bin/i686-w64-mingw32-pkg-config' +windres = '/usr/bin/i686-w64-mingw32-windres' +exe_wrapper = ['xvfb-run', '-a', 'wine'] +ld = '/usr/bin/i686-w64-mingw32-ld' +cmake = '/usr/bin/cmake' + +[properties] +# Directory that contains 'bin', 'lib', etc +root = '/usr/i686-w64-mingw32' +# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries +sys_root = '/usr/i686-w64-mingw32/sys-root/mingw' + +[host_machine] +system = 'windows' +cpu_family = 'x86' +cpu = 'i686' +endian = 'little' + +[cmake] +CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON' +CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER' +CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY' +CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY' +CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY' diff --git a/maint/x86_64-w64-mingw32.txt b/maint/x86_64-w64-mingw32.txt new file mode 100644 index 00000000..80c3607a --- /dev/null +++ b/maint/x86_64-w64-mingw32.txt @@ -0,0 +1,33 @@ +# Copyright 2018-2020 Meson contributors +# SPDX-License-Identifier: Apache-2.0 + +[binaries] +c = '/usr/bin/x86_64-w64-mingw32-gcc' +cpp = '/usr/bin/x86_64-w64-mingw32-g++' +objc = '/usr/bin/x86_64-w64-mingw32-gcc' +ar = '/usr/bin/x86_64-w64-mingw32-ar' +strip = '/usr/bin/x86_64-w64-mingw32-strip' +pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' +windres = '/usr/bin/x86_64-w64-mingw32-windres' +exe_wrapper = ['xvfb-run', '-a', 'wine'] +ld = '/usr/bin/x86_64-w64-mingw32-ld' +cmake = '/usr/bin/cmake' + +[properties] +# Directory that contains 'bin', 'lib', etc +root = '/usr/x86_64-w64-mingw32' +# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries +sys_root = '/usr/x86_64-w64-mingw32/sys-root/mingw' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[cmake] +CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON' +CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER' +CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY' +CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY' +CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY' diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 8a0ddcc0..440fe709 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -439,6 +439,7 @@ case "$ci_buildsys" in export DBUS_TEST_MALLOC_FAILURES=0 meson_setup= + cross_file= # openSUSE has convenience wrappers that run Meson with appropriate # cross options @@ -451,8 +452,20 @@ case "$ci_buildsys" in ;; esac - if [ -z "$meson_setup" ]; then + case "$ci_host" in + (*-w64-mingw32) + cross_file="${srcdir}/maint/${ci_host}.txt" + ;; + esac + + # Debian doesn't have similar convenience wrappers, but we can use + # a cross-file + if [ -z "$meson_setup" ] || ! command -v "$meson_setup" >/dev/null; then meson_setup="meson setup" + + if [ -n "$cross_file" ]; then + set -- --cross-file="$cross_file" "$@" + fi fi # FIXME: ducktype target fails on debian CI.. From 14bfd498c63b66c6ebab60b744a56ed26b892c6c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 17:29:55 +0100 Subject: [PATCH 81/99] CI: Explicitly disable features that can't work on Windows Signed-off-by: Simon McVittie --- tools/ci-build.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 440fe709..313f3535 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -455,6 +455,19 @@ case "$ci_buildsys" in case "$ci_host" in (*-w64-mingw32) cross_file="${srcdir}/maint/${ci_host}.txt" + # openSUSE's wrappers are designed for building predictable + # RPM packages, so they set --auto-features=enabled - + # but that includes some things that make no sense on + # Windows. + set -- -Dapparmor=disabled "$@" + set -- -Depoll=disabled "$@" + set -- -Dinotify=disabled "$@" + set -- -Dkqueue=disabled "$@" + set -- -Dlaunchd=disabled "$@" + set -- -Dlibaudit=disabled "$@" + set -- -Dselinux=disabled "$@" + set -- -Dsystemd=disabled "$@" + set -- -Dx11_autolaunch=disabled "$@" ;; esac From cceffebed36efdccd3636b510734b7974fea6f0e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:32:19 +0100 Subject: [PATCH 82/99] CI: Implement debug build variant for Meson Signed-off-by: Simon McVittie --- tools/ci-build.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 313f3535..42eef2fd 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -471,6 +471,27 @@ case "$ci_buildsys" in ;; esac + case "$ci_variant" in + (debug) + set -- -Dasserts=true "$@" + set -- -Dembedded_tests=true "$@" + set -- -Dmodular_tests=enabled "$@" + set -- -Dverbose_mode=true "$@" + + case "$ci_host" in + (*-w64-mingw32) + ;; + (*) + set -- -Db_sanitize=address,undefined "$@" + set -- -Db_pie=true "$@" + set -- -Duser_session=true "$@" + ;; + esac + + shift + ;; + esac + # Debian doesn't have similar convenience wrappers, but we can use # a cross-file if [ -z "$meson_setup" ] || ! command -v "$meson_setup" >/dev/null; then @@ -482,7 +503,7 @@ case "$ci_buildsys" in fi # FIXME: ducktype target fails on debian CI.. - $meson_setup -Dducktype_docs=disabled + $meson_setup -Dducktype_docs=disabled "$@" meson compile [ "$ci_test" = no ] || meson test DESTDIR=DESTDIR meson install From f49791ec991317b1c5a7678dfd1f4546f284540d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 14:37:22 +0100 Subject: [PATCH 83/99] CI: Tell Meson build where to find the source directory Signed-off-by: Simon McVittie --- tools/ci-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 42eef2fd..545ff084 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -503,7 +503,7 @@ case "$ci_buildsys" in fi # FIXME: ducktype target fails on debian CI.. - $meson_setup -Dducktype_docs=disabled "$@" + $meson_setup -Dducktype_docs=disabled "$@" "$srcdir" meson compile [ "$ci_test" = no ] || meson test DESTDIR=DESTDIR meson install From 0dac45dce26e0c5df34107cb812d7a2cebf856ff Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 17:10:49 +0100 Subject: [PATCH 84/99] CI: Explicitly enable wrap dependencies Signed-off-by: Simon McVittie --- tools/ci-build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 545ff084..86da1282 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -502,6 +502,11 @@ case "$ci_buildsys" in fi fi + # openSUSE's mingw*-meson wrappers are designed for self-contained + # package building, so they include --wrap-mode=nodownload. Switch + # the wrap mode back, so we can use wraps. + set -- "$@" --wrap=default + # FIXME: ducktype target fails on debian CI.. $meson_setup -Dducktype_docs=disabled "$@" "$srcdir" meson compile From 4d0341052a825f028c08b3637e92432dc2f40f6f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 17:11:47 +0100 Subject: [PATCH 85/99] CI: Install cross pkg-config on openSUSE Signed-off-by: Simon McVittie --- tools/ci-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci-install.sh b/tools/ci-install.sh index c2d697da..ee9d3499 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -276,6 +276,7 @@ case "$ci_distro" in packages=( "${packages[@]}" mingw${bits}-cross-gcc-c++ + mingw${bits}-cross-pkgconf mingw${bits}-libexpat-devel mingw${bits}-glib2-devel mingw${bits}-cross-meson From 00c18a8050650f197a318f8dc97b5647e656988a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 17:21:00 +0100 Subject: [PATCH 86/99] CI: Factor out Wine setup so that it applies equally to Meson Signed-off-by: Simon McVittie --- tools/ci-build.sh | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 86da1282..b04f0413 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -231,6 +231,22 @@ esac cd "$builddir" +case "$ci_host" in + (*-w64-mingw32) + # If we're dynamically linking libgcc, make sure Wine will find it + if [ "$ci_test" = yes ]; then + if [ "${ci_distro%%-*}" = opensuse ] && [ "${ci_host%%-*}" = x86_64 ]; then + export WINEARCH=win64 + fi + libgcc_path= + if [ "$ci_runtime" = "shared" ]; then + libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)") + fi + init_wine "${dep_prefix}/bin" "${builddir}/bin" ${libgcc_path:+"$libgcc_path"} + fi + ;; +esac + make="make -j${ci_parallel} V=1 VERBOSE=1" case "$ci_buildsys" in @@ -379,22 +395,12 @@ case "$ci_buildsys" in (*-w64-mingw32) # CFLAGS and CXXFLAGS does do work, checked with cmake 3.15 export LDFLAGS="-${ci_runtime}-libgcc" - # enable tests if supported - if [ "$ci_test" = yes ]; then - # choose correct wine architecture - if [ "${ci_distro%%-*}" = opensuse ]; then - if [ "${ci_host%%-*}" = x86_64 ]; then - export WINEARCH=win64 - cmake=mingw64-cmake - else - cmake=mingw32-cmake - fi + if [ "${ci_distro%%-*}" = opensuse ]; then + if [ "${ci_host%%-*}" = x86_64 ]; then + cmake=mingw64-cmake + else + cmake=mingw32-cmake fi - libgcc_path= - if [ "$ci_runtime" = "shared" ]; then - libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)") - fi - init_wine "${dep_prefix}/bin" "$(pwd)/bin" ${libgcc_path:+"$libgcc_path"} cmdwrapper="xvfb-run -a" fi set _ "$@" From 5cd8b3e0a195e56f57912529b3952c84002d5d27 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 18:15:03 +0100 Subject: [PATCH 87/99] CI: Enable modular tests for all Meson-based CI builds The whole point of these tests is that they're safe to enable because they don't affect the production binaries. Signed-off-by: Simon McVittie --- tools/ci-build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index b04f0413..f77d24ea 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -477,11 +477,12 @@ case "$ci_buildsys" in ;; esac + set -- -Dmodular_tests=enabled "$@" + case "$ci_variant" in (debug) set -- -Dasserts=true "$@" set -- -Dembedded_tests=true "$@" - set -- -Dmodular_tests=enabled "$@" set -- -Dverbose_mode=true "$@" case "$ci_host" in From d946c02289f3c20152e87797eb6ac52c07d1dd3c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 11:13:14 +0100 Subject: [PATCH 88/99] CI: Run Meson with -v so we can see compiler command-lines Signed-off-by: Simon McVittie --- tools/ci-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index f77d24ea..2e31e424 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -516,7 +516,7 @@ case "$ci_buildsys" in # FIXME: ducktype target fails on debian CI.. $meson_setup -Dducktype_docs=disabled "$@" "$srcdir" - meson compile + meson compile -v [ "$ci_test" = no ] || meson test DESTDIR=DESTDIR meson install ( cd DESTDIR && find . -ls) From d8160bdcfa8f87e1807303d8f4211e935128b4e0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 11:14:06 +0100 Subject: [PATCH 89/99] CI: Enable Ducktype-based documentation on Debian/Ubuntu We don't currently know the equivalent of python3-mallard-ducktype on other OSs like openSUSE, but we know this should work on Debian (it does when we do Autotools builds). Signed-off-by: Simon McVittie --- tools/ci-build.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 2e31e424..559713a6 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -477,6 +477,17 @@ case "$ci_buildsys" in ;; esac + case "$ci_distro" in + (debian*|ubuntu*) + # We know how to install python3-mallard-ducktype + ;; + (*) + # TODO: We don't know the openSUSE equivalent of + # python3-mallard-ducktype + set -- -Dducktype_docs=disabled "$@" + ;; + esac + set -- -Dmodular_tests=enabled "$@" case "$ci_variant" in @@ -514,8 +525,7 @@ case "$ci_buildsys" in # the wrap mode back, so we can use wraps. set -- "$@" --wrap=default - # FIXME: ducktype target fails on debian CI.. - $meson_setup -Dducktype_docs=disabled "$@" "$srcdir" + $meson_setup "$@" "$srcdir" meson compile -v [ "$ci_test" = no ] || meson test DESTDIR=DESTDIR meson install From b2a143aa7e3b50dfafea978021d866dd4d26d707 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 11:15:13 +0100 Subject: [PATCH 90/99] CI: Collect config.h This will help to verify that the Meson and Autotools/CMake builds are equivalent. Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 54c30bed..6819f9c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,6 +87,7 @@ variables: name: "dbus-$CI_JOB_NAME" when: always paths: + - "build/config.h" - "build/meson-logs/*.txt" windows amd64 image: From 3e617c4d5c8a0d7d21d510b0d7da6b2708eb7559 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 11:20:56 +0100 Subject: [PATCH 91/99] CI: Force use of subprojects for Windows 32-bit build The Windows image has expat and zlib installed, but they're 64-bit DLLs which won't link successfully into our 32-bit build. Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6819f9c7..b3f0e22e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -353,7 +353,7 @@ windows-meson-vs15-x86: extends: .win-build script: - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=x86 && - meson build && + meson --force-fallback-for=expat,glib,zlib build && meson test -C build" # vim:set sw=2 sts=2 et: From f8500eb8c1bfc799b38d536e5056f9bb39c89f29 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 11:21:11 +0100 Subject: [PATCH 92/99] CI: Collect artifacts for Windows builds Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3f0e22e..84e30b5f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -348,6 +348,14 @@ windows-meson-mingw-ucrt64: meson build && ninja -j1 -C build && meson test -C build" + artifacts: + reports: + junit: "build/meson-logs/testlog.junit.xml" + name: "dbus-$CI_JOB_NAME" + when: always + paths: + - "build/config.h" + - "build/meson-logs/*.txt" windows-meson-vs15-x86: extends: .win-build @@ -355,5 +363,13 @@ windows-meson-vs15-x86: - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=x86 && meson --force-fallback-for=expat,glib,zlib build && meson test -C build" + artifacts: + reports: + junit: "build/meson-logs/testlog.junit.xml" + name: "dbus-$CI_JOB_NAME" + when: always + paths: + - "build/config.h" + - "build/meson-logs/*.txt" # vim:set sw=2 sts=2 et: From b01bcb34a3c794436537c7752548995311ec6c38 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 12:48:44 +0100 Subject: [PATCH 93/99] CI: Ensure that subprojects (if used) are on the Wine PATH If we are not using Meson subprojects, this will have no practical effect, because the directories won't exist. Signed-off-by: Simon McVittie --- tools/ci-build.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 559713a6..937c857a 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -242,7 +242,16 @@ case "$ci_host" in if [ "$ci_runtime" = "shared" ]; then libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)") fi - init_wine "${dep_prefix}/bin" "${builddir}/bin" ${libgcc_path:+"$libgcc_path"} + init_wine \ + "${builddir}/bin" \ + "${builddir}/subprojects/expat-2.4.8" \ + "${builddir}/subprojects/glib-2.72.2/gio" \ + "${builddir}/subprojects/glib-2.72.2/glib" \ + "${builddir}/subprojects/glib-2.72.2/gmodule" \ + "${builddir}/subprojects/glib-2.72.2/gobject" \ + "${builddir}/subprojects/glib-2.72.2/gthread" \ + "${dep_prefix}/bin" \ + ${libgcc_path:+"$libgcc_path"} fi ;; esac From 7de7b215f61567b90cccfe15a6cc4ed46338aa80 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 17:13:52 +0100 Subject: [PATCH 94/99] CI: Explicitly build before running tests If we don't do this, Meson will build everything that is a direct dependency of the test executables, but it won't build indirect dependencies like GLib's gspawn-win32-helper.exe. Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84e30b5f..b4323d3c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -362,6 +362,7 @@ windows-meson-vs15-x86: script: - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=x86 && meson --force-fallback-for=expat,glib,zlib build && + meson compile -C build && meson test -C build" artifacts: reports: From 82ec4cf28fbae3e400784710846c7b71190ecbb0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 18:22:30 +0100 Subject: [PATCH 95/99] CI: Skip tests that run dbus-daemon when running on Windows Mitigates: #400 Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4323d3c..b1418c3f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -347,7 +347,7 @@ windows-meson-mingw-ucrt64: - C:\msys64\usr\bin\bash -lc " meson build && ninja -j1 -C build && - meson test -C build" + meson test --no-suite=runs-dbus-daemon -C build" artifacts: reports: junit: "build/meson-logs/testlog.junit.xml" @@ -360,10 +360,11 @@ windows-meson-mingw-ucrt64: windows-meson-vs15-x86: extends: .win-build script: + # FIXME: tests that run dbus-daemon time out on the Gitlab runner - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=x86 && meson --force-fallback-for=expat,glib,zlib build && meson compile -C build && - meson test -C build" + meson test --no-suite=runs-dbus-daemon -C build" artifacts: reports: junit: "build/meson-logs/testlog.junit.xml" From 1f8bf488011f9ca8f07623bde19316f494b695bb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 18:32:31 +0100 Subject: [PATCH 96/99] CI: Link libexpat statically when using Wine to run tests Signed-off-by: Simon McVittie --- tools/ci-build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 937c857a..6e907deb 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -483,6 +483,9 @@ case "$ci_buildsys" in set -- -Dselinux=disabled "$@" set -- -Dsystemd=disabled "$@" set -- -Dx11_autolaunch=disabled "$@" + # We seem to have trouble finding libexpat.dll when + # cross-building for Windows and running tests with Wine. + set -- -Dexpat:default_library=static "$@" ;; esac From 4fd2dfdf51be90bdcc7a207a0f1971ac2528a251 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Jun 2022 19:13:07 +0100 Subject: [PATCH 97/99] CI: Don't run tests for openSUSE Meson mingw builds for now They don't find their library dependencies. Signed-off-by: Simon McVittie --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1418c3f..a5f30629 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -284,6 +284,9 @@ opensuse mingw64 meson debug: variables: ci_host: "x86_64-w64-mingw32" ci_local_packages: "no" + # TODO: Tests in this configuration fail to find the mingw builds + # of expat and GLib in /usr/x86_64-w64-mingw32/sys-root/mingw/bin + ci_test: "no" ci_variant: "debug" .ubuntu-build: From 9e0bfd5e232d0ce529ece5b80b6888a284e60c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 8 Jul 2022 17:03:12 +0400 Subject: [PATCH 98/99] CI: take cmake config.h as artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5f30629..ba9200d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,6 +75,7 @@ variables: when: always paths: - $CI_PROJECT_DIR/test-results.xml + - "build/config.h" reports: junit: $CI_PROJECT_DIR/test-results.xml @@ -320,6 +321,11 @@ ubuntu jammy autotools: windows msys64 ucrt64 cmake: extends: .win-build + artifacts: + name: dbus-$CI_JOB_NAME + when: always + paths: + - "build/config.h" script: - $env:MSYSTEM = "UCRT64" - $env:CHERE_INVOKING = "1" From 822b63fc6f0536c5cb74516945c8c7f69f1c472f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Jul 2022 20:45:50 +0100 Subject: [PATCH 99/99] maintainer-upload-docs: Use paths pointing into the source directory Signed-off-by: Simon McVittie --- doc/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index ee2de680..3e5f52a8 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -239,8 +239,8 @@ if can_upload_docs run_target('maintainer-upload-docs', command: [ find_program('maintainer-upload-docs.sh'), - docs_files, - dtd_files, + files(docs_files), + files(dtd_files), static_docs, html_files, xml_files,