Commit graph

6213 commits

Author SHA1 Message Date
Alex Richardson
6d7ec5fc6d configure: Avoid exit() when checking for __sync_sub_and_fetch()
Use of exit() requires a stdlib.h include. This check was failing for me
since the compiler defaulted to -Werror=implicit-function-declaration, so
__sync_sub_and_fetch() support was not dectected.

(cherry picked from commit 56e52a4212)
Backported-from: dbus!320
2022-09-13 12:25:54 +01:00
Jan Tojnar
6625f220c4 build: Do not dist built XML catalog
It will have whatever paths the person who built the dist tarball hardcoded.

(cherry picked from commit dcd19cc0d9)
Backported-from: dbus!317
2022-09-13 12:25:40 +01:00
Alex Richardson
9cf3b0810f cmake: Fix definition of DBUS_USE_SYNC
dbus-sysdeps-unix.c checks for DBUS_USE_SYNC using 0/1 checks not defined
checks, so we should be using #cmakedefine01. This fixes lots of -Wundef
warnings when compiling for FreeBSD and ensures that we actually use
atomics instead of the pthread fallback there.

(cherry picked from commit b932c343c4)
Backported-from: dbus!306
2022-09-13 12:24:56 +01:00
Jan Tojnar
9e8fe0718c bus/dir-watch: Do not crash with > 128 dirs
Without this running, dbus-daemon with long XDG_DATA_DIRS
will crash on out-of-bounds write:

	$ XDG_DATA_DIRS=$(seq  -f "/foo/%g" -s ':' 129) dbus-daemon --session
	*** stack smashing detected ***: terminated

(cherry picked from commit b551b3e973)
Backported-from: dbus!302
2022-09-13 12:24:49 +01:00
Alex Richardson
3533087ea4 cmake: Correct DBUS_{SYSTEM,SESSION}_CONFIG_FILE on UNIX systems
We always install to a dbus-1 subdir, but the path encoded in the binary
was missing the dbus-1/ subdirectory, so we end up getting errors when
trying to load it.

(cherry picked from commit f4876e7cb5)
Backported-from: dbus!297
2022-09-13 12:24:43 +01:00
Alex Richardson
1c08115609 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
(cherry picked from commit 6c1c7e539f)
Backported-from: dbus!298
2022-09-13 12:24:35 +01:00
Simon McVittie
e2dd13d906 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>
(cherry picked from commit 104df89947)
Backported-from: dbus!191
2022-09-13 12:24:24 +01:00
Mike Gilbert
d5f9a6e075 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>
(cherry picked from commit 769a0462be)
Backported-from: dbus!285
2022-09-13 12:24:13 +01:00
Alex Richardson
0d3ca74340 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.

(cherry picked from commit e827309976)
Backported-from: dbus!279
2022-09-13 12:24:07 +01:00
Alex Richardson
ce73955aad cmake: Use -Wl,-export_dynamic when building for macOS
The macOS linker does not accept --export-dynamic, so use this
alternate spelling.

(cherry picked from commit c7f6d07252)
Backported-from: dbus!278
2022-09-13 12:24:05 +01:00
Alex Richardson
41d2026fbd 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.

(cherry picked from commit 1a8fd7a382)
Backported-from: dbus!278
2022-09-13 12:23:56 +01:00
Alex Richardson
8c05bdc586 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.

(cherry picked from commit be5da7305e)
Backported-from: dbus!282
2022-09-13 12:23:50 +01:00
Alex Richardson
42b8ac2ba0 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).

(cherry picked from commit 3f5bdf0c2d)
Backported-from: dbus!281
2022-09-13 12:23:44 +01:00
Alex Richardson
83325d29ad 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.

(cherry picked from commit d4dbde9fc5)
Backported-from: dbus!277
2022-09-13 12:23:36 +01:00
Ralf Habacker
b745747f52 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"
(cherry picked from commit 6c21072a1e)
Backported-from: dbus!267
2022-09-13 12:23:24 +01:00
Ralf Habacker
29631357ac 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>
(cherry picked from commit d74fee2727)
Backported-from: dbus!266
2022-09-13 12:23:16 +01:00
Simon McVittie
052a2bead8 bus: Show the errno if inotify cannot be initialized
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 25e22b2540)
Backported-from: dbus!235
2022-09-13 12:23:13 +01:00
Simon McVittie
73240b300e bus: Correct check for inotify_init() failure
fd 0 is a valid fd - although if we are using stdin as our inotify fd,
something is weird somewhere.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7e61e0b53b)
Backported-from: dbus!235
2022-09-13 12:22:46 +01:00
Simon McVittie
b03893726a Merge branch '1.14.x-ci' into 'dbus-1.14'
Fix CI on 1.14.x branch

See merge request dbus/dbus!337
2022-09-12 20:18:32 +00:00
Simon McVittie
8aa34131dd 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:06:46 +01:00
Ralf Habacker
067733d4b0 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-09-12 17:58:03 +01:00
Ralf Habacker
85f5f05038 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-09-12 17:57:50 +01:00
Ralf Habacker
7e9d3708b1 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-09-12 17:57:46 +01:00
Simon McVittie
7d462fe938 Merge branch '1.14-with-x' into 'dbus-1.14'
[1.14] Backport dbus!263

