diff options
Diffstat (limited to 'other/rpm/Makefile')
-rw-r--r-- | other/rpm/Makefile | 32 |
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 @@ | |||
1 | PROJECT_NAME = toxcore | ||
2 | PROJECT_FULL_NAME = c-$(PROJECT_NAME) | ||
3 | PROJECT_VERSION = $(shell git describe | sed -e 's/^v//' -e 's/-/_/g') | ||
4 | PROJECT_COMMIT_ID = $(shell git rev-parse HEAD) | ||
5 | PROJECT_COMMIT_ID_SHORT = $(shell git rev-parse --short HEAD) | ||
6 | PROJECT_GIT_ROOT = $(shell git rev-parse --show-toplevel) | ||
7 | |||
8 | all: | ||
9 | @echo available targets: spec srpm clean | ||
10 | |||
11 | spec: toxcore.spec | ||
12 | |||
13 | toxcore.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 | |||
26 | srpm: toxcore.spec $(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz | ||
27 | rpmbuild --define "_sourcedir ." --define "_srcrpmdir ." -bs toxcore.spec | ||
28 | |||
29 | clean: | ||
30 | rm -f toxcore.spec *.tar.gz *.rpm | ||
31 | |||
32 | .PHONY = clean srpm spec | ||