Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. SRPM := jellyfin-$(subst -,~,$(VERSION))-$(RELEASE)$(shell rpm --eval %dist).src.rpm
  7. TARBALL :=$(NAME)-$(subst -,~,$(VERSION)).tar.gz
  8. epel-7-x86_64_repos := https://packages.microsoft.com/rhel/7/prod/
  9. fed_ver := $(shell rpm -E %fedora)
  10. # fallback when not running on Fedora
  11. fed_ver ?= 36
  12. TARGET ?= fedora-$(fed_ver)-x86_64
  13. outdir ?= $(PWD)/$(DIR)/
  14. srpm: $(DIR)/$(SRPM)
  15. tarball: $(DIR)/$(TARBALL)
  16. $(DIR)/$(TARBALL):
  17. cd $(DIR)/; \
  18. SOURCE_DIR=.. \
  19. WORKDIR="$${PWD}"; \
  20. version=$(VERSION); \
  21. tar \
  22. --transform "s,^\.,$(NAME)-$(subst -,~,$(VERSION))," \
  23. --exclude='.git*' \
  24. --exclude='**/.git' \
  25. --exclude='**/.hg' \
  26. --exclude='**/.vs' \
  27. --exclude='**/.vscode' \
  28. --exclude=deployment \
  29. --exclude='**/bin' \
  30. --exclude='**/obj' \
  31. --exclude='**/.nuget' \
  32. --exclude='*.deb' \
  33. --exclude='*.rpm' \
  34. --exclude=$(notdir $@) \
  35. -czf $(notdir $@) \
  36. -C $${SOURCE_DIR} ./
  37. $(DIR)/$(SRPM): $(DIR)/$(TARBALL) $(DIR)/jellyfin.spec
  38. cd $(DIR)/; \
  39. rpmbuild -bs jellyfin.spec \
  40. --define "_sourcedir $$PWD/" \
  41. --define "_srcrpmdir $(outdir)"
  42. rpms: $(DIR)/$(SRPM)
  43. mock $(addprefix --addrepo=, $($(TARGET)_repos)) \
  44. --enable-network \
  45. -r $(TARGET) $<