diff --git a/.travis.yml b/.travis.yml index d949a329..b321a442 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,17 @@ matrix: dist: trusty compiler: clang sudo: required + - os: linux + dist: xenial + compiler: gcc + sudo: required + - os: linux + dist: xenial + compiler: clang + sudo: required script: + - sudo -E apt-get install fakeroot - sudo -E make install-build-pkgs - make + - make deb diff --git a/Makefile b/Makefile index 1c18e5f9..9d54d61a 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,6 @@ endif USE_XATTR = 1 FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -Ilibfuse/include -FUSE_LIBS = libfuse/obj/libfuse.a -FUSE_TARGET = $(FUSE_LIBS) ifeq ($(DEBUG),1) DEBUG_FLAGS := -g @@ -64,11 +62,11 @@ UGID_USE_RWLOCK = 0 OPTS = -O2 SRC = $(wildcard src/*.cpp) -OBJ = $(SRC:src/%.cpp=obj/%.o) -DEPS = $(OBJ:obj/%.o=obj/%.d) -TARGET = mergerfs -MANPAGE = $(TARGET).1 -CXXFLAGS = $(OPTS) \ +OBJS = $(SRC:src/%.cpp=build/%.o) +DEPS = $(SRC:src/%.cpp=build/%.d) +MANPAGE = mergerfs.1 +CXXFLAGS += \ + $(OPTS) \ $(DEBUG_FLAGS) \ $(STATIC_FLAGS) \ $(LTO_FLAGS) \ @@ -79,6 +77,9 @@ CXXFLAGS = $(OPTS) \ -MMD \ -DUSE_XATTR=$(USE_XATTR) \ -DUGID_USE_RWLOCK=$(UGID_USE_RWLOCK) +LDFLAGS += \ + -pthread \ + -lrt PREFIX = /usr/local EXEC_PREFIX = $(PREFIX) @@ -93,77 +94,79 @@ INSTALLBINDIR = $(DESTDIR)$(BINDIR) INSTALLSBINDIR = $(DESTDIR)$(SBINDIR) INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR) -all: $(TARGET) +.PHONY: all +all: mergerfs +.PHONY: help help: @echo "usage: make\n" @echo "make USE_XATTR=0 - build program without xattrs functionality" @echo "make STATIC=1 - build static binary" @echo "make LTO=1 - build with link time optimization" -$(TARGET): version obj/obj-stamp $(FUSE_TARGET) $(OBJ) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJ) -o $@ $(FUSE_LIBS) -pthread -lrt +objects: version build/stamp + $(MAKE) $(OBJS) -mount.mergerfs: $(TARGET) +build/mergerfs: libfuse objects + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OBJS) -o $@ libfuse/build/libfuse.a $(LDFLAGS) + +mergerfs: build/mergerfs + +build/mount.mergerfs: build/mergerfs $(LN) -fs "$<" "$@" changelog: ifeq ($(GIT_REPO),1) - $(GIT2DEBCL) --name $(TARGET) > ChangeLog + $(GIT2DEBCL) --name mergerfs > ChangeLog else @echo "WARNING: need git repo to generate ChangeLog" endif -authors: -ifeq ($(GIT_REPO),1) - $(GIT) log --format='%aN <%aE>' | sort -f | uniq > AUTHORS -else - @echo "WARNING: need git repo to generate AUTHORS" -endif - +.PHONY: version version: tools/update-version -obj/obj-stamp: - $(MKDIR) -p obj +build/stamp: + $(MKDIR) -p build $(TOUCH) $@ -obj/%.o: src/%.cpp +build/%.o: src/%.cpp $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ +.PHONY: clean clean: rpm-clean - $(RM) -f src/version.hpp - $(RM) -rf obj - $(RM) -f "$(TARGET)" mount.mergerfs + $(RM) -rf build $(FIND) . -name "*~" -delete - cd libfuse && $(MAKE) clean + $(MAKE) -C libfuse clean distclean: clean ifeq ($(GIT_REPO),1) $(GIT) clean -xfd endif +.PHONY: install install: install-base install-mount.mergerfs install-man -install-base: $(TARGET) +install-base: build/mergerfs $(MKDIR) -p "$(INSTALLBINDIR)" - $(INSTALL) -v -m 0755 "$(TARGET)" "$(INSTALLBINDIR)/$(TARGET)" + $(INSTALL) -v -m 0755 build/mergerfs "$(INSTALLBINDIR)/mergerfs" -install-mount.mergerfs: mount.mergerfs +install-mount.mergerfs: build/mount.mergerfs $(MKDIR) -p "$(INSTALLBINDIR)" - $(CP) -a "$<" "$(INSTALLBINDIR)/$<" + $(CP) -a build/mount.mergerfs "$(INSTALLBINDIR)/mount.mergerfs" install-man: $(MANPAGE) $(MKDIR) -p "$(INSTALLMAN1DIR)" $(INSTALL) -v -m 0644 "man/$(MANPAGE)" "$(INSTALLMAN1DIR)/$(MANPAGE)" install-strip: install-base - $(STRIP) "$(INSTALLBINDIR)/$(TARGET)" + $(STRIP) "$(INSTALLBINDIR)/mergerfs" +.PHONY: uninstall uninstall: uninstall-base uninstall-mount.mergerfs uninstall-man uninstall-base: - $(RM) -f "$(INSTALLBINDIR)/$(TARGET)" + $(RM) -f "$(INSTALLBINDIR)/mergerfs" uninstall-mount.mergerfs: $(RM) -f "$(INSTALLBINDIR)/mount.mergerfs" @@ -180,10 +183,11 @@ endif man: $(MANPAGE) -tarball: man changelog authors version +.PHONY: tarball +tarball: man changelog version $(eval VERSION := $(shell cat VERSION)) $(eval VERSION := $(subst -,_,$(VERSION))) - $(eval FILENAME := $(TARGET)-$(VERSION)) + $(eval FILENAME := mergerfs-$(VERSION)) $(eval TMPDIR := $(shell $(MKTEMP) --tmpdir -d .$(FILENAME).XXXXXXXX)) $(MKDIR) $(TMPDIR)/$(FILENAME) $(CP) -ar . $(TMPDIR)/$(FILENAME) @@ -192,19 +196,24 @@ tarball: man changelog authors version debian-changelog: ifeq ($(GIT_REPO),1) - $(GIT2DEBCL) --name $(TARGET) > debian/changelog + $(GIT2DEBCL) --name mergerfs > debian/changelog else cp ChangeLog debian/changelog endif -signed-deb: distclean debian-changelog +signed-deb: + $(MAKE) distclean + $(MAKE) debian-changelog + dpkg-source -b . dpkg-buildpackage -nc deb: $(MAKE) distclean $(MAKE) debian-changelog + dpkg-source -b . dpkg-buildpackage -nc -uc -us +.PHONY: rpm-clean rpm-clean: $(RM) -rf rpmbuild @@ -212,19 +221,18 @@ rpm: tarball $(eval VERSION := $(shell cat VERSION)) $(eval VERSION := $(subst -,_,$(VERSION))) $(MKDIR) -p rpmbuild/BUILD rpmbuild/RPMS rpmbuild/SOURCES - $(SED) 's/__VERSION__/$(VERSION)/g' $(TARGET).spec > \ - rpmbuild/SOURCES/$(TARGET).spec - cp -ar $(TARGET)-$(VERSION).tar.gz rpmbuild/SOURCES - $(RPMBUILD) -ba rpmbuild/SOURCES/$(TARGET).spec \ + $(SED) 's/__VERSION__/$(VERSION)/g' mergerfs.spec > \ + rpmbuild/SOURCES/mergerfs.spec + cp -ar mergerfs-$(VERSION).tar.gz rpmbuild/SOURCES + $(RPMBUILD) -ba rpmbuild/SOURCES/mergerfs.spec \ --define "_topdir $(CURDIR)/rpmbuild" +.PHONY: install-build-pkgs install-build-pkgs: tools/install-build-pkgs -unexport CFLAGS -libfuse/obj/libfuse.a: - cd libfuse && $(MAKE) libfuse.a - -.PHONY: all clean install help version +.PHONY: libfuse +libfuse: + $(MAKE) -C libfuse -include $(DEPS) diff --git a/README.md b/README.md index 02dfc234..6ad1dea3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ % mergerfs(1) mergerfs user manual % Antonio SJ Musumeci -% 2019-04-23 +% 2019-05-03 # NAME @@ -19,7 +19,7 @@ mergerfs -o<options> <branches> <mountpoint> # FEATURES * Runs in userspace (FUSE) -* Configurable behaviors +* Configurable behaviors / file placement * Support for extended attributes (xattrs) * Support for file attributes (chattr) * Runtime configurable (via xattrs) @@ -28,7 +28,8 @@ mergerfs -o<options> <branches> <mountpoint> * Works with heterogeneous filesystem types * Handling of writes to full drives (transparently move file to drive with capacity) * Handles pool of read-only and read/write drives -* Turn read-only files into symlinks to increase read performance +* Can turn read-only files into symlinks to underlying file +* Hard link copy-on-write / CoW # How it works @@ -56,7 +57,7 @@ A + B = C +-- file6 ``` -mergerfs does **not** support the copy-on-write (CoW) behavior found in **aufs** and **overlayfs**. You can **not** mount a read-only filesystem and write to it. However, mergerfs will ignore read-only drives when creating new files so you can mix rw and ro drives. +mergerfs does **not** support the copy-on-write (CoW) behavior found in **aufs** and **overlayfs**. You can **not** mount a read-only filesystem and write to it. However, mergerfs will ignore read-only drives when creating new files so you can mix read-write and read-only drives. # OPTIONS @@ -348,30 +349,22 @@ $ make $ sudo make install ``` -#### Generically with system libfuse +#### Build options -**NOTE:** Configurable threading and thus `-o threads=num` option will be unavailable when built with system libfuse. - -Have git, g++, make, python, 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 ``` +$ make help +usage: make -#### Other build options - -``` -$ make STATIC=1 # builds a static binary -$ make LTO=1 # perform link time optimization +make USE_XATTR=0 - build program without xattrs functionality +make STATIC=1 - build static binary +make LTO=1 - build with link time optimization ``` # RUNTIME CONFIG #### .mergerfs pseudo file #### + ``` /.mergerfs ``` diff --git a/libfuse/Makefile b/libfuse/Makefile index 09d7b98d..5363cb6a 100644 --- a/libfuse/Makefile +++ b/libfuse/Makefile @@ -24,60 +24,61 @@ SRC = \ lib/fuse_signals.c \ lib/helper.c \ lib/mount.c +OBJS = $(SRC:lib/%.c=build/%.o) +DEPS = $(SRC:lib/%.c=build/%.d) -OBJ = $(SRC:lib/%.c=obj/%.o) -DEPS = $(OBJ:obj/%.o=obj/%.d) -CFLAGS = $(OPT) \ - $(DEBUG_FLAGS) \ - -Wall \ - -pipe \ - '-D_FILE_OFFSET_BITS=64' \ - '-D_REENTRANT' \ - '-DFUSE_USE_VERSION=29' \ - '-DFUSERMOUNT_DIR="/usr/local/bin"' \ - '-DPACKAGE_VERSION=$(VERSION)' \ - -Iinclude \ - -MMD -LDFLAGS = \ +CFLAGS += \ + $(OPT) \ + $(DEBUG_FLAGS) \ + -Wall \ + -pipe \ + '-D_FILE_OFFSET_BITS=64' \ + '-D_REENTRANT' \ + '-DFUSE_USE_VERSION=29' \ + '-DFUSERMOUNT_DIR="/usr/local/bin"' \ + '-DPACKAGE_VERSION=$(VERSION)' \ + -Iinclude \ + -Ibuild \ + -MMD +LDFLAGS += \ -lrt \ -pthread -all: obj/libfuse.a +all: build/libfuse.a -libfuse.a: obj/libfuse.a +build/config.h: build/stamp + ecfd/build | tee build/config.h -include/config.h: - ecfd/build | tee include/config.h - -obj/obj-stamp: - mkdir -p obj +build/stamp: + mkdir -p build touch $@ -obj/libfuse.a: - $(MAKE) obj/obj-stamp - $(MAKE) include/config.h - $(MAKE) $(OBJ) - ar rcs obj/libfuse.a $(OBJ) +objects: build/config.h + $(MAKE) $(OBJS) + +build/libfuse.a: objects + ar rcs build/libfuse.a $(OBJS) -mergerfs-mount: include/config.h util/fusermount.c lib/mount_util.c +build/mergerfs-mount: build/config.h util/fusermount.c lib/mount_util.c $(CC) $(CFLAGS) -Ilib -o mergerfs-mount util/fusermount.c lib/mount_util.c -mount.mergerfs: obj/libfuse.a util/mount.fuse.c - $(CC) $(CFLAGS) -o mount.mergerfs util/mount.fuse.c obj/libfuse.a $(LDFLAGS) +build/mount.mergerfs: build/libfuse.a util/mount.fuse.c + $(CC) $(CFLAGS) -o mount.mergerfs util/mount.fuse.c build/libfuse.a $(LDFLAGS) -obj/%.o: lib/%.c +build/%.o: lib/%.c $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -rf obj include/config.h mergerfs-mount mount.mergerfs + rm -rf build distclean: clean - git clean -fdx -install: - install -D mergerfs-mount "$(DESTDIR)$(BINDIR)/mergerfs-mount" +install: build/mergerfs-mount build/mount.mergerfs + install -D build/mergerfs-mount "$(DESTDIR)$(BINDIR)/mergerfs-mount" chown root:root "$(DESTDIR)$(BINDIR)/mergerfs-mount" chmod u+s "$(DESTDIR)$(BINDIR)/mergerfs-mount" - install -D mount.mergerfs "$(DESTDIR)$(SBINDIR)/mount.mergerfs" + install -D build/mount.mergerfs "$(DESTDIR)$(SBINDIR)/mount.mergerfs" + +.PHONY: objects -include $(DEPS) diff --git a/man/mergerfs.1 b/man/mergerfs.1 index 203986a0..d30013b5 100644 --- a/man/mergerfs.1 +++ b/man/mergerfs.1 @@ -1,7 +1,7 @@ .\"t .\" Automatically generated by Pandoc 1.19.2.4 .\" -.TH "mergerfs" "1" "2019\-04\-23" "mergerfs user manual" "" +.TH "mergerfs" "1" "2019\-05\-03" "mergerfs user manual" "" .hy .SH NAME .PP @@ -19,7 +19,7 @@ It is similar to \f[B]mhddfs\f[], \f[B]unionfs\f[], and \f[B]aufs\f[]. .IP \[bu] 2 Runs in userspace (FUSE) .IP \[bu] 2 -Configurable behaviors +Configurable behaviors / file placement .IP \[bu] 2 Support for extended attributes (xattrs) .IP \[bu] 2 @@ -38,7 +38,9 @@ capacity) .IP \[bu] 2 Handles pool of read\-only and read/write drives .IP \[bu] 2 -Turn read\-only files into symlinks to increase read performance +Can turn read\-only files into symlinks to underlying file +.IP \[bu] 2 +Hard link copy\-on\-write / CoW .SH How it works .PP mergerfs logically merges multiple paths together. @@ -74,7 +76,7 @@ mergerfs does \f[B]not\f[] support the copy\-on\-write (CoW) behavior found in \f[B]aufs\f[] and \f[B]overlayfs\f[]. You can \f[B]not\f[] mount a read\-only filesystem and write to it. However, mergerfs will ignore read\-only drives when creating new files -so you can mix rw and ro drives. +so you can mix read\-write and read\-only drives. .SH OPTIONS .SS mount options .IP \[bu] 2 @@ -815,28 +817,16 @@ $\ make $\ sudo\ make\ install \f[] .fi -.SS Generically with system libfuse -.PP -\f[B]NOTE:\f[] Configurable threading and thus \f[C]\-o\ threads=num\f[] -option will be unavailable when built with system libfuse. -.PP -Have git, g++, make, python, 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 -.SS Other build options +.SS Build options .IP .nf \f[C] -$\ make\ STATIC=1\ #\ builds\ a\ static\ binary -$\ make\ LTO=1\ \ \ \ #\ perform\ link\ time\ optimization +$\ make\ help +usage:\ make + +make\ USE_XATTR=0\ \ \ \ \ \ \-\ build\ program\ without\ xattrs\ functionality +make\ STATIC=1\ \ \ \ \ \ \ \ \ \-\ build\ static\ binary +make\ LTO=1\ \ \ \ \ \ \ \ \ \ \ \ \-\ build\ with\ link\ time\ optimization \f[] .fi .SH RUNTIME CONFIG diff --git a/mergerfs.spec b/mergerfs.spec index 58739784..692b704d 100644 --- a/mergerfs.spec +++ b/mergerfs.spec @@ -15,13 +15,15 @@ BuildRequires: git Requires: fuse +%global debug_package %{nil} + %prep %setup -q %description -mergerfs is similar to mhddfs, unionfs, and aufs. Like mhddfs in that it too -uses FUSE. Like aufs in that it provides multiple policies for how to handle -behavior. +mergerfs is a union filesystem geared towards simplifying storage and +management of files across numerous commodity storage devices. It is +similar to mhddfs, unionfs, and aufs. %build make %{?_smp_mflags} @@ -34,6 +36,9 @@ make install PREFIX=%{_prefix} DESTDIR=%{buildroot} %doc %{_mandir}/* %changelog +* Fri Apr 26 2019 Antonio SJ Musumeci +- Update description + * Mon Jan 25 2016 Antonio SJ Musumeci - Remove sbin files diff --git a/tools/update-version b/tools/update-version index f102eec6..cc724d57 100755 --- a/tools/update-version +++ b/tools/update-version @@ -1,10 +1,5 @@ #!/bin/sh -GIT=$(which git) -if [ "${GIT}" = "" ]; then - exit 0 -fi - VERSION=$(git describe --always --tags --dirty) if [ $? -ne 0 ]; then VERSION=$(cat VERSION)