tarsnap-rpm/Makefile

38 lines
1,020 B
Makefile

PKGNAME = tarsnap
SPECFILE = $(PKGNAME).spec
ARCH = $(shell rpm --eval "%{_arch}")
RPMBUILD = $(shell rpm --eval "%{_builddir}")
RPMSOURCE = $(shell rpm --eval "%{_sourcedir}")
RPMDIR = $(shell rpm --eval "%{_rpmdir}")
version = $(shell egrep "^Version" $(SPECFILE) | awk '{ print $$2}')
release = $(shell egrep "^Release" $(SPECFILE) | awk '{ print $$2}' | cut -d% -f1)
dist = $(shell rpm --eval "%{?dist}")
sourceurl = https://www.tarsnap.com/download/tarsnap-autoconf-$(version).tgz
source = $(RPMSOURCE)/tarsnap-autoconf-$(version).tgz
RPM = $(RPMDIR)/$(ARCH)/$(PKGNAME)-$(version)-$(release)$(dist).$(ARCH).rpm
SHA = $(PKGNAME)-$(version)-$(release)$(dist).$(ARCH).rpm.sha256
all: $(RPM)
$(RPM): $(SPECFILE) $(source)
rpmbuild -bb $<
$(source):
wget -O $@ $(sourceurl)
sign: $(RPM)
rpm --addsign $<
rpm -K $<
release: $(RPM) sign
sha256sum $< > $(SHA)
tea release create --draft --title "v$(version)" --tag v$(version) \
--asset $< --asset $(SHA)
clean:
rm $(RPM) $(source) $(SHA)
.PHONY: clean