Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. DIR := $(dir $(lastword $(MAKEFILE_LIST)))
  2. INSTGIT := $(shell if [ "$$(id -u)" = "0" ]; then dnf -y install git; fi)
  3. NAME := jellyfin-server
  4. VERSION := $(shell sed -ne '/^Version:/s/.* *//p' $(DIR)/jellyfin.spec)
  5. RELEASE := $(shell sed -ne '/^Release:/s/.* *\(.*\)%{.*}.*/\1/p' $(DIR)/jellyfin.spec)
  6. GIT_VER := $(shell git describe --tags | sed -e 's/^v//' -e 's/-[0-9]*-g.*$$//')
  7. SRPM := jellyfin-$(subst -,~,$(GIT_VER))-$(RELEASE)$(shell rpm --eval %dist).src.rpm
  8. TARBALL :=$(NAME)-$(subst -,~,$(GIT_VER)).tar.gz
  9. epel-7-x86_64_repos := https://packages.microsoft.com/rhel/7/prod/
  10. epel-8-x86_64_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/
  11. fedora_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/
  12. fedora-34-x86_64_repos := $(fedora_repos)
  13. fedora-35-x86_64_repos := $(fedora_repos)
  14. fedora-34-x86_64_repos := $(fedora_repos)
  15. outdir ?= $(PWD)/$(DIR)/
  16. TARGET ?= fedora-35-x86_64
  17. srpm: $(DIR)/$(SRPM)
  18. tarball: $(DIR)/$(TARBALL)
  19. $(DIR)/$(TARBALL):
  20. cd $(DIR)/; \
  21. SOURCE_DIR=.. \
  22. WORKDIR="$${PWD}"; \
  23. version=$(GIT_VER); \
  24. tar \
  25. --transform "s,^\.,$(NAME)-$(subst -,~,$(GIT_VER))," \
  26. --exclude='.git*' \
  27. --exclude='**/.git' \
  28. --exclude='**/.hg' \
  29. --exclude='**/.vs' \
  30. --exclude='**/.vscode' \
  31. --exclude=deployment \
  32. --exclude='**/bin' \
  33. --exclude='**/obj' \
  34. --exclude='**/.nuget' \
  35. --exclude='*.deb' \
  36. --exclude='*.rpm' \
  37. --exclude=$(notdir $@) \
  38. -czf $(notdir $@) \
  39. -C $${SOURCE_DIR} ./
  40. $(DIR)/$(SRPM): $(DIR)/$(TARBALL) $(DIR)/jellyfin.spec
  41. ./bump_version $(GIT_VER)
  42. cd $(DIR)/; \
  43. rpmbuild -bs jellyfin.spec \
  44. --define "_sourcedir $$PWD/" \
  45. --define "_srcrpmdir $(outdir)"
  46. rpms: $(DIR)/$(SRPM)
  47. mock $(addprefix --addrepo=, $($(TARGET)_repos)) \
  48. --enable-network \
  49. -r $(TARGET) $<