Add RPM build infrastructure
[time-slider.git] / rpm / Makefile
diff --git a/rpm/Makefile b/rpm/Makefile
new file mode 100644 (file)
index 0000000..078f462
--- /dev/null
@@ -0,0 +1,22 @@
+top_builddir = ..
+top_srcdir = ..
+SED = /usr/bin/sed
+INTLTOOL_MERGE = /usr/bin/intltool-merge
+spec_in_files = time-slider.spec.in
+spec_DATA = $(spec_in_files:.spec.in=.spec)
+
+ifeq ($(wildcard $(top_srcdir)/.git),)
+       include $(top_srcdir)/VERSION
+else
+       VERSION=$(shell git describe)
+endif
+MAINVER=$(shell echo $(VERSION) | cut -f1 -d'-')
+RELEASE=$(shell echo $(VERSION) | cut -f2- -d'-' | sed -e 's/-/./g')
+
+all: $(spec_DATA)
+
+$(spec_DATA):
+       $(SED) -e 's,\@VERSION\@,$(MAINVER),g' \
+               -e 's,\@RELEASE\@,$(RELEASE),g' \
+               -e 's,\@GITVER\@,$(VERSION),g' \
+               '$@.in' > '$@'