Commit Graph

462 Commits

Author SHA1 Message Date
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
Philip Withnall
35d5add4bb build: Lower libmount dependency to 2.23
Since commit 96ebcee8c4, we don’t actually need libmount 2.28. Lower our
dependency to 2.23 so that we can continue to build against CentOS 7.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=793288
2018-02-13 14:59:03 +00:00
Philip Withnall
04b3ce7255 build: Remove incorrect to_int() calls in meson.build
They’re called on assignment to these variables.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793288
2018-02-13 14:17:11 +00:00
Philip Withnall
b716660fab build: Drop fallback checks for libmount versions without pkg-config
Building against libmount installed into a non-default prefix wasn’t
working, as we were using #include <libmount/libmount.h> rather than
the correct #include <libmount.h> — all the mount.pc pkg-config files
set `Cflags: -I${includedir}/libmount`.

Fixing this while retaining the fallback support for versions of
libmount without a pkg-config file would have been tricky (we would need
to work out a suitable -I flag to set in LIBMOUNT_CFLAGS) to still be
able to use the correct #include path). Thankfully, libmount gained
pkg-config support a long time ago, so I think we can safely drop the
fallback code. In particular, Debian Jessie, Ubuntu Trusty, and CentOS 5
all ship a mount.pc file.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793288
2018-02-13 14:17:11 +00:00
Tim-Philipp Müller
b241e3a5cc meson: only add -fno-strict-aliasing if supported by compiler
Fixes warning spam on MSVC builds.

https://bugzilla.gnome.org/show_bug.cgi?id=791622
2018-01-10 17:00:14 +00:00
Tim-Philipp Müller
f25c7a2a6e meson: fix G_DIR_SEPARATOR* define on Windows
Must double escape, once for Meson, once for the C string constant.

https://bugzilla.gnome.org/show_bug.cgi?id=757284
2018-01-10 15:57:46 +00:00
Tim-Philipp Müller
e7c044629f meson: change error() to warning() when checking if membarrier is needed
If we don't know the exact architecture that's not fatal, might just
be suboptimal, same as with autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=792338
2018-01-10 15:49:27 +00:00
Mikhail Zabaluev
6dafc1ce13 Move G_DIR_SEPARATOR* and G_SEARCHPATH_SEPARATOR* into glibconfig.h
As platform-dependent macros, they belong in glibconfig.h.
This also makes it one less place where g-ir-scanner picks definitions
from the wrong ifdef branch; see
https://bugzilla.gnome.org/show_bug.cgi?id=696935

