Commit graph

509 commits

Author SHA1 Message Date
Daniel Wagner
afb5bbaba4 meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.

The strong recommendation is only to build libdbus as static library:

  libdbus_dep = dependency(
    'dbus-1',
    required: get_option('libdbus'),
    fallback: ['dbus', 'libdbus_dep'],
    default_options: [
      'default_library=static',
      'embedded_tests=false',
      'message_bus=false',
      'modular_tests=disabled',
      'tools=false',
    ],
  )

This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2023-01-04 09:35:06 +01:00
Ralf Habacker
2dee523608 Add SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license
The full license texts are not added because they were already
added in a previous commit.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>

see #394
2023-01-04 07:53:44 +00:00
Ralf Habacker
e3a365e7ac tools/cmake-format: Relicense to BSD-3-Clause
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-11-29 13:33:53 +00:00
Simon McVittie
33bc01e1b5 tools: Mark GPL-only files with SPDX license identifier
These files are licensed under the GPL only, without the AFL dual-license
of most of the dbus codebase.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-11-29 13:33:53 +00:00
Evgeny Vereshchagin
738d8dbe6f ci: get UBSan to fail and print full backtraces
Unlike ASan, by default UBSan prints one-line warnings and keeps going
and it makes it impossible for the CI to catch issues automatically when
it runs the unit tests. With this patch applied the CI should be able to
prevent issues like
https://gitlab.freedesktop.org/smcv/dbus-issue413/-/merge_requests/1#note_1549306
from making it into the repository going forward.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2022-10-13 03:20:31 +00:00
Evgeny Vereshchagin
9803fb09fc ci: build dbus with clang as well
It should make it possible to catch issues like
like https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/357

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2022-10-13 03:20:07 +00:00
Simon McVittie
e5d8d0c19a build: Show a warning if the system bus socket is not interoperable
We would like to start using ${runstatedir}/dbus/system_bus_socket,
so that distributors who make /var/run a symbolic link to /run will
usually get their dbus-daemon listening on /run/dbus/system_bus_socket,
which has some advantages in corner cases, such as when /var is mediated
by an automounter or is unmounted during system shutdown.

Unfortunately, the interoperable path in the D-Bus Specification is
/var/run/dbus/system_bus_socket for historical reasons (D-Bus is older
than /run), and older versions of Slackware are known to have had /run
and /var/run as distinct directories. Do a check during configuration
to catch systems configured like this and show a warning.

When cross-compiling, this assumes that the system where dbus is built
(the build system in Autotools/Meson, or the "host" in CMake terminology)
has its /var/run and /run set up in a way that is compatible with the
system where dbus will run (the host system in Autotools/Meson, or the
"target" in CMake terminology). This is not 100% correct, but seems good
enough for a warning that will hopefully only trigger for misguided OS
distributors.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Kai A. Hiller
f1c17c74ac dbus-monitor: Disable automatic message filtering 2022-10-11 10:50:08 +00:00
Simon McVittie
bb38fb361e CI: Don't pin msys2 packages to a specific version at all
Similar to dbus/dbus!286, but more so: just use the package names,
ignoring their version numbers completely.

pcre2 is not strictly needed at the moment, but it'll be a dependency
for GLib >= 2.73.x (older versions used pcre). For a bit of
future-proofing, download both pcre and pcre2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-12 20:01:50 +01:00
Alex Richardson
ee880ef811 tools/ci-install.sh: Install meson build dependencies on FreeBSD
Python is already installed, but we need the python3 package to get the
/usr/local/bin/python3 symlink rather than the one with the version suffix.
2022-08-10 11:18:20 +00:00
Alex Richardson
db441d3017 ci-build.sh: Add a autotools ci_variant without the docs archive
This is needed to add autotools support to the FreeBSD CI since we don't
include all the packages needed to build dbus-docs.tar.xz.
2022-08-10 11:18:20 +00:00
Alex Richardson
2659a0f18e gitlab-ci: Use GNU make on FreeBSD
The Makefile.am files contain % pattern rules that are not supported by
`make` (bmake) on FreeBSD. Since the replacing the patterns is non-trivial,
this commit updates the CI script to use GNU make when building on FreeBSD.
2022-08-10 11:18:20 +00:00
Alex Richardson
902260f6da gitlab-ci: Install pkg-config on FreeBSD
Without this change the autotools build system fails to find glib and
reports an error. The CMake build worked prior to this change since CMake
has fallback logic to find glib even without pkg-config.
2022-08-10 11:18:20 +00:00
Alex Richardson
7ca69a9785 dbus-launch-x11.c: Silence clang -Wcast-align warning
In this case the cast is safe since the manual guarantees that the
underlying storage is an array of `long`.
2022-08-10 11:18:20 +00:00
Alex Richardson
aa90d09940 tools/ci-build.sh: Ensure that $builddir is set
When adding the new FreeBSD CI, this was not implicitly forwarded to QEMU,
so the build script failed with confusing errors. Add an explicit check
that the variable is set to make those cases easier to debug.
2022-08-10 11:18:20 +00:00
Alex Richardson
ca091e78d3 tools/ci-install.sh: Add FreeBSD support
This adds support for installing the required packages on FreeBSD.
2022-08-10 11:18:20 +00:00
Alex Richardson
295912045e tools/ci-{build,install}.sh: Use a portable interpreter argument
FreeBSD has bash installed as /usr/local/bin/bash, so hardcoding /bin/bash
does not work. Instead use the portable replacement using env which will
find bash in $PATH.
2022-08-10 11:18:20 +00:00
Simon McVittie
36038fb126 Remove fallback implementation of strtoll(), strtoull()
We now require a (mostly-)C99 compiler, which guarantees the presence
of these functions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 21:11:09 +01:00
Simon McVittie
5cd05bbb5a dbus-launch-x11: Ignore X11 connection when checking for memory leaks
The X11 connection is opened and never closed. Because dbus-launch
forks and continues to run non-trivial code in a forked child, it is
not clear whether (or where) it would be safe to close it; instead, we
leave it open until process exit, at which point the socket is cleaned
up by the kernel.

