Makefile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. epel-8-x86_64_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/
  10. fedora_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/
  11. fedora-34-x86_64_repos := $(fedora_repos)
  12. fedora-35-x86_64_repos := $(fedora_repos)
  13. fedora-34-x86_64_repos := $(fedora_repos)
  14. outdir ?= $(PWD)/$(DIR)/
  15. TARGET ?= fedora-35-x86_64
  16. srpm: $(DIR)/$(SRPM)
  17. tarball: $(DIR)/$(TARBALL)
  18. $(DIR)/$(TARBALL):
  19. cd $(DIR)/; \
  20. SOURCE_DIR=.. \
  21. WORKDIR="$${PWD}"; \
  22. version=$(VERSION); \
  23. tar \
  24. --transform "s,^\.,$(NAME)-$(subst -,~,$(VERSION))," \
  25. --exclude='.git*' \
  26. --exclude='**/.git' \
  27. --exclude='**/.hg' \
  28. --exclude='**/.vs' \
  29. --exclude='**/.vscode' \
  30. --exclude=deployment \
  31. --exclude='**/bin' \
  32. --exclude='**/obj' \
  33. --exclude='**/.nuget' \
  34. --exclude='*.deb' \
  35. --exclude='*.rpm' \
  36. --exclude=$(notdir $@) \
  37. -czf $(notdir $@) \
  38. -C $${SOURCE_DIR} ./
  39. $(DIR)/$(SRPM): $(DIR)/$(TARBALL) $(DIR)/jellyfin.spec
  40. cd $(DIR)/; \
  41. rpmbuild -bs jellyfin.spec \
  42. --define "_sourcedir $$PWD/" \
  43. --define "_srcrpmdir $(outdir)"
  44. rpms: $(DIR)/$(SRPM)
  45. mock $(addprefix --addrepo=, $($(TARGET)_repos)) \
  46. --enable-network \
  47. -r $(TARGET) $<