Add Meson build system

Signed-off-by: Félix Piédallu <felix@piedallu.me>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Félix Piédallu 2020-01-23 13:12:15 +01:00 committed by Simon McVittie
parent b7a1da122a
commit cd2e382610
24 changed files with 3481 additions and 6 deletions

View file

@ -0,0 +1,35 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
if platform_unix
configure_file(
input: 'system.conf.in',
output: 'system.conf',
configuration: data_config,
install_dir: get_option('sysconfdir') / 'dbus-1',
)
endif
configure_file(
input: 'session.conf.in',
output: 'session.conf',
configuration: data_config,
install_dir: get_option('sysconfdir') / 'dbus-1',
)

179
bus/meson.build Normal file
View file

@ -0,0 +1,179 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
session_conf = configure_file(
input: 'session.conf.in',
output: 'session.conf',
configuration: data_config,
install_dir: get_option('datadir') / 'dbus-1',
)
if platform_unix
configure_file(
input: 'system.conf.in',
output: 'system.conf',
configuration: data_config,
install_dir: get_option('datadir') / 'dbus-1',
)
endif
configure_file(
input: 'example-system-enable-stats.conf.in',
output: 'example-system-enable-stats.conf',
configuration: data_config,
install_dir: get_option('datadir') / 'doc' / 'dbus' / 'examples',
)
configure_file(
input: 'example-session-disable-stats.conf.in',
output: 'example-session-disable-stats.conf',
configuration: data_config,
install_dir: get_option('datadir') / 'doc' / 'dbus' / 'examples',
)
if use_launchd
configure_file(
input: 'org.freedesktop.dbus-session.plist.in',
output: 'org.freedesktop.dbus-session.plist',
configuration: data_config,
install_dir: launchd_agent_dir,
)
endif
if use_systemd
configure_file(
input: 'dbus.service.in',
output: 'dbus.service',
configuration: data_config,
install_dir: systemd_system_unitdir,
)
configure_file(
input: 'dbus.socket.in',
output: 'dbus.socket',
configuration: data_config,
install_dir: systemd_system_unitdir,
)
subdir('sysusers.d')
subdir('tmpfiles.d')
if enable_user_session
subdir('systemd-user')
endif
endif
subdir('legacy-config')
libdbus_daemon_internal_sources = [
'activation.c',
'apparmor.c',
'audit.c',
'bus.c',
'config-loader-expat.c',
'config-parser-common.c',
'config-parser.c',
'connection.c',
'containers.c',
'desktop-file.c',
'dispatch.c',
'driver.c',
'expirelist.c',
'policy.c',
'selinux.c',
'services.c',
'signals.c',
'stats.c',
'test.c',
'utils.c',
]
if use_kqueue
libdbus_daemon_internal_sources += 'dir-watch-kqueue.c'
elif use_inotify
libdbus_daemon_internal_sources += 'dir-watch-inotify.c'
else
libdbus_daemon_internal_sources += 'dir-watch-default.c'
endif
libdbus_daemon_internal = static_library('dbus-daemon-internal',
libdbus_daemon_internal_sources,
include_directories: root_include,
dependencies: [
adt_libs,
apparmor,
expat,
network_libs,
selinux,
threads,
],
link_with: [
libdbus,
libdbus_internal,
],
)
dbus_daemon = executable('dbus-daemon',
'main.c',
include_directories: root_include,
link_with: libdbus_daemon_internal,
install: true,
)
if platform_unix and use_traditional_activation
liblaunch_helper_internal_sources = [
'config-loader-expat.c',
'config-parser-common.c',
'config-parser-trivial.c',
'desktop-file.c',
'utils.c',
]
liblaunch_helper_internal = static_library('launch-helper-internal',
liblaunch_helper_internal_sources,
include_directories: root_include,
link_with: [
libdbus,
libdbus_internal,
],
dependencies: [
expat,
network_libs,
threads,
],
install: false,
)
dbus_daemon_launch_helper_sources = [
'activation-helper.c',
'activation-helper-bin.c',
]
# This is the installed launch helper with the setuid checks
# All files that have special cases #ifdef ACTIVATION_LAUNCHER_TEST must
# be listed here and included in test/bus/launch-helper-for-tests.c,
# not in liblaunch_helper_internal.
dbus_daemon_launch_helper = executable('dbus-daemon-launch-helper',
dbus_daemon_launch_helper_sources,
include_directories: root_include,
link_with: liblaunch_helper_internal,
install: true,
install_dir: get_option('libexecdir'),
)
endif

View file

@ -0,0 +1,33 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
configure_file(
input: 'dbus.service.in',
output: 'dbus.service',
configuration: data_config,
install_dir: systemd_user_unitdir,
)
configure_file(
input: 'dbus.socket.in',
output: 'dbus.socket',
configuration: data_config,
install_dir: systemd_user_unitdir,
)

View file

@ -0,0 +1,26 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
configure_file(
input: 'dbus.conf.in',
output: 'dbus.conf',
configuration: data_config,
install_dir: get_option('prefix') / 'lib' / 'sysusers.d',
)

View file

@ -0,0 +1,26 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
configure_file(
input: 'dbus.conf.in',
output: 'dbus.conf',
configuration: data_config,
install_dir: get_option('prefix') / 'lib' / 'tmpfiles.d',
)

43
cmake/meson.build Normal file
View file

@ -0,0 +1,43 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_config = configuration_data()
cmake_config.set('CMAKE_INSTALL_INCLUDEDIR',get_option('prefix') / get_option('includedir'))
cmake_config.set('CMAKE_INSTALL_LIBDIR', get_option('prefix') / get_option('libdir'))
cmake_config.set('DBUS_PREFIX', get_option('prefix'))
cmake_config.set('DBUS_RELOCATABLE', relocation)
cmake_config.set('DBUS_VERSION', version)
cmake_files = [
configure_file(
input: 'DBus1Config.cmake.in',
output: 'DBus1Config.cmake',
configuration: cmake_config,
),
configure_file(
input: 'DBus1ConfigVersion.cmake.in',
output: 'DBus1ConfigVersion.cmake',
configuration: cmake_config,
)
]
install_data(cmake_files,
install_dir: get_option('libdir') / 'cmake' / 'DBus1',
)

