Commit graph

470 commits

Author SHA1 Message Date
Simon McVittie
053238254e ci-build: Update required MSYS packages
The older versions we were previously building against are no longer
available on mirrors.

Based on changes proposed in !189 by Arnout Engelen, and the package
list gathered by Ralf Habacker in #318.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/318
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-06 13:38:45 +00:00
Ralf Habacker
3f3368b490 cmake: Use CMAKE_INSTALL_FULL_<dir> for configuration and state
This means we apply GNUInstallDirs' various special cases when
the prefix is /, /usr or something starting with /opt; these are
not applied when installing to CMAKE_INSTALL_<dir>. See
https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases
2020-06-10 18:13:47 +00:00
Simon McVittie
eeef787418 Normalize C source files to end with exactly one newline
Some editors automatically remove trailing blank lines, or
automatically add a trailing newline to avoid having a trailing
non-blank line that is not terminated by a newline. To avoid unrelated
whitespace changes when users of such editors contribute to dbus,
let's pre-emptively normalize all files.

Unlike more intrusive whitespace normalization like removing trailing
whitespace from each line, this seems unlikely to cause significant
issues with cherry-picking changes to stable branches.

Implemented by:

    find . -name '*.[ch]' -print0 | \
    xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-10 10:47:31 +00:00
Ralf Habacker
fa763da827 CI: for cmake show the used command lines when compiling and linking
This helps to detect incorrect settings.
2020-05-29 16:43:52 +02:00
Ralf Habacker
d64316a676 CI: Add running test cases for cross builds
Before building a wine prefix is created and search pathes
for binaries are configured in the wine prefix.

This commit adds a new shell variable 'ci_runtime' for specifing
the type of compiler support library which defaults to static for now.
2020-05-29 16:43:45 +02:00
Ralf Habacker
08eb885be6 cmake: build and install dbus-cleanup-sockets on non Windows platforms 2020-04-29 17:35:08 +00:00
Ralf Habacker
f88ca3b853 cmake: build and install dbus-uuidgen on non Windows platforms 2020-04-29 17:35:08 +00:00
Ralf Habacker
6e8d75834e Add support to generate the api documentation in Qt help format
Qt help files are used by Qt Creator and KDevelop, for example, to support
the development of Qt-based applications and libraries.

Generating api documentation in Qt help format is controlled by two
user specific options named --enable-qt-help and --with-qchdir (autotools)
and -DENABLE_QT_HELP and -DINSTALL_QCH_DIR (cmake).
2020-04-29 15:23:23 +00:00
Simon McVittie
0ddc510130 Merge branch 'ci-updates' into 'master'
CI: Update to Debian 10 'buster', drop Debian 8 'jessie', add qhelpgenerator

See merge request dbus/dbus!151
2020-04-16 10:25:39 +00:00
Simon McVittie
23e1f044f4 CI: Install qhelpgenerator for native production build on buster
This will be used in dbus!150.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-06 14:59:34 +01:00
Natanael Copa
6d92e8e983 _dbus_generate_random_bytes: use getrandom(2)
Use getrandom(2) and fall back to /dev/urandom if it is missing or if it
fails some any reason.

This solves problem where dbus-uuidgen is called from a chroot which
lacks /dev/urandom.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2020-03-26 16:56:59 +01:00
Ralf Habacker
2d256d42ce cmake: complete adding version info to all installed executables on Windows 2020-02-19 10:23:01 +01:00
Tuomo Rinne
5314ced357 cmake: Add X11 include path for tools
Fixes compilation issues for case when X11 is not in a standard location
2020-01-22 21:56:53 +00:00
Christopher Morin
9842689a29 dbus-send: add --sender option
Clients listening for a signal can match against the 'sender', expecting
it to come from a connection with a specific name. With this change,
dbus-send can send signals to them.
2019-07-15 12:36:50 +00:00
Ralf Habacker
9dc72c9fb8 cmake: install missing files to keep in sync with autotools builds 2019-03-13 08:56:59 +01:00
Ralf Habacker
2798e68776 Adjust indents of CMakeLists.txt files always to 4 spaces 2019-01-24 09:08:15 +01:00
Ralf Habacker
f4032b05ed tools/cmake-format: Add option --check-indents to check indentations independently from other options
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-24 09:07:45 +01:00
Ralf Habacker
904fa97a1b Remove obsolete parameter in end... cmake keywords 2019-01-24 09:07:27 +01:00
Ralf Habacker
5972bbe382 Remove spaces between cmake command and opening bracket 2019-01-24 09:07:27 +01:00
Ralf Habacker
7dd83ba874 Replace tabs by 4 spaces in CMakeLists.txt files 2019-01-24 09:07:27 +01:00
Ralf Habacker
38b7c2859e Remove trailing spaces in CMakeLists.txt files 2019-01-24 09:07:27 +01:00
Ralf Habacker
eb4b378958 tools/cmake-format: Do not exclude CMakeLists.txt files
This fixes a regression of merge request !82 introduced
with the rebase to !84.
2019-01-24 09:07:10 +01:00
Simon McVittie
ad7e2749cf Merge branch 'reformat-cmake-files' into 'master'
Reformat cmake files

