16881f68fSopenharmony_cilibfuse_sources = ['fuse.c', 'fuse_i.h', 'fuse_loop.c', 'fuse_loop_mt.c',
26881f68fSopenharmony_ci                   'fuse_lowlevel.c', 'fuse_misc.h', 'fuse_opt.c',
36881f68fSopenharmony_ci                   'fuse_signals.c', 'buffer.c', 'cuse_lowlevel.c',
46881f68fSopenharmony_ci                   'helper.c', 'modules/subdir.c', 'mount_util.c',
56881f68fSopenharmony_ci                   'fuse_log.c', 'compat.c' ]
66881f68fSopenharmony_ci
76881f68fSopenharmony_ciif host_machine.system().startswith('linux')
86881f68fSopenharmony_ci   libfuse_sources += [ 'mount.c' ]
96881f68fSopenharmony_cielse
106881f68fSopenharmony_ci   libfuse_sources += [ 'mount_bsd.c' ]
116881f68fSopenharmony_ciendif
126881f68fSopenharmony_ci
136881f68fSopenharmony_cideps = [ thread_dep ]
146881f68fSopenharmony_ciif private_cfg.get('HAVE_ICONV')
156881f68fSopenharmony_ci   libfuse_sources += [ 'modules/iconv.c' ]
166881f68fSopenharmony_ci   libiconv = cc.find_library('iconv', required: false)
176881f68fSopenharmony_ci   if libiconv.found()
186881f68fSopenharmony_ci      deps += [ libiconv ]
196881f68fSopenharmony_ci   endif
206881f68fSopenharmony_ciendif
216881f68fSopenharmony_ci
226881f68fSopenharmony_cilibdl = cc.find_library('dl', required: false)
236881f68fSopenharmony_ciif libdl.found()
246881f68fSopenharmony_ci   deps += [ libdl ]
256881f68fSopenharmony_ciendif
266881f68fSopenharmony_ci
276881f68fSopenharmony_ciif host_machine.system().startswith('netbsd')
286881f68fSopenharmony_ci   deps += [ cc.find_library('perfuse'),
296881f68fSopenharmony_ci             cc.find_library('puffs') ]
306881f68fSopenharmony_cielse
316881f68fSopenharmony_ci   # Required for clock_gettime before glibc 2.17
326881f68fSopenharmony_ci   deps += cc.find_library('rt')
336881f68fSopenharmony_ciendif
346881f68fSopenharmony_ci
356881f68fSopenharmony_cifusermount_path = join_paths(get_option('prefix'), get_option('bindir'))
366881f68fSopenharmony_cilibfuse = library('fuse3', libfuse_sources, version: meson.project_version(),
376881f68fSopenharmony_ci                  soversion: '3', include_directories: include_dirs,
386881f68fSopenharmony_ci                  dependencies: deps, install: true,
396881f68fSopenharmony_ci                  link_depends: 'fuse_versionscript',
406881f68fSopenharmony_ci                  c_args: [ '-DFUSE_USE_VERSION=312',
416881f68fSopenharmony_ci                            '-DFUSERMOUNT_DIR="@0@"'.format(fusermount_path) ],
426881f68fSopenharmony_ci                  link_args: ['-Wl,--version-script,' + meson.current_source_dir()
436881f68fSopenharmony_ci                              + '/fuse_versionscript' ])
446881f68fSopenharmony_ci
456881f68fSopenharmony_cipkg = import('pkgconfig')
466881f68fSopenharmony_cipkg.generate(libraries: [ libfuse, '-lpthread' ],
476881f68fSopenharmony_ci             libraries_private: '-ldl',
486881f68fSopenharmony_ci             version: meson.project_version(),
496881f68fSopenharmony_ci             name: 'fuse3',
506881f68fSopenharmony_ci             description: 'Filesystem in Userspace',
516881f68fSopenharmony_ci             subdirs: 'fuse3')
526881f68fSopenharmony_ci
536881f68fSopenharmony_cilibfuse_dep = declare_dependency(include_directories: include_dirs,
546881f68fSopenharmony_ci                                 link_with: libfuse, dependencies: deps)
55