summaryrefslogtreecommitdiff
blob: 873c2e3680b08b92dfa17c483dd2a12f8c9fd858 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/v4l-dvb-hg/v4l-dvb-hg-0.1-r3.ebuild,v 1.3 2009/11/18 19:39:51 zzam Exp $

: ${EHG_REPO_URI:=${MANTIS_V4L_DVB_HG_REPO_URI:-http://www.jusst.de/hg/mantis-v4l-dvb/}}

EAPI="2"

inherit linux-mod eutils toolchain-funcs mercurial savedconfig

DESCRIPTION="Live development version of mantis V4L and DVB driver for kernel 2.6"
SRC_URI=""
HOMEPAGE="http://jusst.de/hg/mantis/"

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

DEPEND="!media-tv/v4l-dvb-hg
		!media-tv/s2-liplianin"

S="${WORKDIR}/${EHG_REPO_URI##*/}mantis-v4l-dvb/v4l"

CONFIG_CHECK="!DVB_CORE !VIDEO_DEV"

pkg_setup()
{
	linux-mod_pkg_setup
	if [[ "${KV_MAJOR}.${KV_MINOR}" != "2.6"  ]]; then
		ewarn "other Kernel than 2.6.x are not supported at the moment."
		die "unsupported Kernel (not 2.6.x)"
	fi
	MODULE_NAMES="dvb(dvb:${S})"
	BUILD_PARAMS="KDIR=${KERNEL_DIR}"
	BUILD_TARGETS="default"
}

src_prepare() {

	einfo "Removing modules-install"
	sed -i "${S}"/Makefile \
		-e "s/install:: media-install firmware_install/install:: media-install/"

	# apply local patches
	if test -n "${DVB_LOCAL_PATCHES}";
	then
		ewarn "Applying local patches:"
		for LOCALPATCH in ${DVB_LOCAL_PATCHES};
		do
			if test -f "${LOCALPATCH}";
			then
				if grep -q linux/drivers "${LOCALPATCH}"; then
					cd "${S}"/..
				else
					cd "${S}"
				fi
				epatch "${LOCALPATCH}"
			fi
		done
	else
		einfo "No additional local patches to use"
	fi

	export ARCH=$(tc-arch-kernel)
	make allmodconfig ${BUILD_PARAMS}
	export ARCH=$(tc-arch)

	echo

	elog "Removing autoload-entry from stradis-driver."
	sed -i "${S}"/../linux/drivers/media/video/stradis.c -e '/MODULE_DEVICE_TABLE/d'

	cd "${S}"
	sed	-e '/-install::/s:rminstall::' \
		-i Makefile

	elog "Removing depmod-calls"
	sed -e '/depmod/d' -i Makefile* scripts/make_makefile.pl scripts/make_kconfig.pl \
	|| die "Failed removing depmod call from Makefile"

	grep depmod * && die "Not removed depmod found."

	mkdir "${WORKDIR}"/header
	cd "${WORKDIR}"/header
	cp "${S}"/../linux/include/linux/dvb/* .
	sed -e '/compiler/d' \
		-e 's/__user//' \
		-i *.h

	cd "${S}"
	restore_config .config
}

src_install() {
	# install the modules
	local DEST="${D}/lib/modules/${KV_FULL}/v4l-dvb"
	make install \
		DEST="${DEST}" \
		KDIR26="${DEST}" \
		KDIRA="${DEST}" \
	|| die "make install failed"

	cd "${S}"/..
	dodoc linux/Documentation/dvb/*.txt
	dosbin linux/Documentation/dvb/get_dvb_firmware

	insinto /usr/include/v4l-dvb-hg/linux/dvb
	cd "${WORKDIR}/header"
	doins *.h

	cd "${S}"
	save_config .config
}

pkg_postinst() {
	echo
	elog "Firmware-files can be found in media-tv/linuxtv-dvb-firmware"
	echo

	linux-mod_pkg_postinst
	echo
	echo
	elog "if you want to use the IR-port or networking"
	elog "with the dvb-card you need to"
	elog "install linuxtv-dvb-apps"
	echo
}