Commit graph

6422 commits

Author SHA1 Message Date
Marc-André Lureau
9016b48cf9 cmake: drop DBUS_VERBOSE_C_S
Apparently, not used anywhere.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
a5c8dda5cf cmake: drop unused HAVE_VASPRINTF/HAVE_VSNPRINTF checks
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
95df73b463 cmake/autotools: remove HAVE_DIRFD/HAVE_DDFD
dirfd() is assumed to be present on Linux, dd_fd is never used.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
f0a4d92490 cmake: drop needless headers checks
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
e986c2b5b6 meson: add missing header checks
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
ffc063a95c meson: add windows_output_debug_string option
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[smcv: Rename to avoid using "Win32" to refer to both 32- and 64-bit]
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
f893b86e52 autotools: dist listen-autolaunch-win.conf.in as well
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
9aa751f59e meson: add test-autolaunch-win
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
ac9d36836e test: Set PATH or WINEPATH to find dbus-daemon.exe in build-time tests
When building for Windows, either natively or cross-compiling and
running tests with Wine, test-autolaunch-win expects to be able to
find the just-built dbus-daemon.exe in the PATH.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
9215dbea53 meson: Allow disabling Valgrind instrumentation
This would currently result in a hard dependency on Valgrind headers
when linking dependent projects to libdbus (see
https://github.com/mesonbuild/meson/pull/10544 for an attempt to
avoid this), so distributions likely don't want to enable this feature
in their main builds of valgrind (although they could enable it in
special debug builds like the one in Debian's dbus-tests package if
desired).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
64e490afe7 meson: Fix the check for --version-script support
At the time we do this check, version_script has not yet been generated,
so we have to use something else.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
154cc9d5ca meson: Add GLib version macros
This helps to avoid unintended dependencies on newer versions of GLib.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
6a4835e627 meson: Define HAVE_GIO_UNIX
Some of the tests check for this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
17e12ccfb0 meson: Check for LOG_PERROR
We use this when writing to the system log.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
d78d742f41 meson: Check for environ declaration
We use this in various places.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
35eca11708 meson: Replicate Autotools check for __sync_sub_and_fetch
The built-in atomic intrinsics are not exactly functions, so it's
incorrect to use has_function to check for them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
ec3edd80a6 meson: Always define HAVE_DECL_MSG_NOSIGNAL to 1 or 0
This is consistent with Autotools AC_CHECK_DECLS.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
4f966cc1b4 meson: Don't check for dirfd
We never actually look at HAVE_DIRFD.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
9c9fae18dd meson: Don't define DBUS_ENABLE_ASSERTS
The other build systems don't define this, and it's too confusing to
have both DBUS_ENABLE_ASSERTS and DBUS_ENABLE_ASSERT.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
09ebed95ea test: Extend some timeouts
Group slow tests (those taking about a minute or more in one of the
configurations built on Gitlab-CI) into a new 'slow' suite, which can
be used with `meson test --no-suite=slow` to run just the faster tests.
They default to a 5 minute timeout (usually enough) unless overridden
(bus/dispatch.c can be *very* slow when OOM testing is enabled, and
gets a 30 minute timeout).

For the remaining tests, default to Meson's usual 30 second timeout,
but bump up the timeout a bit in some cases to have a safety margin
(my method was to take the slowest run on our Gitlab-CI, and make sure
we're allowing about 3 times that long).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
b228b478a4 dbus: Only use compile flags from valgrind, not libraries
Recent versions of valgrind have library code, which we don't need (or
want) to link to; all we actually want is <valgrind.h> and <memcheck.h>.

I had hoped that this would suppress the Requires.private when
generating our .pc file, but it doesn't seem to.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
64711328ec test: Group together tests that run the dbus-daemon
These have slightly different requirements on CI, and are harder to
get working on Windows.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
1dc8cf5875 test: Add missing session.conf, system.conf to Meson build
For as-installed testing on Unix, we want these to be symlinks to the
production versions of the same file.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
6f6fd74a31 meson_post_install.py: Correct path to dbus-daemon-launch-helper
It's installed in the ${libexecdir} for both Autotools and Meson.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
6eefa5da34 meson_post_install.py: Call chmod after chown
If we call chmod before chown, then chown will remove the setuid bit.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
398820d1fe build: Change how we create empty directories from Meson
Use install_emptydir() in Meson versions that support it, or a script
with similar invocation in versions that do not. This will make it
straightforward to migrate to install_emptydir() when we drop support
for Meson versions older than 0.60.0.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
e2f2c5dd42 build: Change how we create symlinks from Meson
Use install_symlink() in Meson versions that support it, or a script
with similar invocation in versions that do not. This will make it
straightforward to migrate to install_symlink() when we drop support
for Meson versions older than 0.61.0.

