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 graphtft naludump permashift_v1 pinplugin
11 mainmenuhooks menuorg menuselection resumereset ttxtsubs"
13 # names of the use-flags
14 EXT_PATCH_FLAGS_RENAMED=""
16 # names ext-patch uses internally, here only used for maintainer checks
17 EXT_PATCH_FLAGS_RENAMED_EXT_NAME="bidi no_kbd sdnotify"
19 IUSE="bidi debug +kbd html systemd vanilla ${EXT_PATCH_FLAGS} ${EXT_PATCH_FLAGS_RENAMED}"
23 S="${WORKDIR}/${MY_P}"
25 EXT_P="extpng-${P}-gentoo-edition-v1"
27 DESCRIPTION="Video Disk Recorder - turns a pc into a powerful set top box for DVB"
28 HOMEPAGE="http://www.tvdr.de/"
29 SRC_URI="ftp://ftp.tvdr.de/vdr/${MY_P}.tar.bz2
30 https://dev.gentoo.org/~hd_brummy/distfiles/${EXT_P}.patch.bz2"
32 KEYWORDS="~arm amd64 ~ppc x86"
36 COMMON_DEPEND="virtual/jpeg:*
38 >=media-libs/fontconfig-2.4.2
39 >=media-libs/freetype-2"
41 DEPEND="${COMMON_DEPEND}
42 >=virtual/linuxtv-dvb-headers-5.3
45 RDEPEND="${COMMON_DEPEND}
47 >=media-tv/gentoo-vdr-scripts-2.7
49 bidi? ( dev-libs/fribidi )
50 systemd? ( sys-apps/systemd )"
53 CAP_FILE=${S}/capabilities.sh
54 CAPS="# Capabilities of the vdr-executable for use by startscript etc."
58 use debug && append-flags -g
60 PLUGIN_LIBDIR="/usr/$(get_libdir)/vdr/plugins"
68 CAPS="${CAPS}\n${arg}=1"
75 ARG_UPPER=$(echo $arg|tr '[:lower:]' '[:upper:]')
76 echo "${ARG_UPPER} = 1" >> Make.config
78 # codesnippet to bring the extpng defines into the vdr.pc CXXFLAGS CFLAGS
79 echo "-DUSE_${ARG_UPPER}" >> "${T}"/defines.tmp
80 cat "${T}"/defines.tmp | tr \\\012 ' ' > "${T}"/defines.IUSE
81 export DEFINES_IUSE=$( cat ${T}/defines.IUSE )
85 extensions_add_make_conf()
87 # copy all ifdef for extensions-patch to Make.config
88 sed -e '1,/need to touch the following:/d' \
89 -e '/need to touch the following/,/^$/d' \
90 Make.config.template >> Make.config
93 extensions_all_defines() {
94 # extract all possible settings for extensions-patch
95 sed -e '/^#\?[A-Z].*= 1/!d' -e 's/^#\?//' -e 's/ .*//' \
96 Make.config.template \
98 | tr '[:upper:]' '[:lower:]'
102 LING_PO=$( ls ${S}/po | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
106 # support languages, written from right to left
107 export "BIDI=$(usex bidi 1 0)"
108 # systemd notification support
109 export "SDNOTIFY=$(usex systemd 1 0)"
110 # with/without keyboard
111 export "USE_KBD=$(usex kbd 1 0)"
115 # apply maintainace-patches
116 ebegin "Changing paths for gentoo"
118 local DVBDIR=/usr/include
120 for i in ${DVB_HEADER_PATH} /usr/include/v4l-dvb-hg /usr/include; do
121 [[ -d ${i} ]] || continue
122 if [[ -f ${i}/linux/dvb/dmx.h ]]; then
123 einfo "Found DVB header files in ${i}"
129 # checking for s2api headers
131 api_version=$(awk -F' ' '/define DVB_API_VERSION / {print $3}' "${DVBDIR}"/linux/dvb/version.h)
132 api_version=${api_version}*$(awk -F' ' '/define DVB_API_VERSION_MINOR / {print $3}' "${DVBDIR}"/linux/dvb/version.h)
134 if [[ ${api_version:-0} -lt 5*3 ]]; then
135 eerror "DVB header files do not contain s2api support or too old for ${P}"
136 eerror "You cannot compile VDR against old dvb-header"
137 die "DVB headers too old"
140 cat > Make.config <<-EOT
142 # Generated by ebuild ${PF}
146 PLUGINLIBDIR = ${PLUGIN_LIBDIR}
147 CONFDIR = ${CONF_DIR}
148 VIDEODIR = /var/vdr/video
149 LOCDIR = \$(PREFIX)/share/locale
150 INCDIR = \$(PREFIX)/include
152 DEFINES += -DCONFDIR=\"\$(CONFDIR)\"
153 INCLUDES += -I\$(DVBDIR)
155 # >=vdr-1.7.36-r1; parameter only used for compiletime on vdr
156 # PLUGINLIBDIR (plugin Makefile old) = LIBDIR (plugin Makefile new)
157 LIBDIR = ${PLUGIN_LIBDIR}
158 PCDIR = /usr/$(get_libdir)/pkgconfig
163 if ! use vanilla; then
165 # Now apply extensions patch
166 epatch "${WORKDIR}/${EXT_P}.patch"
168 # This allows us to start even if some plugin does not exist
169 # or is not loadable.
170 enable_patch PLUGINMISSING
172 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
173 einfo "Doing maintainer checks:"
175 # we do not support these patches
176 # (or have them already hard enabled)
177 local IGNORE_PATCHES="pluginmissing"
179 extensions_all_defines > "${T}"/new.IUSE
180 echo $EXT_PATCH_FLAGS $EXT_PATCH_FLAGS_RENAMED_EXT_NAME \
182 tr ' ' '\n' |sort > "${T}"/old.IUSE
183 local DIFFS=$(diff -u "${T}"/old.IUSE "${T}"/new.IUSE|grep '^[+-][^+-]')
184 if [[ -z ${DIFFS} ]]; then
185 einfo "EXT_PATCH_FLAGS is up to date."
187 ewarn "IUSE differences!"
189 for diff in $DIFFS; do
195 ebegin "Enabling selected patches"
197 for flag in $EXT_PATCH_FLAGS; do
198 use $flag && enable_patch ${flag}
203 extensions_add_make_conf
205 # add defined use-flags compile options to vdr.pc
206 sed -e "s:\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR):\$(CDEFINES) \$(CINCLUDES) \$(HDRDIR) \$(DEFINES_IUSE):" \
210 emake .dependencies >/dev/null
211 eend $? "make depend failed"
214 epatch "${FILESDIR}/${P}_gentoo.patch"
216 # fix some makefile issues
217 sed -e "s:ifndef NO_KBD:ifeq (\$(USE_KBD),1):" \
218 -e "s:ifdef BIDI:ifeq (\$(BIDI),1):" \
219 -e "s:ifdef SDNOTIFY:ifeq (\$(SDNOTIFY),1):" \
226 add_cap CAP_IRCTRL_RUNTIME_PARAM \
227 CAP_VFAT_RUNTIME_PARAM \
229 CAP_SHUTDOWN_AUTO_RETRY
231 echo -e ${CAPS} > "${CAP_FILE}"
234 einfo "\n \t VDR supports the LINGUAS values"
238 einfo "\t Please set one of this values in your sytem make.conf"
239 einfo "\t LINGUAS=\"${LING_PO}\"\n"
241 if [[ -z ${LINGUAS} ]]; then
242 einfo "\n \t No values in LINGUAS="
243 einfo "\t You will get only english text on OSD \n"
246 strip-linguas ${LING_PO} en
250 # trick makefile not to create a videodir by supplying it with an existing
254 DESTDIR="${D}" install || die "emake install failed"
256 keepdir "${PLUGIN_LIBDIR}"
258 # backup for plugins they don't be able to create this dir
259 keepdir "${CONF_DIR}"/plugins
265 nonfatal dodoc MANUAL INSTALL README* HISTORY CONTRIBUTORS
267 insinto /usr/share/vdr
270 if use alternatechannel; then
272 doins "${FILESDIR}"/channel_alternative.conf
275 chown -R vdr:vdr "${D}/${CONF_DIR}"
280 elog "\n\t---- 15 YEARS ANNIVERSARY EDITON ----\n"
281 elog "\tA lot of thanks to Klaus Schmidinger"
282 elog "\tfor this nice piece of Software...\n"
284 elog "It is a good idea to run vdrplugin-rebuild now."
286 elog "To get nice symbols in OSD we recommend to install"
287 elog "\t1. emerge media-fonts/vdrsymbols-ttf"
288 elog "\t2. select font VDRSymbolsSans in Setup"
290 elog "To get an idea how to proceed now, have a look at our vdr-guide:"
291 elog "\thttps://wiki.gentoo.org/wiki/VDR"