Commit Graph

64 Commits

Author SHA1 Message Date
Xavier Claessens
475f0a9b67 Meson: Fix deprecation warning with 0.49.0 release
http://mesonbuild.com/Release-notes-for-0-49-0.html#deprecation-warning-in-pkgconfig-generator
2018-12-10 09:08:28 -05:00
Xavier Claessens
93555577c5 Meson: Add missing include_directories when using glib as subproject
When using glib as subproject we are forced to pass glib_dep,
gobject_dep and gio_dep to any build target. If we pass only gio_dep it
will missing include directory for glib and gobject.
2018-11-24 20:52:01 -05:00
Nirbheek Chauhan
8b3590c231 meson: Add macOS libtool versioning for ABI compatibility
With this, the compatibility version and current version values in macOS
and iOS dylibs will match the values set by Autotools.

See: https://github.com/mesonbuild/meson/issues/1451
2018-10-22 06:51:32 +05:30
Simon McVittie
62af03bda8 Meson: Extract objects from convenience libraries to link them
This avoids the convenience library being treated as though it was
an installed static library (objects not included in the dependent
static library, and convenience library being listed in the pkg-config
metadata), both of which would make static linking impossible.
This is a workaround for meson not having
https://github.com/mesonbuild/meson/pull/3939 merged yet.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1536
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-28 15:15:48 +01:00
Руслан Ижбулатов
ad3694b82a Enable GIO tests on Windows
1) Remove the non-Windows-only condition for subdir('tests').
2) Add libiphlpapi, libws2_32 and libsecur32 deps, needed for W32 tests.
3) Remove the -no-undefined argument (gcc doesn't understand it,
   it *does* understand -Wl,-no-undefined; either way, the test
   compiles without this argument just fine; maybe meson adds it
   by itself - you can hardly build shared modules without it).
4) Add or fix a number of includes
5) Disable gdbus-objectmanager tests when building with MSVC
   (right now these tests don't work on Windows anyway, so the fact
    that MSVC can't even build them properly is irrelevant;
    most likely gdbus-codegen needs changes to put _GLIB_EXTERN
    before each function)
2018-09-12 15:42:11 +00:00
Iñigo Martínez
64e9e1f482 gio: Provide schemas directory information in pkg-config file
GSettings XML schema files are installed in a well known directory
under Glib's installation directory: `glib-2.0/schemas`. However,
the Glib installation directory might vary, so the exact location of
the schema files might be unknown.

The information regarding this directory has been added to GIO's
pkg-config file, so it can be checked, and also overrided, by using
the command line utility.
2018-08-27 13:50:34 +02: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
Matthias Clasen
7217fe56e0 Stop generating code for NetworkMonitor
The portal implementation no longer uses generated
code for org.freedesktop.portal.NetworkMonitor.
2018-07-21 08:21:43 -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
742efe6232 gdesktopappinfo: enable fast posix_spawn gspawn codepath
In order to use the new posix_spawn gspawn codepath, for more robust
app launching when available memory is low, we need to meet some
conditions.

child_setup needs to be NULL for this optimization to work, so drop
the internal child_setup that is used here. Replace it with a lightweight
wrapper binary (gio-launch-desktop) that sets GIO_LAUNCHED_DESKTOP_FILE_PID
before executing the app.

Adjust PATH for gio tests so that it can execute the new binary from the
build directory.
2018-06-21 11:44:28 -05:00
Ondrej Holy
e0e0f259c3 gio: Add bash completion for gio tool
GVfs utils used to have bash completion, which was pretty useful. However,
it hasn't been ported to gio tool unfortunately. GLib provides completion
for various utils already, so it would be nice to provide completion also
for gio tool. I've updated old bash completion code and merged with some
my old unmerged fixes.

The gvfs completion used "gvfs-ls --show-completions" helper. This mentioned
option hasn't been obviously ported to "gio list" and the proposed completion
doesn't add this option in "gio list" to not pollute the codes, but maybe it
is a bit slower as consequence.

The proposed bash completion suggests subcommands, uris and paths including
the remote mounts. It contains some workarounds, especially because of proper
handling of paths with colons and other special chars (like spaces)...
2018-06-15 12:34:10 +02: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
Ting-Wei Lan
a77790330b meson: libelf.pc is not always available
libelf, just like libc, is not a single project. It is an interface
which can be implemented independently by different operating systems.
Therefore, we cannot expect all systems to provide a .pc file, and we
should fallback to cc.find_library and cc.has_function like what we
already do in autotools build.
2018-06-09 09:40:51 +08:00
Xavier Claessens
b04142a24f Merge branch 'fam' into 'master'
Meson: Build fam module

