mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 10:16:57 +08:00
Makefile: option for building with system libfuse
Add INTERNAL_FUSE variable to control linking against bundled libfuse vs external/system libfuse. If external libfuse is requested, `pkg-config` is used to obtain CFLAGS/LIBS/LDFLAGS and to check that the provided external libfuse is >= 2.9.7. This might hopefully get mergerfs closer to inclusion into distros. Link: https://github.com/trapexit/mergerfs/issues/431 Link: https://bugs.gentoo.org/587956#c6
This commit is contained in:
parent
ec6adaa376
commit
756d4ff0ff
30
Makefile
30
Makefile
|
@ -28,6 +28,7 @@ SED = $(shell which sed)
|
|||
GZIP = $(shell which gzip)
|
||||
RPMBUILD = $(shell which rpmbuild)
|
||||
GIT2DEBCL = ./tools/git2debcl
|
||||
PKGCONFIG = pkg-config
|
||||
|
||||
GIT_REPO = 0
|
||||
ifneq ($(GIT),)
|
||||
|
@ -42,6 +43,22 @@ endif
|
|||
|
||||
XATTR_AVAILABLE = $(shell test ! -e /usr/include/attr/xattr.h; echo $$?)
|
||||
|
||||
INTERNAL_FUSE = 1
|
||||
EXTERNAL_FUSE_MIN_REQ = 2.9.7
|
||||
|
||||
ifeq ($(INTERNAL_FUSE),1)
|
||||
FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -Ilibfuse/include
|
||||
FUSE_LIBS = libfuse/lib/.libs/libfuse.a
|
||||
FUSE_TARGET = $(FUSE_LIBS)
|
||||
else
|
||||
FUSE_CFLAGS := $(shell $(PKGCONFIG) --cflags 'fuse >= $(EXTERNAL_FUSE_MIN_REQ)')
|
||||
FUSE_LIBS := $(shell $(PKGCONFIG) --libs 'fuse >= $(EXTERNAL_FUSE_MIN_REQ)')
|
||||
FUSE_TARGET :=
|
||||
ifeq ($(FUSE_CFLAGS)$(FUSE_LIBS),)
|
||||
$(error "Use of external FUSE requested, but no libfuse >= $(EXTERNAL_FUSE_MIN_REQ) found.")
|
||||
endif
|
||||
endif
|
||||
|
||||
UGID_USE_RWLOCK = 0
|
||||
|
||||
OPTS = -O2
|
||||
|
@ -50,7 +67,6 @@ OBJ = $(SRC:src/%.cpp=obj/%.o)
|
|||
DEPS = $(OBJ:obj/%.o=obj/%.d)
|
||||
TARGET = mergerfs
|
||||
MANPAGE = $(TARGET).1
|
||||
FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -Ilibfuse/include
|
||||
CFLAGS = -g -Wall \
|
||||
$(OPTS) \
|
||||
-Wno-unused-result \
|
||||
|
@ -82,10 +98,10 @@ all: $(TARGET)
|
|||
help:
|
||||
@echo "usage: make"
|
||||
@echo "make XATTR_AVAILABLE=0 - to build program without xattrs functionality (auto discovered otherwise)"
|
||||
@echo "make INTERNAL_FUSE=0 - to build program with external (system) libfuse rather than the bundled one ('-o threads=' option will be unavailable)"
|
||||
|
||||
$(TARGET): version obj/obj-stamp libfuse/lib/.libs/libfuse.a $(OBJ)
|
||||
cd libfuse && make
|
||||
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@ libfuse/lib/.libs/libfuse.a -ldl -pthread -lrt
|
||||
$(TARGET): version obj/obj-stamp $(FUSE_TARGET) $(OBJ)
|
||||
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@ $(FUSE_LIBS) -ldl -pthread -lrt
|
||||
|
||||
mount.mergerfs: $(TARGET)
|
||||
$(LN) -fs "$<" "$@"
|
||||
|
@ -115,10 +131,14 @@ clean: rpm-clean libfuse_Makefile
|
|||
$(RM) -rf obj
|
||||
$(RM) -f "$(TARGET)" mount.mergerfs
|
||||
$(FIND) . -name "*~" -delete
|
||||
ifeq ($(INTERNAL_FUSE),1)
|
||||
cd libfuse && $(MAKE) clean
|
||||
endif
|
||||
|
||||
distclean: clean libfuse_Makefile
|
||||
ifeq ($(INTERNAL_FUSE),1)
|
||||
cd libfuse && $(MAKE) distclean
|
||||
endif
|
||||
ifeq ($(GIT_REPO),1)
|
||||
$(GIT) clean -fd
|
||||
endif
|
||||
|
@ -210,12 +230,14 @@ endif
|
|||
unexport CFLAGS
|
||||
.PHONY: libfuse_Makefile
|
||||
libfuse_Makefile:
|
||||
ifeq ($(INTERNAL_FUSE),1)
|
||||
ifeq ($(shell test -e libfuse/Makefile; echo $$?),1)
|
||||
cd libfuse && \
|
||||
$(MKDIR) -p m4 && \
|
||||
autoreconf --force --install && \
|
||||
./configure --enable-lib --disable-util --disable-example
|
||||
endif
|
||||
endif
|
||||
|
||||
libfuse/lib/.libs/libfuse.a: libfuse_Makefile
|
||||
cd libfuse && $(MAKE)
|
||||
|
|
17
README.md
17
README.md
|
@ -71,7 +71,7 @@ mergerfs does **not** support the copy-on-write (CoW) behavior found in **aufs**
|
|||
* **symlinkify_timeout=value**: time to wait, in seconds, to activate the **symlinkify** behavior. (default: 3600)
|
||||
* **nullrw=true|false**: turns reads and writes into no-ops. The request will succeed but do nothing. Useful for benchmarking mergerfs. (default: false)
|
||||
* **ignorepponrename=true|false**: ignore path preserving on rename. Typically rename and link act differently depending on the policy of `create` (read below). Enabling this will cause rename and link to always use the non-path preserving behavior. This means files, when renamed or linked, will stay on the same drive. (default: false)
|
||||
* **threads=num**: number of threads to use in multithreaded mode. When set to zero (the default) it will attempt to discover and use the number of logical cores. If the lookup fails it will fall back to using 4. If the thread count is set negative it will look up the number of cores then divide by the absolute value. ie. threads=-2 on an 8 core machine will result in 8 / 2 = 4 threads. There will always be at least 1 thread. NOTE: higher number of threads increases parallelism but usually decreases throughput. (default: number of cores)
|
||||
* **threads=num**: number of threads to use in multithreaded mode. When set to zero (the default) it will attempt to discover and use the number of logical cores. If the lookup fails it will fall back to using 4. If the thread count is set negative it will look up the number of cores then divide by the absolute value. ie. threads=-2 on an 8 core machine will result in 8 / 2 = 4 threads. There will always be at least 1 thread. NOTE: higher number of threads increases parallelism but usually decreases throughput. (default: number of cores) *NOTE2:* the option is unavailable when built with system libfuse.
|
||||
* **fsname=name**: sets the name of the filesystem as seen in **mount**, **df**, etc. Defaults to a list of the source paths concatenated together with the longest common prefix removed.
|
||||
* **func.<func>=<policy>**: sets the specific FUSE function's policy. See below for the list of value types. Example: **func.getattr=newest**
|
||||
* **category.<category>=<policy>**: Sets policy of all FUSE functions in the provided category. Example: **category.create=mfs**
|
||||
|
@ -287,6 +287,19 @@ $ make
|
|||
$ sudo make install
|
||||
```
|
||||
|
||||
#### Generically with system libfuse
|
||||
|
||||
**NOTE:** Multithreading and thus `-o threads=num` option will be unavailable when built with system libfuse.
|
||||
|
||||
Have git, g++, make, python, libattr1, pkg-config installed.
|
||||
Also, install libfuse >= 2.9.7 (but not libfuse-3.x) and matching libfuse-dev (or libfuse-devel).
|
||||
|
||||
```
|
||||
$ cd mergerfs
|
||||
$ make INTERNAL_FUSE=0
|
||||
$ sudo make INTERNAL_FUSE=0 install
|
||||
```
|
||||
|
||||
# RUNTIME
|
||||
|
||||
#### .mergerfs pseudo file ####
|
||||
|
@ -550,7 +563,7 @@ The gid cache uses fixed storage to simplify the design and be compatible with o
|
|||
|
||||
#### mergerfs or libfuse crashing
|
||||
|
||||
**NOTE:** as of mergerfs 2.22.0 it includes the most recent version of libfuse so any crash should be reported. For older releases continue reading...
|
||||
**NOTE:** as of mergerfs 2.22.0 it includes the most recent version of libfuse (or requires libfuse-2.9.7) so any crash should be reported. For older releases continue reading...
|
||||
|
||||
If suddenly the mergerfs mount point disappears and `Transport endpoint is not connected` is returned when attempting to perform actions within the mount directory **and** the version of libfuse (use `mergerfs -v` to find the version) is older than `2.9.4` its likely due to a bug in libfuse. Affected versions of libfuse can be found in Debian Wheezy, Ubuntu Precise and others.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\"t
|
||||
.\" Automatically generated by Pandoc 1.19.2.4
|
||||
.\" Automatically generated by Pandoc 1.19.2.1
|
||||
.\"
|
||||
.TH "mergerfs" "1" "2018\-07\-25" "mergerfs user manual" ""
|
||||
.hy
|
||||
|
@ -163,7 +163,8 @@ threads=\-2 on an 8 core machine will result in 8 / 2 = 4 threads.
|
|||
There will always be at least 1 thread.
|
||||
NOTE: higher number of threads increases parallelism but usually
|
||||
decreases throughput.
|
||||
(default: number of cores)
|
||||
(default: number of cores) \f[I]NOTE2:\f[] the option is unavailable
|
||||
when built with system libfuse.
|
||||
.IP \[bu] 2
|
||||
\f[B]fsname=name\f[]: sets the name of the filesystem as seen in
|
||||
\f[B]mount\f[], \f[B]df\f[], etc.
|
||||
|
@ -699,6 +700,22 @@ $\ make
|
|||
$\ sudo\ make\ install
|
||||
\f[]
|
||||
.fi
|
||||
.SS Generically with system libfuse
|
||||
.PP
|
||||
\f[B]NOTE:\f[] Multithreading and thus \f[C]\-o\ threads=num\f[] option
|
||||
will be unavailable when built with system libfuse.
|
||||
.PP
|
||||
Have git, g++, make, python, libattr1, pkg\-config installed.
|
||||
Also, install libfuse >= 2.9.7 (but not libfuse\-3.x) and matching
|
||||
libfuse\-dev (or libfuse\-devel).
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
$\ cd\ mergerfs
|
||||
$\ make\ INTERNAL_FUSE=0
|
||||
$\ sudo\ make\ INTERNAL_FUSE=0\ install
|
||||
\f[]
|
||||
.fi
|
||||
.SH RUNTIME
|
||||
.SS .mergerfs pseudo file
|
||||
.IP
|
||||
|
@ -1216,7 +1233,7 @@ Note that doing so will increase the memory needed by each thread.
|
|||
.SS mergerfs or libfuse crashing
|
||||
.PP
|
||||
\f[B]NOTE:\f[] as of mergerfs 2.22.0 it includes the most recent version
|
||||
of libfuse so any crash should be reported.
|
||||
of libfuse (or requires libfuse\-2.9.7) so any crash should be reported.
|
||||
For older releases continue reading...
|
||||
.PP
|
||||
If suddenly the mergerfs mount point disappears and
|
||||
|
|
Loading…
Reference in New Issue
Block a user