Commit Graph

449 Commits

Author SHA1 Message Date
Philip Withnall
30995f9dd7 build: Add runtime_dir option to set runstatedir path
This will be used in upcoming commits to allow the previously-hardcoded
`/run` path to be set at configure time.

Most people will not want to change it from `/run`, even when building
test builds, as otherwise interaction with system mounts and services
will not work.

Inspired by equivalent changes in dbus.git in their commit
ff92efa389a57a5250c6996df6614234d4d462e0.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-02 21:48:03 +00:00
Philip Withnall
3bbe96ca89 build: Simplify construction of glib_localstatedir
`join_paths()` automatically drops all preceding path elements if an
argument to it is an absolute path. The `/` is a tidier synonym for
`join_paths()`.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-02 21:48:00 +00:00
Roman Stratiienko
20e1508e6e gdbusaddress: Form default system dbus path using meson definitions
This is useful for systems where rootfs doesn't contain /var directory,
e.g. on Android.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-11-28 19:57:59 +02:00
Philip Withnall
3fad4d45bf Revert "build: Bump Meson dependency to 0.64.0"
This reverts commit 91f14cd058.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:10:07 +00:00
Philip Withnall
b4231844a2 Revert "build: Use fs.copyfile() instead of configure_file()"
This reverts commit 19353017a7.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:09:55 +00:00
Philip Withnall
b646b1cab7 Revert "meson: Use gnome.mkenum_simple()"
This reverts commit 756b424cce.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:06:10 +00:00
Xavier Claessens
756b424cce meson: Use gnome.mkenum_simple()
Meson now uses find_program() to get glib-mkenum from glib instead of
from system. That was already fixed at least in >=0.60 which is our
current minimum requirement.
2022-11-23 08:02:34 -05:00
Xavier Claessens
6dd5c5002a Merge branch 'wip/pwithnall/meson-0.64' into 'main'
build: Bump Meson dependency to 0.64.0

See merge request GNOME/glib!3077
2022-11-23 11:48:51 +00:00
Philip Withnall
19353017a7 build: Use fs.copyfile() instead of configure_file()
Because Meson complains about using `configure_file(copy: true)`.

Includes improvements by Xavier Claessens.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-23 10:40:32 +00:00
Philip Withnall
91f14cd058 build: Bump Meson dependency to 0.64.0
It will fix dependency ordering issues found in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917#note_1559190.

As per `docs/meson-version.md`, we can depend on Meson ≤0.64.0 now as
it’s in Debian Testing.

The FreeBSD runners have to be changed to explicitly install the right
version of Meson using `pip3`, as the system-installed version is not
quite new enough. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1596257.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: !2917
2022-11-23 10:39:13 +00:00
Marco Trevisan (Treviño)
14ba699508 meson: Compile some tests with multiple C standards
We need to ensure that all the expected macros and utilities are working
with all the supported C standards, so just repeat the tests with all
the ones the compiler supports.
2022-11-22 17:23:14 +01:00
Philip Withnall
7d55571c13 build: Explicitly enable -Wmissing-field-initializers
It was previously only enabled (by default) on macOS, which led to
code being committed which triggered warnings, as that CI job is not
always run.

Avoid that risk by always enabling the warning.

The reasoning for using this warning is that explicit initialisation is
clearer than implicit. We also want to support GLib’s public headers
being used in projects which build with
`-Werror=missing-field-initializers`, but can’t easily enable the
warning for our public headers but not our internal code. So enable it
everywhere.

Make it a warning rather than an error, as there’s a risk that system
header changes will trigger it in distro release builds, which would
cause false build failures. By making it a warning, GLib developers can
build with `-Werror` and promote it to an error, while distros can
choose not to.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2812
2022-11-21 10:49:03 +00:00
Philip Withnall
4ff6ecbeff build: Move -Wnonnull flag to meson.build
It should be enabled in all builds, not just CI builds. Otherwise
developers might miss it locally.

