diff options
author | Matt Housh <jaeger@morpheus.net> | 2006-03-30 16:18:14 +0000 |
---|---|---|
committer | Matt Housh <jaeger@morpheus.net> | 2006-03-30 16:18:14 +0000 |
commit | f281b56edb3b230d578eeb27dcda3813c259920e (patch) | |
tree | c4b54e7911550acbf98319c6bb41dc915ac754f8 /gl-select | |
parent | 6638632dc90f9bcc2a79b190a10398eeec22df38 (diff) | |
download | opt-f281b56edb3b230d578eeb27dcda3813c259920e.tar.gz opt-f281b56edb3b230d578eeb27dcda3813c259920e.tar.xz |
gl-select: initial import, version 1.0; a script which selects the active gl/glx libraries and extensions for x11
Diffstat (limited to 'gl-select')
-rw-r--r-- | gl-select/.footprint | 3 | ||||
-rw-r--r-- | gl-select/.md5sum | 1 | ||||
-rw-r--r-- | gl-select/Pkgfile | 11 | ||||
-rwxr-xr-x | gl-select/gl-select | 105 |
4 files changed, 120 insertions, 0 deletions
diff --git a/gl-select/.footprint b/gl-select/.footprint new file mode 100644 index 000000000..91156d69c --- /dev/null +++ b/gl-select/.footprint @@ -0,0 +1,3 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/gl-select diff --git a/gl-select/.md5sum b/gl-select/.md5sum new file mode 100644 index 000000000..507017382 --- /dev/null +++ b/gl-select/.md5sum @@ -0,0 +1 @@ +b83334a550c8aa19dca7693dae087e18 gl-select diff --git a/gl-select/Pkgfile b/gl-select/Pkgfile new file mode 100644 index 000000000..eaf7b0dca --- /dev/null +++ b/gl-select/Pkgfile @@ -0,0 +1,11 @@ +# Description: A selector for gl/glx libraries and extensions +# Maintainer: Matt Housh, jaeger at morpheus dot net + +name=gl-select +version=1.0 +release=1 +source=($name) + +build() { + install -D -m 0755 -o root -g root $SRC/$name $PKG/usr/bin/$name +} diff --git a/gl-select/gl-select b/gl-select/gl-select new file mode 100755 index 000000000..74ceee751 --- /dev/null +++ b/gl-select/gl-select @@ -0,0 +1,105 @@ +#!/bin/bash +# +# gl-select: select active gl/glx libraries/extensions +# +# Matt Housh <jaeger@morpheus.net> +# + +usage() { + echo "Usage: $0 [x11|nvidia]" + exit +} + +# if other than a single argument is passed, spit out some help +if [ $# -ne 1 ] +then + usage + exit 1 +fi + +# check for the x11 port; if it's not installed, why is this script even run? +if [ -z "`pkginfo -i | awk '{ print $1 }' | grep ^x11$`" ] +then + echo "x11 isn't installed!" + exit 1 +fi + +# perform the selection for the following supported gl/glx setups +case "$1" in + "x11") + echo "* x11 gl/glx selected" + + # check for the existence of libglx_so, libGL_so_1_2 and friends + # if none, nothing is necessary or the backups have been erased + BACKUPS="/usr/X11R6/lib/modules/extensions/libglx_so \ + /usr/X11R6/lib/modules/extensions/libGLcore_so \ + /usr/X11R6/lib/libGL_so_1_2 \ + /usr/X11R6/lib/libGL_a" + for F in $BACKUPS + do + if [ ! -e $F ] + then + echo "One or more of the non-x11 gl/glx backup files are missing. This means" + echo "either you're not using a non-x11 gl/glx setup, in which case nothing" + echo "needs to be changed, OR your x11 backups are missing, which can be" + echo "solved by reinstalling the x11 package from the CRUX CD or ports." + exit 1 + fi + done + # move the x11 backups back into place + echo -n "libglx " + rm -f /usr/X11R6/lib/modules/extensions/libglx.so + mv /usr/X11R6/lib/modules/extensions/libglx{_so,.so} + echo -n "libGLcore " + rm -f /usr/X11R6/lib/modules/extensions/libGLcore.so + mv /usr/X11R6/lib/modules/extensions/libGLcore{_so,.so} + echo -n "libGL " + mv /usr/X11R6/lib/libGL{_so_1_2,.so.1.2} + mv /usr/X11R6/lib/libGL{_a,.a} + ;; + "nvidia") + echo "* nvidia gl/glx selected" + + # is the nvidia port installed? + if [ -z "`pkginfo -i | awk '{ print $1 }' | grep ^nvidia$`" ] + then + echo "nvidia port isn't installed!" + exit 1 + fi + + # get the .so version number + NV_VER="`pkginfo -i | grep "^nvidia " | awk '{ print $2 }' | cut -d- -f2`" + + # check for the existence of libglx_so and libGL_so_1_2 + # if none, move the x11 stuff out of the way for nvidia's + if [ ! -e /usr/X11R6/lib/modules/extensions/libglx_so -a ! -e \ + /usr/X11R6/lib/libGL_so_1_2 ] + then + echo -n "libglx " + mv /usr/X11R6/lib/modules/extensions/libglx{.so,_so} + ln -s libglx.so.1.0.$NV_VER \ + /usr/X11R6/lib/modules/extensions/libglx.so + echo -n "libGLcore " + mv /usr/X11R6/lib/modules/extensions/libGLcore{.so,_so} + ln -s /usr/lib/libGLcore.so.1.0.$NV_VER \ + /usr/X11R6/lib/modules/extensions/libGLcore.so + echo -n "libGL " + mv /usr/X11R6/lib/libGL{.so.1.2,_so_1_2} + mv /usr/X11R6/lib/libGL{.a,_a} + rm /usr/X11R6/lib/libGL.so* + else + echo "You appear to already be using a non-x11 gl/glx setup. If the" + echo "one selected isn't the correct one, revert to x11 and then select" + echo "the correct new setup using 'gl-select x11; gl-select <new gl/glx>'." + exit 1 + fi + ;; + *) + usage + ;; +esac + +/sbin/ldconfig > /dev/null 2>&1 +echo "done." + +# End of file |