Merge branch 'meson' into 'master'

Meson build system (fork of !135)

Closes #325

See merge request dbus/dbus!303
This commit is contained in:
Simon McVittie 2022-07-14 10:58:22 +00:00
commit d626c7bc50
52 changed files with 4413 additions and 169 deletions

3
.gitignore vendored
View file

@ -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
@ -48,5 +50,6 @@ file*.lst
.libs/
Makefile
Makefile.in
__pycache__/
cscope.out
tags

View file

@ -34,6 +34,7 @@ stages:
- build
variables:
builddir: "build"
ci_in_docker: "yes"
ci_local_packages: "yes"
ci_parallel: "2"
@ -44,7 +45,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'
@ -74,9 +75,22 @@ variables:
when: always
paths:
- $CI_PROJECT_DIR/test-results.xml
- "build/config.h"
reports:
junit: $CI_PROJECT_DIR/test-results.xml
.meson-common:
variables:
ci_buildsys: "meson"
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 amd64 image:
stage: "build docker"
variables:
@ -165,6 +179,13 @@ debian cmake:
variables:
ci_buildsys: "cmake-dist"
debian meson:
extends:
- .meson-common
- .debian-build
variables:
ci_buildsys: "meson-dist"
debian mingw32 autotools debug:
extends: .debian-build
variables:
@ -179,6 +200,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:
@ -194,6 +223,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
@ -240,6 +278,18 @@ 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"
# 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:
extends: .unix-host-build
image: "ubuntu:latest"
@ -271,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"
@ -290,4 +345,42 @@ 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 --no-suite=runs-dbus-daemon -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
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 --no-suite=runs-dbus-daemon -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:

View file

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

73
LICENSES/Apache-2.0.txt Normal file
View file

@ -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.

View file

@ -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 \
@ -27,6 +28,11 @@ EXTRA_DIST = \
bus/CMakeLists.txt \
dbus/CMakeLists.txt \
doc/CMakeLists.txt \
meson.build \
meson_options.txt \
meson_post_install.py \
subprojects/expat.wrap \
subprojects/glib.wrap \
test/CMakeLists.txt \
test/name-test/CMakeLists.txt \
tools/CMakeLists.txt \
@ -36,7 +42,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 \

50
README
View file

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

View file

@ -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

View file

@ -0,0 +1,36 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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',
)

223
bus/meson.build Normal file
View file

@ -0,0 +1,223 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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',
)
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',
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
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 += [
{
'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

View file

@ -0,0 +1,34 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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,
)

View file

@ -0,0 +1,27 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
configure_file(
input: 'dbus.conf.in',
output: 'dbus.conf',
configuration: data_config,
install_dir: get_option('prefix') / 'lib' / 'sysusers.d',
)

View file

@ -0,0 +1,27 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
configure_file(
input: 'dbus.conf.in',
output: 'dbus.conf',
configuration: data_config,
install_dir: get_option('prefix') / 'lib' / 'tmpfiles.d',
)

View file

@ -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)
@ -75,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)
@ -147,32 +132,6 @@ int main() {
}
" DBUS_USE_SYNC)
CHECK_C_SOURCE_COMPILES("
#include <sys/types.h>
#include <dirent.h>
int main(
DIR *dirp;
dirp = opendir(\".\");
dirfd(dirp);
closedir(dirp);
)
" HAVE_DIRFD)
if(NOT HAVE_DIRFD)
CHECK_C_SOURCE_COMPILES("
#include <sys/types.h>
#include <dirent.h>
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)

View file

@ -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
@ -226,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
@ -241,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
@ -314,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

44
cmake/meson.build Normal file
View file

@ -0,0 +1,44 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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.pkgconfig.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',
)

View file

@ -647,41 +647,6 @@ if test "x$ac_cv_header_syslog_h" = "xyes"; then
AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include <syslog.h>]])
fi
AC_MSG_CHECKING(for dirfd)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <dirent.h>
]], [[
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 <sys/types.h>
#include <dirent.h>
]], [[
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],

View file

@ -329,6 +329,9 @@ 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

239
dbus/meson.build Normal file
View file

@ -0,0 +1,239 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
dbus_dependencies = [
threads,
network_libs,
systemd,
valgrind.partial_dependency(compile_args: true),
]
# 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,
)
# 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',
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',
)

