Commit Graph

483 Commits

Author SHA1 Message Date
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
James Hilliard
d0b9ebbaac meson: fix build without cpp toolchain
We don't need a cpp toolchain for building glib so lets just
automatically disable tests requiring one when not available.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-07-15 12:58:41 -06:00
Marco Trevisan (Treviño)
f622a4ed53
2.73.2
Co-authored-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Marco Trevisan (Treviño) <marco@ubuntu.com>
2022-07-12 18:32:22 +02:00
Philip Withnall
4353813058 build: Specify -Werror=pointer-sign
This can catch the wrong pointer being passed to a function argument (in
some cases), with few false positives.

Spotted while testing !2529.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-12 15:55:59 +02:00
Aleksei Rybalkin
8d5a44dc8f replace pcre1 with pcre2 2022-07-12 11:46:34 +00:00
Philip Withnall
f615eef4ba gmain: Use waitid() on pidfds rather than a global SIGCHLD handler
When the system supports it (as all Linux kernels ≥ 5.3 should), it’s
preferable to use `pidfd_open()` and `waitid()` to be notified of
child processes exiting or being signalled, rather than installing a
default `SIGCHLD` handler.

A default `SIGCHLD` handler is global, and can never interact well with
other code (from the application or other libraries) which also wants to
install a `SIGCHLD` handler.

This use of `pidfd_open()` is racy (the PID may be reused between
`g_child_watch_source_new()` being called and `pidfd_open()` being
called), so it doesn’t improve behaviour there. For that, we’d need
continuous use of pidfds throughout GLib, from fork/spawn time until
here. See #1866 for that.

