summaryrefslogtreecommitdiff
blob: 0110500e73bc4838712b4660bd169ea6f5d9b178 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/ati-gatos/ati-gatos-4.4.0.ebuild,v 1.6 2007/05/01 00:42:38 genone Exp $

inherit eutils

SNAPSHOT=20040930
MYP=${P}-${SNAPSHOT}

DESCRIPTION="ATI Multimedia-capable drivers for Xorg"
HOMEPAGE="http://gatos.sourceforge.net/"
SRC_URI="mirror://gentoo/${MYP}.tar.bz2"

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

DEPEND=">=x11-base/xorg-x11-6.7.0-r1"

pkg_setup() {
	if ! built_with_use x11-base/xorg-x11 sdk ; then
		ewarn "This package requires that xorg-x11 was merged with the sdk USE flag enabled."
		die "Please merge xorg-x11 with the sdk USE flag enabled."
	fi
}

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

	if has_version '>x11-base/xorg-x11-6.7' ; then
		einfo "Patching ati-gatos for use with >=x11-base/xorg-x11-6.7.99"
		epatch ${FILESDIR}/${P}-new-xorg.patch
	fi

	epatch ${FILESDIR}/${P}-prototypes.patch

	# Build makefiles against Xorg SDK
	imake -I/usr/X11R6/lib/Server/config/cf -DUseInstalled -DXF86DriverSDK

	# Makefile fixes
	fix_makefile
}

src_compile() {
	cd ${S}

	emake DESTDIR=${D} || die "Problem compiling GATOS drivers."
}

src_install() {
	emake DESTDIR=${D} install
}

pkg_postinst() {
	elog "To have Xorg make use of the new GATOS modules, you should add the following"
	elog "line to /etc/X11/XF86Config, in the files section and above any other"
	elog "ModulePath directives:"
	elog
	elog "      ModulePath \"/usr/X11R6/lib/modules-extra/gatos\""
	elog
	elog "Please note that you may need to uncomment or add another ModulePath line with"
	elog "the default module path in it. If Xorg does not start after adding the line"
	elog "above, add this one under it:"
	elog
	elog "      ModulePath \"/usr/X11R6/lib/modules\""
}

fix_makefile() {
	cp Makefile Makefile.orig

	# Add the Xorg SDK include directories that gatos will use
	sed -i -e "s:\ *INCLUDES = \(.\+\):INCLUDES = \\1 -I/usr/X11R6/lib/Server/include -I/usr/X11R6/lib/Server/include/extensions:" Makefile

	# Clean up the ugly sandbox violations
	sed -i -e "s:\(\ \+\)MODULEDIR = .*:\\1MODULEDIR = \\\$(USRLIBDIR)/modules-extra/gatos:" Makefile
	sed -i -e "s:\(\ \+\)BUILDLIBDIR = .*:\\1BUILDLIBDIR = \\\$(DESTDIR)\\\$(TOP)/exports/lib:" Makefile
	sed -i -e "s:\$(RM) \$(BUILDMODULEDIR):\$(RM) \$(DESTDIR)\$(BUILDMODULEDIR):g" Makefile
}