1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
include $(TOPDIR)/rules.mk
PKG_NAME:=tvheadend
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/tvheadend/tvheadend
PKG_MIRROR_HASH:=fbb1341e2c032c6750e03434c3358c231307331975321ef9ee7af1c9a9528c29
PKG_SOURCE_VERSION:=ddb984f4c17f4a26fd34f3e1b24e3323f9641b75
PKG_SOURCE_DATE:=2026-08-17
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE.md
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_BUILD_FLAGS:=no-mips16
PKG_BUILD_DEPENDS:=gettext-full/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
# tvheadend needs iconv //TRANSLIT to build recording file names, which musl
# does not implement, so always build against GNU libiconv.
# With BUILD_NLS set, nls.mk already adds these for the same prefix.
ifneq ($(CONFIG_BUILD_NLS),y)
ICONV_FULL_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-full
TARGET_CFLAGS += -I$(ICONV_FULL_PREFIX)/include
TARGET_LDFLAGS += -L$(ICONV_FULL_PREFIX)/lib -Wl,-rpath-link=$(ICONV_FULL_PREFIX)/lib
endif
define Package/tvheadend
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=TV streaming server
MENU:=1
USERID:=tvheadend:dvb
URL:=https://tvheadend.org
MAINTAINER:=Marius Dinu <m95d+git@psihoexpert.ro>
DEPENDS:= \
+librt \
+libffi \
+libopenssl \
+libiconv-full \
+zlib \
+TVHEADEND_AVAHI_SUPPORT:libavahi-client \
+TVHEADEND_REGEX_PCRE2:libpcre2 \
+BUILD_PATENTED&&TVHEADEND_CSA:libdvbcsa
## Transcoding | Add these to DEPENDS.
## +TVHEADEND_LIBFFMPEG:libffmpeg-full \
## +TVHEADEND_LIBVPX:libvpx \
## +TVHEADEND_LIBTHEORA:libtheora \
## +TVHEADEND_LIBVORBIS:libvorbis \
## +TVHEADEND_LIBOPUS:libopusenc \
## +TVHEADEND_LIBFDKAAC:fdk-aac \
## +BUILD_PATENTED&&TVHEADEND_LIBX264:libx264 \
endef
define Package/tvheadend/description
Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android
supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV, SAT>IP and HDHomeRun as input sources.
Tvheadend supports streaming to clients via HTTP (VLC, MPlayer), HTSP (Kodi, Movian), SAT>IP and TVHeadEnd emulation.
endef
define Package/tvheadend/config
source "$(SOURCE)/Config.in"
endef
## Generic OpenWrt options
ifneq ($(CONFIG_PKG_ASLR_PIE_NONE),)
CONFIGURE_ARGS += --disable-pie
endif
## Generic tvheadend options
ifneq ($(CONFIG_TVHEADEND_OPTIMIZE_SPEED),)
TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3 -flto
TARGET_CXXFLAGS := $(filter-out -O%,$(TARGET_CXXFLAGS)) -O3 -flto
TARGET_LDFLAGS += -flto
endif
ifeq ($(CONFIG_TVHEADEND_TRACE),)
CONFIGURE_ARGS += --disable-trace
endif
ifneq ($(CONFIG_TVHEADEND_MEMORYINFO),)
CONFIGURE_ARGS += --enable-slow_memoryinfo
endif
ifeq ($(CONFIG_TVHEADEND_REGEX_PCRE2),)
CONFIGURE_ARGS += --disable-pcre2
else
CONFIGURE_ARGS += --enable-pcre2
endif
ifeq ($(CONFIG_TVHEADEND_TIMESHIFT),)
CONFIGURE_ARGS += --disable-timeshift
endif
ifeq ($(CONFIG_TVHEADEND_AVAHI_SUPPORT),)
CONFIGURE_ARGS += --disable-avahi
else
CONFIGURE_ARGS += --enable-avahi
endif
## TV sources
# Bug in tvheadend. Can't be disabled.
#ifeq ($(CONFIG_TVHEADEND_TSFILE),)
# CONFIGURE_ARGS += --disable-tsfile
#endif
ifeq ($(CONFIG_TVHEADEND_LINUXDVB_SUPPORT),)
CONFIGURE_ARGS += --disable-linuxdvb
endif
ifeq ($(CONFIG_TVHEADEND_DVBSCAN_SUPPORT),)
CONFIGURE_ARGS += --disable-dvbscan
endif
ifeq ($(CONFIG_TVHEADEND_IPTV),)
CONFIGURE_ARGS += --disable-iptv
endif
ifeq ($(CONFIG_TVHEADEND_SATIP_SERVER),)
CONFIGURE_ARGS += --disable-satip_server
endif
ifeq ($(CONFIG_TVHEADEND_SATIP_CLIENT),)
CONFIGURE_ARGS += --disable-satip_client
endif
ifeq ($(CONFIG_TVHEADEND_HDHOMERUN_CLIENT),)
ifeq ($(CONFIG_TVHEADEND_HDHOMERUN_SERVER),)
CONFIGURE_ARGS += --disable-hdhomerun_static --disable-hdhomerun_client --disable-hdhomerun_server
else
CONFIGURE_ARGS += --enable-hdhomerun_static --disable-hdhomerun_client --enable-hdhomerun_server
endif
else
CONFIGURE_ARGS += --enable-hdhomerun_static --enable-hdhomerun_client
ifeq ($(CONFIG_TVHEADEND_HDHOMERUN_SERVER),)
CONFIGURE_ARGS += --disable-hdhomerun_server
else
CONFIGURE_ARGS += --enable-hdhomerun_server
endif
endif
## Descrambling
ifeq ($(CONFIG_TVHEADEND_LINUXDVB_SUPPORT),)
CONFIGURE_ARGS += --disable-ddci
else
ifeq ($(CONFIG_TVHEADEND_DVB_DDCI),)
CONFIGURE_ARGS += --disable-ddci
endif
endif
ifeq ($(CONFIG_BUILD_PATENTED),)
CONFIGURE_ARGS += --disable-tvhcsa --disable-dvbcsa --disable-constcw --disable-cwc --disable-capmt --disable-cccam
else
ifeq ($(CONFIG_TVHEADEND_CSA),)
CONFIGURE_ARGS += --disable-tvhcsa --disable-dvbcsa --disable-constcw --disable-cwc --disable-capmt --disable-cccam
else
CONFIGURE_ARGS += --enable-tvhcsa --enable-dvbcsa
ifeq ($(CONFIG_TVHEADEND_CONSTCW),)
CONFIGURE_ARGS += --disable-constcw
endif
ifeq ($(CONFIG_TVHEADEND_NEWCAMD),)
CONFIGURE_ARGS += --disable-cwc
endif
ifeq ($(CONFIG_TVHEADEND_CAPMT),)
CONFIGURE_ARGS += --disable-capmt
endif
ifeq ($(CONFIG_TVHEADEND_CCCAM),)
CONFIGURE_ARGS += --disable-cccam
endif
endif
endif
## Transcoding | Uncomment these.
##ifeq ($(CONFIG_BUILD_PATENTED),)
## CONFIGURE_ARGS += --disable-libav --disable-libx264 --disable-libx265 --disable-libx265_static
##else
##ifeq ($(CONFIG_TVHEADEND_LIBFFMPEG),)
## CONFIGURE_ARGS += --disable-libav
##else
## CONFIGURE_ARGS += --enable-libav
##endif
##ifeq ($(CONFIG_TVHEADEND_LIBX264),)
## CONFIGURE_ARGS += --disable-libx264
##endif
##ifeq ($(CONFIG_TVHEADEND_LIBX265),)
## CONFIGURE_ARGS += --disable-libx265 --disable-libx265_static
##endif
##ifneq ($(CONFIG_TVHEADEND_LIBFDKAAC),)
## CONFIGURE_ARGS += --enable-libfdkaac
##endif
##endif
##
##ifeq ($(CONFIG_TVHEADEND_LIBVPX),)
## CONFIGURE_ARGS += --disable-libvpx
##endif
##
##ifeq ($(CONFIG_TVHEADEND_LIBlibtheora),)
## CONFIGURE_ARGS += --disable-libtheora
##endif
##
##ifeq ($(CONFIG_TVHEADEND_LIBVORBIS),)
## CONFIGURE_ARGS += --disable-libvorbis
##endif
##
##ifeq ($(CONFIG_TVHEADEND_LIBOPUS),)
## CONFIGURE_ARGS += --disable-libopus
##endif
#required to cross-compile hdhomerun on non-Linux build host
MAKE_FLAGS += \
OS=Linux
#required to always have "build.linux" dir, not "build.darwin" on macos
CONFIGURE_VARS += \
PLATFORM=linux
#--platfrom=linux is required to cross-compile tvheadend on non-Linux build host
CONFIGURE_ARGS += \
--platform=linux \
--arch=$(ARCH) \
--disable-libsystemd_daemon \
--disable-dbus_1 \
--disable-pcre \
--disable-libav \
--disable-ffmpeg_static \
--disable-libx264 \
--disable-libx264_static \
--disable-libx265 \
--disable-libx265_static \
--disable-libvpx \
--disable-libvpx_static \
--disable-libtheora \
--disable-libtheora_static \
--disable-libvorbis \
--disable-libvorbis_static \
--disable-libopus \
--disable-libopus_static \
--disable-libfdkaac \
--disable-libfdkaac_static \
--disable-pcloud_cache \
--enable-bundle \
--disable-uriparser \
--disable-execinfo \
--nowerror=unused-variable
## Transcoding | Remove these from CONFIGURE_ARGS.
## --disable-libav \
## --disable-libx265 \
## --disable-libx265_static \
## --disable-libx264_static \
## --disable-libvpx_static \
## --disable-libtheora_static \
## --disable-libvorbis_static \
## --disable-libopus_static \
## --disable-libfdkaac_static \
## --disable-pcloud_cache \
define Package/tvheadend/conffiles
/etc/config/tvheadend
/etc/tvheadend
endef
define Package/tvheadend/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/tvheadend.init $(1)/etc/init.d/tvheadend
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/tvheadend.config $(1)/etc/config/tvheadend
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
$(INSTALL_BIN) ./files/dvb.hotplug $(1)/etc/hotplug.d/usb/50-dvb
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/build.linux/tvheadend $(1)/usr/bin/
endef
$(eval $(call BuildPackage,tvheadend))
|