This updates commit f11b96f255.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-18 13:33:20 +00:00
Philip Withnall
7077e7d819 build: Post-release version bump
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 09:27:34 +00:00
Philip Withnall
9ebb491d55 Revert "meson: Define G_OS_DARWIN when compiling under OSX or iOS"
This reverts commit e85635daa0.

See the previous revert for rationale.

Fixes: #2802
2022-11-07 11:30:32 +00:00
Chun-wei Fan
b92b17f021 build: Check for invalid parameter overriding on Windows
Allow one to override the invalid parameter handler if we have the
following items:

* _set_invalid_parameter_hander() or
  _set_thread_local_parameter_handler()
* _CrtSetReportMode() as a function or macro

Currently, we are doing this on Visual Studio to allow GSpawn to work on
Windows as well as having the log writer support color output, as we
might be passing in file descriptors that are invalid, which will cause
the CRT to abort unless the default invalid parameter handler is
overridden.
2022-11-03 00:11:45 +08:00
Xavier Claessens
f6edb52bda Merge branch 'wip/3v1n0/some-meson-fixmes' into 'main'
meson: Handle various build system FIXME's

See merge request GNOME/glib!3012
2022-11-01 23:36:04 +00:00
Philip Withnall
cbf17c9422 Merge branch 'wip/3v1n0/support-can-fail-tests' into 'main'
meson, ci: Support tests that can fail under certain conditions

See merge request GNOME/glib!2987
2022-10-31 14:28:02 +00:00
Marco Trevisan (Treviño)
832dd0805a meson: Add basic summary
It can nicely provide information about how glib is configured
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
9e649debbe meson: Use default test multiplier to define timeouts
So that we don't have to care about the default, being always set to 1m
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
3c56d661d8 meson: Use test setup environment instead of repeating it everywhere 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
b9e085537d meson: Expose library build type as global variables
Given that it can be computed using an error-prone strings comparisons it
is better to provide a variable everywhere, so that we don't have the
risk of comparing values that are always false.
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
62dca6c1cf meson, ci: Support tests that can fail under certain conditions
We have tests that are failing in some environments, but it's
difficult to handle them because:
 - for some environments we just allow all the tests to fail: DANGEROUS
 - when we don't allow failures we have flacky tests: A CI pain

So, to avoid this and ensure that:
 - New failing tests are tracked in all platforms
 - gitlab integration on tests reports is working
 - coverage is reported also for failing tests

Add support for `can_fail` keyword on tests that would mark the test as
part of the `failing` test suite.
Not adding the suite directly when defining the tests as this is
definitely simpler and allows to define conditions more clearly (see next
commits).

Now, add a default test setup that does not run the failing and flaky tests
by default (not to bother distributors with testing well-known issues) and
eventually run all the tests in CI:
 - Non-flaky tests cannot fail in all platforms
 - Failing and Flaky tests can fail

In both cases we save the test reports so that gitlab integration is
preserved.
2022-10-31 14:08:29 +01:00
Marco Trevisan (Treviño)
69f7aa5747 meson: Ignore -Wstring-plus-int in C
It's not really a problem for us, it would be only in c++.
2022-10-31 12:02:57 +01:00
Simon McVittie
b8f37a543c glib: Always implement G_VA_COPY as va_copy()
C99 guarantees that va_copy() exists, so use it, instead of probing
for __va_copy(), va_copy(), or a reimplementation from first principles.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Marco Trevisan (Treviño)
bd2cb39073 meson: Remove stpcpy() workaround for old meson versions and windows
This is now supported by the meson version we depend on.
2022-10-26 17:39:25 +02:00
Marco Trevisan (Treviño)
98059d088f gmodule/meson: Use stdout to communicate return value pf dlsym test code 2022-10-26 17:39:25 +02:00
Marco Trevisan (Treviño)
4a33e2a176 meson: Undefine STAP_HAS_SEMAPHORES and _STD_HAS_SEMAPHORES as autotools did 2022-10-26 17:39:25 +02:00
Marco Trevisan (Treviño)
6dd222e753 meson: Cleanup include-dir paths, use base path without repetitions
Avoid setting the subdir all the times, just use the global definition
plus the specific module subdir
2022-10-24 21:09:09 +02:00
Philip Withnall
2365452d6e Merge branch 'allow-mixed-declarations' into 'main'
meson: Don't explicitly disable mixed declarations and statements