231
dbus/meson.build Normal file
View file

@ -0,0 +1,231 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
dbus_dependencies = [
threads,
network_libs,
systemd,
valgrind,
]
# source code that goes in the installed client library
# and is specific to library functionality
dbus_lib_sources = [
'dbus-address.c',
'dbus-auth.c',
'dbus-bus.c',
'dbus-connection.c',
'dbus-credentials.c',
'dbus-errors.c',
'dbus-keyring.c',
'dbus-marshal-byteswap.c',
'dbus-marshal-header.c',
'dbus-marshal-recursive.c',
'dbus-marshal-validate.c',
'dbus-message.c',
'dbus-misc.c',
'dbus-nonce.c',
'dbus-object-tree.c',
'dbus-pending-call.c',
'dbus-resources.c',
'dbus-server-debug-pipe.c',
'dbus-server-socket.c',
'dbus-server.c',
'dbus-sha.c',
'dbus-signature.c',
'dbus-syntax.c',
'dbus-threads.c',
'dbus-timeout.c',
'dbus-transport-socket.c',
'dbus-transport.c',
'dbus-watch.c',
]
# source code that goes in the installed client library
# AND is generic utility functionality used by the
# daemon or test programs (all symbols in here should
# be underscore-prefixed)
dbus_shared_sources = [
'dbus-dataslot.c',
'dbus-file.c',
'dbus-hash.c',
'dbus-internals.c',
'dbus-list.c',
'dbus-marshal-basic.c',
'dbus-memory.c',
'dbus-mempool.c',
'dbus-pipe.c',
'dbus-string.c',
'dbus-sysdeps.c',
]
if embedded_tests
dbus_shared_sources += 'dbus-test-tap.c'
endif
# source code that is generic utility functionality used
# by the bus daemon or test apps, but is NOT included
# in the D-Bus client library (all symbols in here
# should be underscore-prefixed but don't really need
# to be unless they move to DBUS_SHARED_SOURCES later)
dbus_util_sources = [
'dbus-asv-util.c',
'dbus-mainloop.c',
'dbus-message-util.c',
'dbus-pollable-set-poll.c',
'dbus-pollable-set.c',
'dbus-shell.c',
'dbus-string-util.c',
'dbus-sysdeps-util.c',
]
if platform_windows
dbus_lib_sources += [
'dbus-init-win.cpp',
'dbus-server-win.c',
]
dbus_lib_sources += windows.compile_resources(configure_file(
input: 'versioninfo.rc.in',
output: 'versioninfo.rc',
configuration: data_config,
))
dbus_shared_sources += [
'dbus-file-win.c',
'dbus-pipe-win.c',
'dbus-sysdeps-thread-win.c',
'dbus-sysdeps-win.c',
'dbus-transport-win.c',
]
if platform_win32ce
dbus_shared_sources += 'dbus-sysdeps-wince-glue.c'
endif
dbus_util_sources += 'dbus-sysdeps-util-win.c'
if use_traditional_activation
dbus_util_sources += 'dbus-spawn-win.c'
endif
else # Unix
dbus_lib_sources += [
'dbus-uuidgen.c',
'dbus-server-unix.c',
]
dbus_shared_sources += [
'dbus-file-unix.c',
'dbus-pipe-unix.c',
'dbus-sysdeps-pthread.c',
'dbus-sysdeps-unix.c',
'dbus-transport-unix.c',
'dbus-userdb.c',
]
if use_launchd
dbus_shared_sources += 'dbus-server-launchd.c'
endif
dbus_util_sources += [
'dbus-sysdeps-util-unix.c',
'dbus-userdb-util.c',
]
if use_traditional_activation
dbus_util_sources += 'dbus-spawn-unix.c'
endif
endif
if use_linux_epoll
dbus_util_sources += 'dbus-pollable-set-epoll.c'
endif
version_script = configure_file(
input: 'Version.in',
output: 'version_script',
configuration: data_config,
)
version_flags = '-Wl,--version-script,@0@'.format(version_script)
if not cc.has_link_argument(version_flags)
version_flags = []
endif
libdbus = library('dbus-1',
dbus_lib_sources,
dbus_shared_sources,
include_directories: root_include,
c_args: '-Ddbus_1_EXPORTS',
link_args: version_flags,
soversion: soversion,
version: version_info,
dependencies: dbus_dependencies,
install: true,
)
libdbus_internal = static_library('dbus-internal',
dbus_util_sources,
include_directories: root_include,
link_with: libdbus,
dependencies: dbus_dependencies,
)
install_headers(
'dbus-address.h',
'dbus-bus.h',
'dbus-connection.h',
'dbus-errors.h',
'dbus-macros.h',
'dbus-memory.h',
'dbus-message.h',
'dbus-misc.h',
'dbus-pending-call.h',
'dbus-protocol.h',
'dbus-server.h',
'dbus-shared.h',
'dbus-signature.h',
'dbus-syntax.h',
'dbus-threads.h',
'dbus-types.h',
'dbus.h',
subdir: 'dbus-1.0' / 'dbus',
)
dbus_arch_deps_h = configure_file(
input: 'dbus-arch-deps.h.in',
output: 'dbus-arch-deps.h',
configuration: arch_config,
)
install_data(dbus_arch_deps_h,
install_dir: get_option('libdir') / 'dbus-1.0' / 'include' / 'dbus',
)

