Commit Graph

220 Commits

Author SHA1 Message Date
Xavier Claessens
b2375471cc Merge branch '1313-config-cleanups' into 'master'
More config.h fixups for Meson

Closes #1313

See merge request GNOME/glib!283
2018-08-31 12:56:26 +00:00
Philip Withnall
3fd9f83ae4 build: Bump version to 2.59.0
Ready for the new unstable release series.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-08-31 12:51:38 +01:00
Philip Withnall
8271263af3 Merge branch 'require-python34' into 'master'
[RFC] build: Drop Python 2 support and require Python 3.4+

See merge request GNOME/glib!196
2018-08-31 10:48:11 +00:00
Philip Withnall
41a3951c8f Merge branch 'simplify-alloca-checks' into 'master'
build: simplify alloca checks. See #1313

See merge request GNOME/glib!268
2018-08-31 10:45:29 +00:00
Philip Withnall
ee2b3c5e97 build: Remove SIZEOF___INT64 definition from meson.build
This was a leftover from use of the __int64 type, which was removed
recently in commit 7e821441c4.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-08-31 11:41:12 +01:00
Philip Withnall
b707c71ce4 build: Stop defining STDC_HEADERS
This was previously defined by the AC_HEADER_STDC macro in configure.ac,
but we don’t use that any more. Nothing in GLib depends on this macro,
and neither does anything in my /usr/include which we might care about.

The autoconf documentation for AC_HEADER_STDC says it’s deprecated:
https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Particular-Headers.html#index-AC_005fHEADER_005fSTDC-621

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-08-31 11:41:12 +01:00
Philip Withnall
8759582716 build: Drop unused HAVE_DLFCN_H definition
I can’t see this being used anywhere in GLib, or in my /usr/include
directory. I’m also not sure how configure.ac ends up defining it — it’s
certainly as a side-effect of something, and not deliberate.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-08-31 11:41:12 +01:00
Philip Withnall
3032b5ed5b build: Check for bind_textdomain_codeset() properly
Previously we weren’t checking for it in meson.build (but were checking
for it in configure.ac, courtesy of glib-gettext.m4). Roughly emulate
the checks from glib-gettext.m4, checking for bind_textdomain_codeset()
in whichever libintl implementation we found ngettext() in.

meson.build still doesn’t implement the full set and order of checks in
glib-gettext.m4; there’s still a FIXME about that in meson.build.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-08-31 11:41:12 +01:00
Philip Withnall
7bc3edd1e5 build: Define GLIB_USING_SYSTEM_PRINTF properly
Previously it was hard-coded to true, rather than being based on the
calculations actually made by meson.build.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-08-31 11:36:14 +01:00
Philip Withnall
f35c4d5d42 build: Check for Unix98 positional parameter support in printf()
This is equivalent to the AC_FUNC_PRINTF_UNIX98 macro which we use in
configure.ac. There may still be some obscure Unix platforms which don’t
natively support positional parameters, 20 years on.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-08-31 11:36:13 +01:00
Philip Withnall
c138b98e36 2.58.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-30 18:11:13 +01:00
Nirbheek Chauhan
64f789c6e2 meson: Always set G_MODULE_SUFFIX to so on macOS
This is what Autotools does, and it's what all consumers of the
GModule API expect. Without this change, people on macOS upgrading to
a GLib built with Meson will find that their plugins no longer load.

Projects that use Meson and the `g_module_build_path()` API such as
glib-networking should pass `name_suffix:` to `shared_module()` to
ensure that plugins continue to be called libfoo.so on macOS.

New GModule API will eventually be added to address this.

See also:
https://gitlab.gnome.org/GNOME/glib/issues/1413
a3d81719fe/meson.build (L108)
2018-08-29 15:38:38 +05:30
Christoph Reiter
11fcc2f1ac build: simplify alloca checks. See #1313
The goal of this commit is to reduce differences between the autotools and meson build.