Meson configuration support is also added in this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=757284
2018-01-09 12:08:40 +00:00
Philip Withnall
ade324f6fa build: Enable -fno-strict-aliasing
GLib makes various assumptions about aliasing throughout its codebase,
and compiling with -fstrict-aliasing has been demonstrated to cause
problems (for example, bug #791622). Explicitly disable strict aliasing
as a result.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-01-08 11:50:31 +00:00
Tim-Philipp Müller
7c8906dcda meson: skip optional linux deps that default to true when building on Windows
As 'auto' dependency checking has been declared undesirable,
skip checking of optional dependencies where the option
defaults to true, but where the option doesn't make sense for
the operating system we're building for. Example: selinux only
makes sense on Linux, people compiling on Windows or macOS
shouldn't have to specify -Dselinux=false to get glib to build.

https://bugzilla.gnome.org/show_bug.cgi?id=792129
2018-01-07 12:02:59 +00:00
Michael Catanzaro
617d40c13b Bump to version 2.55.1
So that GIO modules may begin using the static linking support.
2018-01-04 16:34:33 -06:00
Christoph Reiter
cf93b27ceb meson: fix static build under Windows
Properly define GLIB/GOBJECT_STATIC_COMPILATION when static build is enabled.
Use library() instead of shared_library() to allow selecting static builds.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:21:40 +01:00
Christoph Reiter
aa7c5cbdcb meson: build Windows resource files
configure_file() forces utf-8 atm but .rc files are not utf-8.
To work around the issue just remove the only non-ASCII char.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:19:30 +01:00
Xavier Claessens
62c4768423 Meson: Add missing options and conform to naming guidelines
https://bugzilla.gnome.org/show_bug.cgi?id=790837
2017-12-19 14:56:11 -05:00
Havard Graff
17bfc39ea7 meson: add carbon and cocoa libs when building for OSX
https://bugzilla.gnome.org/show_bug.cgi?id=791460
2017-12-14 16:21:46 +05:30
Xavier Claessens
fa8d42de2e Meson: Fix build of gtkdoc
This requires change added in Meson 0.44.0

https://bugzilla.gnome.org/show_bug.cgi?id=786796
2017-12-11 10:25:21 -05:00
Philip Withnall
0a2b238f7c build: Include host_machine.cpu_family() in tapset directory (Meson)
This is a corresponding change to meson.build to match commit
030efac077

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

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2017-11-28 15:07:47 +00:00
Jan Alexander Steffens (heftig)
69b2b5f262 meson: Fix libmount support
The define was still missing.

https://bugzilla.gnome.org/show_bug.cgi?id=789681
2017-10-31 15:24:04 +00:00
Kouhei Sutou
a79ca79a85 Fix missing zlib.h in subprojects/zlib/ with Visual Studio
https://bugzilla.gnome.org/show_bug.cgi?id=788975
2017-10-16 10:41:16 +01:00
Patrick Griffis
b5e7e39395 build: Fix enable-libmount=auto 2017-10-11 18:21:24 -04:00
Emmanuele Bassi
f40154e218 build: Look for mkostemp when configuring
We use this function, but it may be missing on older Linux platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=788705
2017-10-09 12:45:59 +01:00
Chun-wei Fan
a7a6449f4d meson: Install items according to their relevance
The m4 and bash completion items are usable and relevant
depending on the host system's configuration.  So, we check for the
presence of the programs that these items depend on, and only install
them when those programs are found.

For the Valgrind suppression files, we don't install them on Windows as
Valgrind is currently not supported on Windows.

Als fix the path where the GDB helpers are installed, as the path is
incorrectly constructed.

This will fix the "install" stage when building on Visual Studio at
least as there are some post-install steps that are related to them,
which will make use of these programs.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-09-14 16:02:03 +08:00
Philip Withnall
d5933142c8 build: Bump version to 2.55.0
Ready for the new unstable release series.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-11 19:25:56 +01:00
Matthias Clasen
738eff5dec 2.54.0 2017-09-10 20:18:10 -04:00
Matthias Clasen
052f134528 2.53.7 2017-09-04 09:02:53 -04:00
Matthias Clasen
fd081f38b6 2.53.6 2017-08-19 09:48:14 -04:00
Chun-wei Fan
54aee1f627 Meson: Set _WIN32_WINNT to 0x0601 (Windows 7)
We want to set _WIN32_WINNT so that functions will be properly found in
the headers, to target the NT6.1+ (Windows 7+) APIs.

Also improve the checks for if_nametoindex() and if_indextoname() on
Windows as they are supported in Windows Vista+, but they have
to be checked by linking against iphlpapi.lib (or -liphlpapi).  On other
platforms, they are still checked as they were before.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 23:40:35 +08:00
Chun-wei Fan
ea6ac5f71e meson/Windows: Check whether system PCRE is a static build
Instead of hardcoding -DPCRE_STATIC into the CFLAGS of GLib, do the
following on Windows only (since PCRE_STATIC only matters on Windows):

-If there is no installed PCRE, use the included PCRE copy and
 enable -DPCRE_STATIC, as we did before.
-If there is a installed PCRE, check whether the PCRE build is a static
 or DLL build by checking the linkage against pcre_free() with
 PCRE_STATIC defined works.  If it does, enable -DPCRE_STATIC.
-On non-Windows builds, do not enable -DPCRE_STATIC

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 18:26:02 +08:00
Chun-wei Fan
72528938b7 Meson: Check for HAVE_GOOD_PRINTF
The HAVE_GOOD_PRINTF config variable determines whether we are able to
use the CRT-supplied *printf() functions directly, by determining whether
the CRT-supplied vsnprintf() and snprintf() functions support C99 well
enough.

This means, we need to build the gnulib subdir as a static lib in GLib, and use
the gnulib *printf() functions when:

-We are on Windows
-The CRT's vsnprintf() and snprintf() is not sufficiently C99-compliant.

This will fix the problem when the *printf() functions cause a CRT
abort() call on pre-2015 Visual Studio builds at least, and ensures that
the Visual Studio 2015+ builds will pass the printf tests in GLib, since
the *printf() in Visual Studio 2015/2017's CRT does not support the %n
format specifier, nor the positional parameters (which requires
different _*printf_p*() functions), as indicated by
glib/tests/test-printf.c.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:46:37 +08:00
Chun-wei Fan
79b84ba3fc meson: Install msvc_recommended_pragmas.h on Windows
Copy the msvc_recommended_pragmas.h helper header when we build for
Windows, so that people developing/using GLib on Windows can make use
of them in Visual Studio, so that unwanted compiler noise can be
filtered out and code with potentially-problematic warnings can be
attended to.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:19:43 +08:00
Chun-wei Fan
32d6a76b98 build: Use Meson's find_library() for MSVC builds as needed
Some of the dependencies' build systems for Visual Studio do not provide a
pkg-config file upon build, so we use find_library() for them when the
corresponding pkg-config files are not found during Visual Studio builds,
so that one will not need to make up pkg-config files for them, which
could be error-prone.  These .lib names match the names that are built
with the officially supported build system that is used by their
respective Visual Studio support.

For ZLib, this will make gio-2.0.pc reflect on the zlib .lib based on
what is found, or whether we use the fallback/bundled ZLib, when we
don't have a pkg-config file for ZLib on MSVC.  We still need to depend
on Meson to be updated to put the correct link argument for linking ZLib
in the pkg-config case.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:17:59 +08:00
Nirbheek Chauhan
4c46869081 meson: Always define _GNU_SOURCE for pthread checks
Without this, GNU-specific symbols won't be defined and the compiler
check will pass because GCC will assume that you know what you're
doing since it doesn't know what the symbol prototype is and compiler
checks aren't built with -Wall -Werror.

This will then cause a build failure because the wrong prototype will
be used.
2017-08-14 21:49:22 +05:30
Emmanuele Bassi
50eeb24415 meson: Update the pthread feature checks
For GNU extensions, we need to define _GNU_SOURCE; but, more
importantly, we need to tell Meson to use the threadlib dependency when
compiling and linking the feature check.

This currently exposes a bug in Meson; see:

https://github.com/mesonbuild/meson/issues/2165

But once that's fixed, the check will work as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=785955
2017-08-10 14:36:11 +01:00
Emmanuele Bassi
1a755a63e1 meson: Define _GNU_SOURCE as a project argument
We use it pretty much everywhere in order to get feature detection, and
that's also what the AC_USE_SYSTEM_EXTENSIONS m4 macro defines in the
Autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=785955
2017-08-10 14:36:11 +01:00
Matthias Clasen
47e10489c5 2.53.5 2017-08-07 12:35:17 -04:00
Emmanuele Bassi
bfd307855b meson: Allow toggling internal/system PCRE dependency
We don't always want to build GLib with a dependency on the system's
PCRE. The Autotools build allows this, and so should the Meson build.
2017-07-21 14:04:49 +01:00
Christoph Reiter
be7c3ae611 meson: set glib_extension in glibconfig.h to match the autotools output
https://bugzilla.gnome.org/show_bug.cgi?id=784995
2017-07-19 16:39:44 +02:00
Christoph Reiter
cb0c224e94 meson: use set_quoted() instead of quoting manually
https://bugzilla.gnome.org/show_bug.cgi?id=784995
2017-07-19 16:39:14 +02:00
Christoph Reiter
ab6e425574 meson: define G_PID_FORMAT
https://bugzilla.gnome.org/show_bug.cgi?id=784995
2017-07-19 16:38:37 +02:00
Tim-Philipp Müller
2ac8079b94 meson: fix unit tests and "Invalid byte sequence in conversion input"
Check if strerror_r returns a char * and define STRERROR_R_CHAR_P
if so, which is needed by g_strerror() since c8e268b

https://bugzilla.gnome.org/show_bug.cgi?id=784000
2017-07-19 10:34:45 +01:00
Emmanuele Bassi
3c03cc8f68 meson: Simplify the use of built tools
The Meson build has fallen a bit behind the Autotools one, when it comes
to the internally built tools like glib-mkenums and glib-genmarshals.

We don't need to generate gmarshal.strings any more, and since the
glib-genmarshal tool is now written in Python it can also be used when
cross-compiling, and without indirection, just like we use glib-mkenums.

We can also coalesce various rules into a simple array iteration, with
minimal changes to glib-mkenums, thus making the build a bit more
resilient and without unnecessary duplication.
2017-07-17 11:05:07 +01:00
Chun-wei Fan
5ba3b4022e meson.build: Improve checks for va_copy() and __va_copy()
On Visual Studio, the compilation of the check program for va_copy() and
__va_copy() succeeds even though they may not be really available.  So,
make sure we include msvc_recommended_pragmas.h which helps us to detect
this situation by bailing out when warning C4013 (which means this
function is really not available) is encountered.

Also make sure that on Visual Studio builds we always include
msvc_recommended_pragmas.h is included so that it helps us to find out
problems in the build, and update comments for dirent.h and sys/time.h
as they are not shipped with any Visual Studio.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-07-17 14:50:55 +08:00
Emmanuele Bassi
1eda0627f3 meson: Use the appropriate libdir-relative paths 2017-07-14 14:21:57 +01:00
Emmanuele Bassi
065a8a488a meson: Use the appropriate interface and binary ages
We need to build them out of the project version, and then propagate
them.
2017-07-14 14:21:57 +01:00
Emmanuele Bassi
37ff4189fd meson: Sync the version with Autotools 2017-07-14 14:21:57 +01:00
Tim-Philipp Müller
4268372fae meson: error out if atomic ops would be available with -march=i486
Same as autotools build.
2017-07-13 19:03:39 -04:00
Thibault Saunier
0689231bd6 meson: Fix the build defining HAVE_RTLD_X
Otherwise RTLD_XXX get redefined.

https://bugzilla.gnome.org/show_bug.cgi?id=784133
2017-07-13 19:03:39 -04:00
Thibault Saunier
1d30c9eebc meson: Defining MAJOR_IN_ as done by AC_HEADER_MAJOR
https://bugzilla.gnome.org/show_bug.cgi?id=784133
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
03eac5fac5 meson: rebase on top of master ~2.53.1
From 2.51.2
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
2e9fd74b25 meson: add tests/gobject and tests/refcount 2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
dd8ff54736 meson: Use Python port of glib-mkenums
This reduces the build-time dependencies of glib to only Python 3,
Meson, and git. Git is also optional if you provide a tarball in
which the subproject directories already exist.

The Python port was done by Jussi Pakkanen on bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=779332

This version contains some fixes from that and also changes all
instances of `@` to `\u0040` because Meson does not yet provide a
configure_file() mode that ignores unknown @MACRO@ values.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
ee94ad776e meson: Use proxy-libintl if gettext is not found
This is a stub-only library that can be used while building against
MSVC and contains no i18n machinery at all.

The dependencies added indirectly use the libintl.h header, and when
built as a subproject, the header won't be in a path known the
pre-processor.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fb1f52e32f meson: Only require libmount on Linux
It's not available on other platforms, so don't require the user to
explicitly disable it there.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
eb07a2c87d meson: Allow using libffi and zlib as subprojects
Also use the python3 module to find python3, and require Meson 0.37.1
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
2f792f6484 meson: Print output for more compiler checks
When no 'name:' kwarg is specified for cc.run, no output is printed.

This makes it difficult to figure out what is causing a pause in the
configure process.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
88e437873a meson: Detect with-docs and with-man automatically
By default, only build man pages and gtk-doc if the build-deps were
found. To force-enable, pass -Dwith-docs=yes and -Dwith-man=yes.

Also use a foreach loop for man pages instead of listing them all
manually
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
5549a1d0c3 meson: Rebase and update to 2.51.2 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
2f29ee1735 meson: add -fvisibility=hidden explicitly to selected targets
Don't use it project-wide for building everything. Otherwise
symbols for shared modules won't be exposed, e.g. in the
resourceplugin used by the gio resource unit test.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
1224ff0c39 meson: use add_project_arguments() instead of add_global_arguments()
add_global_arguments() doesn't work if the project is used as a
subproject.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
d29f022b0b meson: add support for dtrace/systemtap
Still at least one FIXME. And untested so far. It builds.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
5afc6600e8 meson: Add missing termios.h check
Same change as d1d1aba3b4

https://bugzilla.gnome.org/show_bug.cgi?id=775517
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
9096bde3ce build: Remove function checks for unused functions
These were removed several years ago.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
70021b0e83 meson: Derive defines from header, struct, function names
This is what Autoconf macros do too, so no need to hard-code the names.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
e2da3cb599 meson: Port to latest master (2.51.0)
Also remove headers from some gio sources. Headers do not need to be
added to the list of sources.

+ various smaller self-explanatory fixes.
2017-07-13 19:03:39 -04:00
Patrick Griffis
d10be6102f meson: Minor modernizations 2017-07-13 19:03:39 -04:00
Patrick Griffis
0df9aab053 meson: Build all docs 2017-07-13 19:03:39 -04:00
Patrick Griffis
c61a72f4bc meson: Match soname version of autotools 2017-07-13 19:03:39 -04:00
Patrick Griffis
a690e2a375 meson: More build fixes
- Fix installing various data files
- Build translations
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
213957970e meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files.

Lots of tests have also been added, and glib tests pass now.
2017-07-13 19:03:39 -04:00
Jussi Pakkanen
98e641424b meson: initial glib build
https://mail.gnome.org/archives/gtk-devel-list/2013-August/msg00001.html
2017-07-13 19:03:39 -04:00