summaryrefslogtreecommitdiff
blob: d6766ec23be0111ce0269c57b5ea286d424fa89e (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/rivatv/rivatv-0.8.5-r1.ebuild,v 1.3 2004/10/04 03:37:54 iggy Exp $

S=${WORKDIR}/${P/_/-}
DESCRIPTION="kernel driver for nVidia based cards with video-in"
SRC_URI="mirror://sourceforge/rivatv/${P/_/-}.tar.gz"
HOMEPAGE="http://rivatv.sourceforge.net/"
DEPEND="virtual/x11
	>=virtual/linux-sources-2.4.17"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~x86"
IUSE=""

src_unpack() {
	check_KV
	unpack ${A}

	# Symlink kernel source to a directory we have permissions for
	mkdir ${WORKDIR}/build
	cd ${WORKDIR}/build
	SRC=/lib/modules/${KV}/build
	for f in ${SRC}/.config ${SRC}/.version ${SRC}/*; do ln -s $f; done
}


src_compile() {
	# Alter Makefile.in to install into an alternate directory and
	# set the kernel source path to the build folder
	cd ${S}
	sed 's/\@KERNEL\@/\$\{KDIR\}/' Makefile.in > Makefile.in.new || die
	mv -f Makefile.in.new Makefile.in || die
	sed 's/install\: devices/install\:/' Makefile.in > Makefile.in.new || die
	mv -f Makefile.in.new Makefile.in || die
	sed 's/\/lib\/modules\//\$\{D\}lib\/modules\//' Makefile.in > Makefile.in.new || die
	mv -f Makefile.in.new Makefile.in || die
	sed 's/\$(DEPMOD)/echo replaced/' Makefile.in > Makefile.in.new || die
	mv -f Makefile.in.new Makefile.in || die

	# Configure and build
	set_arch_to_kernel
	econf || die
	emake KDIR=${WORKDIR}/build ARCH=i386 V=1 DEPMOD='' || die
}

src_install () {
	# Create kernel modules folder in the image directory
	dodir lib/modules/${KV}/kernel

	# Install to the image directory
	make install DESTDIR=${D} || die
	set_arch_to_portage
}

pkg_postinst() {
	# Update modules
	depmod -a

	# If devfsd is not being used create devices
	if [ "${ROOT}" = "/" ]
	then
		if [ ! -e /dev/.devfsd ] && [! -e /dev/video0 ]
		then
			# Create devices
			mknod /dev/video0 c 81 0
			chmod 660 /dev/video0
			mknod /dev/video1 c 81 0
			chmod 660 /dev/video1
			mknod /dev/video2 c 81 0
			chmod 660 /dev/video2
			mknod /dev/video3 c 81 0
			chmod 660 /dev/video3
			ln -s /dev/video0 /dev/video
		fi
	fi

	einfo "To load the module automatically at boot up, add these and"
	einfo "\"rivatv\" to your /etc/modules.autoload."
	einfo
	einfo "Also, see ${HOMEPAGE} for more information."
}

pkg_postrm() {
	# Update modules
	depmod -a
	einfo "If you added modules to /etc/modules.autoload remember to"
	einfo "remove them now."
}