Closes #252

See merge request dbus/dbus!82
2019-01-23 20:52:37 +00:00
Simon McVittie
6d8280ec93 Merge branch 'code-coverage' into 'master'
Adapt to API change in AX_CODE_COVERAGE version 28

Closes #249

See merge request dbus/dbus!88

Reviewed-by: @pwithnall
2019-01-23 20:45:32 +00:00
Ralf Habacker
f855d0bb48 Add script for formatting cmake files
The prefered call order is

  tools/cmake-format --trailing-spaces
  # create git commit
  tools/cmake-format --tabs
  # create git commit
  tools/cmake-format --keyword-case
  # create git commit
  tools/cmake-format --keyword-spaces
  # create git commit
  tools/cmake-format --end-args
  # create git commit
  tools/cmake-format --indents
  # create git commit

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-23 21:34:08 +01:00
Ralf Habacker
a8e5e5c552 Add cmake macros add_executable_version_info and add_library_version_info
This helps to reduce duplicated code.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-22 09:58:27 +01:00
Ralf Habacker
3bf97922bd Move cmake related build system to top level
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-22 09:57:40 +01:00
Simon McVittie
83be61aa2d Consistently add CODE_COVERAGE_CPPFLAGS everywhere
We forgot this in a couple of places.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-21 18:46:07 +00:00
Simon McVittie
e0ea7a130c Consistently add CODE_COVERAGE_LIBS everywhere
We need to link the code coverage objects, directly or indirectly,
into every executable and every shared library. The rule I've followed
to make it clear that we do this, without too much repetition, is:
each executable, shared library or convenience library has
CODE_COVERAGE_LIBS in its LDADD or LIBADD, unless it is linked to a
convenience library in the same directory that has CODE_COVERAGE_LIBS
in *its* LIBADD.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-21 18:45:38 +00:00
Simon McVittie
1063bba06b CI: Do the CMake native debug build from an Autotools make dist
We officially release dbus in the form of Autotools `make dist` tarballs,
but people who have downloaded those tarballs should be able to choose
the CMake build system. Our CI should assert that they can.

