Commit Graph

512 Commits

Author SHA1 Message Date
Simon McVittie
59f3c1f17a Autotools: Move libmount from Libs.private to Requires.private
libmount depends on libblkid, so if we statically link a trivial
executable to GIO, we need to pull in both libmount and libblkid.
Linking with -lmount is not enough to achieve that, but recursing
into mount.pc is.

This makes the Autotools build a bit more like the Meson build,
which already puts mount in Requires.private.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-26 10:08:38 +01:00
Simon McVittie
214c991d5b Spelling: fix "every time"
Detected by Debian's Lintian tool.

Also fix the spelling of "linking" in one error message.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:34:48 +01:00
Emmanuele Bassi
fd2d94dca5 Merge branch '656-format-security' into 'master'
build: Set -Wformat when testing for -Wformat-security

Closes #656

See merge request GNOME/glib!300
2018-09-05 09:42:33 +00:00
Christoph Reiter
24a95056b4 autotools: stop generating a ChangeLog file for the dist tarball
We have git for that.

automake requires a ChangLog file in gnu mode so switch to the less strict
foreign mode instead.
2018-09-04 17:43:37 +02:00
Philip Withnall
9e9db46a49 build: Drop pointless -Wformat-security warning flag
We already set -Wformat=2, which implies -Wformat-security, so there’s
no need to test for and set -Wformat-security separately.

The test for -Wformat-security never worked anyway, since gcc complains
if it’s specified without also setting -Wformat to some value. The
complaint causes configure.ac/meson.build to assume the option doesn’t
work.

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

https://gitlab.gnome.org/GNOME/glib/issues/656
2018-09-04 09:51:49 +01:00
Philip Withnall
bac504e32f build: Drop AC_C_CONST from configure.ac
Any compiler we care about now supports the `const` keyword, so we no
longer need to check for it. autoconf has recommended this macro is
obsolete:

https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C-Compiler.html#index-AC_005fC_005fCONST-755

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

https://gitlab.gnome.org/GNOME/glib/issues/1313
2018-09-03 13:04:21 +01: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
c138b98e36 2.58.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-30 18:11:13 +01:00
Christoph Reiter
3d7cde654c autotools: use C99 printf format specifiers on Windows. Fixes #1497
Since we now require a C99 compatible printf and use gnulib on Windows,
we also mark our printf functions as gnu_printf. GCC complains about the
Windows specific I64 specifiers we still write to glibconfig.h with the
autotools build.

To fix this switch all I64(x) to ll(x).

This also makes the glibconfig.h output for those macros match the ones
we get when using meson.
2018-08-24 22:42:42 +02:00
Christoph Reiter
7e821441c4 autotools: remove support for the __int64 type. See #1313
__int64 was the 64bit type for Visual Studio before it added support for
"long long" with VS2013. I think this was used to build glib with mingw and
make the result usable for VS 6.0 which didn't support "long long" (??)

Given that newer MSVC links against a different crt and mixing is not supported
and everything supports "long long" nowadays just remove it.

This is also a cleanup for printf format changes needed for #1497
2018-08-24 21:38:07 +02:00
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
99caee2819 build: only test for broken ip_mreq_source on Android. Fixes #1472
7efd76dd67 added these configure time tests to work around a bug
with older Android. Since the test didn't take Windows into account it
wrongfully applied the workaround on Windows too, breaking the build.
With meson this wasn't an issue since the check is skipped on Windows there
and our CI didn't catch this issue.

Change the test to run on Android only for meson and autotools.
This also makes it clear that the test+code can be dropped again if we stop
supporting older Android versions at some point.
2018-08-03 10:24:00 +02:00
Philip Withnall
ca0110c34d build: Conditionally add spawn and IO channel without using EXTRA_ prefix
See previous commit; same reasoning behind the commit, except that these
sources weren’t (yet) causing `make distcheck` to fail.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-31 18:52:37 +01:00
Philip Withnall
862fe11f90 build: Conditionally add gwin32.c to sources without using EXTRA_ prefix
Instead of messing around with EXTRA_*_SOURCES and manually handling .lo
files, why not just add gwin32.c to the GLib sources conditionally?