With autotools AC_FUNC_ALLOCA was used which defines HAVE_ALLOCA_H, HAVE_ALLOCA,
C_ALLOCA. meson tried to replicate that with has_function() but alloca can be a macro
and and is named _alloca under Windows. Since we require a working alloca anyway
and only need to know if the header exists replace AC_FUNC_ALLOCA with a simple
AC_CHECK_HEADERS.

There is still one user of HAVE_ALLOCA in the embedded gnulib, but since alloca is
always provided through galloca.h just force define HAVE_ALLOCA there and add a comment.

The docs were mentioning alloca as an example for cross compiling. Since that variable no
longer exists now replace it with another one.
2018-08-24 10:57:10 +02:00
Philip Withnall
f2504be625 2.57.3
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-23 18:48:14 +01:00
John Ralls
5df3f42d7b build: Mismatch between gint64 and int64_t in OSX 64-bit
Check for compile warnings when assigning an int64_t* to a long*,
make gint64 a long long if they occur and assigning an int64_t* to
a long long* doesn't.

Modified by Philip Withnall <withnall@endlessm.com> to support Meson as
well as autotools.

https://gitlab.gnome.org/GNOME/glib/issues/972
2018-08-21 10:25:47 +01:00
Christoph Reiter
7e6fb333f7 meson: define _FILE_OFFSET_BITS=64 for MinGW. See #1476
The autotools build set it by default and we use off_t in various places,
even on Windows. Also set it with the meson build to avoid any regressions.

Ideally we shouldn't use off_t and use 64bit capable API on Windows instead, so
we get large file support with MSVC as well.
2018-08-05 22:04:17 +02:00
Christoph Reiter
93261e307b build: Drop Python 2 support and require Python 3.4+
See https://mail.gnome.org/archives/desktop-devel-list/2018-July/msg00004.html
for a discussion on if/when we can start relying on Python 3 only.

Use Python 3.4 as a new requirement because that's the version used in
SLES 12 and Debian 8 and there is no good reason to require something newer
right now.
2018-07-24 12:30:25 +02:00
Nirbheek Chauhan
4e1488eebb Merge branch 'meson-python-module' into 'master'
meson: use the new 'python' module instead of the 'python3' one

Closes #1455

See merge request GNOME/glib!187
2018-07-23 11:17:47 +00:00
Matthias Clasen
a486923001 2.57.2 2018-07-19 06:42:58 -04:00
Christoph Reiter
631c3534b7 meson: use the new 'python' module instead of the 'python3' one. Closes #1455
The new python module, added with 0.46, works with Python 2 and 3 and
allows to pass a path for the interpreter to use, if the need arises.

Previously the meson build set PYTHON, used in the shebang line of
the scripts installed by glib, to the full path of the interpreter.
The new meson module doesn't expose that atm, but we should set it to
a executable name anyway, and not a full path.
2018-07-19 12:32:29 +02:00
Xavier Claessens
1bba3276bb Meson: Install glib tests
Fixes: #1444.
2018-07-16 15:36:20 -04:00
Philip Withnall
194df27f5a gatomic: Tweak __atomic_load*() calls to work with -Wbad-function-cast
When compiling third-party projects with -Wbad-function-cast, the inline
g_atomic_pointer_get() implementation which uses C11 __atomic_load*()
calls on GCC was causing compilation errors like:

   error: cast from function call of type ‘long unsigned int’ to non-matching type ‘void *’

While we don’t want to compile all of GLib with -Wbad-function-cast, we
should support its headers being included in projects which do enable
that warning.

It doesn’t seem to be possible to cast away the warning (e.g. by casting
the function’s result through (void)), so we have to assign to an
intermediate integer of the right size first.

The same has to be done for the bool return value from
__sync_bool_compare_and_swap(). In that case, casting from bool to
gboolean raises a -Wbad-function-cast warning, since gboolean is
secretly int.

The atomic tests have been modified to enable -Wbad-function-cast to
catch regressions of this in future. The GLib build has conversely been
modified to set -Wno-bad-function-cast, just in case people have it set
in their environment CFLAGS.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1041
2018-07-10 17:49:16 +02:00
Philip Withnall
4256d99c3d meson: Add libpcre dependency version, as in configure.ac
Prompted by https://gitlab.gnome.org/GNOME/glib/merge_requests/148.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-08 14:34:53 +01:00
Philip Withnall
fde68be4b7 Merge branch 'meson-doc-ci' into 'master'
ci: Fix dist-job missing gobject/gio documentation

