1 |
#!/bin/bash |
#!/bin/bash |
2 |
# Copyright 1999-2004 Gentoo Foundation |
# Copyright 1999-2004 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/opengl-update/opengl-update.sh,v 1.1 2007-11-14 18:01:25 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/opengl-update/opengl-update.sh,v 1.10 2007-11-14 19:19:16 niro Exp $ |
5 |
# Author: Martin Schlemmer <azarah@gentoo.org> |
# Author: Martin Schlemmer <azarah@gentoo.org> |
6 |
# Further modifications by Donnie Berkholz <spyderous@gentoo.org> |
# Further modifications by Donnie Berkholz <spyderous@gentoo.org> |
7 |
# Further modifications based off submissions to bug #54984 <cyfred@gentoo.org> |
# Further modifications based off submissions to bug #54984 <cyfred@gentoo.org> |
13 |
|
|
14 |
. /etc/init.d/functions |
. /etc/init.d/functions |
15 |
|
|
16 |
hasq() { |
hasq() |
17 |
|
{ |
18 |
local x |
local x |
19 |
|
|
20 |
local me=${1} |
local me=${1} |
21 |
shift |
shift |
22 |
|
|
23 |
for x in "${@}"; do |
for x in $@ |
24 |
if [[ "${x}" == "${me}" ]]; then |
do |
25 |
return 0 |
[[ ${x} = ${me} ]] && return 0 |
|
fi |
|
26 |
done |
done |
27 |
|
|
28 |
return 1 |
return 1 |
29 |
} |
} |
30 |
|
|
31 |
check_user() { |
check_user() |
32 |
if [[ $(id -u) -ne 0 ]]; then |
{ |
33 |
|
if [[ $(id -u) -ne 0 ]] |
34 |
|
then |
35 |
echo "${0}: Must be run as root." |
echo "${0}: Must be run as root." |
36 |
exit 1 |
exit 1 |
37 |
fi |
fi |
38 |
} |
} |
39 |
|
|
40 |
get_current_implem() { |
get_current_implem() |
41 |
|
{ |
42 |
local implem |
local implem |
43 |
if [[ -f ${ENV_D} ]]; then |
|
44 |
|
if [[ -f ${ENV_D} ]] |
45 |
|
then |
46 |
source ${ENV_D} |
source ${ENV_D} |
47 |
if [[ -n "${OPENGL_PROFILE}" ]]; then |
if [[ -n ${OPENGL_PROFILE} ]] |
48 |
|
then |
49 |
implem="${OPENGL_PROFILE}" |
implem="${OPENGL_PROFILE}" |
50 |
elif [[ -n "${LDPATH}" ]]; then |
elif [[ -n ${LDPATH} ]] |
51 |
|
then |
52 |
implem="${LDPATH%%:*}" |
implem="${LDPATH%%:*}" |
53 |
implem="${implem##*opengl/}" |
implem="${implem##*opengl/}" |
54 |
implem="${implem%/lib*}" |
implem="${implem%/lib*}" |
60 |
echo ${implem} |
echo ${implem} |
61 |
} |
} |
62 |
|
|
63 |
get_implementations() { |
get_implementations() |
64 |
|
{ |
65 |
local implems |
local implems |
66 |
for dir in ${PREFIX}/lib{,32,64}/opengl/*; do |
|
67 |
if [[ -d "${dir}" && ${dir##*/} != "global" ]] && ! hasq ${dir##*/} ${implems}; then |
for dir in ${PREFIX}/lib{,32,64}/opengl/* |
68 |
|
do |
69 |
|
if [[ -d ${dir} ]] && |
70 |
|
[[ ${dir##*/} != global ]] && |
71 |
|
! hasq ${dir##*/} ${implems} |
72 |
|
then |
73 |
implems=${implems:+${implems} }${dir##*/} |
implems=${implems:+${implems} }${dir##*/} |
74 |
fi |
fi |
75 |
done |
done |
76 |
|
|
77 |
echo ${implems} |
echo ${implems} |
78 |
} |
} |
79 |
|
|
80 |
print_version() { |
print_version() |
81 |
|
{ |
82 |
echo "opengl-update ${VERSION}" |
echo "opengl-update ${VERSION}" |
83 |
} |
} |
84 |
|
|
85 |
print_usage() { |
print_usage() |
86 |
|
{ |
87 |
# Get grammar right in message |
# Get grammar right in message |
88 |
local IS_ARE IMPLEM_PLURAL |
local IS_ARE IMPLEM_PLURAL |
89 |
if [[ $(echo ${AVAIL_IMPLEMS} | wc -w) -eq 1 ]]; then |
|
90 |
|
if [[ $(echo ${AVAIL_IMPLEMS} | wc -w) -eq 1 ]] |
91 |
|
then |
92 |
IS_ARE="is" |
IS_ARE="is" |
93 |
IMPLEM_PLURAL="" |
IMPLEM_PLURAL="" |
94 |
else |
else |
102 |
Usage: ${0##*/} [<options>] <GL implementation> |
Usage: ${0##*/} [<options>] <GL implementation> |
103 |
Set the opengl implementation. |
Set the opengl implementation. |
104 |
Valid options: |
Valid options: |
105 |
|
--help|-h|-?: Prints this help. |
106 |
|
--version: Shows the version of this utility. |
107 |
--use-old: If an implementation is already set, use that one. |
--use-old: If an implementation is already set, use that one. |
108 |
--prefix=<val>: Set the source prefix (default: /usr) |
--prefix=<val>: Set the source prefix (default: /usr) |
109 |
--dst-prefix=<val>: Set the destination prefix (default: /usr) |
--dst-prefix=<val>: Set the destination prefix (default: /usr) |
110 |
--impl-headers: Use headers provided by this implementation to |
--impl-headers: Use headers provided by this implementation to |
111 |
override golbal ones provided by opengl-update. |
override global ones provided by opengl-update. |
112 |
|
|
113 |
Usage: ${0##*/} --get-implementation |
Usage: ${0##*/} --get-implementation |
114 |
Print the current implementaion |
Print the current implementaion |
130 |
exit 1 |
exit 1 |
131 |
} |
} |
132 |
|
|
133 |
parse_options() { |
parse_options() |
134 |
|
{ |
135 |
local opt |
local opt |
136 |
while [[ ${#} -gt 0 ]]; do |
|
137 |
|
while [[ ${#} -gt 0 ]] |
138 |
|
do |
139 |
opt=${1} |
opt=${1} |
140 |
shift |
shift |
141 |
case ${opt} in |
case ${opt} in |
142 |
--use-old) |
--use-old) |
143 |
if [[ -n "${ACTION}" ]]; then |
if [[ -n ${ACTION} ]] |
144 |
|
then |
145 |
ACTION="error" |
ACTION="error" |
146 |
echo "Invalid usage." |
echo "Invalid usage." |
147 |
else |
else |
148 |
if [[ -n "${CURRENT_GL_IMPLEM}" ]] && hasq ${CURRENT_GL_IMPLEM} ${AVAIL_IMPLEMS}; then |
if [[ -n "${CURRENT_GL_IMPLEM}" ]] && |
149 |
|
hasq ${CURRENT_GL_IMPLEM} ${AVAIL_IMPLEMS} |
150 |
|
then |
151 |
ACTION="old-implementation" |
ACTION="old-implementation" |
152 |
fi |
fi |
153 |
fi |
fi |
154 |
;; |
;; |
155 |
|
|
156 |
--get-implementation) |
--get-implementation) |
157 |
if [[ -n "${ACTION}" ]]; then |
if [[ -n ${ACTION} ]] |
158 |
|
then |
159 |
ACTION="error" |
ACTION="error" |
160 |
echo "Invalid usage." |
echo "Invalid usage." |
161 |
else |
else |
162 |
ACTION="get-implementation" |
ACTION="get-implementation" |
163 |
fi |
fi |
164 |
;; |
;; |
165 |
|
|
166 |
--prefix=*) |
--prefix=*) |
167 |
PREFIX=${opt#*=} |
PREFIX=${opt#*=} |
168 |
AVAIL_IMPLEMS=$(get_implementations) |
AVAIL_IMPLEMS=$(get_implementations) |
169 |
;; |
;; |
170 |
--dst-prefix=*) |
|
171 |
DST_PREFIX=${opt#*=} |
--dst-prefix=*) DST_PREFIX=${opt#*=} ;; |
172 |
;; |
|
173 |
--impl-headers) |
--impl-headers) USE_PROFILE_HEADERS="yes" ;; |
174 |
USE_PROFILE_HEADERS="yes" |
|
175 |
;; |
--help|-h|-?) ACTION="usage" ;; |
176 |
--help|-h|-?) |
|
177 |
ACION="usage" |
--version) ACTION="version" ;; |
178 |
;; |
|
|
--version) |
|
|
ACTION="version" |
|
|
;; |
|
179 |
*) |
*) |
180 |
if hasq ${opt} ${AVAIL_IMPLEMS}; then |
if hasq ${opt} ${AVAIL_IMPLEMS} |
181 |
if [[ "${ACTION}" != "old-implementation" ]]; then |
then |
182 |
if [[ -n "${ACTION}" ]]; then |
if [[ ${ACTION} != old-implementation ]] |
183 |
|
then |
184 |
|
if [[ -n ${ACTION} ]] |
185 |
|
then |
186 |
ACTION="error" |
ACTION="error" |
187 |
echo "Invalid usage." |
echo "Invalid usage." |
188 |
else |
else |
189 |
ACTION="set-implementation" |
ACTION="set-implementation" |
190 |
NEW_GL_IMPLEM="${opt}" |
NEW_GL_IMPLEM="${opt}" |
191 |
fi |
fi |
192 |
fi |
fi |
193 |
else |
else |
194 |
echo "Unrecognized option: ${opt}" |
echo "Unrecognized option: ${opt}" |
195 |
ACTION="error" |
ACTION="error" |
196 |
fi |
fi |
197 |
;; |
;; |
198 |
esac |
esac |
199 |
done |
done |
200 |
} |
} |
201 |
|
|
202 |
set-new-implementation() { |
set_new_implementation() |
203 |
|
{ |
204 |
local GL_IMPLEM=${1} |
local GL_IMPLEM=${1} |
205 |
local GL_LOCAL |
local GL_LOCAL |
206 |
|
|
209 |
# Set a sane umask... bug #83115 |
# Set a sane umask... bug #83115 |
210 |
umask 022 |
umask 022 |
211 |
|
|
212 |
if ! hasq ${GL_IMPLEM} ${AVAIL_IMPLEMS}; then |
if ! hasq ${GL_IMPLEM} ${AVAIL_IMPLEMS} |
213 |
|
then |
214 |
echo "Invalid profile selected." |
echo "Invalid profile selected." |
215 |
exit 1 |
exit 1 |
216 |
fi |
fi |
217 |
|
|
218 |
echo "Switching to ${GL_IMPLEM} OpenGL interface" |
echo "Switching to ${GL_IMPLEM} OpenGL interface" |
|
rm -f ${ENV_D} &> /dev/null |
|
219 |
|
|
220 |
LIBDIRS="lib32 lib lib64" |
rm -f ${ENV_D} &> /dev/null |
221 |
for LIBDIR in ${LIBDIRS}; do |
|
222 |
# Special case handling of lib32 because it can be a symlink to |
LIBDIRS="lib32 lib lib64" |
223 |
# emul libs |
for LIBDIR in ${LIBDIRS} |
224 |
if [[ "${LIBDIR}" = "lib32" ]]; then |
do |
225 |
[[ -d "${PREFIX}/${LIBDIR}/opengl" ]] || continue |
# Special case handling of lib32 because it can be a symlink to |
226 |
else |
# emul libs |
227 |
[[ -d "${PREFIX}/${LIBDIR}/opengl" && ! -h "${PREFIX}/${LIBDIR}" ]] || continue |
if [[ ${LIBDIR} = lib32 ]] |
228 |
fi |
then |
229 |
|
[[ -d ${PREFIX}/${LIBDIR}/opengl ]] || continue |
230 |
# Fallback on xorg if we don't have this implementation for this LIBDIR. |
else |
231 |
if [[ ! -d ${PREFIX}/${LIBDIR}/opengl/"${GL_IMPLEM}" ]]; then |
[[ -d ${PREFIX}/${LIBDIR}/opengl ]] && |
232 |
GL_LOCAL="xorg" |
[[ ! -h ${PREFIX}/${LIBDIR} ]] || continue |
233 |
else |
fi |
234 |
GL_LOCAL="${GL_IMPLEM}" |
|
235 |
fi |
# Fallback on xorg if we don't have this implementation for this LIBDIR. |
236 |
|
if [[ ! -d ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM} ]] |
237 |
mkdir -p ${DST_PREFIX}/${LIBDIR} |
then |
238 |
pushd ${DST_PREFIX}/${LIBDIR} &> /dev/null |
GL_LOCAL="xorg" |
239 |
|
else |
240 |
|
GL_LOCAL="${GL_IMPLEM}" |
241 |
|
fi |
242 |
|
|
243 |
|
mkdir -p ${DST_PREFIX}/${LIBDIR} |
244 |
|
pushd ${DST_PREFIX}/${LIBDIR} &> /dev/null |
245 |
|
# First remove old symlinks |
246 |
|
for file in libGL{,core}.{a,so,la} |
247 |
|
do |
248 |
|
[[ -h ${file} ]] && rm -f ${file} |
249 |
|
done |
250 |
|
|
251 |
|
# Note that we don't do .so*, just .so on purpose. The |
252 |
|
# loader knows to look in the profile dir, and the |
253 |
|
# linked just needs the .so |
254 |
|
for file in ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib/libGL{,core}.{so,a,la} |
255 |
|
do |
256 |
|
[[ -f ${file} ]] || continue |
257 |
|
[[ -f ${file##*/} ]] && rm -f ${file##*/} |
258 |
|
|
259 |
|
# Fix libtool archives (#48297) |
260 |
|
if [[ ${file%.la} != ${file} ]] |
261 |
|
then |
262 |
|
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${LIBDIR}:g" ${file} > ${file##*/} |
263 |
|
else |
264 |
|
ln -s ${file} |
265 |
|
fi |
266 |
|
done |
267 |
|
popd &> /dev/null |
268 |
|
|
269 |
|
if [[ -e ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib/tls ]] |
270 |
|
then |
271 |
|
mkdir -p ${DST_PREFIX}/${LIBDIR}/tls |
272 |
|
pushd ${DST_PREFIX}/${LIBDIR}/tls &> /dev/null |
273 |
# First remove old symlinks |
# First remove old symlinks |
274 |
for file in libGL{,core}.{a,so,la} ; do |
for file in libGL{,core}.{a,so,la} |
275 |
|
do |
276 |
[[ -h ${file} ]] && rm -f ${file} |
[[ -h ${file} ]] && rm -f ${file} |
277 |
done |
done |
278 |
|
|
279 |
# Note that we don't do .so*, just .so on purpose. The |
for file in ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib/tls/libGL{,core}.{so,a,la} |
280 |
# loader knows to look in the profile dir, and the |
do |
281 |
# linked just needs the .so |
[[ -f ${file} ]] || continue |
282 |
for file in ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib/libGL{,core}.{so,a,la}; do |
[[ -f ${file##*/} ]] && rm -f ${file##*/} |
|
[[ -f "${file}" ]] || continue |
|
|
[[ -f "${file##*/}" ]] && rm -f ${file##*/} |
|
283 |
|
|
284 |
# Fix libtool archives (#48297) |
# Fix libtool archives (#48297) |
285 |
if [[ "${file%.la}" != "${file}" ]]; then |
if [[ ${file%.la} != ${file} ]] |
286 |
|
then |
287 |
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${LIBDIR}:g" ${file} > ${file##*/} |
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${LIBDIR}:g" ${file} > ${file##*/} |
288 |
else |
else |
289 |
ln -s ${file} |
ln -s ${file} |
290 |
fi |
fi |
291 |
done |
done |
292 |
popd &> /dev/null |
popd &> /dev/null |
293 |
|
fi |
294 |
|
|
295 |
if [[ -e "${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib/tls" ]]; then |
local MODULEDIR |
296 |
mkdir -p ${DST_PREFIX}/${LIBDIR}/tls |
if [[ -e ${DST_PREFIX}/${LIBDIR}/xorg/modules ]] |
297 |
pushd ${DST_PREFIX}/${LIBDIR}/tls &> /dev/null |
then |
298 |
# First remove old symlinks |
MODULEDIR="xorg/modules" |
299 |
for file in libGL{,core}.{a,so,la} ; do |
else |
300 |
[[ -h ${file} ]] && rm -f ${file} |
MODULEDIR="modules" |
301 |
done |
fi |
302 |
|
|
303 |
for file in ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib/tls/libGL{,core}.{so,a,la}; do |
if [[ -e ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/extensions ]] |
304 |
[[ -f "${file}" ]] || continue |
then |
305 |
[[ -f "${file##*/}" ]] && rm -f ${file##*/} |
mkdir -p ${DST_PREFIX}/${LIBDIR}/${MODULEDIR}/extensions |
306 |
|
pushd ${DST_PREFIX}/${LIBDIR}/${MODULEDIR}/extensions &> /dev/null |
307 |
# Fix libtool archives (#48297) |
# First remove old symlinks |
308 |
if [ "${file%.la}" != "${file}" ]; then |
for file in libglx.so libglx.a |
309 |
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${LIBDIR}:g" ${file} > ${file##*/} |
do |
310 |
else |
[[ -h ${file} ]] && rm -f ${file} |
311 |
ln -s ${file} |
done |
312 |
fi |
|
313 |
done |
for file in ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/extensions/*.{so,a,la} |
314 |
popd &> /dev/null |
do |
315 |
fi |
[[ -f ${file} ]] || continue |
316 |
|
[[ -f ${file##*/} ]] && rm -f ${file##*/} |
317 |
local MODULEDIR |
|
318 |
if [[ -e "${DST_PREFIX}/${LIBDIR}/xorg/modules" ]]; then |
# Fix libtool archives (#48297) |
319 |
MODULEDIR="xorg/modules" |
if [[ ${file%.la} != ${file} ]] |
320 |
else |
then |
321 |
MODULEDIR="modules" |
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${LIBDIR}:g" ${file} > ${file##*/} |
322 |
fi |
else |
323 |
|
ln -s ${file} |
|
if [[ -e "${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/extensions" ]]; then |
|
|
mkdir -p ${DST_PREFIX}/${LIBDIR}/${MODULEDIR}/extensions |
|
|
pushd ${DST_PREFIX}/${LIBDIR}/${MODULEDIR}/extensions &> /dev/null |
|
|
# First remove old symlinks |
|
|
for file in libglx.so libglx.a; do |
|
|
[[ -h ${file} ]] && rm -f ${file} |
|
|
done |
|
|
|
|
|
for file in ${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/extensions/*.{so,a,la}; do |
|
|
[[ -f "${file}" ]] || continue |
|
|
[[ -f "${file##*/}" ]] && rm -f ${file##*/} |
|
|
|
|
|
# Fix libtool archives (#48297) |
|
|
if [[ "${file%.la}" != "${file}" ]]; then |
|
|
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${LIBDIR}:g" ${file} > ${file##*/} |
|
|
else |
|
|
ln -s ${file} |
|
|
fi |
|
|
done |
|
|
popd &> /dev/null |
|
|
fi |
|
|
|
|
|
# Setup the includes |
|
|
mkdir -p ${DST_PREFIX}/include/GL |
|
|
pushd ${DST_PREFIX}/include/GL &> /dev/null |
|
|
for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do |
|
|
# IMPORTANT |
|
|
# It is preferable currently to use the standard glext.h file |
|
|
# however if an OpenGL provider must use a self produced glext.h |
|
|
# then it should be installed to ${GL_IMPLEM}/include and the user |
|
|
# can add the --impl-headers option to select it. |
|
|
|
|
|
if [[ ${USE_PROFILE_HEADERS} == "yes" ]] ; then |
|
|
# Check the profile first. |
|
|
if [[ -e ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} ]]; then |
|
|
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
|
|
ln -s ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} |
|
|
fi |
|
|
continue |
|
324 |
fi |
fi |
325 |
|
done |
326 |
|
popd &> /dev/null |
327 |
|
fi |
328 |
|
|
329 |
if [[ -e ${PREFIX}/${LIBDIR}/opengl/global/include/${file} ]]; then |
# Setup the includes |
330 |
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
mkdir -p ${DST_PREFIX}/include/GL |
331 |
ln -s ${PREFIX}/${LIBDIR}/opengl/global/include/${file} |
pushd ${DST_PREFIX}/include/GL &> /dev/null |
332 |
elif [[ -e ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} ]]; then |
for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h |
333 |
|
do |
334 |
|
# IMPORTANT |
335 |
|
# It is preferable currently to use the standard glext.h file |
336 |
|
# however if an OpenGL provider must use a self produced glext.h |
337 |
|
# then it should be installed to ${GL_IMPLEM}/include and the user |
338 |
|
# can add the --impl-headers option to select it. |
339 |
|
|
340 |
|
if [[ ${USE_PROFILE_HEADERS} = yes ]] |
341 |
|
then |
342 |
|
# Check the profile first. |
343 |
|
if [[ -e ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} ]] |
344 |
|
then |
345 |
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
346 |
ln -s ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} |
ln -s ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} |
|
elif [[ -e ${PREFIX}/${LIBDIR}/opengl/xorg/include/${file} ]]; then |
|
|
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
|
|
ln -s ${PREFIX}/${LIBDIR}/opengl/xorg/include/${file} |
|
347 |
fi |
fi |
348 |
done |
continue |
349 |
popd &> /dev/null |
fi |
350 |
|
|
351 |
|
if [[ -e ${PREFIX}/${LIBDIR}/opengl/global/include/${file} ]] |
352 |
|
then |
353 |
|
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
354 |
|
ln -s ${PREFIX}/${LIBDIR}/opengl/global/include/${file} |
355 |
|
elif [[ -e ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} ]] |
356 |
|
then |
357 |
|
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
358 |
|
ln -s ${PREFIX}/${LIBDIR}/opengl/${GL_IMPLEM}/include/${file} |
359 |
|
elif [[ -e ${PREFIX}/${LIBDIR}/opengl/xorg/include/${file} ]] |
360 |
|
then |
361 |
|
[[ -f "${file}" || ( -L "${file}" && ! -e "${file}" ) ]] && rm -f ${file} |
362 |
|
ln -s ${PREFIX}/${LIBDIR}/opengl/xorg/include/${file} |
363 |
|
fi |
364 |
|
done |
365 |
|
popd &> /dev/null |
366 |
|
|
367 |
# Setup the $LDPATH |
# Setup the $LDPATH |
368 |
ldpath="${ldpath:+${ldpath}:}${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib" |
ldpath="${ldpath:+${ldpath}:}${PREFIX}/${LIBDIR}/opengl/${GL_LOCAL}/lib" |
369 |
|
|
370 |
done |
done |
371 |
|
|
372 |
echo "LDPATH=\"${ldpath}\"" > ${ENV_D} |
# put only one LDPATH per line! |
373 |
echo "OPENGL_PROFILE=\"${GL_IMPLEM}\"" >> ${ENV_D} |
local i |
374 |
|
for i in $(echo ${ldpath} | sed "s:\::\ :g") |
375 |
|
do |
376 |
|
echo "LDPATH=\"${i}\"" >> ${ENV_D} |
377 |
|
done |
378 |
|
echo "OPENGL_PROFILE=\"${GL_IMPLEM}\"" >> ${ENV_D} |
379 |
|
|
380 |
env-rebuild |
env-rebuild |
381 |
|
|
382 |
return 0 |
return 0 |
383 |
} |
} |
392 |
AVAIL_IMPLEMS=$(get_implementations) |
AVAIL_IMPLEMS=$(get_implementations) |
393 |
CURRENT_GL_IMPLEM=$(get_current_implem) |
CURRENT_GL_IMPLEM=$(get_current_implem) |
394 |
USE_PROFILE_HEADERS="no" |
USE_PROFILE_HEADERS="no" |
395 |
VERSION="2.2.4" |
VERSION="@@VERSION@@" |
396 |
|
|
397 |
parse_options ${@} |
parse_options ${@} |
398 |
|
|
399 |
case ${ACTION} in |
case ${ACTION} in |
400 |
get-implementation) |
get-implementation) |
401 |
if [[ -n "${CURRENT_GL_IMPLEM}" ]]; then |
if [[ -n ${CURRENT_GL_IMPLEM} ]] |
402 |
|
then |
403 |
echo ${CURRENT_GL_IMPLEM} |
echo ${CURRENT_GL_IMPLEM} |
404 |
exit 0 |
exit 0 |
405 |
else |
else |
406 |
exit 2 |
exit 2 |
407 |
fi |
fi |
408 |
;; |
;; |
409 |
|
|
410 |
old-implementation) |
old-implementation) |
411 |
set-new-implementation ${CURRENT_GL_IMPLEM} |
set_new_implementation ${CURRENT_GL_IMPLEM} |
412 |
exit $? |
exit $? |
413 |
;; |
;; |
414 |
|
|
415 |
set-implementation) |
set-implementation) |
416 |
if [[ -n "${NEW_GL_IMPLEM}" ]]; then |
if [[ -n ${NEW_GL_IMPLEM} ]] |
417 |
set-new-implementation ${NEW_GL_IMPLEM} |
then |
418 |
|
set_new_implementation ${NEW_GL_IMPLEM} |
419 |
exit $? |
exit $? |
420 |
else |
else |
421 |
print_usage |
print_usage |
422 |
exit 1 |
exit 1 |
423 |
fi |
fi |
424 |
;; |
;; |
425 |
|
|
426 |
version) |
version) |
427 |
print_version |
print_version |
428 |
exit 0 |
exit 0 |
429 |
;; |
;; |
430 |
|
|
431 |
usage) |
usage) |
432 |
print_usage |
print_usage |
433 |
exit 0 |
exit 0 |
434 |
;; |
;; |
435 |
|
|
436 |
error) |
error) |
437 |
print_usage |
print_usage |
438 |
exit 1 |
exit 1 |
439 |
;; |
;; |
440 |
|
|
441 |
*) |
*) |
442 |
print_usage |
print_usage |
443 |
exit 1 |
exit 1 |
444 |
;; |
;; |
445 |
esac |
esac |