View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -ex
DOC_SERVER=dbus.freedesktop.org
DOC_WWW_DIR=/srv/dbus.freedesktop.org/www
SPECIFICATION_SERVER=specifications.freedesktop.org
SPECIFICATION_PATH=/srv/specifications.freedesktop.org/www/dbus/1.0
TMPDIR=$(mktemp -d)
mkdir -p "$TMPDIR/api"
cp -r doc/api/html "$TMPDIR/api"
cp -r "$@" "$TMPDIR"
mv "$TMPDIR" dbus-docs
tar --xz -c -f dbus-docs.tar.xz dbus-docs
scp dbus-docs.tar.xz "$DOC_SERVER:$DOC_WWW_DIR/"
rsync -rpvzP --chmod=Dg+s,ug+rwX,o=rX dbus-docs/ "$DOC_SERVER:$DOC_WWW_DIR/doc/"
scp -p ../doc/*.dtd "$SPECIFICATION_SERVER:$SPECIFICATION_PATH/"

247
doc/meson.build Normal file
View file

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

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)

1056
meson.build Normal file

File diff suppressed because it is too large Load diff

276
meson_options.txt Normal file
View file

@ -0,0 +1,276 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
option(
'apparmor',
type: 'feature',
value: 'auto',
description: 'AppArmor support'
)
option(
'asserts',
type: 'boolean',
value: false,
description: 'Include assertion checks'
)
option(
'checks',
type: 'boolean',
value: true,
description: 'Check for usage errors at public API'
)
option(
'containers',
type: 'boolean',
value: false,
description: 'Enable restricted servers for app containers'
)
option(
'dbus_daemondir',
type: 'string',
description: 'Directory for installing the dbus-daemon'
)
option(
'dbus_user',
type: 'string',
description: 'User for running the system dbus-daemon',
value: 'messagebus'
)
option(
'dbus_session_bus_connect_address',
type: 'string',
value: '',
description: 'Fallback address for a session bus client to connect to',
)
option(
'dbus_session_bus_listen_address',
type: 'string',
value: '',
description: 'Default address for a session bus to listen on',
)
option(
'doxygen_docs',
type: 'feature',
value: 'auto',
description: 'Build Doxygen documentation'
)
option(
'ducktype_docs',
type: 'feature',
value: 'auto',
description: 'Build Ducktype documentation'
)
option(
'embedded_tests',
type: 'boolean',
value: false,
description: 'Enable unit test code in the library and binaries'
)
option(
'epoll',
type: 'feature',
value: 'auto',
description: 'Use epoll(4) on Linux'
)
option(
'inotify',
type: 'feature',
value: 'auto',
description: 'Inotify support on Linux'
)
option(
'installed_tests',
type: 'boolean',
value: false,
description: 'Install automated tests for "as-installed" testing'
)
option(
'kqueue',
type: 'feature',
value: 'auto',
description: 'Kqueue support'
)
option(
'launchd',
type: 'feature',
value: 'auto',
description: 'Launchd auto-launch support'
)
option(
'launchd_agent_dir',
type: 'string',
description: 'Directory to put the launchd agent'
)
option(
'libaudit',
type: 'feature',
value: 'auto',
description: 'Audit logging support for SELinux and AppArmor'
)
option(
'modular_tests',
type: 'boolean',
value: false,
description: 'Enable modular regression tests (requires GLib)'
)
option(
'qch_dir',
type: 'string',
description: 'Directory to put the Qt help file'
)
option(
'qt_help',
type: 'feature',
value: 'auto',
description: 'Build Qt help documentation'
)
option(
'relocation',
type: 'feature',
value: 'auto',
description: 'Make pkg-config metadata relocatable'
)
option(
'selinux',
type: 'feature',
value: 'auto',
description: 'SELinux support'
)
option(
'session_socket_dir',
type: 'string',
description: 'Where to put sockets for the per-login-session message bus'
)
option(
'solaris_console_owner_file',
type: 'string',
value: '',
description: 'File to determine current console owner on Solaris (or "auto")'
)
option(
'stats',
type: 'boolean',
value: true,
description: 'Enable bus daemon usage statistics'
)
option(
'system_pid_file',
type: 'string',
description: 'PID file for systemwide daemon'
)
option(
'system_socket',
type: 'string',
description: 'UNIX domain socket for systemwide daemon'
)
option(
'systemd_system_unitdir',
type: 'string',
description: 'Directory for systemd system service files'
)
option(
'systemd_user_unitdir',
type: 'string',
description: 'Directory for systemd user service files'
)
option(
'systemd',
type: 'feature',
value: 'auto',
description: 'Systemd at_console support'
)
option(
'test_socket_dir',
type: 'string',
description: 'Where to put sockets for make check'
)
option(
'test_user',
type: 'string',
description: 'Unprivileged user for regression tests, other than root and the dbus_user',
value: 'nobody'
)
option(
'traditional_activation',
type: 'boolean',
value: true,
description: 'Build support for service activation without using SystemdService'
)
option(
'user_session',
type: 'boolean',
value: true,
description: 'Enable user-session semantics for session bus under systemd'
)
option(
'verbose_mode',
type: 'boolean',
value: false,
description: 'Support verbose debug mode'
)
option(
'x11_autolaunch',
type: 'feature',
value: 'auto',
description: 'Build with X11 auto-launch support'
)
option(
'xml_docs',
type: 'feature',
value: 'auto',
description: 'Build XML documentation'
)

118
meson_post_install.py Executable file
View file

@ -0,0 +1,118 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os, sys, stat
from pathlib import Path
import shlex, subprocess, json
meson = shlex.split(os.environ.get('MESONINTROSPECT', ''))
introspection = json.loads(subprocess.check_output(meson + ['-a']).decode())
build_options = introspection['buildoptions']
targets = introspection['targets']
def get_option(name):
for i in build_options:
if i['name'] == name:
return i['value']
return None
def get_target(name):
for i in targets:
if i['name'] == name:
return i
return None
destdir = Path(os.getenv('DESTDIR')) if 'DESTDIR' in os.environ else None
prefix = Path(get_option('prefix'))
destdir_prefix = Path(os.getenv('MESON_INSTALL_DESTDIR_PREFIX'))
def to_destdir(path):
path_abs = prefix / path
if destdir:
path_rel_root = path_abs.relative_to(path_abs.anchor)
path_final = destdir / path_rel_root
return path_final
else:
return path_abs
###############################################################################
# Define paths here
abs_libdir = destdir_prefix / get_option('libdir')
dbus_data_dir = destdir_prefix / get_option('datadir') / 'dbus-1'
platform_unix = sys.argv[1].lower() == 'true'
relocation = sys.argv[2].lower() == 'true'
def post_install_data():
(dbus_data_dir / 'session.d').mkdir(parents=True, exist_ok=True)
(dbus_data_dir / 'services').mkdir(parents=True, exist_ok=True)
(dbus_data_dir / 'session.d').mkdir(parents=True, exist_ok=True)
localstatedir = Path(get_option('localstatedir'))
if destdir:
localstatedir = destdir / localstatedir.relative_to(localstatedir.anchor)
if platform_unix:
(localstatedir / 'run' / 'dbus').mkdir(parents=True, exist_ok=True)
(dbus_data_dir / 'system.d').mkdir(parents=True, exist_ok=True)
(dbus_data_dir / 'system-services').mkdir(parents=True, exist_ok=True)
def post_install_relocation():
# Edit pkg-config file to replace the prefix
#
# TODO: Meson >=0.63 has a new feature, -Dpkgconfig.relocatable=true.
pc_filepath = next(
v for (k,v) in introspection['installed'].items() if k.endswith('.pc')
)
# Find the really installed path
pc_filepath = to_destdir(pc_filepath)
with open(pc_filepath, 'r') as pcfile:
lines = pcfile.readlines()
with open(pc_filepath, 'w') as pcfile:
for line in lines:
if line.startswith('prefix='):
line = 'prefix=${pcfiledir}/../..\n'
pcfile.write(line)
def post_install_exe():
# Setuid, chmod and chown for dbus-daemon-launch-helper
daemon_launch_helper = get_target('dbus-daemon-launch-helper')
if daemon_launch_helper:
import grp
exe_name = os.path.basename(daemon_launch_helper['install_filename'][0])
exe_path = abs_libdir / 'dbus-1.0' / exe_name
dbus_user = get_option('dbus_user')
if os.getuid() == 0:
os.chmod(exe_path, stat.S_ISUID | stat.S_IXUSR | stat.S_IXGRP)
os.chown(exe_path, 0, grp.getgrnam(dbus_user).gr_gid)
else:
print('Not installing {0} binary setuid!'.format(exe_path))
print('You\'ll need to manually set permissions to root:{0} and permissions 4750'
.format(dbus_user)
)
if __name__ == "__main__":
post_install_data()
post_install_relocation()
post_install_exe()

View file

@ -0,0 +1,54 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from meson_post_install import *
import os, sys
###############################################################################
systemd_system_dir = to_destdir(sys.argv[1])
systemd_user_dir = to_destdir(sys.argv[2])
def force_symlink(src, dst):
try:
os.unlink(dst)
except OSError:
pass
os.symlink(src, dst)
def post_install_data():
# Install dbus.socket as default implementation of a D-Bus stack.
# Unconditionally enable D-Bus on systemd installations
#
# TODO meson >=0.61 has install_symlink()
(systemd_system_dir / 'sockets.target.wants') .mkdir(parents=True, exist_ok=True)
(systemd_system_dir / 'multi-user.target.wants').mkdir(parents=True, exist_ok=True)
force_symlink('../dbus.socket', systemd_system_dir / 'sockets.target.wants' / 'dbus.socket')
force_symlink('../dbus.service', systemd_system_dir / 'multi-user.target.wants' / 'dbus.service')
if get_option('user_session'):
(systemd_user_dir / 'sockets.target.wants') .mkdir(parents=True, exist_ok=True)
force_symlink('../dbus.socket',systemd_user_dir / 'sockets.target.wants' / 'dbus.socket')
if __name__ == "__main__":
post_install_data()

View file

@ -0,0 +1,34 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import sys, os, shutil
def pairs(args):
while args:
yield (args[0], args[1])
args = args[2:]
for src, dst in pairs(sys.argv[1:]):
os.makedirs(os.path.dirname(dst), exist_ok=True)
try:
shutil.copy(src, dst)
except (IOError, OSError) as e:
print(e.filename)

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

@ -0,0 +1,204 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
data_to_install = [
'auth/anonymous-client-successful.auth-script',
'auth/anonymous-server-successful.auth-script',
'auth/cancel.auth-script',
'auth/client-out-of-mechanisms.auth-script',
'auth/cookie-sha1-username.auth-script',
'auth/cookie-sha1.auth-script',
'auth/external-auto.auth-script',
'auth/external-failed.auth-script',
'auth/external-root.auth-script',
'auth/external-silly.auth-script',
'auth/external-successful.auth-script',
'auth/external-username.auth-script',
'auth/extra-bytes.auth-script',
'auth/fail-after-n-attempts.auth-script',
'auth/fallback.auth-script',
'auth/invalid-command-client.auth-script',
'auth/invalid-command.auth-script',
'auth/invalid-hex-encoding.auth-script',
'auth/mechanisms.auth-script',
'equiv-config-files/basic/basic-1.conf',
'equiv-config-files/basic/basic-2.conf',
'equiv-config-files/basic/basic.d/basic.conf',
'equiv-config-files/entities/basic.d/basic.conf',
'equiv-config-files/entities/entities-1.conf',
'equiv-config-files/entities/entities-2.conf',
'invalid-config-files/apparmor-bad-attribute.conf',
'invalid-config-files/apparmor-bad-mode.conf',
'invalid-config-files/bad-attribute-2.conf',
'invalid-config-files/bad-attribute.conf',
'invalid-config-files/bad-element.conf',
'invalid-config-files/bad-limit.conf',
'invalid-config-files/badselinux-1.conf',
'invalid-config-files/badselinux-2.conf',
'invalid-config-files/circular-1.conf',
'invalid-config-files/circular-2.conf',
'invalid-config-files/circular-3.conf',
'invalid-config-files/double-attribute.conf',
'invalid-config-files/impossible-send.conf',
'invalid-config-files/limit-no-name.conf',
'invalid-config-files/ludicrous-limit.conf',
'invalid-config-files/negative-limit.conf',
'invalid-config-files/non-numeric-limit.conf',
'invalid-config-files/not-well-formed.conf',
'invalid-config-files/policy-bad-at-console.conf',
'invalid-config-files/policy-bad-attribute.conf',
'invalid-config-files/policy-bad-context.conf',
'invalid-config-files/policy-bad-rule-attribute.conf',
'invalid-config-files/policy-contradiction.conf',
'invalid-config-files/policy-member-no-path.conf',
'invalid-config-files/policy-mixed.conf',
'invalid-config-files/policy-no-attributes.conf',
'invalid-config-files/policy-no-rule-attribute.conf',
'invalid-config-files/send-and-receive.conf',
'invalid-config-files/truncated-file.conf',
'invalid-config-files/unknown-limit.conf',
'invalid-messages/boolean-has-no-value.message-raw',
'sha-1/bit-hashes.sha1',
'sha-1/bit-messages.sha1',
'sha-1/byte-hashes.sha1',
'sha-1/byte-messages.sha1',
'sha-1/Readme.txt',
'systemd-activation/com.example.ReceiveDenied.service',
'systemd-activation/com.example.SendDenied.service',
'systemd-activation/com.example.SendDeniedByAppArmorName.service',
'systemd-activation/com.example.SendPrefixDenied.internal.service',
'systemd-activation/com.example.SendPrefixDenied.SendPrefixAllowed.internal.service',
'systemd-activation/com.example.SendPrefixDenied.service',
'systemd-activation/com.example.SystemdActivatable1.service',
'systemd-activation/com.example.SystemdActivatable2.service',
'systemd-activation/org.freedesktop.systemd1.service',
'valid-config-files-system/many-rules.conf',
'valid-config-files-system/system.d/test.conf',
'valid-config-files/basic.conf',
'valid-config-files/basic.d/basic.conf',
'valid-config-files/check-own-rules.conf',
'valid-config-files/entities.conf',
'valid-config-files/listen-unix-runtime.conf',
'valid-config-files/many-rules.conf',
'valid-config-files/minimal.conf',
'valid-config-files/standard-session-dirs.conf',
]
data_in_to_install = [
'dbus-installed-tests.aaprofile',
'invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service',
'invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service',
'invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service',
'systemd-activation/com.example.ReceiveDeniedByAppArmorLabel.service',
'systemd-activation/com.example.SendDeniedByAppArmorLabel.service',
'systemd-activation/com.example.SendDeniedByNonexistentAppArmorLabel.service',
'systemd-activation/com.example.SystemdActivatable3.service',
'valid-config-files-system/debug-allow-all-fail.conf',
'valid-config-files-system/debug-allow-all-pass.conf',
'valid-config-files-system/tmp-session-like-system.conf',
'valid-config-files/as-another-user.conf',
'valid-config-files/count-fds.conf',
'valid-config-files/debug-allow-all-sha1.conf',
'valid-config-files/debug-allow-all.conf',
'valid-config-files/finite-timeout.conf',
'valid-config-files/forbidding.conf',
'valid-config-files/incoming-limit.conf',
'valid-config-files/limit-containers.conf',
'valid-config-files/max-completed-connections.conf',
'valid-config-files/max-connections-per-user.conf',
'valid-config-files/max-containers.conf',
'valid-config-files/max-match-rules-per-connection.conf',
'valid-config-files/max-names-per-connection.conf',
'valid-config-files/max-replies-per-connection.conf',
'valid-config-files/multi-user.conf',
'valid-config-files/pending-fd-timeout.conf',
'valid-config-files/send-destination-prefix-rules.conf',
'valid-config-files/systemd-activation.conf',
'valid-config-files/tmp-session.conf',
'valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service',
'valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service',
'valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service',
'valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service',
'valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service',
'valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service',
'valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service',
'valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service',
'valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service',
'valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service',
]
foreach file : data_to_install
if install_tests
install_data(file,
rename: file,
install_dir: test_exec_dir / 'data',
)
endif
endforeach
foreach file : data_in_to_install
# Underscorify the output name because Meson doesn't allow subdir output files
configured_file = configure_file(
input : file + '.in',
output: file.underscorify(),
configuration: test_data_config,
)
if install_tests
install_data(configured_file,
rename: file,
install_dir: test_exec_dir / 'data',
)
endif
endforeach
###############################################################################
# Copy files into correct places in build directory for tests
files = []
foreach file : data_to_install
src = meson.current_source_dir() / file
dst = meson.current_build_dir() / file
files += src
files += dst
endforeach
foreach file : data_in_to_install
src = meson.current_build_dir() / file.underscorify()
dst = meson.current_build_dir() / file
files += src
files += dst
endforeach
files += meson.project_build_root() / 'bus' / 'session.conf'
files += meson.current_build_dir() / 'valid-config-files/session.conf'
if platform_unix
files += meson.project_build_root() / 'bus' / 'system.conf'
files += meson.current_build_dir() / 'valid-config-files-system/system.conf'
endif
run_result = run_command(find_program('copy_data_for_tests.py'), files, check: true)
files_not_found = run_result.stdout().split()
if files_not_found.length() > 0
error('Those files could not be copied for test : @0@'.format(files_not_found))
endif

604
test/meson.build Normal file
View file

@ -0,0 +1,604 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
###############################################################################
# Tests installation
install_tests = get_option('installed_tests')
test_exec_dir = get_option('libexecdir') / 'installed-tests' / 'dbus'
test_meta_dir = get_option('datadir') / 'installed-tests' / 'dbus'
###############################################################################
# Test configuration needs some specific keys
test_data_config = configuration_data()
test_data_config.merge_from(data_config)
test_data_config.set('DBUS_SESSION_BUS_LISTEN_ADDRESS', test_listen)
test_data_config.set('EXEEXT', exe_ext)
# / '' to convert \-separated dir to /-separated dir on win32
test_data_config.set('DBUS_TEST_EXEC', meson.current_build_dir() / '')
test_data_config.set('DBUS_TEST_DATA', meson.current_build_dir() / 'data')
test_env = environment()
test_env.set('DBUS_TOP_SRCDIR', meson.project_source_root())
test_env.set('DBUS_TEST_HOMEDIR', meson.project_source_root() / 'dbus')
test_env.set('HOME', meson.project_source_root() / 'dbus')
test_env.set('DBUS_TEST_SRCDIR', meson.current_source_dir())
test_env.set('DBUS_TOP_BUILDDIR', meson.project_build_root())
test_env.set('DBUS_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('DBUS_TEST_EXEC', meson.current_build_dir())
test_env.set('DBUS_TEST_DATA', meson.current_build_dir() / 'data')
test_env.set('DBUS_TEST_DAEMON', dbus_daemon.full_path())
test_env.set('DBUS_TEST_DBUS_LAUNCH', dbus_launch.full_path())
test_env.set('DBUS_TEST_DBUS_MONITOR', dbus_monitor.full_path())
test_env.set('DBUS_TEST_DBUS_SEND', dbus_send.full_path())
if platform_unix
test_env.set('DBUS_TEST_DBUS_UUIDGEN', dbus_uuidgen.full_path())
endif
test_env.set('XDG_DATA_HOME', meson.current_build_dir() / 'XDG_DATA_HOME')
test_env.set('XDG_RUNTIME_DIR', meson.current_build_dir() / 'XDG_RUNTIME_DIR')
xdg_data_dirs = [
meson.current_build_dir() / 'XDG_DATA_DIRS',
meson.current_build_dir() / 'XDG_DATA_DIRS2'
]
test_env.set('XDG_DATA_DIRS', xdg_data_dirs)
test_env.set('DBUS_SESSION_BUS_ADDRESS', 'do-not-use-real-session:')
test_env.set('DBUS_FATAL_WARNINGS', '1')
test_env.set('DBUS_TEST_UNINSTALLED', '1')
xdgdir = custom_target('gen-xdgdir',
command: [
python, '-c', 'import os; os.makedirs("@0@", exist_ok=True)'.format(meson.current_build_dir() / 'XDG_RUNTIME_DIR')
],
output: 'XDG_RUNTIME_DIR'
)
###############################################################################
# Dbus testutils
libdbus_testutils_sources = [
'disable-crash-handling.c',
'test-utils.c',
]
if use_glib
libdbus_testutils_sources += 'test-utils-glib.c'
endif
libdbus_testutils = static_library('dbus-testutils',
libdbus_testutils_sources,
include_directories: root_include,
link_with: [
libdbus,
libdbus_internal,
],
dependencies: [
glib,
dbus_dependencies,
],
)
###############################################################################
# Test tools
# these binaries are used in tests but are not themselves tests
test_exit = executable('test-exit',
'test-exit.c',
include_directories: root_include,
link_with: libdbus_testutils,
dependencies: dbus_dependencies,
)
test_names = executable('test-names',
'test-names.c',
include_directories: root_include,
link_with: libdbus_testutils,
dependencies: dbus_dependencies,
)
test_privserver = executable('test-privserver',
'test-privserver.c',
include_directories: root_include,
link_with: libdbus_testutils,
dependencies: dbus_dependencies,
)
# This helper is meant to crash, so if we're compiling the rest with
# AddressSanitizer, we need to stop it from catching the SIGSEGV and
# turning it into _exit(1); so don't give it SANITIZE_CFLAGS.
# CODE_COVERAGE_CFLAGS are fairly pointless here, too.
# TODO
test_segfault = executable('test-segfault',
'test-segfault.c', 'disable-crash-handling.c',
include_directories: root_include,
dependencies: dbus_dependencies,
)
test_shell_service = executable('test-shell-service',
'test-shell-service.c',
include_directories: root_include,
link_with: libdbus_testutils,
dependencies: dbus_dependencies,
)
if use_traditional_activation
test_spawn = executable('test-spawn',
'spawn-test.c',
include_directories: root_include,
link_with: libdbus_testutils,
dependencies: dbus_dependencies,
)
endif
if use_traditional_activation and platform_unix
launch_helper_for_tests = executable('launch-helper-for-tests',
'bus/launch-helper-for-tests.c',
include_directories: root_include,
link_with: liblaunch_helper_internal,
dependencies: dbus_dependencies,
)
test_data_config.set('TEST_LAUNCH_HELPER_BINARY', launch_helper_for_tests.full_path())
else
# Dummy value, should not be used in practice
test_data_config.set('TEST_LAUNCH_HELPER_BINARY', '/bin/false')
endif
if platform_unix and use_glib
test_apparmor_activation = executable('test-apparmor-activation',
'sd-activation.c',
include_directories: root_include,
c_args: '-DDBUS_TEST_APPARMOR_ACTIVATION',
link_with: libdbus_testutils,
dependencies: [
glib, gio,
apparmor,
],
install: install_tests,
install_dir: test_exec_dir,
)
endif
###############################################################################
# Subdirectories need utilities above.
subdir('data')
# the "name-test" subdir in fact contains a bunch of tests now that need a
# temporary bus to be running to do stuff with. The directory should be renamed.
subdir('name-test')
tests = []
if embedded_tests
tests += [
{
'name': 'bus',
'srcs': [ 'bus/main.c' ],
'link': [ libdbus_testutils, libdbus_daemon_internal, ],
'install': false,
},
{
'name': 'bus-dispatch-sha1',
'srcs': [ 'bus/dispatch-sha1.c' ],
'link': [ libdbus_testutils, libdbus_daemon_internal, ],
'install': false,
'timeout': 120,
},
{
'name': 'bus-dispatch',
'srcs': [ 'bus/dispatch.c' ],
'link': [ libdbus_testutils, libdbus_daemon_internal, ],
'install': false,
'timeout': 120,
},
{
'name': 'marshal-recursive',
'srcs': [
'internals/dbus-marshal-recursive-util.c',
'internals/marshal-recursive.c',
],
'link': [ libdbus_testutils, ],
'install': false,
},
{
'name': 'message-internals',
'srcs': [
'internals/dbus-marshal-recursive-util.c',
'internals/dbus-message-factory.c',
'internals/dbus-message-util.c',
'internals/message-internals.c',
],
'link': [ libdbus_testutils, ],
'install': false,
},
]
if use_traditional_activation and platform_unix
tests += [
{
'name': 'bus-launch-helper-oom',
'srcs': [ 'bus/launch-helper-oom.c' ],
'link': [ libdbus_testutils, liblaunch_helper_internal, ],
'install': false,
},
{
'name': 'bus-system',
'srcs': [ 'bus/system.c', ],
'link': [ libdbus_testutils, liblaunch_helper_internal, ],
'install': false,
},
{
'name': 'spawn-oom',
'srcs': [ 'internals/spawn-oom.c', ],
'link': [ libdbus_testutils, ],
'install': false,
}
]
endif
endif
tests += [
{
'name': 'service',
'srcs': [ 'test-service.c' ],
'link': [ libdbus_testutils, ],
'install': true,
'test': false,
},
{
'name': 'sleep-forever',
'srcs': [ 'test-sleep-forever.c' ],
'link': [ libdbus_testutils, ],
'install': true,
'test': false,
}
]
tests += [
{
'name': 'atomic',
'srcs': [ 'internals/atomic.c' ],
'link': [ libdbus_testutils, ],
},
{
'name': 'hash',
'srcs': [ 'internals/hash.c' ],
'link': [ libdbus_testutils, ],
},
{
'name': 'misc-internals',
'srcs': [
'internals/address.c',
'internals/dbus-auth-script.c',
'internals/dbus-auth-util.c',
'internals/dbus-credentials-util.c',
'internals/dbus-marshal-byteswap-util.c',
'internals/dbus-marshal-recursive-util.c',
'internals/dbus-marshal-validate-util.c',
'internals/dbus-string-util.c',
'internals/dbus-sysdeps-util.c',
'internals/mempool.c',
'internals/misc-internals.c',
'internals/sha.c',
],
'link': [ libdbus_testutils, ],
},
{
'name': 'shell',
'srcs': [ 'shell-test.c' ],
'link': [ libdbus_testutils, ],
},
{
'name': 'printf',
'srcs': [ 'internals/printf.c' ],
'link': [ libdbus_testutils, ],
},
{
'name': 'manual-backtrace',
'srcs': [ 'manual-backtrace.c' ],
'link': [ libdbus_testutils, ],
'test': false,
},
{
'name': 'manual-dir-iter',
'srcs': [ 'manual-dir-iter.c' ],
'link': [ libdbus_testutils, ],
'test': false,
},
{
'name': 'manual-tcp',
'srcs': [ 'manual-tcp.c' ],
'link': [ libdbus_testutils, ],
'test': false,
}
]
if platform_windows
tests += [
{
'name': 'manual-paths',
'srcs': [ 'manual-paths.c' ],
'link': [ libdbus_testutils, ],
'test': false,
}
]
endif
if use_glib
tests += [
{
'name': 'assertions',
'srcs': [ 'internals/assertions.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'corrupt',
'srcs': [ 'corrupt.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'dbus-daemon',
'srcs': [ 'dbus-daemon.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'dbus-daemon-eavesdrop',
'srcs': [ 'dbus-daemon-eavesdrop.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'desktop-file',
'srcs': [ 'internals/desktop-file.c' ],
'link': [ libdbus_testutils, libdbus_internal, ],
'deps': [ glib, gio, ],
},
{
'name': 'fdpass',
'srcs': [ 'fdpass.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'header-fields',
'srcs': [ 'header-fields.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'timeout': 120,
},
{
'name': 'message',
'srcs': [ 'message.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'monitor',
'srcs': [ 'monitor.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'loopback',
'srcs': [ 'loopback.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'marshal',
'srcs': [ 'marshal.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'refs',
'srcs': [ 'internals/refs.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'relay',
'srcs': [ 'relay.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'server-oom',
'srcs': [ 'internals/server-oom.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'syntax',
'srcs': [ 'syntax.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'sysdeps',
'srcs': [ 'internals/sysdeps.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'syslog',
'srcs': [ 'internals/syslog.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'uid-permissions',
'srcs': [ 'uid-permissions.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'variant',
'srcs': [ 'internals/variant.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{
'name': 'manual-authz',
'srcs': [ 'manual-authz.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'test': false,
},
{
'name': 'manual-test-thread-blocking',
'srcs': [ 'thread-blocking.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'test': false,
},
]
if platform_unix
tests += [
{ 'name': 'containers',
'srcs': [ 'containers.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
{ 'name': 'sd-activation',
'srcs': [ 'sd-activation.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
},
]
endif
endif
foreach test: tests
name = test.get('name')
srcs = test.get('srcs')
link = test.get('link', [])
deps = test.get('deps', [])
timeout = test.get('timeout', 30)
install = test.get('install', true)
test_now = test.get('test', true)
test_exe = executable('test-' + name,
srcs,
link_with: link,
dependencies: deps,
include_directories: root_include,
install: install_tests and install,
install_dir: test_exec_dir,
)
if test_now
test(name,
test_exe,
args: ['--tap'],
env: test_env,
protocol: 'tap',
timeout: timeout,
)
endif
endforeach
###############################################################################
# Scripts
scripts = []
if platform_unix and use_glib
scripts += [
{ 'name': 'test-dbus-daemon-fork.sh', },
{ 'name': 'transient-services.sh',
'exec': 'integration/transient-services.sh', },
{ 'name': 'test-apparmor-activation.sh' },
]
if embedded_tests
scripts += { 'name': 'test-dbus-launch-eval.sh' }
endif
if embedded_tests and use_x11_autolaunch
scripts += { 'name': 'test-dbus-launch-x11.sh' }
endif
endif
foreach script: scripts
name = script.get('name')
exec = script.get('exec', script.get('name'))
if install_tests
install_data(exec,
install_mode: 'rwxr-xr-x',
install_dir: test_exec_dir,
)
endif
test(name,
find_program(exec),
env: test_env,
depends: xdgdir,
)
endforeach
foreach exe : scripts + tests
name = exe.get('name')
install = exe.get('install', true)
meta_config = configuration_data()
meta_config.set('command',
'env @0@/@1@ --tap'.format(
get_option('prefix') / test_exec_dir, name
))
configure_file(
input : 'meta_template.test.in',
output: name + '.test',
configuration: meta_config,
install: install_tests and install,
install_dir: test_meta_dir
)
meta_config = configuration_data()
meta_config.set('command',
'env DBUS_TEST_EXEC=@0@ DBUS_TEST_DATA=@0@/data @0@/@1@ --tap'.format(
get_option('prefix') / test_exec_dir, name
))
configure_file(
input : 'meta_template.test.in',
output: name + '_with_config.test',
configuration: meta_config,
install: install_tests,
install_dir: test_meta_dir
)
endforeach

View file

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

View file

@ -0,0 +1,79 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
if embedded_tests
tests = [
'test-autolaunch',
'test-ids',
'test-pending-call-disconnected',
'test-shutdown',
]
if use_traditional_activation
tests += [
'test-pending-call-dispatch',
'test-pending-call-timeout',
'test-threads-init',
'test-privserver-client',
]
endif
foreach test: tests
test_exe = executable(test,
test + '.c',
include_directories: root_include,
link_with: [
libdbus,
libdbus_internal,
libdbus_testutils,
],
dependencies: dbus_dependencies,
)
test(test,
dbus_run_session,
args: [
'--config-file=@0@'.format(
meson.project_build_root()/'test/data/valid-config-files/tmp-session.conf'),
'--dbus-daemon=@0@'.format(dbus_daemon.full_path()),
'--',
test_exe,
],
env: test_env,
)
endforeach
if platform_unix
test('run-test',
find_program('run-test.sh'),
env: test_env,
protocol: 'tap',
)
test('run-test-systemserver',
find_program('run-test-systemserver.sh'),
env: test_env,
protocol: 'tap',
)
endif
endif

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

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

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import datetime
print(datetime.datetime.now().isoformat(timespec='minutes'))

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

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

107
tools/meson.build Normal file
View file

@ -0,0 +1,107 @@
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
if not platform_windows
dbus_cleanup_sockets = executable('dbus-cleanup-sockets',
'dbus-cleanup-sockets.c',
include_directories: root_include,
install: true,
)
endif
if platform_windows
dbus_launch_sources = [
'dbus-launch-win.c'
]
else
dbus_launch_sources = [
'dbus-launch.c',
'dbus-launch-x11.c',
'tool-common.c',
]
endif
dbus_launch = executable('dbus-launch',
dbus_launch_sources,
include_directories: root_include,
link_with: libdbus,
dependencies: [ x11, ],
install: true,
)
dbus_monitor = executable('dbus-monitor',
'dbus-print-message.c',
'dbus-monitor.c',
'tool-common.c',
include_directories: root_include,
link_with: libdbus,
install: true,
)
dbus_run_session = executable('dbus-run-session',
'dbus-run-session.c',
'tool-common.c',
include_directories: root_include,
link_with: libdbus_internal,
install: true,
)
dbus_send = executable('dbus-send',
'dbus-print-message.c',
'dbus-send.c',
'tool-common.c',
include_directories: root_include,
link_with: libdbus,
install: true,
)
dbus_test_tool = executable('dbus-test-tool',
'dbus-echo.c',
'dbus-spam.c',
'test-tool.c',
'tool-common.c',
include_directories: root_include,
link_with: libdbus,
install: true,
)
dbus_update_activation_environment = executable('dbus-update-activation-environment',
'dbus-update-activation-environment.c',
'tool-common.c',
platform_windows ? windows.compile_resources('disable-uac.rc') : [],
include_directories: root_include,
link_with: libdbus,
install: true,
)
if not platform_windows
dbus_uuidgen = executable('dbus-uuidgen',
'dbus-uuidgen.c',
include_directories: root_include,
link_with: libdbus,
install: true,
)
endif
install_data('GetAllMatchRules.py',
install_dir: docs_dir / 'examples',
)