summaryrefslogtreecommitdiff
blob: ff75d12694c05ddc39fd253519cb4d2f9a2ed329 (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/mtxdrivers/mtxdrivers-0.2.1.ebuild,v 1.9 2003/11/20 02:29:38 vapier Exp $

RELEASE=2002
DESCRIPTION="Drviers for the Matrox Parhelia card."
HOMEPAGE="http://www.matrox.com/mga/products/parhelia/home.cfm"
SRC_URI="ftp://ftp.matrox.com/pub/mga/archive/linux/${RELEASE}/${P/-/_}.tgz"

LICENSE="Matrox"
SLOT="0"
KEYWORDS="x86"

DEPEND=">=x11-base/xfree-4.1.0
	virtual/kernel"

src_unpack() {
	unpack ${A}
	mv mtxdrivers ${P}
}

src_compile() {
	Xversion=`X -version 2>&1 | grep -s "XFree86 Version" | cut -d" " -f3 | sed -e "s/\([^\.]*\.[^\.]*\.[^\.]*\)\.[^\.]*/\1/"`

	# hack to make mtx.o compile with rmap enabled kernels
	if [ ${RMAPHACK} = "yes" ]; then
		cp kernel/src/mtx_vm.c kernel/src/mtx_vm.c.orig
		sed -e "s:pte_offset:pte_offset_kernel:g" kernel/src/mtx_vm.c.orig > kernel/src/mtx_vm.c
	fi

	# Patch because X 4.3.0 is 'not supported' but works.
	cp -a xfree86/4.2.1 xfree86/4.3.0

	if [ ! -e ${S}/xfree86/${Xversion} ]; then
		eerror "Matrox does not support XFree v${Xversion}"
		die
	fi

	cd ${S}/kernel/src
	emake clean
	emake
}

src_install() {
	Xversion=`X -version 2>&1 | grep -s "XFree86 Version" | cut -d" " -f3 | sed -e "s/\([^\.]*\.[^\.]*\.[^\.]*\)\.[^\.]*/\1/"`

	Xpath="`which X | sed -e "s:/bin/X$::"`"
	Kversion=`uname -r`

	dodir /usr/lib /lib/modules/${Kversion}/kernel/drivers/video ${Xpath}/lib/modules/drivers ${Xpath}/lib/modules/linux

	cp ${S}/xfree86/${Xversion}/mtx_drv.o ${D}/${Xpath}/lib/modules/drivers
	chmod 755 ${D}/${Xpath}/lib/modules/drivers/mtx_drv.o

	cp ${S}/lib/libparhl.so ${D}/usr/lib
	chmod 755 ${D}/usr/lib/libparhl.so
	ln -sf /usr/lib/libparhl.so ${D}${Xpath}/lib/modules/linux

	cp -a kernel/src/mtx.o ${D}/lib/modules/${Kversion}/kernel/drivers/video
	chmod 755 ${D}/lib/modules/${Kversion}/kernel/drivers/video/mtx.o

	dodoc README samples/*
}

pkg_postinst() {
	einfo "Please look at /usr/share/doc/${P}/XF86Config.*"
	einfo "for X configurations for your Parhelia card."
	echo
	einfo "In case you have a kernel with rmap VM the mtx.o"
	einfo "module needs a little hack to work. Remerge this"
	einfo "ebuild like this:"
	einfo "RMAPHACK=\"yes\" emerge mtxdrivers"
}