Commit graph

470 commits

Author SHA1 Message Date
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
Alex Richardson
364fe6be69 tools/ci-install.sh: Install newer CMake on openSuSE
This is needed for JUnit XML output for tests.
2022-05-17 10:48:06 +00:00
Alex Richardson
f366b38f31 tools/ci-build.sh: Add a ci_cmake_junit_output argument
CMake 3.21 can emit JUnit XML test results which can be visualized by
GitLab. This also updates the gitlab CI config file to make use of this
feature whenever possible.
2022-05-17 10:48:06 +00:00
Alex Richardson
50689407cf tools/ci-build.sh: Pass user arguments to cmake last
This allows a user to override ENABLE_WERROR for platforms that are not
yet -Werror clean.
2022-05-01 15:57:40 +00:00
Simon McVittie
6130ac4267 build: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIER
Using PRId64, etc. to print dbus_int64_t or dbus_uint64_t is not 100%
portable. On platforms where both long and long long are 64-bit (such as
Linux and macOS), we will prefer to define dbus_int64_t as long.
If the operating system has chosen to define int64_t as long long,
which is apparently the case on macOS, then the compiler can warn that
we are passing a long argument to PRId64, which is "lld" and therefore
expects a long long argument (even though that ends up with the same
bit-pattern being used).

We can't necessarily just use int64_t and uint64_t directly, even if all
our supported platforms have them available now, because swapping
dbus_int64_t between long and long long might change C++ name mangling,
causing ABI breaks in third-party libraries if they define C++ functions
that take a dbus_int64_t argument.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-19 18:27:47 +00:00
Alex Richardson
6c1c7e539f Fix no-X11 build after d847b5f6ae
Since that commit the error variable is used in all cases not only the
DBUS_BUILD_X11 #ifdef branches.

Fixes: https://gitlab.freedesktop.org/dbus/dbus/-/issues/392
2022-04-16 16:04:57 +00:00
Ralf Habacker
a3b20acdd4 Add automatic detection of suite to CI scripts
The detection is based on the variable VERSION_CODENAME from
/etc/os-release, which is supported by systemd. For further details see
https://www.freedesktop.org/software/systemd/man/os-release.html.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-04 12:37:50 +02:00
Ralf Habacker
82f1aaeea0 Add automatic detection of distribution to CI scripts
The detection is based on the variable ID from /etc/os-release,
which is supported by systemd. For further details see
https://www.freedesktop.org/software/systemd/man/os-release.html.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-04 09:24:31 +02:00
Simon McVittie
363919696a dbus-launch: If no X11, look for existing bus before failing
What we are aiming for here is that `dbus-launch --autolaunch` will
exit with an error if it would have been unable to advertise the bus
in a way that will be picked up by other instances of itself, so that
we don't get a proliferation of autolaunched dbus-launch instances,
each with its own dbus-daemon, and none of them talking to the others.

However, we don't need to do that *immediately*: we can try to look for
an existing instance first. If we find one, then we can assume that
it's suitable for use, even if X11 autolaunching was disabled at
compile-time or if connecting to the X server failed at runtime. We
only need to bail out if we get to the point where we are ready to start
forking child processes.

This lets systemd users run `dbus-launch --autolaunch` to find a
systemd-managed dbus-daemon, even if X11 autolaunching is disabled.
When combined with the previous commit, it also lets macOS users run
`dbus-launch --autolaunch` to find a launchd-managed dbus-daemon.

Resolves: dbus/dbus#385
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-29 14:38:43 +00:00
Simon McVittie
d847b5f6ae dbus-launch: Generalize support for discovering an existing bus
Previously we were looking for an existing bus via
_dbus_lookup_user_bus(), meaning a user bus $XDG_RUNTIME_DIR/bus
(in practice this is managed by systemd --user, although in principle
there's nothing to stop other session frameworks from providing the
same thing).

_dbus_lookup_session_address() looks for an externally-managed
dbus-daemon in a more general way: on macOS it uses launchd, and on other
Unix it's a thin wrapper around _dbus_lookup_user_bus(). Let's try that,
so that macOS users can get their existing dbus-daemon from launchd.