Any memory allocated for the X11 connection is only allocated once per
run of dbus-launch, so there's no need to keep track of it, and we can
silence these memory leak warnings as uninteresting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 15:59:38 +01:00
Simon McVittie
1f8bf48801 CI: Link libexpat statically when using Wine to run tests
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
b01bcb34a3 CI: Ensure that subprojects (if used) are on the Wine PATH
If we are not using Meson subprojects, this will have no practical
effect, because the directories won't exist.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
d8160bdcfa CI: Enable Ducktype-based documentation on Debian/Ubuntu
We don't currently know the equivalent of python3-mallard-ducktype on
other OSs like openSUSE, but we know this should work on Debian (it does
when we do Autotools builds).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
d946c02289 CI: Run Meson with -v so we can see compiler command-lines
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
5cd8b3e0a1 CI: Enable modular tests for all Meson-based CI builds
The whole point of these tests is that they're safe to enable because
they don't affect the production binaries.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
00c18a8050 CI: Factor out Wine setup so that it applies equally to Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
4d0341052a CI: Install cross pkg-config on openSUSE
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
0dac45dce2 CI: Explicitly enable wrap dependencies
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
f49791ec99 CI: Tell Meson build where to find the source directory
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
cceffebed3 CI: Implement debug build variant for Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
14bfd498c6 CI: Explicitly disable features that can't work on Windows
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
c21d47836c CI: Add glue to build with mingw-w64 toolchain on Debian
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
da94d0c029 CI: Only use openSUSE mingw*-meson as a replacement for meson setup
These pass a lot of configure arguments taken from RPM macros, which
are only accepted by the meson command if we don't explicitly select
a mode.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
5eee2d552a CI: Verify that Autotools make dist includes everything needed for Meson
This is similar to what we have done for CMake since dbus/dbus!87
(commit 1063bba "CI: Do the CMake native debug build from an Autotools
`make dist`"). Our official source releases are Autotools `make dist`
tarballs, so our CI should assert that such tarballs contain everything
necessary to do a CMake or Meson build, so that downstream distributions
using our tarballs as source can choose their preferred build system.

When the Meson build system is ready to be recommended as more preferred
than Autotools, we can do as GLib did: stop releasing `make dist`
tarballs, and start releasing `meson dist` tarballs instead (which will
change nothing for Meson or CMake users, but Autotools users will have
to run autoreconf or autogen.sh before building).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
600926adce CI: Consistently build in ./build
This will make it easier to capture log files. All our CI builds happen
in an expendable checkout, so we can safely remove and re-create ./build.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
be17ca80fe CI: Add repository for word-size-independent mingw stuff
windows:mingw:win64 depends on packages from windows:mingw.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
1e5badb071 CI: Reinstate mingw*-glib2-devel
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
c9c2ed8ebf CI: Use mingw32-meson if that's what we're targeting
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
07ddd3597e Add meson build CI
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
5d3756f6fb meson: Create /var/lib/dbus
This holds the machine ID created by dbus-uuidgen.

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
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
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
1582f713a3 build: Distribute Meson build system in release tarballs
As long as we are treating Autotools as a first-class citizen, what we
release will be `make distcheck` output.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
67b651d1c6 build-timestamp.py: Respect SOURCE_DATE_EPOCH
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
3bfd184ab7 tools: Ship disable-uac.rc instead of generating it at build time
The Meson build system ships it anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Félix Piédallu
cd2e382610 Add Meson build system
Signed-off-by: Félix Piédallu <felix@piedallu.me>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Marc-André Lureau
505233a57f tools/ci: remove --{enable,disable}-containers
Fixes: 9d60676a ("Disable the Containers interface")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-06 15:43:52 +04:00
Frederik Van Bogaert
38a98dbf02 dbus-send: Add support for variants to arrays and dictionaries
Adds support for:
* Arrays of variants
* Dictionaries with variants as keys

Manually tested and confirmed working using dbus-monitor.
Example usage:
```
$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus \
    com.example.SomeExample dict:string:variant:one,int16:1
```
In dbus-monitor:
```
method call time=1652796044.991509 sender=:1.84 -> destination=org.freedesktop.DBus
    serial=2 path=/org/freedesktop/DBus; interface=com.example; member=SomeExample
   array [
      dict entry(
         string "one"
         variant             int16 1
      )
   ]
```

Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
2022-05-23 12:15:02 +00:00
Marc-André Lureau
b342ed53e5 build-sys: console-auth-dir leftovers
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-20 13:40:58 +00:00