See merge request GNOME/glib!2951
2022-10-20 14:32:23 +00:00
Marco Trevisan (Treviño)
e85635daa0 meson: Define G_OS_DARWIN when compiling under OSX or iOS
It has enough differences to expose it as an unix-subtype.
2022-10-20 03:37:03 +02:00
Philip Withnall
4bc284fca6 Merge branch 'wip/smcv/deprecated-prop-followup' into 'main'
Run tests with G_ENABLE_DIAGNOSTIC=1

See merge request GNOME/glib!2889
2022-10-15 21:31:29 +00:00
Philip Withnall
870fc6763e Merge branch 'mcatanzaro/plain-build-cast-checks' into 'main'
Disable cast checks in plain builds

See merge request GNOME/glib!2894
2022-10-14 15:34:22 +00:00
Michael Catanzaro
631e99667e Disable cast checks in plain builds 2022-10-14 15:34:22 +00:00
Philip Withnall
192794c6a8 build: Post-release version bump to 2.75.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-14 15:20:45 +01:00
Xavier Claessens
dcfc9f689e Fix symbol visibility macros on Windows
There is currently no `dllimport` attribute on any of our function,
which prevents MSVC to optimize function calls.

To fix that issue, we need to redeclare all our visibility macros for
each of our libraries, because when compiling e.g. GIO code, we need
dllimport in GLIB headers and dllexport in GIO headers. That means they
cannot use the same GLIB_AVAILABLE_* macro.

Since that's a lot of boilerplate to copy/paste after each version bump,
this MR generate all those macros using a python script.

Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'`
keyword argument instead of passing the cflag manually.

This leaves only API index to add manually into glib-docs.xml when
bumping GLib version. That file cannot be generated because Meson does
not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg
unfortunately.
2022-10-13 20:53:56 -04:00
Xavier Claessens
d40459c280 Simplify G_HAVE_GNUC_VISIBILITY definition
There is no need of compiler checks, GNUC visibility should be used when
__GNUC__ >= 4 but not on Windows.
2022-10-13 20:52:49 -04:00
Nirbheek Chauhan
aa757cd54a meson: Don't explicitly disable mixed declarations and statements
We require C99 now, and this warning was added for strict adherence to
C89 because GCC allowed mixed declarations in gnu89 as a GCC
extension. Let's get rid of this.
2022-10-14 04:56:46 +05:30
Philip Withnall
e90733a457 Merge branch 'atomic-older-cplusplus' into 'main'
gatomic: fix the atomic compare_and_exchange macros on older C++ standard versions

See merge request GNOME/glib!2864
2022-10-12 09:56:19 +00:00
Georges Basile Stavracas Neto
255fa26b96 build: Let Meson figure out Python installation
Commit 4a4d9eb662 initially switched Meson to find the python
program using find_program('python3'). Sadly that caused a
regression, since in some cases with MSVC it would fallback to
'meson.exe runpython', which is undesired.

However, that particular code was reverted back to an also
undesired lookup method, find_installation('python3'). This
way of finding python also breaks on Windows + MSVC, in particular
when setting it up as follows:

```
winget install python
winget install meson
```

This fails building GLib with:

> python3 not found

