tvheadend.mk 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. ################################################################################
  2. #
  3. # tvheadend
  4. #
  5. ################################################################################
  6. TVHEADEND_VERSION = 0af87f13f786046df7bb610f8a6b291c26af1b14
  7. TVHEADEND_SITE = $(call github,tvheadend,tvheadend,$(TVHEADEND_VERSION))
  8. TVHEADEND_LICENSE = GPL-3.0+
  9. TVHEADEND_LICENSE_FILES = LICENSE.md
  10. TVHEADEND_DEPENDENCIES = \
  11. host-gettext \
  12. host-pkgconf \
  13. host-pngquant \
  14. host-python3 \
  15. openssl
  16. ifeq ($(BR2_PACKAGE_AVAHI),y)
  17. TVHEADEND_DEPENDENCIES += avahi
  18. endif
  19. ifeq ($(BR2_PACKAGE_DBUS),y)
  20. TVHEADEND_DEPENDENCIES += dbus
  21. TVHEADEND_CONF_OPTS += --enable-dbus-1
  22. else
  23. TVHEADEND_CONF_OPTS += --disable-dbus-1
  24. endif
  25. ifeq ($(BR2_PACKAGE_TVHEADEND_TRANSCODING),y)
  26. TVHEADEND_CONF_OPTS += --enable-libav --enable-libx264
  27. TVHEADEND_DEPENDENCIES += ffmpeg x264
  28. ifeq ($(BR2_PACKAGE_LIBVA),y)
  29. TVHEADEND_CONF_OPTS += --enable-vaapi
  30. TVHEADEND_DEPENDENCIES += libva
  31. else
  32. TVHEADEND_CONF_OPTS += --disable-vaapi
  33. endif
  34. ifeq ($(BR2_PACKAGE_OPUS),y)
  35. TVHEADEND_CONF_OPTS += --enable-libopus
  36. TVHEADEND_DEPENDENCIES += opus
  37. else
  38. TVHEADEND_CONF_OPTS += --disable-libopus
  39. endif
  40. ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
  41. TVHEADEND_CONF_OPTS += --enable-omx
  42. TVHEADEND_DEPENDENCIES += rpi-userland
  43. else
  44. TVHEADEND_CONF_OPTS += --disable-omx
  45. endif
  46. ifeq ($(BR2_PACKAGE_LIBVPX)$(BR2_INSTALL_LIBSTDCPP),yy)
  47. TVHEADEND_CONF_OPTS += --enable-libvpx
  48. TVHEADEND_DEPENDENCIES += libvpx
  49. else
  50. TVHEADEND_CONF_OPTS += --disable-libvpx
  51. endif
  52. ifeq ($(BR2_PACKAGE_X265),y)
  53. TVHEADEND_CONF_OPTS += --enable-libx265
  54. TVHEADEND_DEPENDENCIES += x265
  55. else
  56. TVHEADEND_CONF_OPTS += --disable-libx265
  57. endif
  58. else
  59. TVHEADEND_CONF_OPTS += \
  60. --disable-libav \
  61. --disable-libopus \
  62. --disable-omx \
  63. --disable-vaapi \
  64. --disable-libvpx \
  65. --disable-libx264 \
  66. --disable-libx265
  67. endif
  68. ifeq ($(BR2_PACKAGE_TVHEADEND_DESCRAMBLER),y)
  69. TVHEADEND_CONF_OPTS += \
  70. --enable-cardclient \
  71. --enable-cwc \
  72. --enable-cccam \
  73. --enable-capmt \
  74. --enable-constcw
  75. else
  76. TVHEADEND_CONF_OPTS += \
  77. --disable-cardclient \
  78. --disable-cwc \
  79. --disable-cccam \
  80. --disable-capmt \
  81. --disable-constcw
  82. endif
  83. ifeq ($(BR2_PACKAGE_TVHEADEND_IPTV),y)
  84. TVHEADEND_CONF_OPTS += --enable-iptv
  85. else
  86. TVHEADEND_CONF_OPTS += --disable-iptv
  87. endif
  88. ifeq ($(BR2_PACKAGE_TVHEADEND_SATIP),y)
  89. TVHEADEND_CONF_OPTS += --enable-satip_client --enable-satip_server
  90. else
  91. TVHEADEND_CONF_OPTS += --disable-satip_client --disable-satip_server
  92. endif
  93. ifeq ($(BR2_PACKAGE_TVHEADEND_TIMESHIFT),y)
  94. TVHEADEND_CONF_OPTS += --enable-timeshift
  95. else
  96. TVHEADEND_CONF_OPTS += --disable-timeshift
  97. endif
  98. ifeq ($(BR2_PACKAGE_LIBDVBCSA),y)
  99. TVHEADEND_DEPENDENCIES += libdvbcsa
  100. TVHEADEND_CONF_OPTS += --enable-tvhcsa
  101. else
  102. TVHEADEND_CONF_OPTS += --disable-tvhcsa
  103. endif
  104. ifeq ($(BR2_PACKAGE_LIBHDHOMERUN),y)
  105. TVHEADEND_DEPENDENCIES += libhdhomerun
  106. TVHEADEND_CONF_OPTS += --enable-hdhomerun_client
  107. else
  108. TVHEADEND_CONF_OPTS += --disable-hdhomerun_client
  109. endif
  110. ifeq ($(BR2_PACKAGE_LIBICONV),y)
  111. TVHEADEND_DEPENDENCIES += libiconv
  112. endif
  113. TVHEADEND_CFLAGS = $(TARGET_CFLAGS)
  114. ifeq ($(BR2_PACKAGE_LIBURIPARSER),y)
  115. TVHEADEND_DEPENDENCIES += liburiparser
  116. TVHEADEND_CFLAGS += $(if $(BR2_USE_WCHAR),,-DURI_NO_UNICODE)
  117. endif
  118. ifeq ($(BR2_PACKAGE_PCRE2),y)
  119. TVHEADEND_DEPENDENCIES += pcre2
  120. TVHEADEND_CONF_OPTS += --disable-pcre --enable-pcre2
  121. else ifeq ($(BR2_PACKAGE_PCRE),y)
  122. TVHEADEND_DEPENDENCIES += pcre
  123. TVHEADEND_CONF_OPTS += --enable-pcre --disable-pcre2
  124. else
  125. TVHEADEND_CONF_OPTS += --disable-pcre --disable-pcre2
  126. endif
  127. ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
  128. TVHEADEND_CONF_OPTS += --disable-pie
  129. endif
  130. TVHEADEND_DEPENDENCIES += dtv-scan-tables
  131. # The tvheadend build system expects the transponder data to be present inside
  132. # its source tree. To prevent a download initiated by the build system just
  133. # copy the data files in the right place and add the corresponding stamp file.
  134. define TVHEADEND_INSTALL_DTV_SCAN_TABLES
  135. $(INSTALL) -d $(@D)/data/dvb-scan
  136. cp -r $(TARGET_DIR)/usr/share/dvb/* $(@D)/data/dvb-scan/
  137. touch $(@D)/data/dvb-scan/.stamp
  138. endef
  139. TVHEADEND_PRE_CONFIGURE_HOOKS += TVHEADEND_INSTALL_DTV_SCAN_TABLES
  140. define TVHEADEND_CONFIGURE_CMDS
  141. (cd $(@D); \
  142. $(TARGET_CONFIGURE_OPTS) \
  143. $(TARGET_CONFIGURE_ARGS) \
  144. CFLAGS="$(TVHEADEND_CFLAGS)" \
  145. ./configure \
  146. --prefix=/usr \
  147. --arch="$(ARCH)" \
  148. --cpu="$(GCC_TARGET_CPU)" \
  149. --nowerror \
  150. --python="$(HOST_DIR)/bin/python3" \
  151. --enable-dvbscan \
  152. --enable-bundle \
  153. --enable-pngquant \
  154. --disable-execinfo \
  155. --disable-ffmpeg_static \
  156. --disable-hdhomerun_static \
  157. $(TVHEADEND_CONF_OPTS) \
  158. )
  159. endef
  160. define TVHEADEND_FIX_PNGQUANT_PATH
  161. $(SED) "s%^pngquant_bin =.*%pngquant_bin = '$(HOST_DIR)/bin/pngquant'%" \
  162. $(@D)/support/mkbundle
  163. endef
  164. TVHEADEND_POST_CONFIGURE_HOOKS += TVHEADEND_FIX_PNGQUANT_PATH
  165. define TVHEADEND_BUILD_CMDS
  166. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  167. endef
  168. define TVHEADEND_INSTALL_TARGET_CMDS
  169. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
  170. endef
  171. # Remove documentation and source files that are not needed because we
  172. # use the bundled web interface version.
  173. define TVHEADEND_CLEAN_SHARE
  174. rm -rf $(TARGET_DIR)/usr/share/tvheadend/docs
  175. rm -rf $(TARGET_DIR)/usr/share/tvheadend/src
  176. endef
  177. TVHEADEND_POST_INSTALL_TARGET_HOOKS += TVHEADEND_CLEAN_SHARE
  178. #----------------------------------------------------------------------------
  179. # To run tvheadend, we need:
  180. # - a startup script, and its config file
  181. # - a non-root user to run as, and a home for it that is not accessible
  182. # to the other users (because there will be crendentials in there)
  183. define TVHEADEND_INSTALL_INIT_SYSV
  184. $(INSTALL) -D package/tvheadend/etc.default.tvheadend \
  185. $(TARGET_DIR)/etc/default/tvheadend
  186. $(INSTALL) -D package/tvheadend/S99tvheadend \
  187. $(TARGET_DIR)/etc/init.d/S99tvheadend
  188. endef
  189. define TVHEADEND_USERS
  190. tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
  191. endef
  192. define TVHEADEND_PERMISSIONS
  193. /home/tvheadend r 0700 tvheadend tvheadend - - - - -
  194. endef
  195. $(eval $(generic-package))