See merge request GNOME/glib!123
2018-07-06 12:22:24 +00:00
Xavier Claessens
814d6a5956 Meson: Remove FIXME about _REENTRANT
As per discussion in GLib and Meson issues, this flag is not needed
anymore with modern gcc/clang. We only support GCC on Solaris now. This
might break the Sun/Oracle compilers on Solaris but Meson does not
suppor them (yet) anyway.

https://gitlab.gnome.org/GNOME/glib/issues/1432
https://github.com/mesonbuild/meson/issues/3810
2018-07-04 10:34:35 -04:00
Xavier Claessens
543a9c4f33 ci: Fix dist-job missing gobject/gio documentation
This requires meson >= 0.47.0 otherwise building the doc fails:
https://github.com/mesonbuild/meson/issues/3379

While at it, no need to to pass --prefix --libdir to meson, other CIs
don't have them.
2018-07-03 11:00:54 -04:00
Philip Withnall
ca98ce4280 Merge branch 'master' into 'master'
Use posix_spawn for optimized process launching

See merge request GNOME/glib!95
2018-06-21 17:10:43 +00:00
Daniel Drake
61f54591ac gspawn: Optimize with posix_spawn codepath
When the amount of free memory on the system is somewhat low, gnome-shell
will sometimes fail to launch apps, reporting the error:
  fork(): Cannot allocate memory

fork() is failing here because while cloning the process virtual address
space, Linux worries that the thread being forked may end up COWing the
entire address space of the parent process (gnome-shell, which is
memory-hungry), and there is not enough free memory to permit that to
happen.

In this case we are simply calling fork() in order to quickly call exec(),
which will throw away the entirity of the duplicated VM, so we should
look for ways to avoid the overcommit check.

The well known solution to this is to use clone(CLONE_VM) or vfork(), which
completely avoids creating a new memory address space for the child.
However, that comes with a bunch of caveats and complications:

  https://gist.github.com/nicowilliams/a8a07b0fc75df05f684c23c18d7db234
  https://ewontfix.com/7/

In 2016, glibc's posix_spawn() was rewritten to use this approach
while also resolving the concerns.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9ff72da471a509a8c19791efe469f47fa6977410

I experimented with a similar approach in glib, but it was not practical
because glibc has several items of important internal knowledge (such as
knowing which signals should be given special treatment because they are
NPTL implementation details) that are not cleanly exposed elsewhere.

Instead, this patch adapts the gspawn code to use posix_spawn() where
possible, which will reap the benefits of that implementation.
The posix_spawn API is more limited than the gspawn API though,
partly due to natural limitations of using CLONE_VM, so the posix_spawn
path is added as a separate codepath which is only executed when the
conditions are right. Callers such as gnome-shell will have to be modified
to meet these conditions, such as not having a child_setup function.

In addition to allowing for the gnome-shell "Cannot allocate memory"
failure to be avoided, this should result in a general speedup in this
area, because fork()'s behaviour of cloning the entire VM space
has a cost which is now avoided. posix_spawn() has also recently
been optimized on OpenSolaris as the most performant way to spawn
a child process.
2018-06-21 11:43:32 -05:00
Xavier Claessens
b97453c3e6 Meson: Add comment telling why we test strlcpy/strlcat 2018-06-18 09:28:55 -04:00
Xavier Claessens
acb4f54833 Merge branch 'meson-functions' into 'master'
Meson: Add missing checks for functions

See merge request GNOME/glib!114
2018-06-15 13:27:18 +00:00
Olivier Crête
8e65417c6e docs: Change Bugzilla references to GitLab
Including modifications by Philip Withnall <withnall@endlessm.com>
2018-06-15 13:04:39 +01:00
Christoph Reiter
45f9b5a336 Merge branch 'strlcpy' into 'master'
Meson: Add check for strlcpy/strlcat

