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