From 0c3d9eaa504576fcf010464ee80427c1023da77b Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Mon, 23 Jun 2014 10:16:29 -0400 Subject: [PATCH 1/3] fixup pkg-config error parens --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 83f33382..a1b0feb7 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ GIT2DEBCL = ./tools/git2debcl CPPFIND = ./tools/cppfind ifeq ($(PKGCONFIG),"") -$(error "pkg-config not installed" +$(error "pkg-config not installed") endif ifeq ($(PANDOC),"") From 4e624013bb615031695251179faa8c65cc993691 Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Fri, 20 Jun 2014 17:01:07 -0400 Subject: [PATCH 2/3] add rpm package building. --- Makefile | 10 +++++++++- mergerfs.spec | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 mergerfs.spec diff --git a/Makefile b/Makefile index a1b0feb7..09acaf71 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ STRIP = $(shell which strip) PANDOC = $(shell which pandoc) GIT2DEBCL = ./tools/git2debcl CPPFIND = ./tools/cppfind +RPMBUILD = $(shell which rpmbuild) ifeq ($(PKGCONFIG),"") $(error "pkg-config not installed") @@ -118,7 +119,7 @@ obj/%.o: src/%.cpp $(CXX) $(CFLAGS) -c $< -o $@ clean: - $(RM) -rf obj "$(TARGET)" "$(MANPAGE)" + $(RM) -rf obj "$(TARGET)" "$(MANPAGE)" rpmbuild $(FIND) -name "*~" -delete distclean: clean @@ -154,6 +155,13 @@ deb: $(GIT2DEBCL) $(TARGET) $(VERSION) > debian/changelog $(GIT) buildpackage --git-ignore-new +rpm: + $(eval VERSION := $(subst -,_,$(shell $(GIT) describe --always --tags --dirty))) + $(RPMBUILD) -bb $(TARGET).spec \ + --define "_topdir $(CURDIR)/rpmbuild" \ + --define "_builddir $(CURDIR)" \ + --define "pkg_version $(VERSION)" + .PHONY: all clean install help include $(wildcard obj/*.d) diff --git a/mergerfs.spec b/mergerfs.spec new file mode 100644 index 00000000..4e82953e --- /dev/null +++ b/mergerfs.spec @@ -0,0 +1,37 @@ +Name: mergerfs +Version: %{pkg_version} +Release: 1%{?dist} +Summary: A FUSE union filesystem + +Group: Applications/System +License: MIT +URL: https://github.com/trapexit/mergerfs + +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 + +%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 DESTDIR=%{buildroot} + +%files +%{_bindir}/* +%doc %{_mandir}/* + +%changelog +* Fri Jun 20 2014 Joe Lawrence +- Initial rpm spec file. From f4fd342514d9565de3d3c1f6ed6d9401d22ea8d8 Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Mon, 29 Dec 2014 22:55:18 -0500 Subject: [PATCH 3/3] tweak rpm build to generate source and debuginfo packages --- Makefile | 14 ++++++++++---- mergerfs.spec | 11 ++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 09acaf71..7c1f30e8 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,9 @@ PANDOC = $(shell which pandoc) GIT2DEBCL = ./tools/git2debcl CPPFIND = ./tools/cppfind RPMBUILD = $(shell which rpmbuild) +GZIP = $(shell which gzip) +SED = $(shell which sed) +MKDIR = $(shell which mkdir) ifeq ($(PKGCONFIG),"") $(error "pkg-config not installed") @@ -157,10 +160,13 @@ deb: rpm: $(eval VERSION := $(subst -,_,$(shell $(GIT) describe --always --tags --dirty))) - $(RPMBUILD) -bb $(TARGET).spec \ - --define "_topdir $(CURDIR)/rpmbuild" \ - --define "_builddir $(CURDIR)" \ - --define "pkg_version $(VERSION)" + $(MKDIR) -p rpmbuild/{BUILD,RPMS,SOURCES} + $(GIT) archive --prefix="$(TARGET)-$(VERSION)/" --format tar HEAD | \ + $(GZIP) > rpmbuild/SOURCES/$(TARGET)-$(VERSION).tar.gz + $(SED) 's/__VERSION__/$(VERSION)/g' $(TARGET).spec > \ + rpmbuild/SOURCES/$(TARGET).spec + $(RPMBUILD) -ba rpmbuild/SOURCES/$(TARGET).spec \ + --define "_topdir $(CURDIR)/rpmbuild" .PHONY: all clean install help diff --git a/mergerfs.spec b/mergerfs.spec index 4e82953e..ac75d23f 100644 --- a/mergerfs.spec +++ b/mergerfs.spec @@ -1,11 +1,12 @@ Name: mergerfs -Version: %{pkg_version} +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 @@ -17,6 +18,9 @@ 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 @@ -33,5 +37,10 @@ make install DESTDIR=%{buildroot} %doc %{_mandir}/* %changelog +* 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.