See merge request GNOME/glib!71
2018-06-07 15:18:38 +00:00
Xavier Claessens
077e9f04c1 Meson: Build fam module
gio-querymodules-wrapper.py is copied from glib-networking. This python
wrapper script is needed because meson.build cannot check for DESTDIR
env variable itself, unlike Makefile.am. It is used to update
giomodule.cache file when installing GIO modules like fam.
2018-06-07 10:38:20 -04: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
Xavier Claessens
d3735df34f Revert "Revert "Meson: Fix cocoa and carbon support""
This reverts commit e25a2f95b3.
2018-05-25 03:06:07 +00:00
Xavier Claessens
ead46cdc7e Revert "Revert "Rename objective-c files from .c to .m""
This reverts commit 2e9f3a9afe.
2018-05-25 03:06:07 +00:00
Matthias Clasen
2e9f3a9afe Revert "Rename objective-c files from .c to .m"
This reverts commit e400af99d4.
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
Xavier Claessens
e400af99d4 Rename objective-c files from .c to .m
Those files got renamed to .c to work around an automake issue, but
Meson needs them to have .m extension. Better rename them at build time
in Makefile.am since that's where the workaround is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=672777
2018-05-22 11:49:24 -04:00
Xavier Claessens
7b8d8835f5 Meson: libintl is a public dependency of glib-2.0
On non-glibc platforms gettext is provided by extra libintl dependency.
We wrongly thought libintl is an internal dependency and applications
needs to explicitly link on it, but turns out that breaks many
applications and with autotools the .pc generated actually has -lintl in
public "Libs:".

https://bugzilla.gnome.org/show_bug.cgi?id=796085
2018-05-15 13:00:44 -04:00
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
Xavier Claessens
7efd76dd67 struct ip_mreq_source definition is broken on Android NDK <= r16
This fix the build on Android r16 and older, see:
https://issuetracker.google.com/issues/36987220

https://bugzilla.gnome.org/show_bug.cgi?id=740791
2018-04-24 15:00:17 -04:00
Xavier Claessens
30c2ea4c53 Meson: Use cc.has_type() instead of our own snippet
https://bugzilla.gnome.org/show_bug.cgi?id=740791
2018-04-20 15:47:31 -04:00
Philip Withnall
b868cf5864 gio: Add dummy win32 notification backend
This adds a null notification backend implementation for win32, purely
to avoid crashes due to a missing backend when applications use
GNotification. This backend does nothing except print a warning when a
notification is supposed to be emitted.

In future, it can be expanded to use win32 API to present toaster
notifications appropriately.

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

https://bugzilla.gnome.org/show_bug.cgi?id=776583
2018-04-10 10:39:40 +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
Ernestas Kulik
03e86d000f Remove HAVE_CONFIG_H defs and uses
Since GLib files are only meant to be built as part of GLib, config.h
always exists, so the checks are more or less pointless.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-21 13:57:10 +00:00
Philip Withnall
0cd5127494 build: Fix Meson checks for res_nclose() and res_ndestroy()
The checks wouldn’t compile, and hence would always fail.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793291
2018-02-13 14:18:34 +00:00
Philip Withnall
40be86bb0e gio: Port GThreadedResolver to use res_nquery() to fix thread-safety
res_query() uses global state in the form of the struct __res_state
which contains the contents of resolv.conf (and other things). On Linux,
this state seems to be thread-local, so there is no problem. On OS X,
however, it is not, and hence multiple res_query() calls from parallel
threads will compete and return bogus results.

The fix for this is to use res_nquery(), introduced in BIND 8.2, which
takes an explicit state argument. This allows us to manually store the
state thread-locally. If res_nquery() isn’t available, we fall back to
res_query(). It should be available on OS X though. As a data point,
it’s available on Fedora 27.

There’s a slight complication in the fact that OS X requires the state
to be freed using res_ndestroy() rather than res_nclose(). Linux uses
res_nclose().

