Commit Graph

351 Commits

Author SHA1 Message Date
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
Philip Withnall
73c217dec2 2.69.3
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-07 12:24:07 +01:00
Philip Withnall
10ba1f30eb 2.69.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-08-19 16:13:40 +01:00
Ryan Schmidt
971310a92c build: Fix implicit declaration of function errors
Include the correct system headers for each test that meson performs.
This allows system capabilities to be detected correctly even if
implicit declaration of functions is considered an error.
2021-08-14 05:20:11 -05:00
Philip Withnall
be4b8cbe96 2.69.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-08-04 16:32:18 +01:00
Philip Withnall
9fbd7f3dc1 build: Drop the internal_pcre option in favour of the subproject
This should maintain equivalent functionality, apart from that now you
have to pass `--force-fallback-for libpcre` to `meson configure` in
order to use the subproject; rather than specifying
`-Dinternal_pcre=true` to use the internal copy.

This also fixes #642, as the wrapdb copy of libpcre is version 8.37.

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

Helps: #962
Fixes: #642
2021-06-16 16:45:10 +01:00
Jonas Hahnfeld
c6ce891376 meson: Fix detection of static libintl on macOS
If libintl is built statically on macOS, linking it requires passing
"-framework CoreFoundation" to satisfy symbol dependencies. Use the
available osx_ldflags already detected earlier in the process.
2021-05-16 11:58:26 +02:00
Philip Withnall
e7f6799668 Merge branch '2055-correct-date-format-utf8' into 'master'
Resolve "g_date_time_format() does not return UTF-8 if LC_TIME is not UTF8 but other locale settings are UTF-8"

Closes #2055

See merge request GNOME/glib!1777
2021-03-31 16:16:16 +00:00
Chun-wei Fan
97959cd7eb msvc_recommended_pragmas.h: Refine for clang-cl
Make msvc_recommended_pragmas.h work better with clang-cl so that we can
use that to eliminate some warnings that are emitted as it also consumes
Microsoft compiler and SDK headers.

Also, for GLib builds, force-include msvc_recommended_pragmas.h for
clang-cl builds as well, as it becomes usable and useful there.

Fixes issue #2357.
2021-03-30 16:45:07 +08:00
Frederic Martinsons
782eb1f7af Add private functions to correctly convert datetime when LC_TIME is not UTF8
Functions (_g_get_time_charset and _g_get_ctype_charset) to get LC_TIME and LC_CTYPE charset
by using nl_langinfo with _NL_TIME_CODESET and CODESET).
Another functions (_g_locale_time_to_utf8 and _g_locale_ctype_to_utf8) which uses thel and format
the input string accordingly.
Add new test cases with mixing UTF8 and non UTF8 LC_TIME along with UTF8
and non UTF8 LC_MESSAGES.

Closed #2055

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-03-27 09:28:10 +01:00
Philip Withnall
3a0edbed5b build: Post-release version bump to 2.69.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-18 13:58:50 +00:00
Philip Withnall
a58a47fd6d 2.68.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-18 13:27:26 +00:00
Philip Withnall
b3384e5797 2.67.6
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-11 16:52:09 +00:00
Philip Withnall
05ff2f877c gdbusprivate: Stop hard-coding path to /var/lib
This will require distributions to ensure they pass
`--localstatedir=/var` correctly to Meson, but they should be doing that
already.

See https://mesonbuild.com/Builtin-options.html#directories for details
about how Meson treats `localstatedir` differently from most other `dir`
variables.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
4e4b35208a 2.67.5
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:36:00 +00:00
Aleksandr Mezin
1eac0c39f9 meson: fix str[n]casecmp detection on clang-cl
Meson incorrectly detects strcasecmp, strncasecmp on clang-cl if 'prefix:'
is not specified for cc.has_function().

See https://github.com/mesonbuild/meson/issues/5628

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2337

Before this change:
msvc was using _stricmp()
gcc on mingw was using strcasecmp()
gcc on linux was using strcasecmp()
clang-cl was trying to use strcasecmp()

After this change:
msvc is using _stricmp()
gcc on mingw is using strcasecmp()
gcc on linux is using strcasecmp()
clang-cl is using _stricmp()

Tests are still failing to build with clang-cl, but that's a separate issue.
2021-02-28 02:45:14 +06:00
Seungha Yang
97c7cb0e71 meson: Use subproject zlib if "wrap_mode=forcefallback" was specified
"wrap_mode=forcefallback" would mean that user wants to use dependency
which was built from our source, instead of system installed one.
2021-02-22 19:46:06 +09:00
Philip Withnall
4236672170 2.67.4
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 16:24:25 +00:00
Philip Withnall
5bc9710fa6 2.67.3
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-04 18:07:19 +00:00
Sebastian Dröge
e6f506a92c Merge branch 'fix/unix-stream-pollable-detection' into 'master'
gunix: Fix {Input,Output}Stream pollable detection

Closes #1180

See merge request GNOME/glib!1846
2021-02-02 10:46:52 +00:00
Ole André Vadla Ravnås
d7ee70c013 gunix: Fix {Input,Output}Stream pollable detection
For devices such as PTYs, where not being able to cancel a pending read
operation is problematic for many applications.

Fixes: #1180
2021-02-02 11:11:53 +01:00
Frederic Martinsons
525bbb7712 Check the completiondir from bash-completion package config file.
With bash completion version lesser than 2.10, only prefix is defined
while for greater version it is datadir.

Closes #1054

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-29 18:10:52 +01:00
Philip Withnall
3791add329 Merge branch 'feature/glib-debug-build-option' into 'master'
build: Add glib_debug option

See merge request GNOME/glib!1889
2021-01-20 19:01:43 +00:00
Ole André Vadla Ravnås
670b84ca30 build: Add glib_debug option
To allow disabling debug infrastructure in builds with debug symbols.
2021-01-20 16:05:36 +01:00
Philip Withnall
86aec50c0a Merge branch 'feature/qnx-support' into 'master'
Port to QNX

See merge request GNOME/glib!1847
2021-01-20 12:28:54 +00:00
WorksButNotTested
f4ca92df2b ginetaddress: Handle systems without IPv6 support 2021-01-20 01:11:07 +01:00
Ole André Vadla Ravnås
5de22998d5 build: Define _QNX_SOURCE on QNX
This is in order to activate all library features.
2021-01-19 23:17:11 +01:00
s1341
4e3b646b4f gunixmounts: Add stubs for QNX 2021-01-19 23:16:57 +01:00
Philip Withnall
f22b136b11 2.67.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-07 16:51:43 +00:00
Sebastian Dröge
86c9691a0a Merge branch 'fix/ssize-detection-on-old-glibc' into 'master'
build: Fix ssize_t detection on older versions of glibc

See merge request GNOME/glib!1855
2021-01-06 08:35:42 +00:00
Sebastian Dröge
609d1e292f Merge branch 'fix/android-system-checks' into 'master'
build: Fix Android system checks

See merge request GNOME/glib!1856
2021-01-06 08:34:52 +00:00
Sebastian Dröge
392dc7f145 Merge branch 'feature/disable-tests' into 'master'
build: Add option for disabling tests

See merge request GNOME/glib!1850
2021-01-06 08:27:18 +00:00
Ole André Vadla Ravnås
ea0c4bf045 build: Fix inconsistent Android host system checks
To match the value in the Meson reference table for "Operating system
names", and our checks elsewhere.
2021-01-06 01:12:31 +01:00