add building of rpm

This commit is contained in:
Antonio SJ Musumeci 2015-09-05 17:56:45 -04:00
parent ce2462042f
commit 08d07b71e1
3 changed files with 73 additions and 4 deletions

View File

@ -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)

View File

@ -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/<arch>/mergerfs-<verion>.<arch>.rpm
```
#### Generically

50
mergerfs.spec Normal file
View File

@ -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 <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.