Browse Source

add building of rpm

pull/119/head
Antonio SJ Musumeci 9 years ago
parent
commit
08d07b71e1
  1. 23
      Makefile
  2. 4
      README.md
  3. 50
      mergerfs.spec

23
Makefile

@ -33,11 +33,14 @@ INSTALL = $(shell which install)
MKTEMP = $(shell which mktemp) MKTEMP = $(shell which mktemp)
STRIP = $(shell which strip) STRIP = $(shell which strip)
PANDOC = $(shell which pandoc) PANDOC = $(shell which pandoc)
SED = $(shell which sed)
GZIP = $(shell which gzip)
RPMBUILD = $(shell which rpmbuild)
GIT2DEBCL = ./tools/git2debcl GIT2DEBCL = ./tools/git2debcl
CPPFIND = ./tools/cppfind CPPFIND = ./tools/cppfind
ifeq ($(PKGCONFIG),"") ifeq ($(PKGCONFIG),"")
$(error "pkg-config not installed"
$(error "pkg-config not installed")
endif endif
ifeq ($(PANDOC),"") ifeq ($(PANDOC),"")
@ -122,7 +125,7 @@ obj/obj-stamp:
obj/%.o: src/%.cpp obj/%.o: src/%.cpp
$(CXX) $(CFLAGS) -c $< -o $@ $(CXX) $(CFLAGS) -c $< -o $@
clean:
clean: rpm-clean
$(RM) -rf obj $(RM) -rf obj
$(RM) -f "$(TARGET)" "$(MANPAGE)" clonepath $(RM) -f "$(TARGET)" "$(MANPAGE)" clonepath
$(FIND) . -name "*~" -delete $(FIND) . -name "*~" -delete
@ -162,11 +165,12 @@ man: $(MANPAGE)
tarball: clean man changelog authors tarball: clean man changelog authors
$(eval VERSION := $(shell $(GIT) describe --always --tags --dirty)) $(eval VERSION := $(shell $(GIT) describe --always --tags --dirty))
$(eval VERSION := $(subst -,_,$(VERSION)))
$(eval FILENAME := $(TARGET)-$(VERSION)) $(eval FILENAME := $(TARGET)-$(VERSION))
$(eval TMPDIR := $(shell $(MKTEMP) --tmpdir -d .$(FILENAME).XXXXXXXX)) $(eval TMPDIR := $(shell $(MKTEMP) --tmpdir -d .$(FILENAME).XXXXXXXX))
$(MKDIR) $(TMPDIR)/$(FILENAME) $(MKDIR) $(TMPDIR)/$(FILENAME)
$(CP) -ar . $(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) $(RM) -rf $(TMPDIR)
debian-changelog: debian-changelog:
@ -178,6 +182,19 @@ deb: debian-changelog
unsigned-deb: debian-changelog unsigned-deb: debian-changelog
dpkg-buildpackage -uc -us 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 .PHONY: all clean install help
include $(wildcard obj/*.d) include $(wildcard obj/*.d)

4
README.md

@ -121,7 +121,9 @@ $ sudo dpkg -i ../mergerfs_version_arch.deb
``` ```
$ su - $ su -
# dnf install fuse-devel libattr-devel pandoc gcc-c++ # 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 #### Generically

50
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 <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.
Loading…
Cancel
Save