diff --git a/Makefile b/Makefile index 4807f45..9209b67 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,13 @@ DEBDATE=$(shell date -R) DEBORIGSRC=lume_$(DEBVERSION).orig.tar.xz DEBORIGSRCDIR=lume-$(DEBVERSION) +RPMVERSION=$(subst -,_,$(LUME_VERSION)) +RPMBUILDDIR=$(BUILDDIR)/rpm +RPMTMPLDIR=$(CURDIR)/packaging/rpm +RPMDATE=$(shell date "+%a %b %d %Y") +RPMORIGSRC=lume-$(RPMVERSION).tar.xz +RPMORIGSRCDIR=lume-$(RPMVERSION) + ifeq ($(OS), Windows_NT) EXE=$(BINDIR)/lume.exe RM=del /f /q @@ -40,7 +47,7 @@ build: $(Q) go build -o $(EXE) -ldflags="$(LDFLAGS)" ./cmd/lume .PHONY: clean -clean: deb-clean +clean: deb-clean rpm-clean $(Q) $(RM) $(EXE) .PHONY: install @@ -66,9 +73,23 @@ deb: $(Q) mv $(DEBBUILDDIR)/*.deb $(BUILDDIR) $(Q) mv $(DEBBUILDDIR)/*.tar.* $(BUILDDIR) +.PHONY: rpm +rpm: + $(Q) mkdir -p $(RPMBUILDDIR)/SPECS + $(Q) mkdir -p $(RPMBUILDDIR)/SOURCES + $(Q) sed -e 's/__VERSION__/$(RPMVERSION)/g' -e 's/__DATE__/$(RPMDATE)/g' $(RPMTMPLDIR)/lume.spec > $(RPMBUILDDIR)/SPECS/lume.spec + $(Q) git archive --format tar --prefix $(RPMORIGSRCDIR)/ $(LUME_VERSION) | xz > $(RPMBUILDDIR)/SOURCES/$(RPMORIGSRC) + $(Q) rpmbuild --define "_topdir $(RPMBUILDDIR)" -ba $(RPMBUILDDIR)/SPECS/lume.spec + $(Q) mv $(RPMBUILDDIR)/RPMS/*/*.rpm $(BUILDDIR) + $(Q) mv $(RPMBUILDDIR)/SRPMS/*.rpm $(BUILDDIR) + deb-clean: $(Q) rm -rf $(DEBBUILDDIR) $(Q) rm $(BUILDDIR)/*.changes $(Q) rm $(BUILDDIR)/*.buildinfo $(Q) rm $(BUILDDIR)/*.deb $(Q) rm $(BUILDDIR)/*.tar.* + +rpm-clean: + $(Q) rm -rf $(RPMBUILDDIR) + $(Q) rm $(BUILDDIR)/*.rpm diff --git a/packaging/rpm/lume.spec b/packaging/rpm/lume.spec new file mode 100644 index 0000000..9f199ef --- /dev/null +++ b/packaging/rpm/lume.spec @@ -0,0 +1,32 @@ +Name: lume +Version: __VERSION__ +Release: 1%{?dist} +Summary: A CLI tool for the LIFX HTTP API + +License: MPL +URL: https://git.kill0.net/chill9/lume +Source: %{name}-%{version}.tar.xz + +%global debug_package %{nil} + +%description + +%prep +%setup + +%build +%make_build + +%install +%make_install DESTDIR=%{buildroot} + + +%files +%{_bindir}/lume +%license LICENSE +/usr/share/lume/lumerc + + +%changelog +* __DATE__ Ryan Cavicchioni +- lume __VERSION__