Commit graph

6438 commits

Author SHA1 Message Date
Simon McVittie
104df89947 cmake: Look for dbus-arch-deps.h next to DBus1Config.cmake
<dbus/dbus-arch-deps.h> is architecture-dependent, and compilers have
not traditionally supported an installation path for architecture-specific
headers (Debian-based systems have /usr/include/${multiarch_tuple}, but
that isn't portable beyond Debian). When dbus was built using Autotools,
dependent projects that use CMake need to look for this header in the
right place.

Unfortunately, it seems that at least recent versions of CMake will
ignore the HINTS we get from pkg-config if they are told to search in
a non-standard prefix via ${DBus1_ROOT}.

Look for dbus-arch-deps.h in a directory derived from the filename of
the CMake config file, before trying the normal search algorithm. The
CMake config file is in ${libdir}, and so is the architecture-specific
header, so this should work reasonably reliably.

According to the CMake documentation, if we search for the same thing
multiple times, the first successful result will be used; and searching
with NO_DEFAULT_PATH is the official way to prepend things to the
search order.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/314
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-30 07:36:38 +00:00
Simon McVittie
6238a9818d Merge branch 'generalize-autolaunch' into 'master'
dbus-launch: Generalize support for discovering an existing bus

Closes #385

See merge request dbus/dbus!273
2022-03-29 19:12:02 +00: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
7cb63366aa Merge branch 'ci-opensuse-support' into 'master'
On CI add support for building package based on openSUSE distribution

Closes #383

See merge request dbus/dbus!192
2022-03-29 14:24:04 +00:00
Ralf Habacker
93073e9565 CI: Switch active cmake related jobs to opensuse as default
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 12:47:59 +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
dd8638e131 cmake: temporary disable fatal warnings related to new opensuse builds
This is necessary for these CI builds to be successful.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 12:47:59 +00:00
Ralf Habacker
8d86453b82 Merge branch 'compile-with-clang' into 'master'
cmake: Only add warning flags if the compiler supports them

Closes #387

See merge request dbus/dbus!276
2022-03-29 12:36:47 +00:00
Alex Richardson
d35554c111 cmake: Only add warning flags if the compiler supports them
I am compiling for FreeBSD where the compiler is Clang and doesn't accept
all the GCC warning flags. This breaks the -Werror build:
```
error: unknown warning option '-Wduplicated-branches' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wduplicated-cond' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wjump-misses-init' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wrestrict' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wunused-but-set-variable'; did you mean '-Wunused-const-variable'? [-Werror,-Wunknown-warning-option]
```

With this change we use check_{c,cxx}_compiler_flag to check if the flag
is supported before adding it. In the future this will allow adding
clang-specific warning flags to the list of warnings as well since they
will be ignored for GCC.
2022-03-29 12:21:46 +00:00
Simon McVittie
0a22950288 Merge branch 'bug834725' into 'master'
sysdeps-unix: check fd before calling _dbus_fd_set_close_on_exec()

See merge request dbus/dbus!285
2022-03-29 12:19:58 +00:00
Mike Gilbert
769a0462be sysdeps-unix: check fd before calling _dbus_fd_set_close_on_exec()
If /proc/self/oom_score_adj does not exist, fd will invalid (-1).
Attempting to set the CLOEXEC flag will obviously fail, and we lose the
original errno value from open().

Bug: https://bugs.gentoo.org/834725
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
2022-03-29 11:52:32 +00:00
Ralf Habacker
b56cad123c Merge branch 'cross-compile-session-socket' into 'master'
cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling

See merge request dbus/dbus!279
2022-03-29 11:49:56 +00:00
Alex Richardson
e827309976 cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling
Inferring it from the environment is not correct, since the host system
could have a different temporary directory defined. Instead of guessing
based on the host, require the user to pass an explicit directory when
cross-compiling. This is helpful for me since I am cross-compiling for
FreeBSD from macOS and on my host TMPDIR is set to
/var/folders/<random characters>/T/ instead of the expected /tmp.
2022-03-29 11:40:15 +00:00
Ralf Habacker
302f85d45d Merge branch 'fix-fetching-mingw-packages' into 'master'
tools/ci-install.sh: on debian|ubuntu reduce the need for mingw package name changes

Closes #388

See merge request dbus/dbus!286
2022-03-29 11:39:45 +00:00
Ralf Habacker
c6b35bc0f4 .gitignore: Ignore downloaded and installed mingw packages used on debian|ubuntu
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29 10:30:51 +02: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
2fb2491ad0 Merge branch 'cmake-fix-export-dynamic' into 'master'
cmake: Only pass -Wl,--export-dynamic when linking

See merge request dbus/dbus!278
2022-03-24 22:13:55 +00:00
Alex Richardson
c7f6d07252 cmake: Use -Wl,-export_dynamic when building for macOS
The macOS linker does not accept --export-dynamic, so use this
alternate spelling.
2022-03-24 22:00:06 +00:00
Alex Richardson
1a8fd7a382 cmake: Only pass -Wl,--export-dynamic when linking
Otherwise we get the following warnings when building .o files with Clang:
clang-13: warning: -Wl,--export-dynamic: 'linker' input unused [-Wunused-command-line-argument]

This is required to allow the -Werror build to pass on FreeBSD.
2022-03-24 22:00:06 +00:00
Ralf Habacker
8757c7d8d8 Merge branch 'cmake-unnecessary-include-dir' into 'master'
cmake: Drop an unnecessary include directory

See merge request dbus/dbus!282
2022-03-24 14:36:15 +00:00
Alex Richardson
be5da7305e cmake: Drop an unnecessary include directory
There should be no need to include the directory above the DBus sources,
if that is actually required users can always pass -I flags to CMake.
I noticed this because CLion started indexing all my cloned projects when
I opened DBus due to this include path.
2022-03-24 14:26:42 +00:00
Ralf Habacker
453905de32 Merge branch 'detect-backtrace-freebsd' into 'master'
cmake: Detect backtrace() support on platforms such as FreeBSD

See merge request dbus/dbus!281
2022-03-24 13:56:13 +00:00
Alex Richardson
3f5bdf0c2d cmake: Detect backtrace() support on platforms such as FreeBSD
On FreeBSD use of backtrace requires linking libexecinfo. The current
check_symbol_exists() will fail due to that missing library. Fortunately,
CMake ships with a FindBacktrace module (at least since 3.0) that can
be used to correctly handle platforms such as FreeBSD (and OpenBSD
according to the FindBacktrace source).
2022-03-24 13:41:19 +00:00
Ralf Habacker
1312fd5f81 Merge branch 'fix-freebsd-environ' into 'master'
Revert "Fix gcc compile error: redundant redeclaration of ‘environ’ [-Werror=redundant-decls]"

See merge request dbus/dbus!277
2022-03-24 13:40:44 +00:00
Alex Richardson
d4dbde9fc5 Revert "Fix gcc compile error: redundant redeclaration of ‘environ’ [-Werror=redundant-decls]"
Breaks the build on FreeBSD which doens't have an environ declaration.
The CMake check_symbol_exists call sets `HAVE_DECL_ENVIRON` to an empty
variable (which means if(DEFINED) suceeds). This normalization should not
be necessary as it will be handled correctly by `#cmakedefine01`. If not,
all the other HAVE_* defines would also be wrong.

This reverts commit e8b34b419e.
2022-03-19 14:50:31 +00:00
Ralf Habacker
25c0aff7e8 Merge branch 'issue-templates' into 'master'
Add bug and feature template for issue tracker

See merge request dbus/dbus!270
2022-03-18 07:47:10 +00:00
Ralf Habacker
46e8904e2b Add feature template 2022-03-18 08:36:35 +01:00
Ralf Habacker
ae0bc8462f Add bug template 2022-03-18 08:36:35 +01:00
Simon McVittie
4d6a568cce Merge branch 'memcmp' into 'master'
sysdeps: Implement _DBUS_DOUBLES_BITWISE_EQUAL with memcmp

See merge request dbus/dbus!274
2022-03-16 15:58:11 +00:00
Simon McVittie
e1273eb115 sysdeps: Implement _DBUS_DOUBLES_BITWISE_EQUAL with memcmp
memcmp is the Standard C way to compare arbitrary regions of memory
bit-by-bit, so let's use it, instead of reinventing it in a way that
violates Standard C aliasing rules.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-16 14:54:55 +00: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
Ralf Habacker
721b5429c3 .gitignore: Add sub directory ci-build*
Reviewed-by: Simon McVittie <smcv@collabora.com>
2022-03-16 14:18:18 +00:00
Simon McVittie
65fc23b4f7 Merge branch 'ci-job-names' into 'master'
CI: Adjust job names

See merge request dbus/dbus!262
2022-03-16 14:03:22 +00:00
Ralf Habacker
c692921781 CI: Adjust job names
Job names now provide more information about platform, build environment,
system and configuration, which makes it easier to read.

The names for the build environments has been shorted to commonly known
names e.g. 'mingw64' for 'x86_64-w64-mingw32'.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-09 07:38:24 +00:00
Ralf Habacker
0249d1f5a5 Merge branch 'fix-issue-381' into 'master'
cmake: Fix race condition on creating docbook based files

Closes #381

See merge request dbus/dbus!268
2022-03-08 15:07:13 +00:00
Ralf Habacker
f74fdf06ad cmake: Fix race condition on creating docbook based files
With the previous implementation, race conditions could arise because a
generated intermediate file was used by multiple targets.

To fix the mentioned problem, the macro 'generate_docbook_file' has been
integrated into a in a new macro 'add_docbook' to simplify the dependency
chain and make it easier to use.

When using an xml template with the 'TEMPLATE' parameter, a separate
intermediate xml file is used for each generated output file to avoid
overwriting each other, which was the main cause of the described problem.

Due to the adaptation of the calling conventions it was necessary to
introduce the parameter 'MAN_CATEGORY'.

Fixes #381

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-04 09:18:01 +00:00
Ralf Habacker
5c14cfbf0e Merge branch 'fix-issue-375-1' into 'master'
cmake: fix setting DBUS_*_CONFIG_FILE on non win32 platform

See merge request dbus/dbus!267
2022-03-04 07:26:15 +00:00
Ralf Habacker
6c21072a1e cmake: Set DBUS_*_CONFIG_FILE to be in datadir on Unix
The files were installed to the datadir (usually /usr/share) since
commit 70950325, but the macros used to implement dbus-daemon --system
and dbus-daemon --session still looked for them in the sysconfdir
(usually /etc).

Fixes: 70950325 "Adjust cmake build to match autoconf installation locations"
2022-03-04 08:14:44 +01:00
Ralf Habacker
a0040b9cef Merge branch 'fix-issue-375' into 'master'
cmake: setup variable WORDS_BIGENDIAN correctly

Closes #375

See merge request dbus/dbus!266
2022-03-03 11:45:09 +00:00
Ralf Habacker
d74fee2727 cmake: setup variable WORDS_BIGENDIAN correctly
Since version 3.0 cmake provides the macro test_big_endian for
that purpose.

fixes #375

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-02 14:35:54 +01:00
Ralf Habacker
9b426c7916 Add api doc to _dbus_platform_c|rmutex_new()
The documentation has been added to the header to avoid duplication as
these functions are implemented platform specific.

Cherry-picked from merge request dbus/dbus!243

Reviewed-by: @smcv

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-02 09:03:40 +01:00
Simon McVittie
20f623c79b Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-01 18:44:30 +00:00
Simon McVittie
e3cb728ee6 Merge branch 'configure_with-x_option' into 'master'
build: Fix logic for --with-x configure option

See merge request dbus/dbus!263
2022-03-01 18:28:06 +00:00
Lars Wendler
c71f013a64
Convert "if" calls to AS_IF macro for the block that handles X11 2022-03-01 19:02:22 +01:00
Lars Wendler
bf3cb42c6d
Add have_x11=no if --without-x was given to make later checks happy 2022-03-01 19:02:15 +01:00
Lars Wendler
17c88a8944
Emit an error when --with-x was given but no X11 libs were found 2022-03-01 19:01:17 +01:00
Lars Wendler
51e468d828
Move DBUS_X_* definitions into PKG_CHECK_MODULES block 2022-03-01 19:01:07 +01:00