summaryrefslogtreecommitdiff
blob: 5bdf58ab8edbab164dbef2abf29f894161554d1e (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/ati-drivers/ati-drivers-2.9.6.ebuild,v 1.2 2003/04/20 01:15:52 lu_zero Exp $

IUSE="qt kde gnome"

DESCRIPTION="Ati precompiled drivers for r300, r250 and r200 chipsets"
HOMEPAGE="http://www.ati.com"
##SRC_URI="http://pdownload.mii.instacontent.net/ati/drivers/fglrx-glc22-4.3.0-${PV}.i586.rpm"
##SRC_URI="http://www.schneider-digital.de/download/ati/glx1_linux_X4.3.zip"
A="fglrx-glc22-4.3.0-${PV}.i586.rpm"
SLOT="${KV}"
LICENSE="ATI GPL-2 QPL-1.0"
KEYWORDS="-* ~x86"

DEPEND=">=virtual/linux-sources-2.4
	>=sys-libs/glibc-2.2.2
	app-arch/rpm2targz
	>=x11-base/xfree-4.3.0
	qt? ( >=x11-libs/qt-3.0 )"

ATIBIN="${D}/opt/ati/bin"
RESTRICT="nostrip"

src_unpack() {
	if [ ! -f ${DISTDIR}/${A} ] ; then
		die "Please download ${A} from ${HOMEPAGE} or http://www.schneider-digital.de/html/body_download_ati.html (fetch glx1_linux_X4.3.zip and unpack it)"
	fi	
    cd ${WORKDIR}
    #unpack  ${A}
	#mv "./XFree 4.3.0-2.9.6/fglrx-glc22-4.3.0-${PV}.i586.rpm" .    
    rpm2targz ${DISTDIR}/${A} 
	tar zxf fglrx-glc22-4.3.0-${PV}.i586.tar.gz
}

pkg_setup(){
	opengl-update xfree
}


src_compile() {

	einfo "building the glx module"

    cd ${WORKDIR}/lib/modules/fglrx/build_mod
    #that is the dirty way to avoid the id -u check
    sed -e 's:`id -u`:0:' make.sh >make.sh.new
    mv make.sh.new make.sh
    chmod +x make.sh
    ./make.sh || ewarn "glx module not built" 
	

    einfo "building the fgl_glxgears sample"
	
	mkdir ${WORKDIR}/fglrxgears
    cd ${WORKDIR}/fglrxgears
    tar -xzvf ${WORKDIR}/usr/src/fglrx_sample_source.tgz
    mv xc/programs/fgl_glxgears/* .
    make -f Makefile.Linux || die
    
    if [ "`use qt`" ]
	then 
	    einfo "building the qt fglx panel"
	    cd ${WORKDIR}
	    local OLDBIN="/usr/X11R6/bin"
	    local ATIBIN="${D}/opt/ati/bin"
	    mkdir fglrx_panel
	    cd  fglrx_panel
	    tar -xzvf ${WORKDIR}/usr/src/fglrx_panel_sources.tgz
	    sed -e "s:"${OLDBIN}":"${ATIBIN}":"\
		Makefile >Makefile.new
		mv Makefile.new Makefile
	emake || die
    fi
    
#removing stuff 
    einfo "cleaning"
    cd ${WORKDIR}
    rm -fR usr/share
    cd usr/X11R6/
    rm -fR bin/firegl*.bz2 bin/LICENSE.* bin/fgl_glxgears src
}

pkg_preinst() {
# clean the dinamic libGL stuff's home to ensure
# we dont have stale libs floating around
    if [ -d ${ROOT}/usr/lib/opengl/ati ]
	then
	    rm -rf ${ROOT}/usr/lib/opengl/ati/*
    fi
}			    

src_install() {
    local ATI_ROOT="/usr/lib/opengl/ati"
    
    cd ${WORKDIR}

#drm module 
    insinto /lib/modules/${KV}/video
    doins lib/modules/fglrx/build_mod/fglrx.o

#dri driver
    exeinto ${ATI_ROOT}/lib
    doexe usr/X11R6/lib/libGL.so.1.2 
    dosym libGL.so.1.2 ${ATI_ROOT}/lib/libGL.so.1
    dosym libGL.so.1.2 ${ATI_ROOT}/lib/libGL.so
    dosym libGL.so.1.2 ${ATI_ROOT}/lib/libMesaGL.so
    #that is the same as in the xfree
    dosym ../../xfree/lib/libGL.la ${ATI_ROOT}/lib/libGL.la

#same as in xfree
    exeinto ${ATI_ROOT}/
    dosym ../xfree/include ${ATI_ROOT}/include
    dosym ../xfree/extensions ${ATI_ROOT}/extensions
    rm usr/X11R6/lib/libGL.so.1.2

#apps
    insinto /etc/env.d
    doins ${FILESDIR}/09ati
    exeinto /opt/ati/bin
    doexe fglrxgears/fgl_glxgears
    doexe usr/X11R6/bin/*
    rm usr/X11R6/bin/*

    if [ "`use qt`" ] 
	then
	    doexe fglrx_panel/fireglcontrol
    fi

    #if ["`use kde`"] then


    #if ["`use gnome`"]
	cp -R usr ${D}
}

pkg_postinst() {
#switch to the ati implementation
    if [ "${ROOT}" = "/" ]
	then
	    /usr/sbin/opengl-update ati
    fi
    
    einfo
    einfo "To use the xfree GLX, run \"opengl-update xfree\""
    einfo
    einfo
    einfo "To chance your XF86Config you can use the bundled \"fglrxconfig\""
    einfo
#drm-module
    update-modules

}

pkg_postrm() {
	opengl-update xfree
}