Based on an implementation in the game-data-packager package, which used
a shell script.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
abef795081 build: Don't replace prefix in .pc file if relocation is disabled
Replacing the prefix with a path relative to ${pcfiledir} can be harmful
if the number of path components between the prefix and the ${libdir}
is not what we expect, in particular on Debian-derived systems where the
${libdir} is normally lib/x86_64-linux-gnu or similar.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
47deeb4a9e doc: Don't install introspect.xsl for now
Maybe this should be installed, but for now maintain parity with
Autotools.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
b47263d0ab bus: Install example systemd hardening when using Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
08348e9e46 test: Install transient-services.sh into a subdirectory
This is what we do with Autotools, and keeping Meson the same means we
can diff the installed trees more easily.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
c74504fb7e doc: Make Meson yelp-build invocation compatible with older versions
Older versions of yelp-build like the one in Debian 11 do not allow
permuting arguments, so all options (in this case -o) must appear
before all positional parameters.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
29ae675978 doc: Write absolute path to DTDS into XML catalog
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
77312171b9 test: libdbus-testutils depends on GIO, not just GLib
This matters when we build against GLib as a Meson subproject.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
179669fa7c build: Define x11 to an empty dependency if X11 autolaunch is disabled
Otherwise, we can't build successfully for Windows with X11 autolaunch
explicitly disabled.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
78d359dbb6 test: Make environment variables consistent with Autotools
DBUS_SESSION_BUS_LISTEN_ADDRESS is the same as in non-test files:
the test data distinguishes between DBUS_SESSION_BUS_LISTEN_ADDRESS,
the real session bus configuration, and TEST_LISTEN, the test-only
configuration.

DBUS_TEST_HOMEDIR and HOME should be in the build directory, not
the source directory.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
4fbdb14987 subprojects: Allow expat and GLib to be built as subprojects
This should let us build everything with a mingw-w64 toolchain, without
having to use prebuilt dependencies from MSYS.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
37e1728638 maintainer-upload-docs: Remove assumptions about source, build dirs
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
4655d00952 maintainer-upload-docs: Fail if an undefined variable is referenced
"Unofficial strict mode" for shell scripting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
0c948dc744 maintainer-upload-docs: Allow servers and directories to be overridden
This lets maintainers test the script without putting changes
directly into production!

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
9a64c6c095 build: Make update-authors convenience target runnable from Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
6e5f42be4d build: Remove a misleading comment
It's fine to define DBUS_COMPILATION for anything that is being
compiled as part of dbus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
ff92efa389 build: Implement a runtime_dir option
If the prefix is /usr, then this defaults to /run, similar to the
special cases for /var and /etc built into Meson. This is correct for
typical modern Linux distributions implementing FHS 3.0. This is
intentionally not consistent with Autotools and CMake: if distributions
are transitioning to a different way to build dbus, then that's a good
time to re-evaluate their build options.

Otherwise, this defaults to LOCALSTATEDIR/run, consistent with Autotools
and CMake.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
e75d8a7cbc test: Correct generation of .test metadata
If a helper executable is not, in itself, a test-case, then we should
not generate metadata that tells ginsttest-runner to run it as a
test-case.

Meanwhile, we were previously generating foo_with_config.test metadata
for tests that don't get installed; stop doing that.

We also need to distinguish between the abstract name of the test
(which usually does not start with test-), the name of the .test file
(which does start with test- for compiled executables), and the name
of the executable (which may include .exe as well). To make validation
against the Autotools build system as straightforward as possible,
generate exactly the same names as in Autotools. We can consider removing
the test- prefix later, if we remove the Autotools build system.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
c8ecf552c8 test: Allow for scripts that don't get installed
At the moment there aren't any like this, but it seems reasonable that
we might get some later.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
fad7a62c39 test: Don't run integration tests at build-time
Some items listed in the tests array are helper executables rather
than actually being tests, and should not be run as a test at any time.
Those have {"test": false}. Expand this special case to the scripts
array for completeness (although currently, no scripts need this).

Meanwhile, some items listed in the scripts array are "as-installed"
integration tests which cannot safely be run at build-time, because
they make assertions about the state of the installed system.
Introduce {"build_time_test": false} for these, and expand this special
case to the tests array for completeness (although currently, no
compiled executables need this).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
0793e3be3d build: Propagate some comments from Autotools build into Meson
Comments like these represent hard-won knowledge which we should not
discard.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
7445af51a4 build: Add machine-readable licensing markers to the Meson build system
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
d9194ffb4d test: Try to create temporary XDG_RUNTIME_DIR with correct mode
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
e6e2370e9e doc: avoid Python injection if filenames contain quotes
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00