aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--Makefile.am6
-rw-r--r--README.md38
-rw-r--r--meson.build59
-rw-r--r--sshfs.1.in4
5 files changed, 99 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 1850ce5..dba14eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
Unreleased Changes
------------------
+* Added support for building with Meson.
* Added support for more SSH options.
* Dropped support for the *nodelay* workaround.
diff --git a/Makefile.am b/Makefile.am
index 72c771e..e34fbb3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,14 +15,14 @@ sshfs_CFLAGS = $(SSHFS_CFLAGS)
sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\" \
-DIDMAP_DEFAULT="\"$(IDMAP_DEFAULT)\""
-EXTRA_DIST = sshfs.1.in
+EXTRA_DIST = sshfs.1.in meson.build
CLEANFILES = sshfs.1 sshfs.1.tmp
dist_man_MANS = sshfs.1
sshfs.1: sshfs.1.in
$(AM_V_GEN)sed \
- -e 's,__IDMAP_DEFAULT__,$(IDMAP_DEFAULT),g' \
- -e 's,__UNMOUNT_COMMAND__,$(UNMOUNT_COMMAND),g' \
+ -e 's/[@]IDMAP_DEFAULT@/$(IDMAP_DEFAULT)/g' \
+ -e 's/[@]UNMOUNT_COMMAND@/$(UNMOUNT_COMMAND)/g' \
<$(srcdir)/sshfs.1.in >sshfs.1.tmp || exit 1; \
mv sshfs.1.tmp sshfs.1
diff --git a/README.md b/README.md
index b574ff3..ca06dd0 100644
--- a/README.md
+++ b/README.md
@@ -49,15 +49,45 @@ instead. Finally, you need the
(which should be available from your operating system's package
manager).
-To compile and install SSHFS, extract the tarball and run:
+To build and install, we recommend to use
+[Meson](http://mesonbuild.com/) (version 0.38 or newer) and
+[Ninja](https://ninja-build.org). After extracting the sshfs tarball,
+create a (temporary) build directory and run Meson and Ninja:
+
+ $ md build; cd build
+ $ meson ..
+ $ ninja
+ $ sudo ninja install
+
+Normally, the default build options will work fine. If you
+nevertheless want to adjust them, you can do so with the *mesonconf*
+command:
+
+ $ mesonconf # list options
+ $ mesonconf -D strip=true # set an option
+ $ ninja # rebuild
+
+
+Alternate Installation
+----------------------
+
+If you are not able to use Meson and Ninja, please report this to the
+sshfs mailing list. Until the problem is resolved, you may fall back
+to an in-source build using autotools:
+
+ $ ./configure
+ $ make
+ $ sudo make install
+
+Note that support for building with autotools may disappear at some
+point, so if you depend on using autotools for some reason please let
+the sshfs developers know!
+
./configure
make
sudo make install
-When checking out from git (instead of using a release tarball), you
-will need to run `autoreconf -i` before `./configure`.
-
Getting Help
------------
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..de4dfc5
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,59 @@
+project('sshfs', 'c', version: '3.0.0',
+ meson_version: '>= 0.38',
+ default_options: [ 'buildtype=plain' ])
+
+add_global_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H',
+ '-Wall', '-Wextra', '-Wno-sign-compare',
+ '-Wmissing-declarations', '-Wwrite-strings',
+ language: 'c')
+
+# Some (stupid) GCC versions warn about unused return values even when they are
+# casted to void. This makes -Wunused-result pretty useless, since there is no
+# way to suppress the warning when we really *want* to ignore the value.
+cc = meson.get_compiler('c')
+code = '''
+__attribute__((warn_unused_result)) int get_4() {
+ return 4;
+}
+int main(void) {
+ (void) get_4();
+ return 0;
+}'''
+if not cc.compiles(code, args: [ '-O0', '-Werror=unused-result' ])
+ message('Compiler warns about unused result even when casting to void')
+ add_global_arguments('-Wno-unused-result', language: 'c')
+endif
+
+
+cfg = configuration_data()
+
+cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
+
+include_dirs = [ include_directories('.') ]
+sshfs_sources = ['sshfs.c', 'cache.c']
+if target_machine.system() == 'darwin'
+ cfg.set_quoted('IDMAP_DEFAULT', 'user')
+ sshfs_sources += [ 'compat/fuse_opt.c', 'compat/darwin_compat.c' ]
+ include_dirs += [ include_directories('compat') ]
+else
+ cfg.set_quoted('IDMAP_DEFAULT', 'none')
+endif
+
+configure_file(input: 'sshfs.1.in',
+ output: 'sshfs.1',
+ configuration : cfg)
+configure_file(output: 'config.h',
+ configuration : cfg)
+
+sshfs_deps = [ dependency('fuse', version: '>= 2.3'),
+ dependency('glib-2.0'),
+ dependency('gthread-2.0') ]
+
+executable('sshfs', sshfs_sources,
+ include_directories: include_dirs,
+ dependencies: sshfs_deps,
+ c_args: ['-DFUSE_USE_VERSION=26'],
+ install: true,
+ install_dir: get_option('bindir'))
+
+install_man('sshfs.1')
diff --git a/sshfs.1.in b/sshfs.1.in
index 4ed4fa4..b96e7dc 100644
--- a/sshfs.1.in
+++ b/sshfs.1.in
@@ -7,7 +7,7 @@ SSHFS \- filesystem client based on ssh
\fBsshfs\fP [\fIuser\fP@]\fBhost\fP:[\fIdir\fP] \fBmountpoint\fP [\fIoptions\fP]
.SS unmounting
.TP
-\fB__UNMOUNT_COMMAND__ mountpoint\fP
+\fB@UNMOUNT_COMMAND@ mountpoint\fP
.SH DESCRIPTION
SSHFS (Secure SHell FileSystem) is a file system for Linux (and other
operating systems with a FUSE implementation, such as Mac OS X or FreeBSD)
@@ -97,7 +97,7 @@ fix buffer fillup bug in server (default: on)
.RE
.TP
\fB\-o\fR idmap=TYPE
-user/group ID mapping (default: __IDMAP_DEFAULT__)
+user/group ID mapping (default: @IDMAP_DEFAULT@)
.RS 8
.TP
none