See merge request dbus/dbus!264
2022-03-01 19:01:22 +00:00
Simon McVittie
8c4cc34f04 Update NEWS with dbus!263
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-01 18:45:03 +00:00
Lars Wendler
62361f47f9 Convert "if" calls to AS_IF macro for the block that handles X11
(cherry picked from commit c71f013a64)
2022-03-01 18:40:51 +00:00
Lars Wendler
e03554eb0b Add have_x11=no if --without-x was given to make later checks happy
(cherry picked from commit bf3cb42c6d)
2022-03-01 18:40:48 +00:00
Lars Wendler
5dad12f34c Emit an error when --with-x was given but no X11 libs were found
(cherry picked from commit 17c88a8944)
2022-03-01 18:40:46 +00:00
Lars Wendler
5f2577aea3 Move DBUS_X_* definitions into PKG_CHECK_MODULES block
(cherry picked from commit 51e468d828)
2022-03-01 18:40:39 +00:00
Lars Wendler
fdbb32bd1f build: Treat --with-x[=yes] the same as --with-x=auto
Previously, --with-x would disable the check for X11 libraries, which
was not intended.

(cherry picked from commit 99cc28e0eb)
2022-03-01 18:40:36 +00:00
Simon McVittie
c169d863f9 Post-release version bump for 1.14.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 18:19:08 +00:00
Simon McVittie
6fd1509ba3 Prepare v1.14.0
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/350
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:43:32 +00:00
Simon McVittie
428f60e8b2 spec: Go back to v0.38
Nothing changed in v0.39 yet, and it would be confusing to have the
version uploaded alongside dbus 1.14.0 say "not yet finalized".

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:23:39 +00:00
Simon McVittie
fce6a676d9 Revert "Disable MSVC CI by default for now"
This reverts commit 254b17977e.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:22:35 +00:00
Simon McVittie
90a2d9d948 Update AUTHORS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:15:32 +00:00
Ralf Habacker
c8ca3ecebc Merge branch 'doc_dbus-api-design_link_fixes' into 'master'
doc/dbus-api-design: fix broken links

See merge request dbus/dbus!257
2022-02-28 08:16:17 +00:00
Michael Nosthoff
bed735b493 doc/dbus-api-design: fix broken links
* use version independent qtdbus url
* developer.gnome.org links moved to developer-old.gnome.org
* bustle now on freedesktop gitlab
2022-02-28 08:01:34 +00:00
Ralf Habacker
fc92ceada7 Merge branch 'mingw-w64-printf' into 'master'
build: Opt out from using mingw-w64's replacement printf(), etc.

Closes #380

See merge request dbus/dbus!261
2022-02-28 07:47:19 +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
81e6a5e662 CI: Use current Debian stable release for mingw-w64 builds
Now that we have resolved the failure to build with newer mingw-w64,
we don't need to hold these back to Debian 10 'buster' and can upgrade
to the current stable release, Debian 11 'bullseye'.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-27 17:05:58 +00:00
Simon McVittie
daf362ee61 build: Opt out from using mingw-w64's replacement printf(), etc.
The Windows code in dbus is careful to use Windows-specific equivalents
of the Standard C features that are not implemented by msvcrt.dll, so
we don't need to substitute a Standard C printf implementation.

This avoids compiler warnings/errors when gcc expects us to be using
Microsoft printf syntax (`ms_printf` attribute), but newer versions of
mingw-w64 expect us to be using GNU or Standard C printf syntax
(`gnu_printf` attribute) as a result of `__USE_MINGW_ANSI_STDIO` being
enabled by default if not otherwise specified.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/380
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-27 17:05:56 +00:00
Simon McVittie
71f74ee530 Merge branch 'ci' into 'master'
CI: Update Debian releases

See merge request dbus/dbus!260
2022-02-25 14:55:49 +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
cfbc3a429e CI: Build on Debian 11 'bullseye' instead of Debian 10 'buster'
This is the current stable release for Debian, making Debian 10 a much
less interesting target for backports. Add a manually-triggered job
so we can still try buster occasionally.

Continue to use buster for mingw-w64 builds until format string issues
with bullseye toolchains can be sorted out.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:08:55 +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
Simon McVittie
254b17977e Disable MSVC CI by default for now
The necessary CI runner doesn't seem to be available, and we shouldn't
let that prevent us from merging dbus changes. This can be reverted
when the runner comes back.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 13:54:05 +00:00
Simon McVittie
1df1955b04 build: Fix update-authors rule to work out-of-tree
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-23 19:42:46 +00:00
Simon McVittie
d15a2328f1 AUTHORS: Update from git history
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-23 19:42:26 +00:00
Simon McVittie
21784cacd3 Start development of dbus 1.13.24
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-23 19:40:15 +00:00