See merge request GNOME/glib!111
2018-06-15 05:22:54 +00:00
Christoph Reiter
ee5a37f657 Merge branch 'threads-none' into 'master'
Remove unused THREADS_NONE

See merge request GNOME/glib!110
2018-06-15 04:55:17 +00:00
Xavier Claessens
8ba364186f Meson: Add missing checks for functions 2018-06-14 14:51:08 -04:00
Xavier Claessens
5ee54589e2 Meson: Add missing checks for struct members 2018-06-14 14:32:49 -04:00
Xavier Claessens
76a7f7dca3 Remove unused THREADS_NONE
Thread implementation is mandatory and configure will abort. So there is
no point in having a THREADS_NONE conditional/define.
2018-06-14 14:07:40 -04:00
Xavier Claessens
5ebcfdf447 Meson: Add check for strlcpy/strlcat
I don't know why it runs the code in autotools instead of only checking
if it links, but let's copy the same logic for now.
2018-06-14 14:00:43 -04:00
Philip Withnall
9c840fedd8 build: Bump Meson dependency to 0.46.1
We don’t strictly require this, but given that our CI runs it, we
essentially never test with 0.46.0, so it might as well be broken.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-14 13:02:18 +01:00
Philip Withnall
262b153c41 Merge branch 'wip/lantw/freebsd-meson-builds' into 'master'
Fix meson build files for FreeBSD

See merge request GNOME/glib!73
2018-06-11 10:53:10 +00:00
Chun-wei Fan
26b5d7dfff Remove glib-zip.in
We have not updated nor used this script for a long time, and nowadays
Meson makes it much easier to build on Windows for either Visual Studio
or MinGW, even straight from a GIT checkout, so it's about time that we
drop the glib-zip script from the source tree.
2018-06-08 15:47:22 +08:00
Ting-Wei Lan
c61f01f0ff build: Define MAJOR_IN_TYPES when major is defined in sys/types.h
Autoconf macro AC_HEADER_MAJOR doesn't define a macro in config.h when
major is defined in sys/types.h. This was not a problem because major
is assumed to be always available. However, commit aefffa3fbc
changes this assumption in order to fix build on systems without major,
which causes code using major to be disabled on systems putting major
in sys/types.h.

This commit defines a new macro MAJOR_IN_TYPES for both autotools and
meson builds to make major useful on these systems again.
2018-06-07 23:05:50 +08:00
Ting-Wei Lan
f752515925 meson: Use cc.compiles instead of cc.has_header to check malloc.h
cc.has_header checks whether a header exists without knowing whether it
can be used. This is a problem on FreeBSD because its malloc.h is a
header with an '#error' line which always throw compilation error. To
avoid false positive in the check result, we use cc.compiles to do a
full compilation test instead of cc.has_header which only does check
with preprocessor.
2018-06-07 23:05:50 +08:00
Xavier Claessens
11822c40bc Meson: Remove config.h.meson template
It became useless because glib_conf is not used anymore for generating
pkgconfig files. See issue #1313.
2018-06-07 09:28:03 -04:00
Philip Withnall
f06ba1722c Merge branch 'solaris-defines' into 'master'
Meson: Add missing defines on Solaris

See merge request GNOME/glib!64
2018-06-06 01:55:43 +00:00
Xavier Claessens
02bac34921 Merge branch 'drop-unused-defines' into 'master'
Remove unused HAVE_LONG_LONG_FORMAT and HAVE_LONG_LONG_FORMAT

See merge request GNOME/glib!63
2018-06-05 23:32:20 +00:00
Xavier Claessens
6ed57f8e26 Meson: Add missing defines on Solaris
We have no way to test Solaris builds atm, and it is not even clear how
to detect Solaris systems with meson. It will probably need to be
revisited when we get a proper CI in place.
2018-06-05 19:30:16 -04:00
Xavier Claessens
65bd090d57 Remove unused HAVE_LONG_LONG_FORMAT and HAVE_INT64_AND_I64 2018-06-05 19:04:48 -04:00
Xavier Claessens
9229f96fd6 Meson: Remove unused zlib_libname variable 2018-06-05 10:51:03 -04:00
Christoph Reiter
a7fefb0e4e g_check_setuid: implement using getauxval(AT_SECURE) with glibc
See commit 4c2928a544 for why checking AT_SECURE is preferable compared
to UID checks as currently done in the fallback case.

