1 ################################################################################
5 ################################################################################
7 TVHEADEND_VERSION = 54e63e3f9af8fdc0d23f61f3cda7fa7b246c1732
8 TVHEADEND_SITE = $(call github,tvheadend,tvheadend,$(TVHEADEND_VERSION))
9 TVHEADEND_LICENSE = GPL-3.0+
10 TVHEADEND_LICENSE_FILES = LICENSE.md
11 TVHEADEND_DEPENDENCIES = \
15 $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python) \
18 ifeq ($(BR2_PACKAGE_AVAHI),y)
19 TVHEADEND_DEPENDENCIES += avahi
22 ifeq ($(BR2_PACKAGE_DBUS),y)
23 TVHEADEND_DEPENDENCIES += dbus
24 TVHEADEND_CONF_OPTS += --enable-dbus-1
26 TVHEADEND_CONF_OPTS += --disable-dbus-1
29 ifeq ($(BR2_PACKAGE_FFMPEG),y)
30 TVHEADEND_DEPENDENCIES += ffmpeg
31 TVHEADEND_CONF_OPTS += --enable-libav
33 TVHEADEND_CONF_OPTS += --disable-libav
36 ifeq ($(BR2_PACKAGE_LIBDVBCSA),y)
37 TVHEADEND_DEPENDENCIES += libdvbcsa
38 TVHEADEND_CONF_OPTS += --enable-dvbcsa
40 TVHEADEND_CONF_OPTS += --disable-dvbcsa
43 ifeq ($(BR2_PACKAGE_LIBHDHOMERUN),y)
44 TVHEADEND_DEPENDENCIES += libhdhomerun
45 TVHEADEND_CONF_OPTS += --enable-hdhomerun_client
47 TVHEADEND_CONF_OPTS += --disable-hdhomerun_client
50 ifeq ($(BR2_PACKAGE_LIBICONV),y)
51 TVHEADEND_DEPENDENCIES += libiconv
54 TVHEADEND_CFLAGS = $(TARGET_CFLAGS)
55 ifeq ($(BR2_PACKAGE_LIBURIPARSER),y)
56 TVHEADEND_DEPENDENCIES += liburiparser
57 TVHEADEND_CFLAGS += $(if $(BR2_USE_WCHAR),,-DURI_NO_UNICODE)
60 ifeq ($(BR2_PACKAGE_PCRE),y)
61 TVHEADEND_DEPENDENCIES += pcre
62 TVHEADEND_CONF_OPTS += --enable-pcre
64 TVHEADEND_CONF_OPTS += --disable-pcre
67 TVHEADEND_DEPENDENCIES += dtv-scan-tables
69 # The tvheadend build system expects the transponder data to be present inside
70 # its source tree. To prevent a download initiated by the build system just
71 # copy the data files in the right place and add the corresponding stamp file.
72 define TVHEADEND_INSTALL_DTV_SCAN_TABLES
73 $(INSTALL) -d $(@D)/data/dvb-scan
74 cp -r $(TARGET_DIR)/usr/share/dvb/* $(@D)/data/dvb-scan/
75 touch $(@D)/data/dvb-scan/.stamp
77 TVHEADEND_PRE_CONFIGURE_HOOKS += TVHEADEND_INSTALL_DTV_SCAN_TABLES
79 define TVHEADEND_CONFIGURE_CMDS
81 $(TARGET_CONFIGURE_OPTS) \
82 $(TARGET_CONFIGURE_ARGS) \
83 CFLAGS="$(TVHEADEND_CFLAGS)" \
87 --cpu="$(BR2_GCC_TARGET_CPU)" \
89 --python="$(HOST_DIR)/bin/python" \
93 --disable-ffmpeg_static \
94 --disable-hdhomerun_static \
95 $(TVHEADEND_CONF_OPTS) \
99 define TVHEADEND_FIX_PNGQUANT_PATH
100 $(SED) "s%^pngquant_bin =.*%pngquant_bin = '$(HOST_DIR)/bin/pngquant'%" \
101 $(@D)/support/mkbundle
103 TVHEADEND_POST_CONFIGURE_HOOKS += TVHEADEND_FIX_PNGQUANT_PATH
105 define TVHEADEND_BUILD_CMDS
106 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
109 define TVHEADEND_INSTALL_TARGET_CMDS
110 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
113 # Remove documentation and source files that are not needed because we
114 # use the bundled web interface version.
115 define TVHEADEND_CLEAN_SHARE
116 rm -rf $(TARGET_DIR)/usr/share/tvheadend/docs
117 rm -rf $(TARGET_DIR)/usr/share/tvheadend/src
120 TVHEADEND_POST_INSTALL_TARGET_HOOKS += TVHEADEND_CLEAN_SHARE
122 #----------------------------------------------------------------------------
123 # To run tvheadend, we need:
124 # - a startup script, and its config file
125 # - a non-root user to run as, and a home for it that is not accessible
126 # to the other users (because there will be crendentials in there)
128 define TVHEADEND_INSTALL_INIT_SYSV
129 $(INSTALL) -D package/tvheadend/etc.default.tvheadend $(TARGET_DIR)/etc/default/tvheadend
130 $(INSTALL) -D package/tvheadend/S99tvheadend $(TARGET_DIR)/etc/init.d/S99tvheadend
133 define TVHEADEND_USERS
134 tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
136 define TVHEADEND_PERMISSIONS
137 /home/tvheadend r 0700 tvheadend tvheadend - - - - -
140 $(eval $(generic-package))