1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
project(
'bindfs',
'c',
version: '0.0.0',
default_options: ['warning_level=2', 'c_std=gnu11']
)
cc = meson.get_compiler('c')
# ---- Abhängigkeiten ----
# Bevorzuge FUSE2 (alte API), falle auf FUSE3 zurück.
fuse_dep = dependency('fuse', required: false) # pkg-config: fuse (FUSE2)
if fuse_dep.found()
add_project_arguments('-DFUSE_USE_VERSION=26', language: 'c') # FUSE2 API
else
fuse_dep = dependency('fuse3', required: true)
add_project_arguments('-DFUSE_USE_VERSION=30', language: 'c') # FUSE3 API
add_project_arguments('-DBINDFS_USE_FUSE3', language: 'c')
endif
threads_dep = dependency('threads', required: true)
dl_dep = cc.find_library('dl', required: true)
rt_dep = cc.find_library('rt', required: false)
iconv_dep = dependency('iconv', required: false)
deps = [fuse_dep, threads_dep, dl_dep]
if rt_dep.found()
deps += rt_dep
endif
if iconv_dep.found()
deps += iconv_dep
endif
# ---- Allgemeine Compiler-Flags ----
# GNU-Extensions (pipe2 etc.) & große Offsets.
add_project_arguments(
'-D_GNU_SOURCE',
'-D_FILE_OFFSET_BITS=64',
# S_ISDIR etc.: stellt sicher, dass <sys/stat.h> überall drin ist
'-include', 'sys/stat.h',
language: 'c'
)
# ---- Feature-Checks (ersetzt configure.ac) ----
# Achtung: passende Includes pro Funktion setzen.
have_pipe2 = cc.has_function('pipe2', prefix: '#include <unistd.h>')
have_posix_spawn = cc.has_function('posix_spawn', prefix: '#include <spawn.h>')
have_copy_file_range = cc.has_function('copy_file_range', prefix: '#include <unistd.h>')
# Utimens-Varianten – bindfs.c entscheidet anhand dieser Makros:
have_utimensat = cc.has_function('utimensat', prefix: '#define _GNU_SOURCE\n#include <sys/stat.h>\n#include <fcntl.h>')
have_lutimes = cc.has_function('lutimes', prefix: '#include <sys/time.h>')
have_futimesat = cc.has_function('futimesat', prefix: '#include <sys/time.h>\n#include <fcntl.h>\n#include <unistd.h>')
conf = configuration_data()
conf.set('HAVE_PIPE2', have_pipe2)
conf.set('HAVE_POSIX_SPAWN', have_posix_spawn)
conf.set('HAVE_COPY_FILE_RANGE', have_copy_file_range)
# Diese drei sind wichtig, damit der #error in bindfs_utimens nicht triggert:
conf.set('HAVE_UTIMENSAT', have_utimensat)
conf.set('HAVE_LUTIMES', have_lutimes)
conf.set('HAVE_FUTIMESAT', have_futimesat)
# Autotools-kompatible Makros, die der Code nutzt
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
# Exakt "config.h" erzeugen (liegt im Build-Root)
configure_file(output: 'config.h', configuration: conf)
# ---- Unterverzeichnisse ----
subdir('src')
# ---- Manpage installieren ----
install_data('src/bindfs.1', install_dir: get_option('mandir') / 'man1')
|