This will hopefully fix `make distcheck` failing due to gwin32.Plo not
being generated in the sub-builddir≠srcdir stage, due to depcomp
inexplicably not generating it. (Note that it is correctly generated in
non-distcheck builds.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-31 18:52:37 +01: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
Matthias Clasen
a486923001 2.57.2 2018-07-19 06:42:58 -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
d31270e24c Merge branch 'pcre-8.31' into 'master'
regex: Require PCRE 8.31

See merge request GNOME/glib!148
2018-07-06 13:02:43 +00:00
Philip Withnall
21f7566923 build: Drop Perl dependency on autotools
We don’t have the same dependency in the Meson build, and we don’t
depend on Perl any more. See #1332. The last remaining Perl script,
gen-unicode-tables.pl, is only ever run manually when we update our
Unicode character database. It will be ported to Python in due course.

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

https://gitlab.gnome.org/GNOME/glib/issues/1332
2018-07-06 13:07:10 +01:00
Olivier Blin
25b23978e1 regex: Require PCRE 8.31
PCRE >= 8.31 is required for PCRE_INFO_MAXLOOKBEHIND usage, introduced
in commit 6fbb146342 (2013/07).

regex can also make use of the PCRE_NO_AUTO_POSSESS feature from PCRE
8.34, but this is optional and properly guarded already.
2018-07-02 16:29:46 +02: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
Philip Withnall
c200c1d1df docs: Rename README.in to README.md for GitLab
There seems to be little point in substituting the version number into
README (using autotools). Rename it to README.md and distribute that
verbatim (with autotools and Meson) instead.

Autotools still requires that README exists, so leave a stub README file
in place which redirects people to README.md. This can be dropped when
we drop autotools support.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-15 13:04:59 +01: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
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
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
Xavier Claessens
b087b2644c Remove unused HAVE_FAM define 2018-06-07 09:45:08 -04:00
Chun-wei Fan
4bb173b297 build: Remove leftovers of Visual Studio project stuff
There are more leftover preconfigured stuff that we ought to remove...
2018-06-06 23:54:13 +08:00
Chun-wei Fan
f658e94e65 build: Drop Visual Studio projects
In master, it is already possible to build GLib using Visual Studio
using Meson[1] for some time, so we should focus on maintaining only the
Meson build files for building GLib with Visual Studio.

[1]: There are caveats when building with Visual Studio 2008, namely
     that one needs to use the mt command to embed the manifests that
     are generated with the .exe/DLLs, for all builds, and that in the
     case where the compilation hangs on Visual Studio 2008 x64, as a
     workaround, should stop the build by terminating all cl.exe tasks
     and change the compiler optimization flag from /O2 (full speed) to
     /O1 (optimize for size), due to compiler optimization issues.
2018-06-06 23:54:13 +08:00
Xavier Claessens
65bd090d57 Remove unused HAVE_LONG_LONG_FORMAT and HAVE_INT64_AND_I64 2018-06-05 19:04:48 -04:00
Christoph Reiter
3aa23078ac build: Remove the --disable-mem-pools build option and the DISABLE_MEM_POOLS macro
It's mostly not used anymore and doesn't do what it says it does.

The docs state that it affects GList, GSList, GNode, GMemChunks, GSignal,
GType n_preallocs and GBSearchArray while:

* GList, GSList and GNode use GSlice and are not affected
* GMemChunks is gone
* GType npreallocs is ignored

It also states that it can be used to force the usage of g_malloc/g_free,
which is handled by G_SLICE=always-malloc now.

The only places where it's used is in signal handling through GBSearchArray
and in GValueArray (deprecated). Since it's unlikely that anyone wants to
reduce allocation sizes just for those cases remove the build option.
2018-06-02 09:45:55 +02:00
Xavier Claessens
a3c061a814 Merge branch 'remove-gc-friendly-default' into 'master'
Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option

See merge request GNOME/glib!43
2018-05-31 17:36:25 +00:00
Xavier Claessens
09b8c6d24b Merge branch 'remove-secure-libc' into 'master'
Remove unused HAVE_LIBC_ENABLE_SECURE  and add a glibc implementation for g_check_setuid

See merge request GNOME/glib!45
2018-05-31 16:20:12 +00:00
Emmanuele Bassi
54db9d3fc3 Merge branch 'remove-posix-memalign-compl-check' into 'master'
Remove posix_memalign() checks for an old glibc bug

See merge request GNOME/glib!47
2018-05-31 13:03:41 +00:00
Christoph Reiter
fe59a18f89 Remove posix_memalign() checks for an old glibc bug
POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS was added in
https://bugzilla.gnome.org/show_bug.cgi?id=328254
to work around a glibc bug where it wrongly checked the size argument
to be a power of two instead of the alignment.

This was fixed in glibc in
https://sourceware.org/git/?p=glibc.git;a=commit;h=b2bffca2e3b59dd882039e3b0ab835d127bdaf7a
about 16 years ago.
2018-05-31 14:29:33 +02:00
Christoph Reiter
b6c81d139c Remove NO_FD_SET and assume fd_set exists
gspawn.c is using fd_set without checks for 17 years now and the NO_FD_SET check was added
19 years ago.
2018-05-31 13:31:55 +02: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
Christoph Reiter
41165b2a7e Remove unused HAVE_LIBC_ENABLE_SECURE
It was added in 4c2928a544 to potentially enable accessing
AT_SECURE through __libc_enable_secure, but was never enabled.

Newer glibc provides getauxval(AT_SECURE) which should be used instead.
Add a TODO note for that.
2018-05-31 10:58:27 +02:00
Christoph Reiter
118332dd5c Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option
ENABLE_GC_FRIENDLY_DEFAULT was supposed to set the default for the gc friendliness
while still allowing to force enable it at runtime with G_DEBUG=gc-friendly.

With commit 943a18b564 (6 years ago) things were changed to always set it
according to the content of G_DEBUG in glib_init(), making the default unused.

Since nobody complained since then just remove the macro and the build option.
2018-05-31 07:19:12 +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
Kouhei Sutou
e8e9dbe843 build: Add missing subprojects/ to archive. Fixes #1295 2018-05-28 12:45:34 +02:00
Matthias Clasen
d5869fc597 2.57.1 2018-05-22 17:21:16 -04:00
Xavier Claessens
9d12af9ef8 configure.ac: Remove --disable-znodelete options
There is no reason to disable this linker flags, and we are not going to
add this option in our meson build system, so remove it from autotools
too to be on par. If anyone complains with a valid use-case we can add
them back.

Keeping -Bsymbolc for now because it is used for refdbg and Debian has a
package that build glib with that flag.

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