diff --git a/configure.ac b/configure.ac index 2ab633648..5804d8020 100644 --- a/configure.ac +++ b/configure.ac @@ -1651,8 +1651,7 @@ FAM_LIBS= if test "x$should_disable_fam" = "xno"; then AC_CHECK_LIB(fam, FAMOpen, [AC_CHECK_HEADERS(fam.h, - [AC_DEFINE(HAVE_FAM, [], [Define if we have FAM]) - AC_CHECK_LIB(fam, FAMNoExists, + [AC_CHECK_LIB(fam, FAMNoExists, AC_DEFINE(HAVE_FAM_NO_EXISTS, [], [Define if we have FAMNoExists in fam])) FAM_LIBS="-lfam"] fam_support=yes, diff --git a/gio/Makefile.am b/gio/Makefile.am index 7c7f247c0..8e46d6f87 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -820,6 +820,7 @@ gio-2.0.lib: libgio-2.0.la gio.def $(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@ bin_PROGRAMS = gio-querymodules glib-compile-schemas glib-compile-resources gsettings +EXTRA_DIST += gio-querymodules-wrapper.py glib_compile_resources_LDADD = libgio-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \ diff --git a/gio/fam/gfamfilemonitor.map b/gio/fam/gfamfilemonitor.map new file mode 100644 index 000000000..43ed5a77c --- /dev/null +++ b/gio/fam/gfamfilemonitor.map @@ -0,0 +1,8 @@ +{ +global: + g_io_module_load; + g_io_module_unload; + g_io_module_query; +local: + *; +}; diff --git a/gio/fam/meson.build b/gio/fam/meson.build new file mode 100644 index 000000000..fdbdd15c6 --- /dev/null +++ b/gio/fam/meson.build @@ -0,0 +1,36 @@ +# FIXME: We should use subdir_done() instead of if blocks, but it's broken in +# meson 0.46.1. See https://github.com/mesonbuild/meson/issues/3700. +if get_option('fam') + fam_dep = cc.find_library('fam') + fam_c_args = ['-DG_DISABLE_DEPRECATED'] + gio_c_args + if cc.has_function('FAMNoExists', dependencies : fam_dep) + fam_c_args += '-DHAVE_FAM_NO_EXISTS=1' + endif + + deps = [ + fam_dep, + libglib_dep, + libgobject_dep, + libgio_dep, + ] + + symbol_map = join_paths(meson.current_source_dir(), 'gfamfilemonitor.map') + fam_ldflags = cc.get_supported_link_arguments([ + '-Wl,--version-script,' + symbol_map, + '-Wl,-no-undefined', + ]) + + module = shared_module('giofam', 'gfamfilemonitor.c', + include_directories : [gmoduleinc], + dependencies : deps, + c_args : fam_c_args, + link_args : fam_ldflags, + link_depends : symbol_map, + install_dir : glib_giomodulesdir, + install : true, + ) + + if not meson.is_cross_build() + meson.add_install_script('../gio-querymodules-wrapper.py', gio_querymodules.full_path(), glib_giomodulesdir) + endif +endif diff --git a/gio/gio-querymodules-wrapper.py b/gio/gio-querymodules-wrapper.py new file mode 100644 index 000000000..8960540b4 --- /dev/null +++ b/gio/gio-querymodules-wrapper.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import sys + +if not os.environ.get('DESTDIR'): + print('GIO module cache creation...') + subprocess.call([sys.argv[1], sys.argv[2]]) diff --git a/gio/meson.build b/gio/meson.build index 355510ef1..60b433ce8 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -753,11 +753,6 @@ if host_system == 'windows' internal_deps += [ giowin32_lib ] endif -# FIXME: FAM support -#if HAVE_FAM -# subdir('fam') -#endif - if have_bash install_data([ 'completion/gapplication', @@ -894,7 +889,7 @@ executable('gresource', 'gresource-tool.c', link_args : noseh_link_args, dependencies : [libelf, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) -executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', +gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', install : true, c_args : gio_c_args, # intl.lib is not compatible with SAFESEH @@ -952,6 +947,8 @@ if enable_systemtap install : true) endif +subdir('fam') + if host_system != 'windows' subdir('tests') endif diff --git a/meson_options.txt b/meson_options.txt index 3d816d365..5245e0a8b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -73,3 +73,8 @@ option('force_posix_threads', type : 'boolean', value : false, description : 'Also use posix threads in case the platform defaults to another implementation (on Windows for example)') + +option('fam', + type : 'boolean', + value : false, + description : 'Use fam for file system monitoring')