summaryrefslogtreecommitdiff
blob: de013a754b018ec1859cd1a5d82121bcd5c43750 (plain)
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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/vdr/vdr-1.3.34-r2.ebuild,v 1.3 2005/12/17 16:14:52 zzam Exp $

inherit eutils

IUSE="lirc vfat rcu
	lnbsharing sourcecaps aio bigpatch jumpplay"

# Names of patches
FNAME_AIO="${P}-enAIO-2.6.diff"
FNAME_BIGPATCH="BigPatch/bigpatch-current.diff"
FNAME_JUMPPLAY="vdr-jumpplay-0.6-1.3.29.diff"
FNAME_LNBSHARING="configurableLNBshare-VDR_1.3.33.patch"
FNAME_SOURCECAPS_NORMAL="SourceCaps-1.3.33.patch"
FNAME_SOURCECAPS_LNBSHARING="SourceCaps-1.3.33-lnb-sharing.patch"

DESCRIPTION="Video Disk Recorder - turns a pc into a powerful set top box for DVB"
HOMEPAGE="http://www.cadsoft.de/vdr/"
SRC_URI="ftp://ftp.cadsoft.de/vdr/Developer/${P}.tar.bz2
	lnbsharing? ( http://xn--ltzke-jua.de/dvb/VDR_LNB_sharing_patch/${FNAME_LNBSHARING} )
	aio? ( http://www.saunalahti.fi/~rahrenbe/vdr/patches/${FNAME_AIO}.gz )
	bigpatch? ( http://bigpatch.vdr-developer.org/$PV/${P}-bigpatch-test1.tar.bz2 )
	jumpplay? ( http://www.toms-cafe.de/vdr/download/${FNAME_JUMPPLAY} )"

KEYWORDS="~amd64 ~x86"
SLOT="0"
LICENSE="GPL-2"


_DEPEND="media-libs/jpeg
	lirc? ( app-misc/lirc )
	sys-apps/gawk"

RDEPEND="${_DEPEND}
	dev-lang/perl
	media-tv/vdrplugin-rebuild
	media-tv/gentoo-vdr-scripts"

DEPEND="${_DEPEND}
	media-tv/linuxtv-dvb-headers"

# Relevant Pathes for vdr on gentoo
DVB_DIR=/usr/include
VDR_INCLUDE_DIR=/usr/include/vdr
PLUGIN_DIR=/usr/lib/vdr/plugins
CONF_DIR=/etc/vdr
RC_DIR=/usr/lib/vdr/rcscript
CAP_FILE=${S}/vdr-capabilities.sh
VDR_HOME=/var/vdr

pkg_setup() {
	enewgroup vdr
	enewuser vdr -1 /bin/bash ${VDR_HOME} vdr,video
}

src_unpack() {
	unpack ${A}
	cd ${S}

	ebegin "Changing pathes for gentoo"
	sed -e 's-$(DVBDIR)/include-$(DVBDIR)-' -i Makefile

	sed \
	  -e 's-ConfigDirectory = VideoDirectory;-ConfigDirectory = CONFIGDIR;-' \
	  -i vdr.c

	cat > Make.config <<-EOT
		#
		# Generated by ebuild ${PF}
		#
		DVBDIR       = ${DVB_DIR}
		PLUGINLIBDIR = ${PLUGIN_DIR}
		CONFIGDIR    = ${CONF_DIR}

		DEFINES     += -DCONFIGDIR=\"\$(CONFIGDIR)\"
	EOT
	eend 0

	if use rcu; then
		echo "REMOTE=RCU" >> Make.config
		use lirc && ewarn "Only one remotes can be used: dropping lirc and keeping rcu"
	else
		use lirc && echo "REMOTE=LIRC" >> Make.config
	fi
	use vfat && echo "VFAT=1" >> Make.config

	# apply standard patches
	local PATCHDIR=${FILESDIR}/${PV}
	local MY_SOURCECAPS="${PATCHDIR}/${FNAME_SOURCECAPS_NORMAL}"

	epatch "${PATCHDIR}/${P}-shutdown-retry.diff"
	epatch "${FILESDIR}/vdr-1.3.32-daemon.patch"

	if use bigpatch; then
		epatch "${WORKDIR}/${FNAME_BIGPATCH}"
	else
		# All these patches are included in bigpatch
		if use aio; then
			if use lnbsharing; then
				ewarn "At the moment lnbsharing can not be combined with aio, dropping aio patch!"
			else
				epatch "../${FNAME_AIO}"
			fi
		fi

		if use lnbsharing; then
			epatch "${DISTDIR}/${FNAME_LNBSHARING}"
			MY_SOURCECAPS="${PATCHDIR}/${FNAME_SOURCECAPS_LNBSHARING}"
		fi

		use sourcecaps && epatch "${MY_SOURCECAPS}"

		if use jumpplay; then
			if use sourcecaps; then
				ewarn "At the moment sourcecaps can not be combined with jumpplay, dropping jumpplay patch."
			else
				epatch "${DISTDIR}/${FNAME_JUMPPLAY}"
			fi
		fi
	fi



	# apply local patches defined by variable VDR_LOCAL_PATCHES_DIR
	if test -n "${VDR_LOCAL_PATCHES_DIR}"; then
		echo
		einfo "Applying local patches"
		for LOCALPATCH in ${VDR_LOCAL_PATCHES_DIR}/${PV}/*.{diff,patch}; do
			test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}"
		done
	fi

	if [[ -n "${VDRSOURCE_DIR}" ]]; then
		cp -r ${S} ${T}/source-tree
	fi

	cat > ${CAP_FILE} <<-EOT
		CAP_IRCTRL_RUNTIME_PARAM=1
		CAP_VFAT_RUNTIME_PARAM=1
		CAP_SHUTDOWN_AUTO_RETRY=1
	EOT
}

src_install() {
	exeinto /usr/bin
	doexe vdr
	doexe svdrpsend.pl

	insinto ${VDR_INCLUDE_DIR}
	doins *.h
	doins Make.config

	insinto ${VDR_INCLUDE_DIR}/libsi
	doins libsi/*.h

	keepdir ${CONF_DIR}
	keepdir ${CONF_DIR}/plugins
	keepdir ${VDR_HOME}
	keepdir ${VDR_HOME}/video

	insinto ${CONF_DIR}
	doins *.conf channels.conf.*

	chown -R vdr:vdr ${D}/${CONF_DIR} ${D}/${VDR_HOME}
	keepdir "${PLUGIN_DIR}"

	doman vdr.1 vdr.5

	insinto ${RC_DIR}
	doins ${CAP_FILE}

	if [[ -n "${VDRSOURCE_DIR}" ]]; then
		einfo "Installing sources"
		insinto ${VDRSOURCE_DIR}/${P}
		doins -r ${T}/source-tree/*
		keepdir ${VDRSOURCE_DIR}/${P}/PLUGINS/lib
	fi
}

pkg_postinst() {
	einfo "It is a good idea to run vdrplugin-rebuild now"
}