]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/tvheadend/tvheadend.mk
Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin
[coffee/buildroot.git] / package / tvheadend / tvheadend.mk
1 ################################################################################
2 #
3 # tvheadend
4 #
5 ################################################################################
6
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 = \
12         host-gettext \
13         host-pkgconf \
14         host-pngquant \
15         $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python) \
16         openssl
17
18 ifeq ($(BR2_PACKAGE_AVAHI),y)
19 TVHEADEND_DEPENDENCIES += avahi
20 endif
21
22 ifeq ($(BR2_PACKAGE_DBUS),y)
23 TVHEADEND_DEPENDENCIES += dbus
24 TVHEADEND_CONF_OPTS += --enable-dbus-1
25 else
26 TVHEADEND_CONF_OPTS += --disable-dbus-1
27 endif
28
29 ifeq ($(BR2_PACKAGE_FFMPEG),y)
30 TVHEADEND_DEPENDENCIES += ffmpeg
31 TVHEADEND_CONF_OPTS += --enable-libav
32 else
33 TVHEADEND_CONF_OPTS += --disable-libav
34 endif
35
36 ifeq ($(BR2_PACKAGE_LIBDVBCSA),y)
37 TVHEADEND_DEPENDENCIES += libdvbcsa
38 TVHEADEND_CONF_OPTS += --enable-dvbcsa
39 else
40 TVHEADEND_CONF_OPTS += --disable-dvbcsa
41 endif
42
43 ifeq ($(BR2_PACKAGE_LIBHDHOMERUN),y)
44 TVHEADEND_DEPENDENCIES += libhdhomerun
45 TVHEADEND_CONF_OPTS += --enable-hdhomerun_client
46 else
47 TVHEADEND_CONF_OPTS += --disable-hdhomerun_client
48 endif
49
50 ifeq ($(BR2_PACKAGE_LIBICONV),y)
51 TVHEADEND_DEPENDENCIES += libiconv
52 endif
53
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)
58 endif
59
60 ifeq ($(BR2_PACKAGE_PCRE),y)
61 TVHEADEND_DEPENDENCIES += pcre
62 TVHEADEND_CONF_OPTS += --enable-pcre
63 else
64 TVHEADEND_CONF_OPTS += --disable-pcre
65 endif
66
67 TVHEADEND_DEPENDENCIES += dtv-scan-tables
68
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
76 endef
77 TVHEADEND_PRE_CONFIGURE_HOOKS += TVHEADEND_INSTALL_DTV_SCAN_TABLES
78
79 define TVHEADEND_CONFIGURE_CMDS
80         (cd $(@D); \
81                 $(TARGET_CONFIGURE_OPTS) \
82                 $(TARGET_CONFIGURE_ARGS) \
83                 CFLAGS="$(TVHEADEND_CFLAGS)" \
84                 ./configure \
85                         --prefix=/usr \
86                         --arch="$(ARCH)" \
87                         --cpu="$(BR2_GCC_TARGET_CPU)" \
88                         --nowerror \
89                         --python="$(HOST_DIR)/bin/python" \
90                         --enable-dvbscan \
91                         --enable-bundle \
92                         --enable-pngquant \
93                         --disable-ffmpeg_static \
94                         --disable-hdhomerun_static \
95                         $(TVHEADEND_CONF_OPTS) \
96         )
97 endef
98
99 define TVHEADEND_FIX_PNGQUANT_PATH
100         $(SED) "s%^pngquant_bin =.*%pngquant_bin = '$(HOST_DIR)/bin/pngquant'%" \
101                 $(@D)/support/mkbundle
102 endef
103 TVHEADEND_POST_CONFIGURE_HOOKS += TVHEADEND_FIX_PNGQUANT_PATH
104
105 define TVHEADEND_BUILD_CMDS
106         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
107 endef
108
109 define TVHEADEND_INSTALL_TARGET_CMDS
110         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
111 endef
112
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
118 endef
119
120 TVHEADEND_POST_INSTALL_TARGET_HOOKS += TVHEADEND_CLEAN_SHARE
121
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)
127
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
131 endef
132
133 define TVHEADEND_USERS
134         tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
135 endef
136 define TVHEADEND_PERMISSIONS
137         /home/tvheadend r 0700 tvheadend tvheadend - - - - -
138 endef
139
140 $(eval $(generic-package))