This partially resolves dbus/dbus#385, although initially only for macOS
users who have (unusually) enabled X11 autolaunching support.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-29 14:38:43 +00:00
Ralf Habacker
acdf5a7a18 On CI add build support for openSUSE distributions
The mingw related jobs are running the whole test suite which
is an extension to the available jobs.

The environment variable ci_suite is not used on openSUSE
distributions, as it is determined from the installed image.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 12:47:59 +00:00
Ralf Habacker
c4d69fe95e tools/ci-install.sh: clean up the previously used installation prefix and the downloaded mingw packages
This is necessary to have a clean initial state when running the script
locally.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 10:29:18 +02:00
Ralf Habacker
99c1de5180 tools/ci-install.sh: Use partially qualified versions with mingw package names
Fixes dbus/dbus#388

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 10:29:18 +02:00
Ralf Habacker
a7fb199f22 tools/ci-install.sh: on debian|ubuntu reduce the need for mingw package name changes
Instead of having to specify an exact version that needs to be adjusted
with each repository update, it is now possible to specify package names
without version or partially qualified versions, which reduces the
frequency of necessary adjustments.

This is achieved by searching for the package names in a previously
downloaded list of available packages.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 10:29:18 +02:00
Ralf Habacker
251bb0be7f tools/ci-build.sh: Define and use variable builddir
Reviewed-by: Simon McVittie <smcv@collabora.com>
2022-03-16 14:19:32 +00:00
Simon McVittie
b03cb9f9cd CI: Make most gcc warnings fatal for CMake builds
This makes sure we notice problems early.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-27 17:09:33 +00:00
Simon McVittie
61cfa140cb CI: Use https to download MSYS packages
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:08:58 +00:00
Simon McVittie
97c2f9e306 CI: Install ci-certificates
We need this to be able to download MSYS packages now.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:08:58 +00:00
Simon McVittie
69c610f6f0 CI: Remove EOL versions of Debian and Ubuntu
Debian 9 'stretch' is EOL, and Ubuntu 16.04 is EOL unless you enter into
a special subscription with Canonical. This puts them outside our
informal security-support policy, and realistically, anyone sufficiently
change-averse to be following these distributions is not going to be
backporting a current version of dbus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 13:54:05 +00:00
Marc-André Lureau
94f8689417 docker/windows: fix bad path from MR !218
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-01-27 23:07:18 +04:00
Marc-André Lureau
98c903656d gitlab-ci: build a Windows docker image, with VS15 & msys
Based on GStreamer & Mesa freedesktop gitlab CI, use the Windows 1809
runner provided by the GStreamer Foundation.

https://www.freedesktop.org/wiki/Infrastructure/

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-01-21 21:16:45 +04:00
Ralf Habacker
19d6954b05 tools/ci-build.sh: Double maximum test time when running tests on Windows
The currently timeout of 60 seconds is too short for test-dbus-daemon on
Windows, depending on the load of the CI system.

Fixes #359
2021-12-06 23:52:01 +01:00
Ralf Habacker
acb9ca7422 tools/ci-*.sh: Show used command line for CI build scripts
This makes it much easier to determine the command line used for the
purpose of reproducing the build.
2021-11-29 15:20:10 +00:00
Ralf Habacker
0eef54ea1b _dbus_spawn_program(): Add additional parameter to return error
By specifying an error instance via the additional parameter, errors that
occur in it are transported to the caller in a coordinated manner.

This eliminates the need to query GetLastError() outside the function,
which can return an incorrect value if the implementation changes.
2021-11-29 13:07:04 +01:00
Ralf Habacker
ba1dc32667 _dbus_spawn_program() now returns #NULL for unification in case of error 2021-11-29 13:07:04 +01:00
Ralf Habacker
fe84e9b0e5 dbus-run-session: also catches a server-exit under Windows
If the dbus-daemon fails before the --ready-event-handle is signalled,
then dbus-run-session now detects that, and exit unsuccessfully.

