Prepare build system to produce RPMs

Add .spec file under extras/rpms and create targets to produce
source and binary rpms
This commit is contained in:
Renato Botelho do Couto 2017-12-05 07:27:59 -06:00
parent e7b1c0c38c
commit 1c187c5729
6 changed files with 135 additions and 7 deletions

35
extras/rpm/Makefile.in Normal file
View file

@ -0,0 +1,35 @@
TARBALL=$(shell realpath ../../build-root/clixon-latest.tar.xz)
BASENAME=$(shell basename $(TARBALL) | sed -e s/.tar.\*//)
VERSION=$(shell echo $(BASENAME) | cut -f2 -d-)
RELEASE=$(shell echo $(BASENAME) | cut -f3- -d- | sed -e s/-/_/g)
BR=$(shell realpath $(CURDIR)/../../build-root)
RPMBUILD=$(BR)/rpmbuild
all: RPM
spec:
@echo $(TARBALL)
mkdir -p $(RPMBUILD)/{RPMS,SRPMS,BUILD,SOURCES,SPECS}
cp $(TARBALL) $(RPMBUILD)/SOURCES/clixon-$(VERSION)-$(RELEASE).tar.xz
cp clixon.spec $(RPMBUILD)/SPECS
srpm: spec
rpmbuild -bs \
--define "cligen_prefix @CLIGEN_PREFIX@" \
--define "_topdir $(RPMBUILD)" \
--define "_version $(VERSION)" \
--define "_release $(RELEASE)" \
$(RPMBUILD)/SPECS/clixon.spec
mv $$(find $(RPMBUILD)/SRPMS -name \*.src.rpm -type f) $(BR)
# Define DEVELOPER environmrnt variable to prevent .spec to add cligent to the
# list of build requirements
RPM: spec
rpmbuild -bb \
--define "cligen_prefix @CLIGEN_PREFIX@" \
$${DEVELOPER:+--define "developer yes"} \
--define "_topdir $(RPMBUILD)" \
--define "_version $(VERSION)" \
--define "_release $(RELEASE)" \
$(RPMBUILD)/SPECS/clixon.spec
mv $$(find $(RPMBUILD)/RPMS -name \*.rpm -type f) $(BR)