1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils flag-o-matic multilib toolchain-funcs
9 # Switches supported by extensions-patch
10 EXT_PATCH_FLAGS="alternatechannel ddepgentry dvlvidprefer graphtft
11 jumpplay jumpingseconds mainmenuhooks menuorg naludump permashift permashift_v1
12 pinplugin rotor ttxtsubs vasarajanauloja wareagleicon yaepg"
14 # names of the use-flags
15 EXT_PATCH_FLAGS_RENAMED=""
17 # names ext-patch uses internally, here only used for maintainer checks
18 EXT_PATCH_FLAGS_RENAMED_EXT_NAME=""
20 IUSE="bidi debug html vanilla ${EXT_PATCH_FLAGS} ${EXT_PATCH_FLAGS_RENAMED}"
24 S="${WORKDIR}/${MY_P}"
26 EXT_P="extpng-${P}-gentoo-edition-v6"
28 DESCRIPTION="Video Disk Recorder - turns a pc into a powerful set top box for DVB"
29 HOMEPAGE="http://www.tvdr.de/"
30 SRC_URI="ftp://ftp.tvdr.de/vdr/${MY_P}.tar.bz2
31 https://dev.gentoo.org/~hd_brummy/distfiles/${EXT_P}.patch.bz2"
33 KEYWORDS="amd64 ~arm ~ppc x86"
38 permashift? ( !permashift_v1 )
39 permashift_v1? ( !permashift )"
41 COMMON_DEPEND="virtual/jpeg:*
43 >=media-libs/fontconfig-2.4.2
44 >=media-libs/freetype-2"
46 DEPEND="${COMMON_DEPEND}
47 >=virtual/linuxtv-dvb-headers-5.3
50 RDEPEND="${COMMON_DEPEND}
52 >=media-tv/gentoo-vdr-scripts-2.5_rc1
54 bidi? ( dev-libs/fribidi )"
57 CAP_FILE=${S}/capabilities.sh
58 CAPS="# Capabilities of the vdr-executable for use by startscript etc."
61 use debug && append-flags -g
63 PLUGIN_LIBDIR="/usr/$(get_libdir)/vdr/plugins"
71 CAPS="${CAPS}\n${arg}=1"
78 ARG_UPPER=$(echo $arg|tr '[:lower:]' '[:upper:]')
79 echo "${ARG_UPPER} = 1" >> Make.config
81 # codesnippet to bring the extpng defines into the vdr.pc CXXFLAGS CFLAGS
82 echo "-DUSE_${ARG_UPPER}" >> "${T}"/defines.tmp
83 cat "${T}"/defines.tmp | tr \\\012 ' ' > "${T}"/defines.IUSE
84 export DEFINES_IUSE=$( cat ${T}/defines.IUSE )
88 extensions_add_make_conf()
90 # copy all ifdef for extensions-patch to Make.config
91 sed -e '1,/need to touch the following:/d' \
92 -e '/need to touch the following/,/^$/d' \
93 Make.config.template >> Make.config
96 extensions_all_defines() {
97 # extract all possible settings for extensions-patch
98 sed -e '/^#\?[A-Z].*= 1/!d' -e 's/^#\?//' -e 's/ .*//' \
99 Make.config.template \
101 | tr '[:upper:]' '[:lower:]'
105 LING_PO=$( ls ${S}/po | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
109 # apply maintainace-patches
110 ebegin "Changing paths for gentoo"
112 local DVBDIR=/usr/include
114 for i in ${DVB_HEADER_PATH} /usr/include/v4l-dvb-hg /usr/include; do
115 [[ -d ${i} ]] || continue
116 if [[ -f ${i}/linux/dvb/dmx.h ]]; then
117 einfo "Found DVB header files in ${i}"
123 # checking for s2api headers
125 api_version=$(awk -F' ' '/define DVB_API_VERSION / {print $3}' "${DVBDIR}"/linux/dvb/version.h)
126 api_version=${api_version}*$(awk -F' ' '/define DVB_API_VERSION_MINOR / {print $3}' "${DVBDIR}"/linux/dvb/version.h)
128 if [[ ${api_version:-0} -lt 5*3 ]]; then
129 eerror "DVB header files do not contain s2api support or too old for ${P}"
130 eerror "You cannot compile VDR against old dvb-header"
131 die "DVB headers too old"
134 cat > Make.config <<-EOT
136 # Generated by ebuild ${PF}
140 PLUGINLIBDIR = ${PLUGIN_LIBDIR}
141 CONFDIR = ${CONF_DIR}
142 VIDEODIR = /var/vdr/video
143 LOCDIR = \$(PREFIX)/share/locale
144 INCDIR = \$(PREFIX)/include
146 DEFINES += -DCONFDIR=\"\$(CONFDIR)\"
147 INCLUDES += -I\$(DVBDIR)
149 # >=vdr-1.7.36-r1; parameter only used for compiletime on vdr
150 # PLUGINLIBDIR (plugin Makefile old) = LIBDIR (plugin Makefile new)
151 LIBDIR = ${PLUGIN_LIBDIR}
152 PCDIR = /usr/$(get_libdir)/pkgconfig
156 # support languages, written from right to left
157 BUILD_PARAMS+=" BIDI=$(usex bidi 1 0)"
159 epatch "${FILESDIR}/${PN}-2.0.6_gentoo.patch"
161 if ! use vanilla; then
163 # Now apply extensions patch
164 epatch "${WORKDIR}/${EXT_P}.patch"
166 # This allows us to start even if some plugin does not exist
167 # or is not loadable.
168 enable_patch PLUGINMISSING
169 enable_patch CHANNELBIND
171 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
172 einfo "Doing maintainer checks:"
174 # we do not support these patches
175 # (or have them already hard enabled)
176 local IGNORE_PATCHES="pluginmissing channelbind"
178 extensions_all_defines > "${T}"/new.IUSE
179 echo $EXT_PATCH_FLAGS $EXT_PATCH_FLAGS_RENAMED_EXT_NAME \
181 tr ' ' '\n' |sort > "${T}"/old.IUSE
182 local DIFFS=$(diff -u "${T}"/old.IUSE "${T}"/new.IUSE|grep '^[+-][^+-]')
183 if [[ -z ${DIFFS} ]]; then
184 einfo "EXT_PATCH_FLAGS is up to date."
186 ewarn "IUSE differences!"
188 for diff in $DIFFS; do
194 ebegin "Enabling selected patches"
196 for flag in $EXT_PATCH_FLAGS; do
197 use $flag && enable_patch ${flag}
202 extensions_add_make_conf
204 # add defined use-flags compile options to vdr.pc
205 sed -e "s:\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR):\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR) \$(DEFINES_IUSE):" \
209 emake .dependencies >/dev/null
210 eend $? "make depend failed"
217 add_cap CAP_IRCTRL_RUNTIME_PARAM \
218 CAP_VFAT_RUNTIME_PARAM \
220 CAP_SHUTDOWN_AUTO_RETRY
222 echo -e ${CAPS} > "${CAP_FILE}"
225 einfo "\n \t VDR supports the LINGUAS values"
229 einfo "\t Please set one of this values in your sytem make.conf"
230 einfo "\t LINGUAS=\"${LING_PO}\"\n"
232 if [[ -z ${LINGUAS} ]]; then
233 einfo "\n \t No values in LINGUAS="
234 einfo "\t You will get only english text on OSD \n"
237 strip-linguas ${LING_PO} en
241 # # trick makefile not to create a videodir by supplying it with an existing
245 DESTDIR="${D}" install || die "emake install failed"
247 keepdir "${PLUGIN_LIBDIR}"
249 keepdir "${CONF_DIR}"/plugins
250 keepdir "${CONF_DIR}"/themes
256 dodoc MANUAL INSTALL README* HISTORY CONTRIBUTORS
258 insinto /usr/share/vdr
261 if use alternatechannel; then
263 doins "${FILESDIR}"/channel_alternative.conf
266 chown -R vdr:vdr "${D}/${CONF_DIR}"
270 elog "It is a good idea to run vdrplugin-rebuild now."
272 elog "To get nice symbols in OSD we recommend to install"
273 elog "\t1. emerge media-fonts/vdrsymbols-ttf"
274 elog "\t2. select font VDRSymbolsSans in Setup"
276 elog "To get an idea how to proceed now, have a look at our vdr-guide:"
277 elog "\thttps://wiki.gentoo.org/wiki/VDR"