summaryrefslogtreecommitdiff
path: root/other/rpm/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'other/rpm/Makefile')
-rw-r--r--other/rpm/Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/other/rpm/Makefile b/other/rpm/Makefile
new file mode 100644
index 00000000..5e164717
--- /dev/null
+++ b/other/rpm/Makefile
@@ -0,0 +1,32 @@
1PROJECT_NAME = toxcore
2PROJECT_FULL_NAME = c-$(PROJECT_NAME)
3PROJECT_VERSION = $(shell git describe | sed -e 's/^v//' -e 's/-/_/g')
4PROJECT_COMMIT_ID = $(shell git rev-parse HEAD)
5PROJECT_COMMIT_ID_SHORT = $(shell git rev-parse --short HEAD)
6PROJECT_GIT_ROOT = $(shell git rev-parse --show-toplevel)
7
8all:
9 @echo available targets: spec srpm clean
10
11spec: toxcore.spec
12
13toxcore.spec:
14 sed -r \
15 -e 's#@PROJECT_NAME@#$(PROJECT_NAME)#g' \
16 -e 's#@PROJECT_VERSION@#$(PROJECT_VERSION)#' \
17 -e 's#^(%define commit )0$$#\1$(PROJECT_COMMIT_ID)#' \
18 toxcore.spec.in > toxcore.spec
19
20$(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz:
21 ( \
22 cd $(PROJECT_GIT_ROOT); \
23 git archive --prefix '$(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT)/' -o other/rpm/$(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz $(PROJECT_COMMIT_ID) \
24 )
25
26srpm: toxcore.spec $(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz
27 rpmbuild --define "_sourcedir ." --define "_srcrpmdir ." -bs toxcore.spec
28
29clean:
30 rm -f toxcore.spec *.tar.gz *.rpm
31
32.PHONY = clean srpm spec