Fix that by not passing any argument to find_installation(), which
lets Meson figure it all out by itself.
2022-09-29 17:18:10 -03:00
Simon McVittie
831f5c5c2d tests: Run all tests with deprecated property warnings enabled
The tests that functionally rely on G_ENABLE_DIAGNOSTIC=1 still set it
explicitly, so that they will behave as expected when run as
installed-tests or manually.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 11:20:34 +01:00
Simon McVittie
88e160dfe4 tests: Move common test environment variables to top level
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 11:19:28 +01:00
Xavier Claessens
a73ca336aa meson: Set install_tag on remaining installed files 2022-09-20 11:30:12 -04:00
Emmanuele Bassi
115d8b48ac Post-release version bump to 2.74.1 2022-09-17 19:50:37 +01:00
Marco Trevisan (Treviño)
30bd57ecf8
2.74.0
Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2022-09-17 20:38:17 +02:00
Marco Trevisan (Treviño)
1cbe7a6734 meson: Build C++ tests for the currently supported C++ standard versions
We've various macros definitions that are depending using C++ features
that may not work in all the standard versions, so recompile the cxx
tests that we have in all the ones we want to support.
2022-09-15 01:18:40 +02:00
Marco Trevisan (Treviño)
1edb3c515a
2.73.3
Co-authored-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2022-08-05 18:24:47 -04:00
Michael Catanzaro
61a843564d Improve default value of glib_debug option
glib_debug is an auto option. This is clever because it allows us to
guess the best default based on the build type, while also allowing an
easy way to override if the guess is not good. Sadly, the attempt to
guess based on the build type does not work well. For example, it
considers debugoptimized builds to be debug builds, but despite the
name, it is definitely a release build type (except on Windows, which
we'll ignore here). The minsize build type has the exact same problem.
The debug option is true for both build types, but this only controls
whether debuginfo is enabled, not whether debug extras are enabled.

The plain build type has a different problem: debug is off, but the
optimization option is off too, even though plain builds are distro
builds are will almost always use optimization.

I've outlined an argument for why we should make these changes here:
https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/

Specifically, Rule 4 shows all the build types and whether they
correspond to release builds or debug builds. Rule 6 argues that we
should provide good defaults for plain builds.
2022-08-03 17:07:13 -05:00
Simon McVittie
ae15c800ce Install gio-launch-desktop in a non-PATH location
This is an internal helper executable, which users shouldn't invoke
directly (see glib#1633).

When building for a single-architecture distribution, we can install
it as ${libexecdir}/gio-launch-desktop.

When building for a multiarch distribution, installing it into an
architecture-specific location and packaging it alongside the GLib
library avoids the problem discussed in glib#1633 where it would either
cause a circular dependency between the GLib library and a common
cross-architecture package (libglib2.0-bin in Debian), or require a
separate package just to contain gio-launch-desktop, or cause different
architectures' copies to overwrite each other.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00
Simon McVittie
0c087d121f gio: Optionally install trigger executables to architecture-specific paths
In Debian-style multiarch (libdir = lib/x86_64-linux-gnu or similar),
Red-Hat-style multilib (libdir = lib64 or lib) and Arch-style multilib
(libdir = lib or lib32), we have to run a separate version of
gio-querymodules to discover 32- or 64-bit modules on x86. Installing
modules in the directory used for each word size needs to trigger
recompilation of the correct modules list.

Debian, Fedora and Arch currently all have patches to facilitate this:
Debian moves gio-querymodules into ${libdir}/glib-2.0 and provides a
compat symlink in ${bindir}, while Fedora and Arch rename one or both
of the gio-querymodules executables to give it a -32 or -64 suffix.

We can avoid the need for these patches by making this a build option.
Doing this upstream has the advantage that the pkg-config metadata for
each architecture points to the correct executable and is in sync with
reality.

I'm using Debian's installation scheme with a separate directory here,
because the word-size suffix used in Fedora and Arch only works for the
common case of 32- and 64-bit multilib, and does not cover scenarios
where there can be more than one ABI with the same word size, such as
multiarch cross-compilation or alternative ABIs like x32.

Now that we have this infrastructure, it's also convenient to use it for
glib-compile-schemas. This works with /usr/share, so it only needs to
be run for one architecture (typically the system's primary
architecture), but using /usr/bin/glib-compile-schemas for the trigger
would result in either primary and secondary architectures trying to
overwrite each other's /usr/bin/glib-compile-schemas binaries, or a
circular dependency (the GLib library would have to depend on a
common package that contains glib-compile-schemas, but
glib-compile-schemas depends on the GLib library). Installing a
glib-compile-schemas binary in an architecture-specific location
alongside each GLib library bypasses this problem.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-24 11:19:37 +01:00