(See, for example, the NetBSD man page:
https://www.unix.com/man-page/netbsd/3/res_ninit/. The Linux one is
incomplete and not so useful:
http://man7.org/linux/man-pages/man3/resolver.3.html.)

The new code will call res_ninit() once per res_nquery() task. This is
not optimal, but no worse than before — since res_query() was being
called in a worker thread, on Linux, it would implicitly initialise the
thread-local struct __res_state when it was called. We’ve essentially
just made that explicit. In practical terms, this means a
stat("/etc/resolv.conf") call per res_nquery() task.

In future, we could improve this by using an explicit thread pool with
some manually-created worker threads, each of which initialises a struct
__res_state on spawning, and only updates it on receiving
the #GResolver::reload signal.

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

https://bugzilla.gnome.org/show_bug.cgi?id=792050
2018-02-02 18:05:27 +01:00
Philip Withnall
ba976f13b6 gio: Rename gnetworkmonitorwindows to gwin32networkmonitor
This makes it more consistent with the other win32 objects in GIO. This
commit just renames the files; a follow-up commit will rename the
GObject.

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

https://bugzilla.gnome.org/show_bug.cgi?id=685442
2018-01-17 12:59:51 +00:00
Jan-Michael Brummer
f9aacf3952 GNetworkMonitorWindows: Add IPv4/IPv6 network monitor backend for windows
Added a Windows backend to GNetworkMonitor, using NotifyRouteChange2()
(available on Vista and later). It marshals the route change callbacks
to the thread-specific default main context the GNetworkMonitor was
constructed in.

https://bugzilla.gnome.org/show_bug.cgi?id=685442
2018-01-17 12:31:26 +00: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
7f69b828fc GIOModule: Use unique names for load/unload symbols
GIO modules should include their name into their exported symbols to
make them unique. This avoids symbol clash when building modules
statically.

extract_name() function is copied from GStreamer which recently
switched to the same symbol naming scheme.

https://bugzilla.gnome.org/show_bug.cgi?id=684282
2018-01-04 11:01:40 -05: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
5f83cd3add meson.build: make the android-check reflect the autotools one
In autotools this same check reads:

AS_IF([test $glib_native_android != yes]

with glib_native_android being defined as:

case $host in
  *android*)
    glib_native_android="yes"
    ;;
  *)
    glib_native_android="no"
    ;;
esac

This is needed to be able to compile on OSX.

https://bugzilla.gnome.org/show_bug.cgi?id=791460

Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>
2017-12-14 16:21:46 +05:30
Nirbheek Chauhan
7a9d92702e meson: Create gio-unix and gio-win32 internal deps
These are useful when using glib as a subproject and you want to use
gio-unix-2.0 or gio-win32-2.0.
2017-11-24 12:40:43 +05:30
Nirbheek Chauhan
bd22bb9898 meson: Use files() for gio sources and headers
This allows them to be fetched with subproject().get_variable(). Needed
for generating Gio-2.0.gir in the gobject-introspection meson port.
2017-11-23 23:03:57 +05:30
Julien Isorce
ea725a6414 gio: add g_socket_join_multicast_group_ssm (IGMPv3 SSM)
It adds support for source-specific multicast IGMPv3.

Allow receiving data only from a specified source when joining
a multicast group.

g_socket_join_multicast_group_ssm can be called multiple times
to allow receiving data from more than one source.

Support IPv4 and IPv6.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740791
2017-10-16 11:14:57 +01:00
Nirbheek Chauhan
b444ae0de2 meson: Improve gdbus-codegen custom target dependencies
Ensure that the custom targets that use gdbus-codegen get rebuilt when
any of the gdbus-codegen files are changed.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 16:55:39 +05:30
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
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
Matthias Clasen
653be67d7d Add gopenuriportal.c to the meson build
This was added recently.
2017-07-13 19:34:21 -04:00
Alessandro Decina
4db695bfb7 meson: replace meson.current_source_dir() with files()
As the meson reference doc says, files() is preferred over building
paths with current_source_dir().
2017-07-13 19:03:39 -04:00
Alessandro Decina
266bc1e510 meson: fix wrong #include's for gdbus_codegen files
When building glib as a subproject, #include's for xdp-dbus.h from xdp-dbus.c
and for gdbus-daemon-generated.h from gdbus-daemon-generated.c were generated as
being prefixed with the subproject prefix, eg
 #include "subproject/glib/gio/gdbus-daemon-generated.h".
That failed since the root of the build directory is obviously not part of the
include path when building a subproject.

Passing --output-directory @OUTDIR@ to gdbus-codegen and removing @OUTDIR@ from
--generate-c-code fixes the issue.
2017-07-13 19:03:39 -04:00
Thibault Saunier
eb2196e89d meson: Fix building as a subproject
meson.source_root() returns the toplevel source directory
of the toplevel project, thus the paths were wrong when using
it. Simply using files() gets us the right path

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