(The Autotools debug build already does a `make distcheck`, which
asserts that tarball releases can be used for an Autotools build.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: dbus#255
2019-01-21 15:05:11 +00:00
Simon McVittie
fa63c16346 .gitignore: Ignore many more generated files
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 13:28:50 +00:00
Simon McVittie
d3fffaa72f .gitignore: Normalize into LC_ALL=C sort order
If lists are in a completely arbitrary order, sorting them consistently
means that there is only one correct place to insert a new entry, avoiding
the merge conflicts that would occur if we always append new entries.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
0c62a9a5f4 .gitignore: Make match patterns more specific
In subdirectories we mostly only want to match at the current level,
not in nested subdirectories.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
2fd386245b .gitignore: Remove obsolete patterns
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
c95873e537 .gitignore: Consolidate generic patterns at top level
Patterns in the top-level .gitignore match in all subdirectories, so
there's no need to repeat ourselves quite so much for generic
C, Autotools and gcov patterns.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
eb837e6fd7 ci: Apply AddressSanitizer to Linux "debug" builds
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-11 12:47:22 +00:00
Simon McVittie
0c9f943277 build: Add a way to set CFLAGS for AddressSanitizer etc.
We don't want to set these globally via the normal CFLAGS, because if
we did, AddressSanitizer would catch test-segfault deliberately
segfaulting, and "helpfully" turn it into exit status 1, which in turn
makes our test fail because it asserts that the segfault is reported
as a segfault.

A typical use with gcc as compiler, on a reasonably recent Debian,
would be:

    ./configure SANITIZE_CFLAGS="-fsanitize=address -fsanitize=undefined -fPIE -pie"

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-11 12:47:22 +00:00
Ralf Habacker
5a3dd741fb run-session: Fix warning 'array subscript 3 is above array bounds of 'char *[3]' on Windows
After the merge request !22 was created, this bug was fixed in !23,
the associated branch was used for local tests, but the fix was not
transferred to !22. After merging !22 into the master branch and
rebasing !23 to the master, this fix was lost.

Reviewed-by: Simon McVittie <smcv@collabora.com>
2018-12-11 10:39:02 +00:00
Simon McVittie
78efbb6c0d CI: Install yelp-tools, for yelp-build, in recent distros
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-05 14:54:24 +00:00
Simon McVittie
52fcc82379 CI: Make adduser properly non-interactive
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-05 14:54:24 +00:00
Simon McVittie
cb6abc6391 CI: Don't install weak dependencies (Recommends)
In particular this avoids installing the TeX toolchain.

However, this also means we don't install dbus, which broke some tests
in minimal containers where dbus wasn't already installed, because the
messagebus user wouldn't have been created. Make sure that user exists,
using the same adduser call as the Debian dbus package.

CMake really wants to find a C++ compiler (even though we only use C++
when compiling for Windows), so explicitly install the default
version of the GNU C++ compiler, g++.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-05 14:54:24 +00:00
Simon McVittie
a59eb6e944 Merge branch 'unpythonize' into 'master'
Translate Python-based tests to C

See merge request dbus/dbus!37

Reviewed-by: pwithnall
2018-12-05 14:09:00 +00:00
Simon McVittie
bcc34caa43 CI: Exercise maintainer-only documentation build
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:48:53 +00:00
Simon McVittie
e0a1bfb26a CI: Remove unimplemented --with-glib option
dbus has never actually had this option.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:41:23 +00:00
Simon McVittie
d71049799a CI: List attributes, sizes etc. of installed files, not just names
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:41:23 +00:00
Simon McVittie
0c553afcd9 CI: Stop building on Ubuntu 14.04 'trusty'
The version of gcc in trusty is too old for AddressSanitizer, which we
want to be able to start using, and Travis-CI finally supports Ubuntu
16.04 'xenial' now. This lets us remove some workarounds, but we need
to update others.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-03 20:00:32 +00:00
Simon McVittie
1191262f5e Translate Python-based tests to C
This simplifies bootstrapping: now you don't have to build dbus,
build dbus-python (with GLib), and use dbus-python to test dbus.

It also avoids test failures when using facilities like
AddressSanitizer. When libdbus is built with AddressSanitizer, but the
system copies of Python and dbus-python were not, dbus-python will exit
the Python interpreter on load, because libasan wasn't already
initialized. The simplest way to avoid this is to not use Python:
the scripts are not *that* hard to translate into C.

Both of these tests happen to be conditionally compiled for Unix only.
test_activation_forking() relies on code in TestSuiteForkingEchoService
that calls fork(), which can only work on Unix; meanwhile,
test_system_signals() tests the system bus configuration, which is
only relevant to Unix because we don't support using dbus-daemon as
a privilege boundary on Windows (and in any case D-Bus is not a Windows
OS feature, so the system bus cannot be used to communicate with OS
services like it can on most Linux systems).

This is also a partial solution to
<https://gitlab.freedesktop.org/dbus/dbus/issues/135>, by reducing the
size of name-test/.

For this to work, we need to build the test-service helper executable
even if embedded tests are disabled.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-03 17:42:48 +00:00
Simon McVittie
94806fb2c7 Don't let dbus-daemon and its subprocesses inherit unnecessary fds
This should avoid test failures under CMake in which the
dbus-daemon inherits an unwanted fd from CMake's test framework, causing
the close-on-exec check before executing activated services to fail.

The dbus-daemon now marks all fds that it inherits, except for its
stdin, stdout and stderr, to be closed on exec. For completeness, the
dbus-daemons run by dbus-run-session and dbus-launch also now inherit
stdin, stdout, stderr and the pipes used to communicate with their
callers, but nothing else.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-20 19:09:18 +00:00
Ralf Habacker
0764f08e7e Fix broken meinproc4 based docbook generating by already used xsltproc
Using xsltproc helps to reduce manual editing of xml doc and avoids
cyclic dependency (kdelibs depends on dbus and dbus depends on kdelibs).
It is available on all platforms (in the opposite to xmlto) and supports
freedesktop CI out of the box.

This commit adds docbook-xml and docbook-xsl as new dependency for cmake
and removes obsolate xmlto support, which depends on xsltproc.
2018-11-20 15:56:12 +01:00
Ralf Habacker
bac2fd3aa4 ci-build.sh: Show file size in list of files to be able to compare generated file size 2018-11-20 12:59:23 +01:00