getauxval() was added with glibc 2.16

While glibc <2.19 didn't provide a way to differentiate a 0 return value from an error,
passing AT_SECURE should always succeed according to
https://sourceware.org/ml/libc-alpha/2014-07/msg00407.html
I've added an errno check anyway, to be on the safe side.
2018-05-31 12:02:36 +02:00
Philip Withnall
61b2f5c8e1 build: Always enable -Wmisleading-indentation
Try and ensure that people don’t push code with misleading indentation
in future. This should give fairly few false positives.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-30 10:12:01 +01:00
Philip Withnall
6054d11001 Merge branch 'nirbheek/windows-7-not-vista' into 'master'
meson: We actually support 7+, not Vista+

See merge request GNOME/glib!39
2018-05-29 12:25:08 +00:00
Nirbheek Chauhan
2e5454f892 meson: We actually support 7+, not Vista+
https://gitlab.gnome.org/GNOME/glib/issues/504#note_225707
2018-05-29 17:41:29 +05:30
Xavier Claessens
5d0a99105d Meson: Always fallback to proxy-libintl subproject
An implementation of gettext is required, but it's not always needed
e.g. for CI builds.

https://bugzilla.gnome.org/show_bug.cgi?id=796264
2018-05-28 09:15:45 -04:00
Philip Withnall
ab76d34ad7 build: Alphabetically order lists of functions and headers to find
This might make a repeat of
https://gitlab.gnome.org/GNOME/glib/issues/559 a little harder in
future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-28 12:03:32 +01:00
Philip Withnall
b84e0d1647 Merge branch 'meson-remove-duplicate-checks' into 'master'
meson: remove duplicate checks for gmtime_r and termios.h See #559

See merge request GNOME/glib!27
2018-05-28 10:38:03 +00:00
Philip Withnall
e201386143 Merge branch 'win32-rc-def-soname' into 'master'
meson/win32: set LT_CURRENT_MINUS_AGE, it's used by the .rc.in files

See merge request GNOME/glib!26
2018-05-28 10:29:32 +00:00
Christoph Reiter
f6c5090b82 meson: remove duplicate checks for gmtime_r and termios.h See #559
They are in the list twice
2018-05-28 10:01:06 +02:00
Christoph Reiter
310c5301c6 meson/win32: set LT_CURRENT_MINUS_AGE, it's used by the .rc.in files
This fixes the various warnings during meson configure on Windows about
LT_CURRENT_MINUS_AGE not being present in the config data.
2018-05-27 21:23:48 +02:00
Christoph Reiter
947b585ca6 msvc: set the execution and source encoding to utf-8. Fixes #1294
gcc defaults to utf-8 for both (see -fexec-charset and -finput-charset in the
gcc man page) so we should use it with msvc as well.

msvc by default uses the locale encoding unless there is a BOM, see
https://msdn.microsoft.com/en-us/library/mt708821.aspx
2018-05-27 20:54:37 +02:00
Xavier Claessens
d64ce3a538 Meson: Remove FIXME about missing checks for macosx <= 10.3
Our minimum requirement is already greater than that, so we don't need
to add checks there. We can always add -Wl,-framework,CoreFoundation
flag.

Fixes #1380.
2018-05-25 09:50:52 -04:00
Philip Withnall
170cf5a397 build: Add -Wunused to the set of standard warnings
This may catch problems like #1390 in future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-25 13:38:29 +01:00
Xavier Claessens
d3735df34f Revert "Revert "Meson: Fix cocoa and carbon support""
This reverts commit e25a2f95b3.
2018-05-25 03:06:07 +00:00
Matthias Clasen
d5869fc597 2.57.1 2018-05-22 17:21:16 -04:00
Matthias Clasen
e25a2f95b3 Revert "Meson: Fix cocoa and carbon support"
This reverts commit 2e3769a4f7.
2018-05-22 17:21:16 -04:00
Xavier Claessens
2e3769a4f7 Meson: Fix cocoa and carbon support
- Compiler checks were failing because it were using C compiler to build
objc code.
- xdgmime is needed on osx too.
- -DGIO_COMPILATION must be passed to objc compiler too.
- gapplication doesn't build on osx, it is excluded in autotools too.