Fixes #354
2021-11-25 16:46:27 +01:00
Ralf Habacker
2334307fbd tools/dbus-run-session.c: use _dbus_win_set_error_from_last_error() on remaining locations
The previously used function _dbus_win_stderr_win_error() has been removed
because it is no longer used.
2021-11-23 08:38:14 +01:00
Ralf Habacker
79df3d2811 tools/dbus-run-session: fix race between manual and automatically started dbus-daemon on Windows
dbus-run-session starts a dbus-daemon before the client application.
We must avoid letting the application try to connect before the
dbus-daemon's DBusServer is listening for connections.

In the Unix implementation, we already achieved this via the
--print-address option. If the client tried to connect too soon,
the server would not yet be listening and the client would fail.

In the Windows implementation, we communicate the bus address to
the client application as an autolaunch: address, so if the client
tried to connect too soon, it would autolaunch a new dbus-daemon
instead of using the one that it was intended to use.

We can avoid this by using a new option to pass in a Windows event
object, which will be set when the server has started and is ready
to process connections.

Fixes #297
2021-11-23 08:38:14 +01:00
Ralf Habacker
151574605e tools/cmake-format: fix sed warning Expression #1, char 25: unknown option for »s« in --all mode 2021-10-25 15:56:09 +02:00
Ralf Habacker
75003c4ca1 tools/cmake-format: add support to use custom source root directory 2021-10-25 15:42:37 +02:00
Simon McVittie
a42a07a1fb dbus-send: Validate interface, member names before use
Instead of a failed check or assertion failure and a core dump, let's
produce an error message on stderr and a graceful nonzero exit status.
It's still not going to *work*, but at least we can avoid crashing.

    $ dbus-send / com.example.Nope..Nope
    Interface name was not valid: 'com.example.Nope.'
    $ dbus-send / com.example.Nope.0
    Invalid signal name: Member name was not valid: '0'

Resolves: dbus#338
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-21 12:04:05 +01:00
Simon McVittie
dde5c8fdc4 dbus-send: Print an error message if object path is syntactically invalid
$ dbus-send // nope
    Object path was not valid: '//'

Related to dbus#338.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-21 12:02:27 +01:00
Marc-André Lureau
c5385dfd60 ci: bump msys2 deps, fix broken links
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-01-13 18:53:23 +04:00
Ralf Habacker
6412ccdf67 tools/ci-install.sh: Use package=() style for local package list to avoid '\' notation 2020-11-24 07:08:42 +00:00
Ralf Habacker
9c5734fe90 On CI use common install prefix named 'dep_prefix' for installing local packages
With this commit a new variable 'ci_local_packages' has been introduced
to have a choice for using development packages from a local installation
or from the distribution.
2020-11-24 07:08:42 +00:00
Ralf Habacker
e82d5fe486 tools/ci-build.sh: Clean up directories from possible previous builds
Otherwise, ci-build.sh cannot be executed on a local system if there
are previous runs.
2020-11-24 07:08:42 +00:00
Ralf Habacker
478484f13c tools/ci-install.sh: merge multiple calls to apt-get
This required a reorganization of the steps that had been carried out.
The new order is:
   1. install packages with apt-get
   2. create user for build if required
   3. fetch and unpack tar balls
   4. create messagebus user
2020-11-24 07:08:42 +00:00
Ralf Habacker
1e3d82d85e Move installing packages into tools/ci-install.sh
In tools/ci-build.sh the cross compile setup has to be moved further up
to match the correct subdirectory.
2020-11-24 07:08:42 +00:00
Ralf Habacker
2534c2076f Drop unused travis CI configuration files 2020-11-16 14:48:59 +01:00
William Earley
3545d0f4de dbus-launch: Replace slashes in DISPLAY if present
dbus-daemon fails to autolaunch with X11 on macOS 10.8+ because XQuartz
(the X11 package for macOS) provides a value for `$DISPLAY` that is
not expected by dbus, in that it contains `/` characters. This is
addressed by replacing the invalid path character `/` with `_`.

Resolves: #8
Resolves: #311
2020-11-06 17:17:09 +00:00