From 08d07b71e13bae0a310039c1cbb35e5db3fe7f62 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Sat, 5 Sep 2015 17:56:45 -0400 Subject: [PATCH] add building of rpm --- Makefile | 23 ++++++++++++++++++++--- README.md | 4 +++- mergerfs.spec | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 mergerfs.spec diff --git a/Makefile b/Makefile index 60a1d5c3..e6f91996 100644 --- a/Makefile +++ b/Makefile @@ -33,11 +33,14 @@ 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 CPPFIND = ./tools/cppfind ifeq ($(PKGCONFIG),"") -$(error "pkg-config not installed" +$(error "pkg-config not installed") endif ifeq ($(PANDOC),"") @@ -122,7 +125,7 @@ obj/obj-stamp: obj/%.o: src/%.cpp $(CXX) $(CFLAGS) -c $< -o $@ -clean: +clean: rpm-clean $(RM) -rf obj $(RM) -f "$(TARGET)" "$(MANPAGE)" clonepath $(FIND) . -name "*~" -delete @@ -162,11 +165,12 @@ man: $(MANPAGE) tarball: clean man changelog authors $(eval VERSION := $(shell $(GIT) describe --always --tags --dirty)) + $(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) + $(TAR) --exclude=.git -cz -C $(TMPDIR) -f $(FILENAME).tar.gz $(FILENAME) $(RM) -rf $(TMPDIR) debian-changelog: @@ -178,6 +182,19 @@ deb: debian-changelog unsigned-deb: debian-changelog dpkg-buildpackage -uc -us +rpm-clean: + $(RM) -rf rpmbuild + +rpm: tarball + $(eval VERSION := $(shell $(GIT) describe --always --tags --dirty)) + $(eval VERSION := $(subst -,_,$(VERSION))) + $(MKDIR) -p rpmbuild/{BUILD,RPMS,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" + .PHONY: all clean install help include $(wildcard obj/*.d) diff --git a/README.md b/README.md index 5eb52be0..a711912c 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,9 @@ $ sudo dpkg -i ../mergerfs_version_arch.deb ``` $ su - # dnf install fuse-devel libattr-devel pandoc gcc-c++ -# make install +# cd mergerfs +# make rpm +# rpm -i rpmbuild/RPMS//mergerfs-..rpm ``` #### Generically diff --git a/mergerfs.spec b/mergerfs.spec new file mode 100644 index 00000000..396a57e7 --- /dev/null +++ b/mergerfs.spec @@ -0,0 +1,50 @@ +Name: mergerfs +Version: __VERSION__ +Release: 1%{?dist} +Summary: A FUSE union filesystem + +Group: Applications/System +License: MIT +URL: https://github.com/trapexit/mergerfs + +Source: mergerfs-%{version}.tar.gz + +BuildRequires: gcc-c++ +BuildRequires: libattr-devel +BuildRequires: fuse-devel +# rpmbuild driven by the Makefile uses git to generate a version number +BuildRequires: git +# pandoc pulls in ~60 packages (87M installed) from EPEL :( +BuildRequires: pandoc + +Requires: fuse-libs + +%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 +* Sat Sep 05 2015 Antonio SJ Musumeci +- Include PREFIX to install + +* Mon Dec 29 2014 Joe Lawrence +- 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 +- Initial rpm spec file.