Browse Source

[RFC] Switch to CMake build system

Currently incomplete features:
 * version generation based on git information;
   (currently done at configure time,
    not build time, so can get stale easily)
 * libattr autodetection;
   (might need to be reworked for <sys/attr.h> change)
 * RPM/DEB packaging might be lacking something;
 * TGZ (source code) packaging is incomplete.
pull/511/head
Andrey Mazo 6 years ago
parent
commit
efc330a06e
No known key found for this signature in database GPG Key ID: 8D30814ABF01E3CF
  1. 244
      CMakeLists.txt
  2. 247
      Makefile
  3. 1
      debian/compat
  4. 18
      debian/control
  5. 11
      debian/rules
  6. 50
      mergerfs.spec
  7. 2
      src/version.hpp.in
  8. 23
      tools/update-version

244
CMakeLists.txt

@ -0,0 +1,244 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(mergerfs LANGUAGES CXX)
include(CMakeDependentOption)
include(GNUInstallDirs)
if(NOT DEFINED ENABLE_XATTR)
set(ENABLE_XATTR "AUTO")
endif()
# we could have used option(ENABLE_XATTR) here, but it doesn't allow for AUTO behavior
set(ENABLE_XATTR "${ENABLE_XATTR}" CACHE STRING "Build with xattr support (AUTO, YES, NO)")
CMAKE_DEPENDENT_OPTION(WITH_XATTR "Include dir with xattr headers"
OFF "ENABLE_XATTR"
OFF)
option(WITH_INTERNAL_FUSE "Use bundled (YES) or system (NO) libfuse" "YES")
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING)
endif()
file(GLOB mergerfs_sources src/*.cpp src/*.icpp src/*.hpp src/*.h)
set(version_hpp "${CMAKE_CURRENT_BINARY_DIR}/version.hpp")
list(APPEND mergerfs_sources ${version_hpp})
add_executable(mergerfs ${mergerfs_sources})
target_include_directories(mergerfs PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
set(GIT2DEBCL "${CMAKE_CURRENT_SOURCE_DIR}/tools/git2debcl")
find_program(PANDOC pandoc)
if(NOT PANDOC)
message(WARNING "pandoc does not appear available: manpage won't be buildable")
endif()
if(NOT DEFINED ${MERGERFS_VERSION})
set(git_toplevel_dir)
find_program(GIT git)
if(GIT)
execute_process(
COMMAND ${GIT} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE git_toplevel_dir
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(git_toplevel_dir)
file(TO_CMAKE_PATH "${git_toplevel_dir}" git_toplevel_dir)
endif()
endif()
if(git_toplevel_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# we're in a git worktree, and not in a super-project git tree
execute_process(
COMMAND ${GIT} describe --always --tags --dirty
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE MERGERFS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" MERGERFS_VERSION)
else()
message(FATAL_ERROR "mergerfs version can't be determined. Use release tarball or run from within mergerfs git repository")
endif()
endif()
# XXX: might get stale
# after MERGERFS_VERSION is defined
configure_file(src/version.hpp.in "${version_hpp}" @ONLY)
if(ENABLE_XATTR) # including "AUTO"
if(WITH_XATTR)
find_path(XATTR_INCLUDE_DIR attr/xattr.h PATHS "${WITH_XATTR}")
else()
find_path(XATTR_INCLUDE_DIR attr/xattr.h)
endif()
if(NOT XATTR_INCLUDE_DIR)
if(ENABLE_XATTR EQUAL "AUTO")
set(msg_level "WARNING")
else()
# xattr is explicitly requested, but is not available
set(msg_level "FATAL_ERROR")
endif()
message("${msg_level}" "xattr not available: disabling")
endif()
else()
set(XATTR_INCLUDE_DIR NO)
endif()
if(XATTR_INCLUDE_DIR)
target_include_directories(mergerfs PRIVATE "${XATTR_INCLUDE_DIR}")
else()
target_compile_definitions(mergerfs PRIVATE "-DWITHOUT_XATTR")
endif()
if(WITH_INTERNAL_FUSE)
include(ExternalProject)
ExternalProject_Add(libfuse_internal
URL "${CMAKE_CURRENT_SOURCE_DIR}/libfuse"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory m4
COMMAND autoreconf --force --install
COMMAND ./configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} --enable-lib --disable-util --disable-example
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
INSTALL_COMMAND true
BUILD_IN_SOURCE 1
)
ExternalProject_Get_Property(libfuse_internal SOURCE_DIR)
ExternalProject_Get_Property(libfuse_internal BINARY_DIR)
add_library(libfuse STATIC IMPORTED)
set_property(TARGET libfuse PROPERTY IMPORTED_LOCATION "${BINARY_DIR}/lib/.libs/libfuse.a")
add_dependencies(mergerfs libfuse_internal)
target_include_directories(mergerfs PRIVATE "${SOURCE_DIR}/include")
target_compile_definitions(mergerfs PRIVATE "-D_FILE_OFFSET_BITS=64")
target_link_libraries(mergerfs PRIVATE libfuse dl)
set_property(TARGET mergerfs APPEND PROPERTY LINK_FLAGS "-pthread")
else()
set(EXTERNAL_FUSE_MIN_REQ 2.9.7)
find_package(PkgConfig REQUIRED)
pkg_search_module(FUSE REQUIRED "fuse >= ${EXTERNAL_FUSE_MIN_REQ}")
target_include_directories(mergerfs PRIVATE "${FUSE_INCLUDE_DIRS}")
target_compile_options(mergerfs PRIVATE "${FUSE_CFLAGS_OTHER}")
target_link_libraries(mergerfs PRIVATE "${FUSE_LIBRARIES}")
set_property(TARGET mergerfs APPEND PROPERTY LINK_FLAGS "${FUSE_LDFLAGS_OTHER}")
link_directories("${FUSE_LIBRARY_DIRS}")
endif()
set(UGID_USE_RWLOCK 0)
target_compile_definitions(mergerfs PRIVATE
"-DFUSE_USE_VERSION=29"
"-DUGID_USE_RWLOCK=${UGID_USE_RWLOCK}"
)
target_compile_options(mergerfs PRIVATE "-Wall" "-Wno-unused-result")
add_custom_command(OUTPUT mount.mergerfs
COMMAND ${CMAKE_COMMAND} -E create_symlink mergerfs mount.mergerfs
DEPENDS mergerfs
VERBATIM
)
add_custom_target(create-mount.mergerfs ALL
DEPENDS mount.mergerfs
)
install(TARGETS mergerfs DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mount.mergerfs" DESTINATION "${CMAKE_INSTALL_BINDIR}")
set(manpage "${CMAKE_CURRENT_SOURCE_DIR}/man/mergerfs.1")
if(PANDOC)
set(manpage "${CMAKE_CURRENT_BINARY_DIR}/mergerfs.1")
add_custom_command(OUTPUT "${manpage}"
COMMAND ${PANDOC} -s -t man -o "${manpage}" "${CMAKE_CURRENT_SOURCE_DIR}/README.md"
DEPENDS README.md
VERBATIM
)
endif()
install(
FILES "${manpage}"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
)
add_custom_target(man ALL DEPENDS "${manpage}")
if(GIT)
add_custom_target(changelog
COMMAND ${GIT2DEBCL} --name ${PROJECT_NAME} > ${CMAKE_CURRENT_BINARY_DIR}/changelog
BYPRODUCTS changelog
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(authors
COMMAND ${GIT} log --format='%aN <%aE>' | sort -fu > ${CMAKE_CURRENT_BINARY_DIR}/AUTHORS
BYPRODUCTS AUTHORS
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
if(EXISTS /usr/bin/apt-get)
add_custom_target(install-build-pkgs
COMMAND apt-get -qy update
COMMAND apt-get -qy --no-install-suggests --no-install-recommends --force-yes install build-essential git g++ debhelper libattr1-dev python automake libtool lsb-release
)
elseif(EXISTS /usr/bin/dnf)
add_custom_target(install-build-pkgs
COMMAND dnf -y update
COMMAND dnf -y install git rpm-build libattr-devel gcc-c++ make which python automake libtool gettext-devel
)
elseif(EXISTS /usr/bin/yum)
add_custom_target(install-build-pkgs
COMMAND yum -y update
COMMAND yum -y install git rpm-build libattr-devel gcc-c++ make which python automake libtool gettext-devel
)
endif()
set(CPACK_GENERATOR "DEB;RPM")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${MERGERFS_VERSION}")
set(CPACK_PACKAGE_CONTACT "Antonio SJ Musumeci <trapexit@spawn.link>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "another FUSE union filesystem")
set(package_long_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."
)
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\\$\{shlibs\:Depends}, \\$\{misc\:Depends}, fuse [linux-any] | fuse4bsd [kfreebsd-any]")
set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS "debhelper (>= 8.0.0), libattr1-dev")
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://github.com/trapexit/mergerfs")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION
"${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
${package_long_description}"
)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "ON")
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION "ON")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/debian/docs;${CMAKE_CURRENT_SOURCE_DIR}/debian/copyright;${CMAKE_CURRENT_BINARY_DIR}/changelog"
)
set(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
set(CPACK_RPM_PACKAGE_LICENSE "ISC")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
set(CPACK_RPM_PACKAGE_URL "http://github.com/trapexit/mergerfs")
set(CPACK_RPM_PACKAGE_REQUIRES "fuse")
set(CPACK_RPM_PACKAGE_SUMMARY "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
set(CPACK_RPM_PACKAGE_DESCRIPTION "${package_long_description}")
# TODO: CPACK_RPM_CHANGELOG_FILE
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${MERGERFS_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/.git/")
# CPACK_SOURCE_INSTALLED_DIRECTORIES
# custom_target instead of cpack source generator?
include(CPack)

247
Makefile

@ -1,247 +0,0 @@
# Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
GIT = $(shell which git)
TAR = $(shell which tar)
MKDIR = $(shell which mkdir)
TOUCH = $(shell which touch)
CP = $(shell which cp)
RM = $(shell which rm)
LN = $(shell which ln)
FIND = $(shell which find)
INSTALL = $(shell which install)
MKTEMP = $(shell which mktemp)
STRIP = $(shell which strip)
PANDOC = $(shell which pandoc)
SED = $(shell which sed)
GZIP = $(shell which gzip)
RPMBUILD = $(shell which rpmbuild)
GIT2DEBCL = ./tools/git2debcl
PKGCONFIG = pkg-config
GIT_REPO = 0
ifneq ($(GIT),)
ifeq ($(shell test -e .git; echo $$?),0)
GIT_REPO = 1
endif
endif
ifeq ($(PANDOC),)
$(warning "pandoc does not appear available: manpage won't be buildable")
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
SRC = $(wildcard src/*.cpp)
OBJ = $(SRC:src/%.cpp=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d)
TARGET = mergerfs
MANPAGE = $(TARGET).1
CFLAGS = -g -Wall \
$(OPTS) \
-Wno-unused-result \
$(FUSE_CFLAGS) \
-DFUSE_USE_VERSION=29 \
-MMD \
-DUGID_USE_RWLOCK=$(UGID_USE_RWLOCK)
PREFIX = /usr/local
EXEC_PREFIX = $(PREFIX)
DATAROOTDIR = $(PREFIX)/share
DATADIR = $(DATAROOTDIR)
BINDIR = $(EXEC_PREFIX)/bin
SBINDIR = $(EXEC_PREFIX)/sbin
MANDIR = $(DATAROOTDIR)/man
MAN1DIR = $(MANDIR)/man1
INSTALLBINDIR = $(DESTDIR)$(BINDIR)
INSTALLSBINDIR = $(DESTDIR)$(SBINDIR)
INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR)
ifeq ($(XATTR_AVAILABLE),0)
$(warning "xattr not available: disabling")
CFLAGS += -DWITHOUT_XATTR
endif
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 $(FUSE_TARGET) $(OBJ)
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@ $(FUSE_LIBS) -ldl -pthread -lrt
mount.mergerfs: $(TARGET)
$(LN) -fs "$<" "$@"
changelog:
ifeq ($(GIT_REPO),1)
$(GIT2DEBCL) --name $(TARGET) > ChangeLog
endif
authors:
ifeq ($(GIT_REPO),1)
$(GIT) log --format='%aN <%aE>' | sort -f | uniq > AUTHORS
endif
version:
tools/update-version
obj/obj-stamp:
$(MKDIR) -p obj
$(TOUCH) $@
obj/%.o: src/%.cpp
$(CXX) $(CFLAGS) -c $< -o $@
clean: rpm-clean libfuse_Makefile
$(RM) -f src/version.hpp
$(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
install: install-base install-mount.mergerfs install-man
install-base: $(TARGET)
$(MKDIR) -p "$(INSTALLBINDIR)"
$(INSTALL) -v -m 0755 "$(TARGET)" "$(INSTALLBINDIR)/$(TARGET)"
install-mount.mergerfs: mount.mergerfs
$(MKDIR) -p "$(INSTALLBINDIR)"
$(CP) -a "$<" "$(INSTALLBINDIR)/$<"
install-man: $(MANPAGE)
$(MKDIR) -p "$(INSTALLMAN1DIR)"
$(INSTALL) -v -m 0644 "man/$(MANPAGE)" "$(INSTALLMAN1DIR)/$(MANPAGE)"
install-strip: install-base
$(STRIP) "$(INSTALLBINDIR)/$(TARGET)"
uninstall: uninstall-base uninstall-mount.mergerfs uninstall-man
uninstall-base:
$(RM) -f "$(INSTALLBINDIR)/$(TARGET)"
uninstall-mount.mergerfs:
$(RM) -f "$(INSTALLBINDIR)/mount.mergerfs"
uninstall-man:
$(RM) -f "$(INSTALLMAN1DIR)/$(MANPAGE)"
$(MANPAGE): README.md
ifneq ($(PANDOC),)
$(PANDOC) -s -t man -o "man/$(MANPAGE)" README.md
endif
man: $(MANPAGE)
tarball: distclean man changelog authors version
$(eval VERSION := $(shell cat VERSION))
$(eval VERSION := $(subst -,_,$(VERSION)))
$(eval FILENAME := $(TARGET)-$(VERSION))
$(eval TMPDIR := $(shell $(MKTEMP) --tmpdir -d .$(FILENAME).XXXXXXXX))
$(MKDIR) $(TMPDIR)/$(FILENAME)
$(CP) -ar . $(TMPDIR)/$(FILENAME)
$(TAR) --exclude=.git -cz -C $(TMPDIR) -f $(FILENAME).tar.gz $(FILENAME)
$(RM) -rf $(TMPDIR)
debian-changelog:
ifeq ($(GIT_REPO),1)
$(GIT2DEBCL) --name $(TARGET) > debian/changelog
else
cp ChangeLog debian/changelog
endif
signed-deb: debian-changelog
dpkg-buildpackage
deb: debian-changelog
dpkg-buildpackage -uc -us
rpm-clean:
$(RM) -rf rpmbuild
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 \
--define "_topdir $(CURDIR)/rpmbuild"
install-build-pkgs:
ifeq ($(shell test -e /usr/bin/apt-get; echo $$?),0)
apt-get -qy update
apt-get -qy --no-install-suggests --no-install-recommends --force-yes \
install build-essential git g++ debhelper libattr1-dev python automake libtool lsb-release
else ifeq ($(shell test -e /usr/bin/dnf; echo $$?),0)
dnf -y update
dnf -y install git rpm-build libattr-devel gcc-c++ make which python automake libtool gettext-devel
else ifeq ($(shell test -e /usr/bin/yum; echo $$?),0)
yum -y update
yum -y install git rpm-build libattr-devel gcc-c++ make which python automake libtool gettext-devel
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)
.PHONY: all clean install help version
-include $(DEPS)

1
debian/compat

@ -1 +0,0 @@
9

18
debian/control

@ -1,18 +0,0 @@
Source: mergerfs
Section: utils
Priority: optional
Maintainer: Antonio SJ Musumeci <trapexit@spawn.link>
Build-Depends: debhelper (>= 8.0.0),
libattr1-dev
Standards-Version: 3.9.4
Homepage: http://github.com/trapexit/mergerfs
Package: mergerfs
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
fuse [linux-any] | fuse4bsd [kfreebsd-any]
Description: another FUSE union filesystem
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.

11
debian/rules

@ -1,11 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
override_dh_auto_install:
$(MAKE) DESTDIR=$(CURDIR)/debian/mergerfs PREFIX=/usr install

50
mergerfs.spec

@ -1,50 +0,0 @@
Name: mergerfs
Version: __VERSION__
Release: 1%{?dist}
Summary: A FUSE union filesystem
Group: Applications/System
License: ISC
URL: https://github.com/trapexit/mergerfs
Source: mergerfs-%{version}.tar.gz
BuildRequires: gcc-c++
BuildRequires: libattr-devel
# rpmbuild driven by the Makefile uses git to generate a version number
BuildRequires: git
Requires: fuse
%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.
%build
make %{?_smp_mflags}
%install
make install PREFIX=%{_prefix} DESTDIR=%{buildroot}
%files
%{_bindir}/*
%doc %{_mandir}/*
%changelog
* Mon Jan 25 2016 Antonio SJ Musumeci <trapexit@spawn.link>
- Remove sbin files
* Sat Sep 05 2015 Antonio SJ Musumeci <trapexit@spawn.link>
- Include PREFIX to install
* Mon Dec 29 2014 Joe Lawrence <joe.lawrence@stratus.com>
- Tweak rpmbuild to archive current git HEAD into a tarball, then (re)build in
the rpmbuild directory -- more complicated but seemingly better suited to
generate source and debug rpms.
* Fri Jun 20 2014 Joe Lawrence <joe.lawrence@stratus.com>
- Initial rpm spec file.

2
src/version.hpp.in

@ -0,0 +1,2 @@
#pragma once
static const char MERGERFS_VERSION[] = "@MERGERFS_VERSION@";

23
tools/update-version

@ -1,23 +0,0 @@
#!/bin/sh
GIT=$(which git)
if [ "${GIT}" = "" ]; then
exit 0
fi
VERSION=$(git describe --always --tags --dirty)
if [ $? -ne 0 ]; then
VERSION=$(cat VERSION)
fi
if [ "${VERSION}" = "" ]; then
VERSION="unknown"
fi
echo -n "${VERSION}" > VERSION
grep -q \"${VERSION}\" src/version.hpp
RV=$?
if [ $RV -ne 0 ]; then
echo "#pragma once" > src/version.hpp
echo "static const char MERGERFS_VERSION[] = \"${VERSION}\";" >> src/version.hpp
fi
Loading…
Cancel
Save