blob: 054cd77c55bfd0de775845b14bcc7110221eb0be (
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
158
159
160
161
162
163
164
|
#!/bin/bash
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-base/opengl-update/files/opengl-update-1.6,v 1.3 2004/03/06 04:20:10 vapier Exp $
# Author: Martin Schlemmer <azarah@gentoo.org>
source /etc/init.d/functions.sh
if [ `id -u` -ne 0 ]
then
eerror "${0}: must be root."
exit 1
fi
usage() {
cat << FOO
usage: `basename $0` <GL implementation>
note:
This utility switches between OpenGL implementations. Currently there
are four supported implementations, "xfree" "nvidia" "ati" and "mtx", the
implementations for XFree86, NVidia, ATI and Matrox drivers respectively.
examples:
`basename $0` xfree
This will setup things to use libGL.so from XFree86.
`basename $0` nvidia
This will setup things to use libGL.so from the NVidia drivers.
FOO
exit 1
}
if [ "$#" -ne 1 -a "$#" -ne 2 ] || [ "$#" -eq 2 -a "$1" != "--use-old" ]
then
usage
fi
GL_IMPLEM=""
# Only use specified implementation if it is not already selected.
if [ "$1" = "--use-old" ]
then
shift
if [ -f /etc/env.d/09opengl ]
then
source /etc/env.d/09opengl
if [ -n "${LDPATH}" ]
then
GL_IMPLEM="${LDPATH/\/usr\/lib\/opengl\/}"
GL_IMPLEM="${GL_IMPLEM/\/lib}"
unset LDPATH
fi
fi
if [ -z "${GL_IMPLEM}" ]
then
GL_IMPLEM="$1"
fi
else
GL_IMPLEM="$1"
fi
if [ ! -d /usr/lib/opengl/${GL_IMPLEM} ]
then
usage
else
ebegin "Switching to ${GL_IMPLEM} OpenGL interface"
#setup the $LDPATH
echo "LDPATH=/usr/lib/opengl/${GL_IMPLEM}/lib" >/etc/env.d/09opengl
/usr/sbin/env-update &>/dev/null
#setup the /usr/lib/libGL.so symlink
if [ -e /usr/lib/libGL.so ]
then
rm -f /usr/lib/libGL.so
fi
if [ -e /usr/lib/libGL.so.1 ]
then
rm -f /usr/lib/libGL.so.1
fi
realname="$(readlink /usr/lib/opengl/${GL_IMPLEM}/lib/libGL.so)"
ln -sf /usr/lib/opengl/${GL_IMPLEM}/lib/${realname} \
/usr/lib/libGL.so
ln -sf /usr/lib/opengl/${GL_IMPLEM}/lib/${realname} \
/usr/lib/libGL.so.1
#setup the /usr/X11R6/lib/libMesaGL.so symlink
if [ -e /usr/X11R6/lib/libMesaGL.so ]
then
rm -f /usr/X11R6/lib/libMesaGL.so
fi
realname="$(readlink /usr/lib/opengl/${GL_IMPLEM}/lib/libGL.so)"
ln -sf /usr/lib/opengl/${GL_IMPLEM}/lib/${realname} \
/usr/X11R6/lib/libMesaGL.so
#setup the /usr/lib/libGLcore.so symlink
if [ -e /usr/lib/libGLcore.so ]
then
rm -f /usr/lib/libGLcore.so
fi
if [ -e /usr/lib/libGLcore.so.1 ]
then
rm -f /usr/lib/libGLcore.so.1
fi
if [ -e /usr/lib/opengl/${GL_IMPLEM}/lib/libGLcore.so ]
then
realname="$(readlink /usr/lib/opengl/${GL_IMPLEM}/lib/libGLcore.so)"
ln -sf /usr/lib/opengl/${GL_IMPLEM}/lib/${realname} \
/usr/lib/libGLcore.so
ln -sf /usr/lib/opengl/${GL_IMPLEM}/lib/${realname} \
/usr/lib/libGLcore.so.1
fi
#setup the /usr/lib/libGL.la symlink
if [ -e /usr/lib/libGL.la ]
then
rm -f /usr/lib/libGL.la
fi
if [ -e /usr/lib/opengl/${GL_IMPLEM}/lib/libGL.la ]
then
ln -sf /usr/lib/opengl/${GL_IMPLEM}/lib/libGL.la \
/usr/lib/libGL.la
fi
#setup the /usr/X11R6/lib/modules/extensions/libglx.so symlink
if [ -e /usr/X11R6/lib/modules/extensions/libglx.so ]
then
rm -f /usr/X11R6/lib/modules/extensions/libglx.so
fi
if [ -e /usr/lib/opengl/${GL_IMPLEM}/extensions/libglx.so ]
then
ln -sf /usr/lib/opengl/${GL_IMPLEM}/extensions/libglx.so \
/usr/X11R6/lib/modules/extensions/libglx.so
fi
#setup the /usr/X11R6/lib/modules/extensions/libglx.a symlink
if [ -e /usr/X11R6/lib/modules/extensions/libglx.a ]
then
rm -f /usr/X11R6/lib/modules/extensions/libglx.a
fi
if [ -e /usr/lib/opengl/${GL_IMPLEM}/extensions/libglx.a ]
then
ln -sf /usr/lib/opengl/${GL_IMPLEM}/extensions/libglx.a \
/usr/X11R6/lib/modules/extensions/libglx.a
fi
#setup the includes
for x in gl.h glx.h glxtokens.h
do
if [ -e /usr/X11R6/include/GL/${x} ]
then
rm -f /usr/X11R6/include/GL/${x}
fi
ln -sf /usr/lib/opengl/${GL_IMPLEM}/include/${x} \
/usr/X11R6/include/GL/${x}
done
eend 0
fi
# vim:ts=4
|