aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2025-10-02 00:01:35 +0200
committerLeonard Kugis <leonard@kug.is>2025-10-02 00:01:35 +0200
commit98f6fd6d3513f65e3f065d62c647ae884830cde6 (patch)
treeaeef47284f66fb442a982d64de23ec33259b84d5
parent755e0895040bbd43a8e2f3efc7f32f366160a408 (diff)
downloadbindfs-98f6fd6d3513f65e3f065d62c647ae884830cde6.tar.gz
Introduced meson build system
-rw-r--r--meson.build78
-rw-r--r--meson_options.txt5
-rw-r--r--src/meson.build23
3 files changed, 106 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7f2adef
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,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')
+
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..fcb84af
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option('install_macos_fs_link',
+ type: 'boolean',
+ value: false,
+ description: 'Install macOS filesystems / bindfs.fs with mount_bindfs symlink')
+
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..4e72ffa
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,23 @@
+srcs = files(
+ 'bindfs.c',
+ 'debug.c',
+ 'permchain.c',
+ 'userinfo.c',
+ 'arena.c',
+ 'misc.c',
+ 'usermap.c',
+ 'rate_limiter.c',
+)
+
+# Wichtig: relative Includes!
+# '.' -> src/ (Source + Build von src/)
+# '..' -> Projekt-Root (Source + Build-Root -> dort liegt build/config.h)
+inc = include_directories('.', '..')
+
+executable('bindfs',
+ sources: srcs,
+ include_directories: inc,
+ dependencies: deps,
+ install: true
+)
+