rules 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #! /usr/bin/make -f
  2. CONFIG := Release
  3. TERM := xterm
  4. SHELL := /bin/bash
  5. WEB_TARGET := $(CURDIR)/MediaBrowser.WebDashboard/jellyfin-web
  6. WEB_VERSION := $(shell sed -n -e 's/^version: "\(.*\)"/\1/p' $(CURDIR)/build.yaml)
  7. HOST_ARCH := $(shell arch)
  8. BUILD_ARCH := ${DEB_HOST_MULTIARCH}
  9. ifeq ($(HOST_ARCH),x86_64)
  10. # Building AMD64
  11. DOTNETRUNTIME := debian-x64
  12. ifeq ($(BUILD_ARCH),arm-linux-gnueabihf)
  13. # Cross-building ARM on AMD64
  14. DOTNETRUNTIME := debian-arm
  15. endif
  16. ifeq ($(BUILD_ARCH),aarch64-linux-gnu)
  17. # Cross-building ARM on AMD64
  18. DOTNETRUNTIME := debian-arm64
  19. endif
  20. endif
  21. ifeq ($(HOST_ARCH),armv7l)
  22. # Building ARM
  23. DOTNETRUNTIME := debian-arm
  24. endif
  25. ifeq ($(HOST_ARCH),arm64)
  26. # Building ARM
  27. DOTNETRUNTIME := debian-arm64
  28. endif
  29. export DH_VERBOSE=1
  30. export DOTNET_CLI_TELEMETRY_OPTOUT=1
  31. %:
  32. dh $@
  33. # disable "make check"
  34. override_dh_auto_test:
  35. # disable stripping debugging symbols
  36. override_dh_clistrip:
  37. override_dh_auto_build:
  38. echo $(WEB_VERSION)
  39. # Clone down and build Web frontend
  40. mkdir -p $(WEB_TARGET)
  41. wget -O web-src.tgz https://github.com/jellyfin/jellyfin-web/archive/v$(WEB_VERSION).tar.gz || wget -O web-src.tgz https://github.com/jellyfin/jellyfin-web/archive/master.tar.gz
  42. mkdir -p $(CURDIR)/web
  43. tar -xzf web-src.tgz -C $(CURDIR)/web/ --strip 1
  44. cd $(CURDIR)/web/ && npm install yarn
  45. cd $(CURDIR)/web/ && node_modules/yarn/bin/yarn install
  46. mv $(CURDIR)/web/dist/* $(WEB_TARGET)/
  47. # Build the application
  48. dotnet publish --configuration $(CONFIG) --output='$(CURDIR)/usr/lib/jellyfin/bin' --self-contained --runtime $(DOTNETRUNTIME) \
  49. "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none" Jellyfin.Server
  50. override_dh_auto_clean:
  51. dotnet clean -maxcpucount:1 --configuration $(CONFIG) Jellyfin.Server || true
  52. rm -f '$(CURDIR)/web-src.tgz'
  53. rm -rf '$(CURDIR)/usr'
  54. rm -rf '$(CURDIR)/web'
  55. rm -rf '$(WEB_TARGET)'
  56. # Force the service name to jellyfin even if we're building jellyfin-nightly
  57. override_dh_installinit:
  58. dh_installinit --name=jellyfin