clixon/extras/rpm/Makefile.in
Renato Botelho do Couto 1c187c5729 Prepare build system to produce RPMs
Add .spec file under extras/rpms and create targets to produce
source and binary rpms
2017-12-05 07:27:59 -06:00

35 lines
1.2 KiB
Makefile

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)