We have to be careful when we use add_project_link_arguments(): All
targets are built using link arguments for the C language, except for
libgio on osx which use the objc language, because it contains some ".m"
source files. See https://github.com/mesonbuild/meson/issues/3585.

https://bugzilla.gnome.org/show_bug.cgi?id=796214
2018-05-22 11:51:59 -04:00
Nirbheek Chauhan
74af384153 meson: Add exception for atomic ops test for Android
Some compilers, particularly Android on armv5 and old versions of Clang
provide atomic ops, but don't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
so we need to define it ourselves.

This matches what configure does, with the exception that now it's only
done for Android since clang defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
now.

https://bugzilla.gnome.org/show_bug.cgi?id=796325
2018-05-22 14:34:16 +05:30
Philip Withnall
0b60f2589f build: Remove an unnecessary ‘dnl’ from meson.build
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-22 09:48:42 +01:00
Philip Withnall
c16e8af351 build: Migrate G_ATOMIC_LOCK_FREE docs from configure.ac to meson.build
The explanation of how G_ATOMIC_LOCK_FREE is meant to be used is useful.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-22 09:48:04 +01:00
Mathieu Duponchelle
3c9a7ec270 meson: do not run atomic test with msvc
The latest patches have fixed the atomic check, which
uses __sync_bool_compare_and_swap , and thus fails on
MSVC.

As a result, in gatomic.c, we ended up trying to include
pthread.h, which failed.

This mimics the old behaviour a bit more closely, where
G_ATOMIC_LOCK_FREE was always defined in the win32
glibconfig.h

https://bugzilla.gnome.org/show_bug.cgi?id=796220
2018-05-22 09:44:34 +01:00
Nirbheek Chauhan
7551267f19 meson: Fix checks for posix_memalign and stpcpy
The 'no-builtin' checks were just plain wrong. For accurate detection of
functions, use has_function with a header in the prefix. This fixes
posix_memalign detection on Android and on MinGW32, MSYS-MinGW-w64, and
old versions of MSYS2-MinGW-w64.

Using the header in the `prefix:` is generally a good idea because of
how macOS does targetting of specific macOS releases at compile time.

This also allows cross-files to override the result by setting
`has_function_stpcpy = false`, etc in [extra properties]

https://bugzilla.gnome.org/show_bug.cgi?id=795876
2018-05-21 21:10:53 +05:30
Xavier Claessens
e2c154d9d8 Meson: Remove legacy code used to write pc files
We are using meson's generator now so those variables are not used
anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=796264
2018-05-20 08:16:11 -04:00
Christoph Reiter
eceac66e86 meson: Don't skip snprintf/vsnprintf checks under MinGW
The comment stated that the test isn't good enough, but it correctly
detects a C99 printf when I build with -D__USE_MINGW_ANSI_STDIO=1
and an incompatible printf without it.

Using mingw-w64 from current MSYS2.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-18 18:54:57 +02:00
Xavier Claessens
487b1fd20c Meson: Add export-dynamic flag
https://bugzilla.gnome.org/show_bug.cgi?id=788773
2018-05-17 10:27:01 -04:00
Philip Withnall
53d3455e75 build: Add missing return statements from compiled tests
This could have caused spurious test failures when running with -Werror,
due to the missing return statement in int main().

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-17 15:11:17 +01:00
Philip Withnall
1a6fc60fe9 build: Fix test for G_ATOMIC_LOCK_FREE in meson.build
Commit 3e96523e6b did not entirely fix the test, as the compiled test
code did not have a main() function, so failed to link with:

 /usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

This caused an invalid mixtures of builtin and non-builtin atomics/locks
to be used, which caused deadlocks in a number of tests.