The use of `waitid()` to get the process exit status could be expanded
in future to also work for stopped or continued processes (as per #175)
by adding `WSTOPPED | WCONTINUED` into the flags. That’s a behaviour
change which is outside the strict scope of adding pidfd support,
though.

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

Helps: #1866
Fixes: #2216
2022-07-07 14:08:29 +01:00
Marco Trevisan (Treviño)
b61cd872f1 build: Threat unused-result warnings as errors
We don't have any in code now, so we should definitely ensure that we
won't introduce anymore unguarded calls.
2022-07-06 18:41:10 +02:00
Emmanuele Bassi
2a12de5b1d Require C99's __VA_ARGS__
We have fallback in places for GNU's variadic arguments in macros, and
for static inline functions with variadic arguments as an fallback of
last resort, but going forward we are going to depend on `__VA_ARGS__`
for macros that cannot be re-implemented using a static inline function.

Fixes: #2681
2022-06-30 01:46:32 +01:00
Emmanuel Fleury
207b8cb8a5 Convert tests/assert-msg-test* to glib/tests/assert-msg-test*
Closes issue #1434
2022-06-28 11:19:21 +01:00
Philip Withnall
e5ccbe09da Merge branch 'atomic-exchange-pre-value' into 'main'
gatomic: Add Compare and Exchange functions that returns the previous value

See merge request GNOME/glib!2766
2022-06-23 13:19:05 +00:00
ericLemanissier
f2ea67ae44 use gvdb as a subproject
this fixes the build when using --wrap-mode=nofallback
fix proposed by @eschwartz
2022-06-23 08:26:21 +00:00
Marco Trevisan (Treviño)
922bc1d995 build: Use _GLIB prefix for GCC features we detected at build time
We used a _GCC prefix that is not our namesapce, so even if such value
is not provided by the compiler, let's just use a better name.
2022-06-22 23:01:33 +02:00
Philip Withnall
ebfbef1acd 2.73.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 14:02:39 +01:00
Philip Withnall
46a6f49066 Merge branch 'meson-add-test-setup' into 'main'
build: Use add_test_setup() to allow tests to be run under valgrind

See merge request GNOME/glib!2752
2022-06-20 11:09:55 +00:00
Philip Withnall
f5baecdb36 build: Use add_test_setup() to allow tests to be run under valgrind
This means we can specify the standard options for testing GLib under
valgrind consistently, so that developers can use `meson test
--setup=valgrind` to run them.

Port the existing valgrind CI to use them (this will not change its
functional behaviour).

Suggested by Marco Trevisan at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2717#note_1478891.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-20 11:54:10 +01:00
Eli Schwartz
26435b570f
meson: simplify intl lookups using Meson's builtin dependency lookup
intl is complicated to look up. Some of that complexity now resides in
Meson, since 0.59.0, via a `dependency('intl')` lookup, so use that
instead.

The Meson lookup doesn't include all the checks here, but likewise this
meson.build doesn't include all the checks in Meson. Particularly, the
following are different:

- Meson accurately detects support built into libc, even if that
  conflicts with an external library version (which should be detected as
  broken and thus not-found, but glib does not do so).

  The problem here is that depending on which libintl.h header is first
  in the search path, the *gettext symbols may be the libc ABI, or they
  may be renamed to libintl_*gettext, then additionally take over the
  *gettext names via a macro, in order to invoke the external library
  version even on systems where there is a libc builtin. This means that
  checking for `cc.has_function()` correctly reports that there is such
  a function in libc, but that unfortunately does not mean it is usable,
  because source code referencing `ngettext` etc. will expect to be
  linked to `libintl_ngettext`.

- glib checks whether the found intl requires pthread, rather than
  simply trusting the result of `cc.find_library()` for the external
  library case.

Do the heavy lifting by using Meson to check for intl, and select the
correct implementation, but do a post-discovery check if the symbol is
linkable both with/without pthread.

The logic is still a bit hairy, and eventually more of the logic could
be moved into Meson. But it's better than before.

Fixes incorrect detection of intl on musl-based systems (which have a
less capable libc intl), when GNU libintl is installed as an external
library.
2022-06-16 12:04:59 -04:00
Eli Schwartz
24ec80cfb4
meson: simplify iconv lookups using Meson's builtin dependency lookup
iconv is complicated to look up. That complexity now resides in
Meson, since 0.60.0, via a `dependency('iconv')` lookup, so use that
instead.

No effort is made to support the old option for which type of iconv to
use. It was a false choice, because if only one was available, then
that's the only one you can use, and if both are available, the external
iconv shadows the builtin one and renders the builtin one unusable,
so there is still only one you can use.

This meant that when configuring glib with -Diconv=libc on systems that
had an external iconv, the configure check would detect a valid libc
iconv, try to use it, and then fail during the build because iconv.h
belongs to the external iconv and generates machine code using the
external iconv ABI, but fails to link to the iconv `find_library()`.
Meson handles this transparently.
2022-06-16 12:04:59 -04:00
Philip Withnall
594a70bf5f Merge branch 'gvdb-as-wrap' into 'main'
build: Move gvdb to a subproject

See merge request GNOME/glib!2733
2022-06-16 09:29:43 +00:00
Philip Withnall
b3f49d08a6 build: Move gvdb to a subproject
Rather than carrying the copylib around inside GLib, which is a pain to
synchronise and affects our code coverage statistics.

This requires updating the CI images to cache the new subproject,
including updating the `cache-subprojects.sh` script to pull in git
submodules.

It also requires adding `gioenumtypes_dep` to be added to the
dependencies list of `libgio`, since it needs to be build before GVDB as
it’s pulled in by the GIO headers which GVDB includes.

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

Helps: #2603
2022-06-16 10:12:07 +01:00
Philip Withnall
dccc1ceebc build: Add native argument to add_languages() for objc
This fixes the macOS build with Meson 0.54 or later.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-07 18:26:55 +01:00
Marco Trevisan (Treviño)
fa4e34667c gatomic: Add APIs to perform atomic int / pointer exchanges
Atomic APIs provide a way to exchange values only if we compare a value
that is equal to the old value, but not to just exchange the value
returning the old one.

However, compilers provide such built-in functions, so we can use them
to expose such functionality to GLib.

The only drawback is that when using an old version of gcc not providing
atomic APIs to swap values, we need to re-implement it with an
implementation that may not be fully atomic, but that is safe enough.

However this codepath should really not be used currently as gcc
introduced __atomic_exchange_n() at version 4.7.4, so 8 years ago.
2022-06-07 17:10:57 +02:00
nitinosiris
b33ef610de Add functionality to preserve nanosecond timestamps
file copy doesn't preserve nanosecond timestamps

Closes #369
2022-05-27 17:03:35 +01:00
Eli Schwartz
c630b4a5bc
meson: use builtin zlib dependency lookup
Since Meson 0.54.0, `dependency('zlib')` will fallback on systems
without a pkg-config dependency, to a system dependency lookup that
performs the necessary `find_libary('z')` (or MSVC zlib/zlib1) and
`has_header('zlib.h')` checks.

This means all the manual lookups are no longer needed, and a single
dependency lookup covers all cases, and also clarifies the log lookup by
not sometimes listing "not found" a couple times.
2022-05-24 15:22:34 -04:00
Philip Withnall
bc51658167 build: Factor out some size_t checks
With Meson 0.60 (or possibly some earlier versions) we can factor the
checks out as a variable can now be used as an array key. This
simplifies the checks a little, while introducing no functional
differences.

The contents of `g_sizet_compatibility` after this block are identical
with and without the changes applied.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-17 14:04:24 +01:00
Philip Withnall
51c55b44ad build: Use cc.check_header() to check malloc.h
Since Meson 0.47, this can be used to check a header with compilation,
rather than just stat. This removes a workaround.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-17 14:04:24 +01:00
Philip Withnall
5efbd51ea8 Merge branch 'cleanup-root' into 'main'
Various updates to documentation and misc files in the root directory

See merge request GNOME/glib!2649
2022-05-17 12:58:25 +00:00
Marc-André Lureau
960ed2f906 glib/tests: add spawn-stderr-socket test
Check the spawn implementation behaviour when the stderr is a
socket (mostly for win32).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:54:11 +02:00
Philip Withnall
f78e2884d7 tests: Move .test.in template files to tests directory
This makes a bit more sense than having them cluttering up the root
directory.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-11 13:12:20 +01:00
Philip Withnall
5129750884 tools: Move glib.supp to tools directory
This tidies up the root directory a bit more.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-11 13:11:01 +01:00
Philip Withnall
0dc53687f4 tools: Move glib-gettextize.in to tools directory
This tidies up the root directory a bit more.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-11 13:09:17 +01:00
Philip Withnall
b18fec9f23 Merge branch 'meson-version-policy' into 'main'
docs: Add a Meson version policy and bump Meson version in CI

Closes #2596

See merge request GNOME/glib!2641
2022-05-10 11:43:41 +00:00
illiliti
07fb19ee6e meson: Check rres.compiled() before calling rres.returncode()
As per meson spec, returncode() produces unspecified data if
compiled() == false. Check compiled() first to avoid relying
upon unspecified data.

In addition, muon -- an implemetation of meson written in C goes
further and forbids returning unspecified data. This is a good
decision, but also makes it harder to support applications which
wrongly use meson API. Therefore, application needs to be fixed.
2022-05-07 00:20:33 +03:00
Philip Withnall
bd1781a356 build: Stop using Meson features deprecated in Meson <0.60
This clears some Meson warnings.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:55:28 +01:00
Xavier Claessens
374be41433 meson: Use meson.can_run_host_binaries()
It is not only shorter than `not meson.is_cross_build() or
meson.has_exe_wrapper()` but also handle the case of cross compiling to
a compatible arch such as building for i386 on an amd64.
2022-05-06 13:17:11 +01:00
Philip Withnall
25ab87d8e5 build: Drop checks and workarounds for older Meson versions
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Philip Withnall
1bdce46399 build: Bump Meson dependency to 0.60.0
As per the new policy in `docs/meson-version.md`, we can now bump the
dependency.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Philip Withnall
7fd4ebacb3 docs: Add a Meson version policy
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2596
2022-05-06 13:01:44 +01:00
Simon McVittie
04e5f93e38 Merge branch 'version-bump' into 'main'
build: Post-release version bump to 2.73.0

See merge request GNOME/glib!2577
2022-04-05 14:20:14 +00:00
Loïc Le Page
8bb923f22a Move msvc warnings in meson.build file
Move msvc warnings in meson.build file from line 24 to line 469 to group
them next to gcc/clang warnings. So it is easier to see warnings flags
for all platforms at once.
2022-04-05 14:09:42 +02:00
Philip Withnall
c90b80b7b1 build: Post-release version bump to 2.73.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-31 18:17:37 +01:00
Philip Withnall
2501f24f7a Merge branch 'revert-2541-meson-python' into 'main'
Revert "meson: simplify lookup of python command"

See merge request GNOME/glib!2565
2022-03-29 11:35:38 +00:00
Haruka Ma
be5acbb5e6 meson: Set BROKEN_POLL in macOS builds 2022-03-28 11:59:59 +00:00
Philip Withnall
9e38cffdfc Revert "meson: simplify lookup of python command"
This reverts commit 4a4d9eb662.

It seems to cause build failures with `VsDevCmd.bat` 2022:
```
..\meson.build:2274:0: ERROR: Command "C:\Program Files\Meson\meson.exe runpython --version" failed with status 2.
```

Revert it for now until this can be fixed in Meson.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2541#note_1410521
2022-03-21 13:17:32 +00:00
Philip Withnall
411a20af2b Merge branch 'find_program_python3' into 'main'
meson: simplify lookup of python command

See merge request GNOME/glib!2541
2022-03-17 15:12:39 +00:00
Philip Withnall
8697c1a53c 2.72.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 15:01:31 +00:00
Eli Schwartz
4a4d9eb662
meson: simplify lookup of python command
It can be treated like any other command, we don't need a full blown
module capable of building extensions just to get an ExternalProgram
executable that can be used to run scripts.

Since find_program has a builtin kwarg for requiring a given version, we
can avoid manually coding some checks and emitting a custom error.
2022-03-07 22:05:51 -05:00
Philip Withnall
918fcd7928 2.71.3
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-04 21:03:41 +00:00
Loic Le Page
258775a1a6 Hide non-fatal level-4 warnings and repetitions during build 2022-02-18 10:24:57 +01:00
Philip Withnall
40fc53d3aa 2.71.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-15 14:25:23 +00:00
Philip Withnall
f9c08308ea Merge branch 'ebassi/aligned-alloc' into 'main'
Add aligned memory allocators

Closes #2574

See merge request GNOME/glib!2421
2022-02-11 15:04:25 +00:00
Emmanuele Bassi
475d574440 Add aligned memory allocators
When working with storage (especially GInputStream or GOutputStream) it
is preferred to use page-aligned buffers so that the operating system
can do page-mapping tricks as the operation passes through the kernel.

Another use case is allocating memory used for vectorised operations,
which must be aligned to specific boundaries.

POSIX and Windows, as well as the C11 specification, provide this kind
of allocator functions, and GLib already makes use of it inside GSlice.
It would be convenient to have a public, portable wrapper that other
projects can use.

Fixes: #2574
2022-02-11 14:44:09 +00:00
Christoph Reiter
17a5958f79 build: deprecate force_posix_threads build option 2022-02-08 13:15:33 +00:00
Philip Withnall
4bd23d1b26 2.71.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-01-27 15:22:23 +00:00
Philip Withnall
f242299b3e Merge branch 'windows-static-resource' into 'main'
Windows: Do not link DLL specific resources when doing a static build

Closes #2585

See merge request GNOME/glib!2457
2022-01-27 11:02:34 +00:00
Xavier Claessens
9159e84ce5 Windows: Do not link DLL specific resources when doing a static build
Fixes: #2585
2022-01-26 09:49:30 -05:00
Marc-André Lureau
fd1e2c8019 meson: check for win32 afunix.h
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-01-26 18:19:23 +04:00
Loic Le Page
42c77c7ac7 Enable full-static build on Windows
Glib cannot be built statically on Windows because glib, gobject and gio
modules need to perform specific initialization when DLL are loaded and
cleanup when unloaded. Those initializations and cleanups are performed
using the DllMain function which is not called with static builds.

Issue is known for a while and solutions were already proposed but never
merged (see: https://gitlab.gnome.org/GNOME/glib/-/issues/692). Last
patch is from version 2.36.x and since then the
"constructor/destructor" mechanism has been implemented and used in
other part of the system.

This patch takes back the old idea and updates it to the last version of
glib to allow static compilation on Windows.

WARNING: because DllMain doesn't exist anymore in static compilation
mode, there is no easy way of knowing when a Windows thread finishes.
This patch implements a workaround for glib threads created by calling
g_thread_new(), so all glib threads created through glib API will behave
exactly the same way in static and dynamic compilation modes.
Unfortunately, Windows threads created by using CreateThread() or
_beginthread/ex() will not work with glib TLS functions. If users need
absolutely to use a thread NOT created with glib API under Windows and
in static compilation mode, they should not use glib functions within
their thread or they may encounter memory leaks when the thread finishes.

This should not be an issue as users should use exclusively the glib API
to manipulate threads in order to be cross-platform compatible and this
would be very unlikely and cumbersome that they may mix up Windows native
threads API with glib one.

Closes #692
2022-01-26 10:14:02 +01:00
Sebastian Keller
d9e001e2cd gfileutils: Remove outdated BTRFS fsync optimization from set_contents
This code was skipping fsync on BTRFS because of an old guarantee about
the overwrite-by-rename behavior that no longer holds true. This has
been confirmed by the BTRFS developers to no longer be guaranteed since
Kernel 3.17 (August 2014), but it was guaranteed when this optimization
was first introduced in 2010.

This could result in empty files after crashes in applications using
g_file_set_contents(). Most prominently this might have been the cause
of dconf settings getting lost on BTRFS after crashes due to the
frequency with which such writes can happen in dconf.

See: https://gitlab.gnome.org/GNOME/dconf/-/issues/73
2022-01-11 19:07:01 +01:00
Kelvin Zhang
2a4422b0f2 Use meson dependency to link against apple framework
Using ld_flags would work, but that does not propagate ldflags to users
of glib. Meson's dependency() call will propagate apple framework
dependencies to downstream users.
2022-01-05 11:32:32 -08:00
Biswapriyo Nath
4356683136 meson: Fix linking with static library in Windows
libuuid is required for known folder IDs in glib/gutils.c file
2021-12-02 19:33:46 +00:00
Philip Withnall
249e654b96 build: Pass warning and warning-disabling arguments to C++ and ObjC too
Previously they were only passed to the C compiler, which meant disabled
warnings were still emitted when (for example) including C headers from
C++ and ObjC files.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
cc0e2978a4 build: Disable -Wvariadic-macros
We explicitly require support for variadic macros; see
https://wiki.gnome.org/Projects/GLib/CompilerRequirements.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Emmanuel Fleury
b5dade12c9 Get back to '-werror' with warnings at level 3
Closes: #1735
2021-11-17 16:19:28 +01:00
Xavier Claessens
9a9f6b5a4b Rename libpcre.wrap to pcre.wrap
It is exactly the same wrap as the one in WrapDB but with a different
name. That fix error when multiple projects uses pcre and they don't
have the same wrap name:

meson.build:1:0: ERROR: Multiple wrap files provide 'libpcre' dependency: pcre.wrap and libpcre.wrap
2021-11-01 18:22:26 +00:00
Philip Withnall
46588698e2 build: Bump Meson dependency to 0.52.0
This is what’s available in the new Debian Stable, so we can expect it
to be available pretty much everywhere.

Subsequent commits will clean up old workarounds.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-07 17:15:13 +01:00
Philip Withnall
7692e84f0d build: Post-release version bump to 2.71.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-17 11:35:55 +01:00
Philip Withnall
6fd4f36bac 2.70.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-17 11:15:53 +01:00