10
dbus/test-version-script Normal file
View file

@ -0,0 +1,10 @@
NOT_REALLY_LIBDBUS_1_3 {
global:
dbus_*;
local:
*;
};
NOT_REALLY_LIBDBUS_PRIVATE_1.2.3 {
global:
_dbus_*;
};

View file

@ -223,3 +223,8 @@ clean-local:
rm -rf dbus-docs dbus-docs.tmp
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

9
doc/list-doc-source.py Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: MIT
import glob
import sys
print('\n'.join(glob.glob(sys.argv[1] + '/*.[ch]')))

View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
set -eux
: "${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}"
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"
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 "$top_srcdir"/doc/*.dtd "$SPECIFICATION_SERVER:$SPECIFICATION_PATH/"

251
doc/meson.build Normal file
View file

@ -0,0 +1,251 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# XML files used for Man and html doc
xmls_mans_htmls_names = [
'dbus-cleanup-sockets.1',
'dbus-daemon.1',
'dbus-launch.1',
'dbus-monitor.1',
'dbus-run-session.1',
'dbus-send.1',
'dbus-test-tool.1',
'dbus-update-activation-environment.1',
'dbus-uuidgen.1',
]
xml_files = []
man_html_list = []
foreach xml_in : xmls_mans_htmls_names
xml_file = configure_file(
input : xml_in + '.xml.in',
output: xml_in + '.xml',
configuration: data_config,
)
man_html_list += {
'xml' : xml_file,
'man' : xml_in,
'html' : xml_in + '.html',
}
xml_files += xml_file
endforeach
# XML files used for html doc
xmls_names = [
'dbus-faq',
'dbus-specification',
'dbus-test-plan',
'dbus-tutorial',
]
html_list = []
foreach xml_in : xmls_names
html_list += {
'xml' : xml_in + '.xml',
'html' : xml_in + '.html',
}
endforeach
# uploaded and distributed, but not installed
static_docs = files(
'dbus-api-design.duck',
'dbus-faq.xml',
'dbus-specification.xml',
'dbus-test-plan.xml',
'dbus-tutorial.xml',
'dcop-howto.txt',
'introspect.xsl',
)
###############################################################################
# Install man files
if build_xml_docs
foreach man: man_html_list
custom_target(man.get('man'),
input: man.get('xml'),
output: man.get('man'),
command: [
xsltproc,
'--nonet',
'--xinclude',
'--stringparam', 'man.output.quietly', '1',
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: get_option('mandir') / 'man1',
)
endforeach
endif
###############################################################################
# Install html doc files
html_files = []
if build_xml_docs
foreach man: man_html_list + html_list
html_files += custom_target(man.get('html'),
input: man.get('xml'),
output: man.get('html'),
command: [
xsltproc,
'--nonet',
'--xinclude',
'--stringparam', 'generate.consistent.ids', '1',
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: docs_dir,
)
endforeach
endif
docs_files = [
'system-activation.txt',
'diagram.png',
'diagram.svg',
]
install_data(
sources: docs_files,
install_dir: docs_dir,
)
configure_file(
input: 'index.html.in',
output: 'index.html',
configuration: data_config,
install_dir: docs_dir,
)
###############################################################################
# Install dtd files
xml_dir = get_option('datadir') / 'xml' / 'dbus-1'
dtd_files = [
'busconfig.dtd',
'introspect.dtd',
]
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': get_option('prefix') / 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,
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',
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
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',
'-o', meson.current_build_dir(),
'@INPUT@',
],
install: true,
install_dir: docs_dir,
)
endif
if can_upload_docs
run_target('maintainer-upload-docs',
command: [
find_program('maintainer-upload-docs.sh'),
files(docs_files),
files(dtd_files),
static_docs,
html_files,
xml_files,
bonus_files,
],
depends: doxygen_tgt,
)
endif

44
doc/meson_post_install.py Normal file
View file

@ -0,0 +1,44 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os
import sys
import shutil
from pathlib import Path
if __name__ == "__main__":
arg_builddir = sys.argv[1]
arg_docdir = sys.argv[2]
arg_qch = sys.argv[3]
arg_qchdir = sys.argv[4]
env_destdir = os.getenv('MESON_INSTALL_DESTDIR_PREFIX')
builddir = Path(arg_builddir)
docdir = Path(arg_docdir)
qch = Path(arg_qch)
qchdir = Path(arg_qchdir)
destdir = Path(env_destdir)
apidir = Path(destdir /docdir / 'api')
shutil.rmtree(apidir, ignore_errors=True)
shutil.copytree(builddir / 'api/html', apidir)
if qch.is_file():
shutil.copy(qch, destdir / qchdir)

View file

@ -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'

11
maint/update-authors.sh Executable file
View file

@ -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

View file

@ -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'

1188
meson.build Normal file

File diff suppressed because it is too large Load diff

300
meson_options.txt Normal file
View file

@ -0,0 +1,300 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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: 'feature',
value: 'auto',
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'
)
# 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',
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(
'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',
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'
)
option(
'windows_output_debug_string',
type: 'boolean',
value: false,
description: 'use OutputDebugString() to log messages to Windows debug port'
)

105
meson_post_install.py Executable file
View file

@ -0,0 +1,105 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os, sys, stat
from pathlib import Path
import shlex, subprocess, json
meson = shlex.split(os.environ.get('MESONINTROSPECT', ''))
introspection = json.loads(subprocess.check_output(meson + ['-a']).decode())
build_options = introspection['buildoptions']
targets = introspection['targets']
def get_option(name):
for i in build_options:
if i['name'] == name:
return i['value']
return None
def get_target(name):
for i in targets:
if i['name'] == name:
return i
return None
destdir = Path(os.getenv('DESTDIR')) if 'DESTDIR' in os.environ else None
prefix = Path(get_option('prefix'))
destdir_prefix = Path(os.getenv('MESON_INSTALL_DESTDIR_PREFIX'))
def to_destdir(path):
path_abs = prefix / path
if destdir:
path_rel_root = path_abs.relative_to(path_abs.anchor)
path_final = destdir / path_rel_root
return path_final
else:
return path_abs
###############################################################################
# Define paths here
abs_libexecdir = destdir_prefix / get_option('libexecdir')
relocation = sys.argv[1].lower() == 'true'
def post_install_relocation():
# Edit pkg-config file to replace the prefix
#
# 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')
)
# 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_libexecdir / exe_name
dbus_user = get_option('dbus_user')
if os.getuid() == 0:
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'
.format(dbus_user)
)
if __name__ == "__main__":
post_install_relocation()
post_install_exe()

14
subprojects/expat.wrap Normal file
View file

@ -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

13
subprojects/glib.wrap Normal file
View file

@ -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

View file

@ -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 \
@ -850,5 +851,12 @@ $(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
EXTRA_DIST += mkdir-m700.py
# Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE
include $(top_srcdir)/aminclude_static.am

View file

@ -0,0 +1,35 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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)

View file

@ -0,0 +1,45 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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

224
test/data/meson.build Normal file
View file

@ -0,0 +1,224 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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/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',
'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,
)
# 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
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
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

692
test/meson.build Normal file
View file

@ -0,0 +1,692 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
###############################################################################
# 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('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_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())
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
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')
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,
files('mkdir-m700.py'),
meson.current_build_dir() / 'XDG_RUNTIME_DIR',
],
output: 'XDG_RUNTIME_DIR'
)
installed_tests = []
###############################################################################
# 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,
gio,
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).
# 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,
dependencies: dbus_dependencies,
override_options: ['b_sanitize=none'],
)
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,
'suite': ['slow'],
},
{
'name': 'bus-dispatch',
'srcs': [ 'bus/dispatch.c' ],
'link': [ libdbus_testutils, libdbus_daemon_internal, ],
'install': false,
'suite': ['slow'],
'timeout': 3000,
},
{
'name': 'marshal-recursive',
'srcs': [
'internals/dbus-marshal-recursive-util.c',
'internals/marshal-recursive.c',
],
'link': [ libdbus_testutils, ],
'install': false,
'timeout': 60,
},
{
'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,
'suite': ['slow'],
},
]
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': 'test-service',
'srcs': [ 'test-service.c' ],
'link': [ libdbus_testutils, ],
'install': true,
'test': false,
},
{
'name': 'test-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, ],
'suite': ['runs-dbus-daemon', 'slow'],
},
{
'name': 'dbus-daemon-eavesdrop',
'srcs': [ 'dbus-daemon-eavesdrop.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'suite': ['runs-dbus-daemon'],
},
{
'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, ],
'suite': ['runs-dbus-daemon', 'slow'],
},
{
'name': 'message',
'srcs': [ 'message.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'monitor',
'srcs': [ 'monitor.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'suite': ['runs-dbus-daemon'],
'timeout': 45,
},
{
'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, ],
'suite': ['slow'],
},
{
'name': 'relay',
'srcs': [ 'relay.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'timeout': 60,
},
{
'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, ],
'suite': ['runs-dbus-daemon'],
},
{
'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, ],
'suite': ['runs-dbus-daemon'],
},
{ 'name': 'sd-activation',
'srcs': [ 'sd-activation.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'suite': ['runs-dbus-daemon'],
},
]
endif
endif
foreach test: tests
name = test.get('name')
srcs = test.get('srcs')
link = test.get('link', [])
deps = test.get('deps', [])
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
timeout = 30
endif
timeout = test.get('timeout', timeout)
test_exe = executable(exe_name,
srcs,
link_with: link,
dependencies: deps,
include_directories: root_include,
install: install_tests and install,
install_dir: test_exec_dir,
)
# 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'],
env: test_env,
protocol: 'tap',
suite: suites,
timeout: timeout,
)
endif
if install and test.get('test', true)
installed_tests += [{
'name': exe_name,
'exe': exe_name + exe_ext,
}]
endif
endforeach
###############################################################################
# Scripts
scripts = []
if platform_unix and use_glib
scripts += [
{ 'name': 'test-dbus-daemon-fork.sh', },
{ 'name': 'transient-services.sh',
'subdir': 'integration',
'build_time_test': false },
{ 'name': 'test-apparmor-activation.sh',
'build_time_test': false },
]
# Testing dbus-launch relies on special code in that binary.
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')
install = script.get('install', true)
suites = script.get('suite', ['dbus'])
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(test_subdir / name,
install_mode: 'rwxr-xr-x',
install_dir: install_dir,
)
installed_tests += [{
'name': name,
'subdir': test_subdir,
}]
endif
# 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(script.get('subdir', '.') / name),
env: test_env,
depends: xdgdir,
suite: suites,
)
endif
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@ --tap'.format(exe),
)
configure_file(
input : 'meta_template.test.in',
output: name + '.test',
configuration: meta_config,
install: install_tests,
install_dir: install_dir,
)
meta_config = configuration_data()
meta_config.set('command',
'env DBUS_TEST_EXEC=@0@ DBUS_TEST_DATA=@0@/data @1@ --tap'.format(
get_option('prefix') / test_exec_dir, exe,
))
configure_file(
input : 'meta_template.test.in',
output: name + '_with_config.test',
configuration: meta_config,
install: install_tests,
install_dir: install_dir,
)
endforeach

View file

@ -0,0 +1,4 @@
[Test]
Type=session
Output=TAP
Exec=@command@

15
test/mkdir-m700.py Executable file
View file

@ -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

View file

@ -121,3 +121,5 @@ test_autolaunch_LDADD = \
$(NULL)
endif
endif
EXTRA_DIST += meson.build

103
test/name-test/meson.build Normal file
View file

@ -0,0 +1,103 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
if embedded_tests
tests = [
'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',
'test-pending-call-timeout',
'test-privserver-client',
'test-threads-init',
]
endif
foreach test: tests
test_exe = executable(test,
test + '.c',
include_directories: root_include,
link_with: [
libdbus,
libdbus_internal,
libdbus_testutils,
],
dependencies: dbus_dependencies,
)
if test == 'test-autolaunch'
# This one is run from run-test.sh, not directly
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: [
'--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,
protocol: 'tap',
suite: suites,
timeout: timeout,
)
endforeach
if platform_unix
test('run-test',
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

View file

@ -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)"

View file

@ -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" "$@"
}

View file

@ -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
@ -154,3 +151,8 @@ install-data-local:
installcheck-local:
test -d $(DESTDIR)$(localstatedir)/lib/dbus
EXTRA_DIST += build-timestamp.py
EXTRA_DIST += meson.build
EXTRA_DIST += meson-compat-install-emptydirs.py
EXTRA_DIST += meson-compat-install-symlink.py

32
tools/build-timestamp.py Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
import datetime
import os
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'))

View file

@ -175,21 +175,31 @@ 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,
(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
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,13 +229,33 @@ 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"
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 \
"${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
make="make -j${ci_parallel} V=1 VERBOSE=1"
case "$ci_buildsys" in
@ -374,22 +404,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 _ "$@"
@ -427,6 +447,102 @@ case "$ci_buildsys" in
${make} install DESTDIR=$(pwd)/DESTDIR
( cd DESTDIR && find . -ls)
;;
(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
meson_setup=
cross_file=
# openSUSE has convenience wrappers that run Meson with appropriate
# cross options
case "$ci_host" in
(i686-w64-mingw32)
meson_setup=mingw32-meson
;;
(x86_64-w64-mingw32)
meson_setup=mingw64-meson
;;
esac
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 "$@"
# We seem to have trouble finding libexpat.dll when
# cross-building for Windows and running tests with Wine.
set -- -Dexpat:default_library=static "$@"
;;
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
(debug)
set -- -Dasserts=true "$@"
set -- -Dembedded_tests=true "$@"
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
meson_setup="meson setup"
if [ -n "$cross_file" ]; then
set -- --cross-file="$cross_file" "$@"
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
$meson_setup "$@" "$srcdir"
meson compile -v
[ "$ci_test" = no ] || meson test
DESTDIR=DESTDIR meson install
( cd DESTDIR && find . -ls)
;;
esac
# vim:set sw=4 sts=4 et:

View file

@ -159,6 +159,7 @@ case "$ci_distro" in
ducktype
g++
gcc
git
gnome-desktop-testing
libapparmor-dev
libaudit-dev
@ -168,6 +169,8 @@ case "$ci_distro" in
libselinux1-dev
libsystemd-dev
libx11-dev
meson
ninja-build
sudo
valgrind
wget
@ -205,6 +208,7 @@ case "$ci_distro" in
automake
cmake
libtool
meson
)
# docs
@ -263,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
@ -270,8 +276,10 @@ 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
)
;;

1
tools/disable-uac.rc Normal file
View file

@ -0,0 +1 @@
1 24 "Win32.Manifest"

View file

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

View file

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

View file

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

113
tools/meson.build Normal file
View file

@ -0,0 +1,113 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
# 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.
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',
)
# Create the empty directory to hold the machine ID
install_emptydirs += [
get_option('localstatedir') / 'lib' / 'dbus',
]