Diff vdr-2.2.0-r7 with a vdr-2.4.1-r3

/usr/portage/media-video/vdr/vdr-2.4.1-r3.ebuild 2021-04-12 04:42:00.000000000 +0300
5 5

  
6 6
inherit flag-o-matic l10n toolchain-funcs
7 7

  
8
# Switches supported by extensions-patch
9
EXT_PATCH_FLAGS="alternatechannel graphtft naludump permashift pinplugin
10
				mainmenuhooks menuorg menuselection resumereset ttxtsubs"
11

  
12
# names of the use-flags
13
EXT_PATCH_FLAGS_RENAMED=""
14

  
15
# names ext-patch uses internally, here only used for maintainer checks
16
EXT_PATCH_FLAGS_RENAMED_EXT_NAME="bidi no_kbd sdnotify"
17

  
18
MY_PV="${PV%_p*}"
19
MY_P="${PN}-${MY_PV}"
20
S="${WORKDIR}/${MY_P}"
21

  
22
EXT_P="extpng-${P}-gentoo-edition-v1"
23

  
24 8
DESCRIPTION="Video Disk Recorder - turns a pc into a powerful set top box for DVB"
25 9
HOMEPAGE="http://www.tvdr.de/"
26
SRC_URI="ftp://ftp.tvdr.de/vdr/${MY_P}.tar.bz2
27
	mirror://gentoo/${EXT_P}.patch.bz2"