Fix the atomic ops test in meson.build, and the unit tests all start
working again.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=796164
2018-05-17 15:10:41 +01:00
Xavier Claessens
2477c7b05f Meson: add 'force_posix_threads' option
This allows building with posix threads on Windows. It is generally
better to use win32 threads implementation on Windows, but this option
can be used in case it causes issues, or for performance comparison for
example.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-05-16 10:21:07 -04:00
Xavier Claessens
4b82738f0a Meson: Add missing flags on Windows
win32_cflags gets used globally as cflags and exposed in the .pc file.
win32_ldflags gets passed to glib-2.0 and exposed in the .pc file.

This should match what the autotools build is currently doing with
GLIB_EXTRA_CFLAGS and G_LIBS_EXTRA.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-05-16 10:19:08 -04:00
Xavier Claessens
cf28bf1f11 Meson: Remove FIXME about COCOA_LIBS and CARBON_LIBS
They are already handled properly by osx_ldflags. As far as I can tell
it does the same as with autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-05-16 10:19:08 -04:00
Nirbheek Chauhan
ab0a0c706c meson: Fix error message for iconv detection 2018-05-16 14:26:11 +05:30
Nirbheek Chauhan
3e96523e6b meson: Fix atomic ops test to match configure.ac
We must try linking, not just compiling. That will give a false
positive.
2018-05-09 18:04:59 +05:30
Xavier Claessens
b6cb22f32b Meson: Do not build tests with nodelete/Bsymbolic-functions
-z nodelete breaks the libresourceplugin module usage in the resources.c
test, which expects to be able to unload it.

Make the Meson build match what the autotools build does: only pass
glib_link_flags to the headline libraries (glib-2.0, gio-2.0,
gobject-2.0, gthread-2.0, gmodule-2.0) and omit it from all other build
targets.

https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-05-09 12:52:59 +01:00
Christoph Reiter
98a0ab929d Always assume that we use a gnu/c99 printf implementation
On Windows we use gnulib and elsewhere we use glibc or similar.

Also change G_GNUC_PRINTF to use gnu_printf instead of __format__ if
possible because __format__ evaluates to ms_printf under MinGW,
but we use gnulib there and not the system printf.
gnu_printf is only available with GCC>=4.4 and not with clang.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-07 19:50:25 +02:00
Xavier Claessens
a67dc37e9c Meson: Add -Wl,-z,nodelete and -Wl,-Bsymbolic-functions where supported
https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-04-30 12:14:07 -04:00
Xavier Claessens
01e8396301 Fix build when pthread_getname_np is not available
On Android _setname_ is always available but _getname_ is available only
with API level >= 26.

https://bugzilla.gnome.org/show_bug.cgi?id=795406
2018-04-25 13:56:14 -04:00
Christoph Reiter
06d61434c9 meson: pass -fno-builtin when testing whether stpcpy is a builtin
In https://bugzilla.gnome.org/show_bug.cgi?id=794555 the tests for
posix_memalign and stpcpy were extended to catch the case where
the compiler provides an incomplete builtin.

Under MSYS2 the example code still compiles and links while the real usage
of stpcpy fails to build. To prevent the MSYS2 gcc from using the builtin
versions pass -fno-builtin.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:49 +02:00
Руслан Ижбулатов
85a32c7137 Force W32-specific POLL* constant values in meson
The winsock2-using test does work perfectly, however this is a new
thing that didn't exist in autotools-based builds of glib in the past.
Autotools builds used the generic case where values were just defined
to some agreed-upon numbers, and this is what all autotools-glib
binaries and binaries built against autotools-glib (since these
values go into public glibconfig.h header) use. At least one value,
G_POLLIN, is different, thus breaking ABI if some binaries are
built with autotools and the others are built with meson.

Force meson buildscript to use the same G_POLL* constant values
for Windows builds that autotools builds use.

