summaryrefslogtreecommitdiff
blob: 788d25f6b68b9e253b8c6065b6a53c2aeb3dcbad (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-2005 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.4 2005/01/20 04:55:57 battousai 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.99*' ; 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() {
	einfo "To have Xorg make use of the new GATOS modules, you should add the following"
	einfo "line to /etc/X11/XF86Config, in the files section and above any other"
	einfo "ModulePath directives:"
	einfo
	einfo "      ModulePath \"/usr/X11R6/lib/modules-extra/gatos\""
	einfo
	einfo "Please note that you may need to uncomment or add another ModulePath line with"
	einfo "the default module path in it. If Xorg does not start after adding the line"
	einfo "above, add this one under it:"
	einfo
	einfo "      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
}