10
SRC_URI="ftp://ftp.tvdr.de/vdr/${P}.tar.bz2
11
	mainmenuhooks? ( http://vdr.websitec.de/download/${PN}/${P}/${P}_mainmenuhook-1.0.1.patch.bz2 )
12
	menuorg? ( https://projects.vdr-developer.org/projects/plg-menuorg/repository/revisions/master/raw/vdr-patch/vdr-menuorg-2.3.x.diff )
13
	naludump? ( http://www.udo-richter.de/vdr/files/vdr-2.1.5-naludump-0.1.diff )
14
	pinplugin? ( http://vdr.websitec.de/download/${PN}/${P}/${P}_pinplugin.patch.bz2 )
15
	ttxtsubs? ( http://vdr.websitec.de/download/${PN}/${P}/${PN}-2.4.0-ttxtsubs.patch.bz2 )
16
	permashift? ( https://raw.githubusercontent.com/eikesauer/Permashift/master/vdr-2.4-patch-for-permashift.diff )"
28 17

  
29 18
LICENSE="GPL-2+"
30 19
SLOT="0"
31
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
32
IUSE="bidi debug keyboard html systemd vanilla ${EXT_PATCH_FLAGS} ${EXT_PATCH_FLAGS_RENAMED}"
20
KEYWORDS="amd64 ~arm ~arm64 ~ppc x86"
21
IUSE="bidi debug demoplugins html keyboard mainmenuhooks menuorg naludump pinplugin permashift systemd ttxtsubs verbose"
33 22

  
34 23
COMMON_DEPEND="
35 24
	virtual/jpeg:*
......
40 29
	>=virtual/linuxtv-dvb-headers-5.3"
41 30
RDEPEND="${COMMON_DEPEND}
42 31
	dev-lang/perl
43
	>=media-tv/gentoo-vdr-scripts-2.7
32
	media-tv/gentoo-vdr-scripts
44 33
	media-fonts/corefonts
45 34
	bidi? ( dev-libs/fribidi )
46 35
	systemd? ( sys-apps/systemd )"
47 36
BDEPEND="sys-devel/gettext"
48 37

  
38
REQUIRED_USE="pinplugin? ( !mainmenuhooks )
39
	permashift? ( !naludump !pinplugin )"
40

  
49 41
CONF_DIR="/etc/vdr"
50 42
CAP_FILE="${S}/capabilities.sh"
51 43
CAPS="# Capabilities of the vdr-executable for use by startscript etc."
......
55 47

  
56 48
	PLUGIN_LIBDIR="/usr/$(get_libdir)/vdr/plugins"
57 49

  
50
	# use the corrected DIR /var/lib/vdr/* for acct/{user,group) handling
51
	if has_version ">=media-tv/gentoo-vdr-scripts-3.0_rc1"; then
52
		VIDEO_DIR="/var/lib/vdr/video"
53
	else
54
		VIDEO_DIR="/var/vdr/video"
55
	fi
56

  
58 57
	tc-export CC CXX AR
59 58
}
60 59

  
......
65 64
	done
66 65
}
67 66

  
68
enable_patch() {
69
	local arg ARG_UPPER
70
	for arg; do
71
		ARG_UPPER=$(echo $arg | tr '[:lower:]' '[:upper:]')
72
		echo "${ARG_UPPER} = 1" >> Make.config || die "cannot write to Make.config"
73

  
74
		# codesnippet to bring the extpng defines into the vdr.pc CXXFLAGS CFLAGS
75
		echo "-DUSE_${ARG_UPPER}" >> "${T}"/defines.tmp || die "cannot write to defines.tmp"
76
		cat "${T}"/defines.tmp | tr \\\012 ' '  > "${T}"/defines.IUSE || die "cannot write to defines.tmp"
77
		export DEFINES_IUSE=$( cat ${T}/defines.IUSE )
78
	done
79
}
80

  
81
extensions_add_make_conf() {
82
	# copy all ifdef for extensions-patch to Make.config
83
	sed -e '1,/need to touch the following:/d' \
84
		-e '/need to touch the following/,/^$/d' \
85
		Make.config.template >> Make.config || die "cannot write to Make.config"
86
}
87

  
88
extensions_all_defines() {
89
	# extract all possible settings for extensions-patch
90
	sed -e '/^#\?[A-Z].*= 1/!d' -e 's/^#\?//' -e 's/ .*//' \
91
		Make.config.template \
92
		| sort \
93
		| tr '[:upper:]' '[:lower:]' || die "error in function extensions_all_defines"
94
}
95

  
96 67
lang_po() {
97 68
	LING_PO=$( ls ${S}/po | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
98 69
}
......
104 75
	export "SDNOTIFY=$(usex systemd 1 0)"
105 76
	# with/without keyboard
106 77
	export "USE_KBD=$(usex keyboard 1 0)"
78
	# detailed compile output for debug
79
	export "VERBOSE=$(usex verbose 1 0)"
107 80
}
108 81

  
109 82
src_prepare() {
110 83
	# apply maintenance-patches
111 84
	ebegin "Changing paths for gentoo"
112 85

  
113
	local DVBDIR="/usr/include"
86
	local DVBDIR=/usr/include
114 87
	local i
115 88
	for i in ${DVB_HEADER_PATH} /usr/include/v4l-dvb-hg /usr/include; do
116 89
		[[ -d ${i} ]] || continue
117 90
		if [[ -f ${i}/linux/dvb/dmx.h ]]; then
118 91
			einfo "Found DVB header files in ${i}"
119
			DVBDIR="${i}"
92
			DVBDIR=${i}
120 93
			break
121 94
		fi
122 95
	done
......
140 113
		DVBDIR			= ${DVBDIR}
141 114
		PLUGINLIBDIR	= ${PLUGIN_LIBDIR}
142 115
		CONFDIR			= ${CONF_DIR}
143
		VIDEODIR		= /var/vdr/video
116
		ARGSDIR			= \$(CONFDIR)/conf.d
117
		VIDEODIR		= ${VIDEO_DIR}
144 118
		LOCDIR			= \$(PREFIX)/share/locale
145 119
		INCDIR			= \$(PREFIX)/include
146 120

  
......
155 129
	EOT
156 130
	eend 0
157 131

  
158
	# wrt bug 586070
159
	if has_version ">=sys-apps/systemd-230"; then
160
		sed -e "s:libsystemd-daemon:libsystemd:g" -i Makefile || die "sed libsystemd failed"
161
	fi
162

  
163
	if ! use vanilla; then
164

  
165
		# Now apply extensions patch
166
		eapply "${WORKDIR}/${EXT_P}.patch"
167
		sed -e 's/PERMASHIFT_V1/PERMASHIFT/g' -i "${S}"/*.[ch] "${S}"/Make.config* || die "sed failed"
168

  
169
		# This allows us to start even if some plugin does not exist
170
		# or is not loadable.
171
		enable_patch PLUGINMISSING
172

  
173
		if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
174
			einfo "Doing maintainer checks:"
175

  
176
			# we do not support these patches
177
			# (or have them already hard enabled)
178
			local IGNORE_PATCHES="pluginmissing"
179

  
180
			extensions_all_defines > "${T}"/new.IUSE || die "cannot write to new.IUSE"
181
			echo $EXT_PATCH_FLAGS $EXT_PATCH_FLAGS_RENAMED_EXT_NAME \
182
					$IGNORE_PATCHES | \
183
				tr ' ' '\n' |sort > "${T}"/old.IUSE || die "cannot write to old.IUSE"
184
			local DIFFS=$(diff -u "${T}"/old.IUSE "${T}"/new.IUSE|grep '^[+-][^+-]')
185
			if [[ -z ${DIFFS} ]]; then
186
				einfo "EXT_PATCH_FLAGS are up to date."
187
			else
188
				ewarn "IUSE differences!"
189
				local diff
190
				for diff in $DIFFS; do
191
					ewarn "$diff"
192
				done
193
			fi
194
		fi
195

  
196
		ebegin "Enabling selected patches"
197
		local flag
198
		for flag in $EXT_PATCH_FLAGS; do
199
			use $flag && enable_patch ${flag}
200
		done
201

  
202
		eend 0
203

  
204
		extensions_add_make_conf
205

  
206
		# add defined use-flags compile options to vdr.pc
207
		sed -e "s:\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR):\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR) \$(DEFINES_IUSE):" \
208
			-i Makefile || die "sed fails on Makefile"
209

  
210
		ebegin "Make depend"
211
		emake .dependencies >/dev/null
212
		eend $? "make depend failed"
213

  
214
		eapply "${FILESDIR}/${P}_gcc7extpng.patch"
215
		eapply "${FILESDIR}/${P}_gcc11.patch"
216
	fi
217

  
218 132
	eapply "${FILESDIR}/${P}_gentoo.patch"
219
	eapply "${FILESDIR}/${P}_unsignedtosigned.patch"
220
	eapply "${FILESDIR}/${P}_glibc-2.24.patch"
221
	eapply "${FILESDIR}/${P}-jpeg-9c.patch"
133
	eapply "${FILESDIR}/vdr-2.2.0-jpeg-9c.patch"
134
	use demoplugins || eapply "${FILESDIR}/vdr-2.4_remove_plugins.patch"
135
	eapply "${FILESDIR}/${P}_makefile-variables.patch"
222 136
	eapply "${FILESDIR}/${P}_glibc-2.31.patch"
223 137

  
224
	# fix some makefile issues
225
	sed -e "s:ifndef NO_KBD:ifeq (\$(USE_KBD),1):" \
226
		-e "s:ifdef BIDI:ifeq (\$(BIDI),1):" \
227
		-e "s:ifdef SDNOTIFY:ifeq (\$(SDNOTIFY),1):" \
228
		-i "${S}"/Makefile || die "sed fails on Makefile"
229

  
230
	eapply_user
231

  
232
	add_cap CAP_UTF8
233

  
234
	add_cap CAP_IRCTRL_RUNTIME_PARAM \
235
			CAP_VFAT_RUNTIME_PARAM \
236
			CAP_CHUID \
237
			CAP_SHUTDOWN_AUTO_RETRY
138
	use naludump && eapply "${DISTDIR}/${PN}-2.1.5-naludump-0.1.diff"
139
	use permashift && eapply "${DISTDIR}/${PN}-2.4-patch-for-permashift.diff"
140
	use pinplugin && eapply "${WORKDIR}/${P}_pinplugin.patch"
141
	use ttxtsubs && eapply "${WORKDIR}/${PN}-2.4.0-ttxtsubs.patch"
142
	use ttxtsubs && eapply "${FILESDIR}/${P}_ttxtsubs_segfault.patch"
143
	use menuorg && eapply "${DISTDIR}/vdr-menuorg-2.3.x.diff"
144
	use mainmenuhooks && eapply "${WORKDIR}/${P}_mainmenuhook-1.0.1.patch"
145

  
146
	add_cap CAP_UTF8 \
147
		CAP_IRCTRL_RUNTIME_PARAM \
148
		CAP_VFAT_RUNTIME_PARAM \
149
		CAP_CHUID \
150
		CAP_SHUTDOWN_AUTO_RETRY
238 151

  
239
	echo -e ${CAPS} > "${CAP_FILE}"
152
	echo -e ${CAPS} > "${CAP_FILE}" || die "cannot write to CAP_FILE"
240 153

  
241 154
	# LINGUAS support
242 155
	einfo "\n \t VDR supports the LINGUAS values"
......
252 165
	fi
253 166

  
254 167
	strip-linguas ${LING_PO} en
168

  
169
	default
255 170
}
256 171

  
257 172
src_install() {
258
	# trick makefile not to create a videodir by supplying it with an existing
259
	# directory
260
	emake install \
261
	VIDEODIR="/" \
262
	DESTDIR="${ED}" install
173
	# trick the makefile to not create a VIDEODIR by supplying it with an
174
	# existing directory
175
	emake VIDEODIR="/" DESTDIR="${ED}" install
263 176

  
264 177
	keepdir "${PLUGIN_LIBDIR}"
265 178

  
266 179
	# backup for plugins they don't be able to create this dir
267
	keepdir "${CONF_DIR}"/plugins
180
	keepdir "${CONF_DIR}/plugins"
268 181

  
269 182
	if use html; then
270 183
		local HTML_DOCS=( *.html )
271 184
	fi
272

  
273
	local DOCS=( MANUAL INSTALL README* HISTORY CONTRIBUTORS )
274

  
185
	local DOCS=( MANUAL INSTALL README* HISTORY CONTRIBUTORS UPDATE-2* )
275 186
	einstalldocs
276 187

  
277 188
	insinto /usr/share/vdr
278 189
	doins "${CAP_FILE}"
279 190

  
280
	if use alternatechannel; then
281
		insinto /etc/vdr
282
		doins "${FILESDIR}"/channel_alternative.conf
283
	fi
284

  
285
	chown -R vdr:vdr "${ED}/${CONF_DIR}" || die "chown failed"
191
	fowners vdr:vdr "${CONF_DIR}" -R
286 192
}
287 193

  
288 194
pkg_postinst() {
195
	elog "Please read the /usr/share/doc/${PF}/UPDATE-2.4"
196
	elog "for major changes in this version\n"
289 197

  
290
	elog "\n\t---- 15 YEARS ANNIVERSARY EDITON ----\n"
291
	elog "\tA lot of thanks to Klaus Schmidinger"
292
	elog "\tfor this nice piece of Software...\n"
293

  
294
	elog "It is a good idea to run vdrplugin-rebuild now."
198
	elog "It is a good idea to run vdrplugin-rebuild now.\n"
295 199

  
296 200
	elog "To get nice symbols in OSD we recommend to install"
297 201
	elog "\t1. emerge media-fonts/vdrsymbols-ttf"
298
	elog "\t2. select font VDRSymbolsSans in Setup"
299
	elog ""
202
	elog "\t2. select font VDRSymbolsSans in Setup\n"
203

  
300 204
	elog "To get an idea how to proceed now, have a look at our vdr-guide:"
301 205
	elog "\thttps://wiki.gentoo.org/wiki/VDR"
302 206
}
Thank you!