https://bugzilla.gnome.org/show_bug.cgi?id=794687
2018-04-25 12:40:06 +00:00
Xavier Claessens
cc7e0f6cc2 Meson: Define G_ENABLE_DEBUG and friends
https://bugzilla.gnome.org/show_bug.cgi?id=794790
2018-04-19 10:00:41 -04:00
Xavier Claessens
b0ae762a33 Meson: Get results from cross file properties if cannot run code
When cross compiling and not exe wrapper has been defined cc.run() raise
an exception. Avoid this by taking the value from [properties] in the
cross file and provide sensible default if the variable is not defined.

https://bugzilla.gnome.org/show_bug.cgi?id=794898
2018-04-18 19:38:09 -04:00
Xavier Claessens
3f741e087f Meson: Use cc.compute_int() instead of running our own code
When cross compiling we cannot run code, and meson has code to compute
int values without executing code.

https://bugzilla.gnome.org/show_bug.cgi?id=794898
2018-04-18 19:38:09 -04:00
Philip Withnall
723ac89b0c tests: Add a GFileMonitor test for G_FILE_MONITOR_WATCH_HARD_LINKS
Add a test for monitoring an existing local file, with the
WATCH_HARD_LINKS flag specified. This would previously cause a crash;
now it doesn’t.

This test contains a FIXME where I suspect we should be getting some
additional file change notifications from changes made through the hard
link; this requires further follow up and probably further fixes to our
inotify backend.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:13:02 +01:00
Xavier Claessens
dad4f956c5 Meson: Add carbon and cocoa flags into glib and gio pc files
https://bugzilla.gnome.org/show_bug.cgi?id=788773
2018-03-28 19:31:25 -04:00
Xavier Claessens
3c76114e73 Meson: Use pkgconfig module to generate all pc files
This requires improved pc file generator from meson 0.45.

https://bugzilla.gnome.org/show_bug.cgi?id=788773
2018-03-28 19:31:20 -04:00
Руслан Ижбулатов
a9c65317d3 Use a real test for G_HAVE_GNUC_VISIBILITY
Accurate G_HAVE_GNUC_VISIBILITY is needed to correctly
define G_GNUC_INTERNAL later on. Autotools did that,
meson currently doesn't and opts to just set
G_HAVE_GNUC_VISIBILITY to 1 for all compilers except MSVC.
This leads to MinGW GCC having G_HAVE_GNUC_VISIBILITY=1,
which results in G_GNUC_INTERNAL being defined to
__attribute__((visibility("hidden"))), which is not supported.

Because cc.compiles() does not support override_options or
anything like that, we just feed it '-Werror' as-is, since
MSVC is known as not supporting visibility attributes anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=794636
2018-03-28 11:55:50 +00:00
Руслан Ижбулатов
dcc452b5f9 Check stpcpy() and posix_memalign() to *not* to be built-in
GCC has built-ins for these functions, which might give a compile-only
test an impression that the functions are actually present in the C runtime.
Use a linked test to be sure.

Specifically, both functions are missing on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=794555
2018-03-28 11:47:14 +00:00
Philip Withnall
15201345de build: Bump version to 2.57.0
Ready for the new unstable release series.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-03-13 12:17:31 +00:00
Matthias Clasen
f58d46e39f 2.56.0 2018-03-12 16:52:13 -04:00
Dr. Michael Lauer
cc50c19544 configure.ac: link to AppKit on macOS.
This is actually only necessary for gio, not for the other libraries.

https://bugzilla.gnome.org/show_bug.cgi?id=793565
2018-03-05 16:48:07 +00:00
Ernestas Kulik
9d24c8b223 build: meson: add warning flags
Courtesy of GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-21 13:57:10 +00:00
Rafal Luzynski
be4f96b650 g_date_time_format: Support nominative/genitive months
Supports %OB (alternative, standalone, nominative) month name along
with the old %B (primary, in a complete date format context, genitive)
month name.  Similarly %Ob and %Oh for abbreviated month names.
Depending on the underlying operating system uses nl_langinfo()
or provides our custom implementation.

(Tweaked by Philip Withnall <withnall@endlessm.com> to add test case
comment and bug reference.)

https://bugzilla.gnome.org/show_bug.cgi?id=749206
2018-02-16 14:37:51 +00:00
Matthias Clasen
ee57d56e8d 2.55.2 2018-02-14 08:19:20 -05:00