]> git.proxmox.com Git - mirror_lxcfs.git/blobdiff - meson.build
support explicit fuse version choice
[mirror_lxcfs.git] / meson.build
index f8b8806c2699392e47fe621712a15dc0e2cced85..57d2ec29474c37938fc496ebe871f0114bab0e00 100644 (file)
@@ -4,7 +4,7 @@
 project(
     'lxcfs',
     'c',
-    version: '4.0.0',
+    version: '5.0.0',
     license: 'LGPLv2+',
     default_options: [
         'b_colorout=always',
@@ -52,6 +52,7 @@ datadir = join_paths(prefixdir, get_option('datadir'))
 
 lxcfssharedir = join_paths(datadir, 'lxcfs')
 lxcconfdir = join_paths(datadir, 'lxc/config/common.conf.d')
+lxcmandir = join_paths(datadir, 'man')
 
 conf.set_quoted('BINDIR', bindir)
 conf.set_quoted('LIBDIR', libdir)
@@ -68,6 +69,7 @@ conf.set_quoted('LXCFSTARGETDIR', join_paths(localstatedir, 'lib/lxcfs'))
 # Custom configuration.
 init_script = get_option('init-script')
 want_tests = get_option('tests')
+want_docs= get_option('docs')
 
 
 # Build flags.
@@ -144,18 +146,33 @@ foreach ident: [
     conf.set10('HAVE_' + ident[0].to_upper(), have)
 endforeach
 
-libfuse = dependency('fuse3', required: false)
-if libfuse.found()
-    conf.set10('HAVE_FUSE3', true)
-    conf.set('FUSE_USE_VERSION', 30)
-else
+fuse_version = get_option('fuse-version')
+if fuse_version == '3' or fuse_version == 'auto'
+    libfuse = dependency('fuse3', required: false)
+    if libfuse.found()
+        conf.set10('HAVE_FUSE3', true)
+        conf.set('FUSE_USE_VERSION', 35)
+        if libfuse.version().version_compare('>=3.10.3')
+            conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', true)
+        else
+            conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', false)
+        endif
+    endif
+endif
+
+if fuse_version == '2' or (not libfuse.found() and fuse_version == 'auto')
     libfuse = dependency('fuse', version: '>= 2.6')
     if libfuse.found()
         conf.set10('HAVE_FUSE', true)
         conf.set('FUSE_USE_VERSION', 26)
+        conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', true)
     endif
 endif
 
+if not libfuse.found()
+       error('no usable fuse version found')
+endif
+
 libdl = cc.find_library('dl')
 threads = dependency('threads')
 
@@ -167,8 +184,7 @@ add_project_arguments('-include', 'config.h', language: 'c')
 
 # Binary.
 lxcfs_sources = files('src/lxcfs.c')
-public_programs = []
-public_programs += executable(
+lxcfs = executable(
     'lxcfs',
     lxcfs_sources,
     dependencies: [
@@ -251,6 +267,24 @@ lxcfs_spec = custom_target(
         '@OUTPUT@',
     ])
 
+# Man pages
+if want_docs == true
+    help2man = find_program('help2man')
+    help2man_opts = [
+       '--name="System virtualization filesystem for containers"',
+       '--no-discard-stderr',
+       '--section=1',
+       '--opt-include=docs/lxcfs.man.add',
+       '--no-info',
+    ]
+    custom_target('lxcfs.1',
+        output: 'lxcfs.1',
+        command: [help2man, help2man_opts, '--output=@OUTPUT@', lxcfs],
+        install: true,
+        install_dir: join_paths(lxcmandir, 'man1'))
+endif
+
+
 # Include sub-directories.
 subdir('config/init')
 subdir('share')
@@ -275,5 +309,6 @@ status = [
     'lxcfs source root directory:      @0@'.format(project_source_root),
     'init system:                      @0@'.format(init_script),
     'tests:                            @0@'.format(want_tests),
+    'documentation:                    @0@'.format(want_docs),
 ]
 message('\n         '.join(status))