Commit Graph

512 Commits

Author SHA1 Message Date
Philip Withnall
342b654e35 Merge branch 'main' into 'ebassi/girepository'
This needs to be done as a merge rather than a rebase because !3642 cannot be rebased.

Conflicts:
  meson_options.txt
2023-11-08 11:54:28 +00:00
CaiJingLong
7b80f73d29 fix: about libproc.h and PROC_PIDLISTFD_SIZE 2023-11-06 14:46:52 +00:00
Alessandro Bono
168de73a73 meson: Improve PTRACE_O_EXITKILL presence check
The PTRACE_O_EXITKILL symbol in sys/ptrace.h is an enum member, not
a macro. The #ifdef check added to the GSubprocess test-case in
272ec5dbca will not detect it.

Use cc.has_header_symbol() to properly detect it. According to the
documentation: "Symbols here include function, variable, #define,
type definition, etc.".

Fixes: 272ec5dbca
Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/3156
2023-10-26 10:54:34 +02:00
Philip Withnall
24a3e728ce build: Bump Meson dependency to 1.2.0
And update all the CI builds to use the latest micro release from that
series, 1.2.3.

This version bump means we can:
 - Drop some backwards-compatibility Meson checks
 - Fix a periodic CI failure caused by a now-fixed Meson bug
   (https://github.com/mesonbuild/meson/pull/10633)

It’s in line with our [Meson version policy](./docs/meson-version.md),
as Meson 1.2.1 is available in
[Debian Trixie](https://packages.debian.org/source/trixie/meson) and the
[freedesktop SDK](c95902f2ed/elements/components/meson.bst).

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-10-24 17:00:24 +01:00
Emmanuele Bassi
fe32c3f5c5 Generate introspection data
Currently, the introspection data for GLib and its sub-libraries is
generated by gobject-introspection, to avoid the cyclic dependency
between the two projects.

Since gobject-introspection is generally available on installed systems,
we can check for its presence, and generate the introspection data
directly from GLib.

This does introduce a cyclic dependency, which is why it's possible to
build GLib without introspection, then build gobject-introspection, and
finally rebuild GLib.

By having introspection data available during the GLib build, we can do
things like generating documentation; validating newly added API; and
close the loop between adding new API and it becoming available to non-C
consumers of the C ABI (i.e. language bindings).
2023-10-23 11:26:53 +01:00
Emmanuele Bassi
af36393e60 Build libgirepository as a GLib sub-library
The introspection API has lived out of tree far too long. It has the
same ABI guarantees as the rest of GLib, so it has no reason to be split
from the main library.

The gobject-introspection project can depend on libgirepository, and the
language bindings can drop the gobject-introspection-1.0 dependency.
2023-10-16 15:24:08 +01:00
Luca Bacci
337912072a Windows: Compile with the UNICODE / _UNICODE macros
It's the recommended way to build C/C++ projects on Windows, see
https://learn.microsoft.com/en-us/windows/win32/intl/conventions-for-function-prototypes
2023-10-12 11:32:03 +02:00
Philip Withnall
260b5003c6 build: Post-release version bump
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-10-03 10:21:56 +01:00
Benjamin Gilbert
34e457e9f1 meson: Fix Windows build with PCRE2 as sibling subproject
If glib and PCRE2 are both built for Windows as subprojects of a parent
project, cc.links() will fail because PCRE2 hasn't been built yet when
glib is being configured:

    subprojects/glib-2.78.0/meson.build:2109:20: ERROR: Dependencies must be external dependencies

609d58beea changed the detection logic to avoid cc.links() in this
case, but dd5683ce64 broke it again.  PCRE2 detection could use a
broader cleanup, but for now, make the minimum change to fix this case.

use_pcre2_static_flag ends up set to false, matching the behavior of
609d58beea.

Fixes: dd5683ce64 ("meson: Allow fallback & static build of pcre subproject")
2023-10-01 23:06:49 -05:00
Philip Withnall
3c543ef69f
2.78.0
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-09-08 14:42:18 +01:00
Philip Withnall
aa2e243dbf
2.77.3
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-31 11:23:47 +01:00
Philip Withnall
c00d7999b1 Merge branch 'th/use-getservbyname-r' into 'main'
gnetworkaddress: use reentrant getservbyname_r() if available

See merge request GNOME/glib!3526
2023-08-14 09:24:51 +00:00
Thomas Haller
f738c7f3db gio: use reentrant getservbyname_r() if available 2023-08-14 09:32:43 +01:00
Marc-André Lureau
4dde72e038 meson: warn if -mms-bitfields is necessary
GCC >= 4.7 and clang >= 12 don't need it. It should be left to the user
to decide what ABI convention should be used, and it creates some issues
with some tools to have this flag in cflags.

We leave the flag for now, but print a warning at compile time so people
get a chance to change their build system before we drop it from glib.pc

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-08-13 16:13:21 +04:00
Philip Withnall
1e8d310e6e
2.77.2
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-12 23:38:03 +01:00
Philip Withnall
e1f4c5806f
2.77.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-07-30 20:44:31 +03:00
Philip Withnall
627dc1415c Revert "build-sys: drop -mms-bitfields GCC flag"
This reverts commit 252bbcd207.

After further discussion in !3511, we’ve decided that there are risks
associated with this change, and it’s not the best way of addressing the
original problem.

The original motivation for the change turned out to be that
`-mms-bitfields` was not handled by `windres`, which was receiving it
from `pkg-config --cflags glib-2.0` in some projects. However, if
`windres` is claiming to accept CFLAGS then it should accept (and
ignore) `-mms-bitfields`, since the `-m` family of options are defined
in `man gcc`, just like `-I`, `-D`, etc.

There is some question that there might still be third party projects
which are built with an old enough compiler that `-mms-bitfields` is not
the compiler default. For that reason, we should either still continue
to specify `-mms-bitfields` in the `.pc` file, or add a test to assert
that third party projects are always compiled with `-mms-bitfields` set.
But adding a new test for all third-party compilations is risky (if we
get it wrong, things will break; and it’s a test which may behave
differently on different platforms), so it seems safer to just keep
`-mms-bitfields` in `.pc` for now.

Once all compilers which we require specify `-mms-bitfields` by default,
we can finally drop this flag (without adding a test for third-party
compilations).

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3511
2023-07-29 11:54:22 +03:00
Simon McVittie
71d44e8d71 testutils: Use prctl PR_SET_DUMPABLE to silence core dumps on Linux
Otherwise, crashing tests like assert-msg-test will still report to
pipe-based crash reporting frameworks like systemd-coredump, even though
the RLIMIT_CORE limit is zero.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-07-26 15:42:06 +01:00
Philip Withnall
e051f4abaf Merge branch 'win32' into 'main'
build-sys: drop -mms-bitfields GCC flag

See merge request GNOME/glib!3509
2023-07-24 15:52:10 +00:00
Marc-André Lureau
252bbcd207 build-sys: drop -mms-bitfields GCC flag
This flag is problematic for some usages, and is no longer needed since
~2012 GCC 4.7 (https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a6c467624ade35128)

It is dropped from MINGW since:
https://github.com/msys2/MINGW-packages/pull/12891

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-07-24 14:45:09 +04:00
Philip Withnall
3ab16a0d18 Merge branch 'libintl_fallback' into 'main'
meson: Allow forcing fallback for libintl

Closes #3048

See merge request GNOME/glib!3497
2023-07-21 16:44:56 +00:00
Michael Catanzaro
a552bf5694 Merge branch 'revert3356' into 'main'
Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"

See merge request GNOME/glib!3504
2023-07-20 15:20:58 +00:00
Andoni Morales Alastruey
dc37ca70fe meson: help gobject-introspection locate source and build dirs
gobject-introspection is currently assuming glib subproject
is in unversioned, but gstreamer uses a versioned directory, eg:
subprojects/glib-2.74.1 instead of subprojects/glib
2023-07-20 10:49:26 +02:00
Harald van Dijk
6e29fbec2d
Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"
This reverts commit 004f48f4fc.

Per the discussion on #3356, this change was prompted by a
misunderstanding of ldflags/link_args, and it resulted in various other
packages using glib no longer getting symbols exported. This commit
restores the glib 2.76 behaviour.
2023-07-18 18:26:49 +01:00
Brendan Shanks
d0862c3692 meson: Allow forcing fallback for libintl
Closes #3048
2023-07-13 10:02:04 -07:00
Marius Kintel
0ae1b57ae4 Link with -framework Foundation and -framework AppKit to correctly link libiconv on macOS 2023-06-28 21:10:03 -04:00
Philip Withnall
d3fbb6e0fc Merge branch 'meson-intl-iconv-lookup' into 'main'
meson: try iconv in libintl lookup

See merge request GNOME/glib!3448
2023-06-28 14:48:19 +00:00
Marius Kintel
dd5683ce64 meson: Allow fallback & static build of pcre subproject
Using `allow_fallback: false` on the first check for libpcre
was unnecessary, as `required: false` already disables using
fallbacks. `allow_fallback: false` meant that
`--force-fallback-for` couldn’t work. This commit fixes that.

Also allow the fallback libpcre to be built statically so it
can be linked into GLib.

Helps: #3025
2023-06-28 14:38:36 +00:00
Jan200101
a497d5be12 meson: try iconv in libintl lookup
This was originally removed in !2734 but still appears to be required for
some MinGW setups, such as the `x86_64-w64-mingw32.static` target in
[mxe](https://github.com/mxe/mxe).

Currently, this configuration fails the libintl internal assert on line
2128, as on this platform `ngettext()` is only found inside libiconv.

This commit will look up iconv potentially twice, once as `libiconv` and
potentially once as `libintl_iconv`. This is what the code did before
!2734 landed, so it’s known to work reliably on a number of platforms.
2023-06-28 15:22:36 +01:00
Philip Withnall
c0bdc61879 meson: Export HAVE_FREE_SIZED in glibconfig.h for use in g_free()
This allows the `g_free()` wrapper introduced in the previous commit to
only be defined if `free_sized()` is actually available to improve
performance.

This avoids passing an allocation size to every `g_free()` call if it’s
not going to be used, saving a register store instruction each time.

Suggested by Marco Trevisan in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3252#note_1660032

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-30 13:45:05 +01:00
Philip Withnall
e02fa2ec90 gfile: Ensure loff_t is defined on FreeBSD
When `copy_file_range()` support was added, I used the definition of
`copy_file_range()` from Linux, which uses `loff_t` to abstract the
different `off*_t` types.

`loff_t` doesn’t exist on FreeBSD, so this doesn’t compile, and was
caught in subsequent asynchronous CI.

Define `loff_t` with a fallback value if it’s not defined, which should
fix this and other uses of `loff_t` in `gfile.c` (for example, if
FreeBSD ever starts declaring `splice()`).

Fixes this CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/2812302

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-15 16:22:35 +01:00
Philip Withnall
20964ad4ab Merge branch '2863-copy-file-range' into 'main'
gfile: Support copy_file_range() for file copies

Closes #2863

See merge request GNOME/glib!3328
2023-05-09 14:08:18 +00:00
Philip Withnall
0e5d9fd249 gfile: Support copy_file_range() for file copies
While it can’t be used in all situations, it is a little bit faster than
`splice()` in some situations, basically if the file system supports
copy on write. In other situations it’s no slower than `splice()`.

See `man copy_file_range` for the situations where it doesn’t work. In
all of these situations, it will return an error, and the GLib code will
fall through and try the existing `splice()` copy code instead.

From my testing of `time gio copy A B` with a 9GB file, the `splice()`
code path takes 22s, and the `copy_file_range()` code path takes 20s.

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

Fixes: #2863
2023-05-09 14:01:50 +01:00
Samuel Thibault
81d729dc53 Check for linux/netlink.h buildability
When cross-building with a non-Linux target, linux/netlink.h will not
actually be buildable, even if distributions typically put it in
/usr/include and thus exposed to the cross-compiler.
2023-05-09 13:31:28 +01:00
Philip Withnall
377e8a2d9e docs: Update various broken/redirected links
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-02 14:26:52 +01:00
Marco Trevisan
9f111c3416 Merge branch 'valgrind-variable' into 'main'
meson: Add glib_valgrind_suppressions variable to glib pkg-config file

See merge request GNOME/glib!3361
2023-04-17 12:52:28 +00:00
Marco Trevisan (Treviño)
ade79bcb50 meson: Add tests for generated pkg-config files
Ensure things are generated as we expect and avoid we regress on that.
2023-04-17 14:25:52 +02:00
Marco Trevisan (Treviño)
fcad56e313 meson: Add glib_valgrind_suppressions variable to glib pkg-config file
Various projects are running tests under valgrind, and they are using
the GLib suppresions to avoid false-positive results.

While this is stored in a well-known path for some years, and easy to
figure out from the GLib prefix, it's better to expose it through a
proper pkgconfig variable so that it's easy to get it from any build
system.
2023-04-14 19:20:51 +02:00
Philip Withnall
11bdd6fcc4 Merge branch 'wip/jtojnar/wl-are-compiler-flags' into 'main'
build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags

See merge request GNOME/glib!3356
2023-04-14 15:52:56 +00:00
Philip Withnall
715c8064be Merge branch 'meson-system-libintl-detection' into 'main'
meson: Fix detection of a system-provided proxy-libintl

See merge request GNOME/glib!3352
2023-04-14 15:50:20 +00:00
Philip Withnall
17295bd0b0 Merge branch 'move-msvc-recommended-pragmas' into 'main'
meson: Move msvc_recommended_pragmas.h to a subdirectory

See merge request GNOME/glib!3340
2023-04-14 15:49:21 +00:00
Philip Withnall
f06bc48685 build: Post-release version bump
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-14 16:09:33 +01:00
Jan Tojnar
004f48f4fc build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags
Previously, `-Wl,--export-dynamic` was in `Libs` key of `gmodule-2.0.pc`,
even though `-Wl` is a compiler flag, rather than a linker one.
This caused issues with API reference builds in evolution-data-server,
which passes the output of `pkg-config --libs` through `--ldflags`
argument of `gtkdoc-scan`, which are forwarded unchanged to `ld`:

    ld: unrecognized option '-Wl,--export-dynamic'

Let’s move the flag to `Cflags` so that the compiler can deal with it.

https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/463
2023-03-31 20:44:14 +02:00
Nirbheek Chauhan
32249a22fc meson: Fix detection of a system-provided proxy-libintl
proxy-libintl defines ngettext() as a define in the header that points
to the actual symbol in the library which is g_libintl_ngettext().
Same with bind_textdomain_codeset().
2023-03-26 13:45:37 +01:00
Philip Withnall
180713772f
2.76.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 11:28:01 +00:00
Philip Withnall
6a1c7b7c2e meson: Move msvc_recommended_pragmas.h to a subdirectory
It’s cluttering up the root directory.

This should introduce no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 14:21:18 +00:00
Philip Withnall
8a9ada6639
2.76.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-10 14:33:15 +00:00
Philip Withnall
084a35620c
2.75.4
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-03 11:15:47 +00:00
Maciej S. Szmigiero
3dc77fef24 gsocket: Use accept4 () for race-free setting of the close-on-exec flag
The code was already setting the close-on-exec flag for the new socket,
just in a racy way.
2023-02-19 16:47:13 +01:00
Philip Withnall
b65044c52b
2.75.3
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-13 19:02:58 +00:00