treewide: replace /bin/ksh93 hashbangs with /bin/sh
[unleashed-userland.git] / components / x11 / ogl-select / files / mesa_vendor_select
blobb04fe96cac5e602b54ad09817873a0ae706b70bc
1 #!/bin/sh
3 # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
14 # Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 # DEALINGS IN THE SOFTWARE.
26 LINKDIR=/var/run/opengl
28 PATH=/usr/bin:/usr/sbin
30 ARCH="$(uname -p)"
32 case "${ARCH}" in
33 sparc) DIR64="sparcv9" ;;
34 i386) DIR64="amd64" ;;
35 *) exit 1 ;; # Unknown architecture
36 esac
38 if [[ $# -eq 1 ]]; then
39 # If this is just a probe, identify ourself and leave.
40 if [[ $1 == "identify" ]]; then
41 if [[ "${ARCH}" == "i386" ]] ; then
42 print "SUNWtext mesa"
44 # Already is the default fallback for all platforms
45 return 0
47 # Build links under an alternate root if root=/path is passed
48 if [[ "$1" =~ root=.* ]] ; then
49 LINKDIR="${1#root=}${LINKDIR}"
53 # Make a directory. $1 is the pathname.
54 function make_dir {
55 if [[ $# != 1 ]]; then
56 return
58 if [[ ! -d $1 ]]; then
59 mkdir -p $1
60 fi
61 chmod 755 $1
64 # Make a file link. $1 is the source path, $2 is the target path
65 function make_link {
66 if [[ $# != 2 ]]; then
67 return
69 if [[ -h $2 ]]; then
70 rm -f $2
72 ln -sf $1 $2
75 # Create directories
76 make_dir ${LINKDIR}
77 make_dir ${LINKDIR}/lib
78 make_dir ${LINKDIR}/lib/${DIR64}
79 make_link ${DIR64} ${LINKDIR}/lib/64
80 make_dir ${LINKDIR}/include
81 make_dir ${LINKDIR}/server
83 if [[ -d /usr/lib/mesa/modules/extensions/${DIR64} ]] ; then
84 make_dir ${LINKDIR}/server/${DIR64}
87 # User libraries
88 make_link ../../../../usr/lib/mesa/libGL.so.1 ${LINKDIR}/lib/libGL.so.1
89 make_link ../../../../../usr/lib/mesa/${DIR64}/libGL.so.1 \
90 ${LINKDIR}/lib/${DIR64}/libGL.so.1
92 make_link ../../../../usr/lib/mesa/libEGL.so.1 ${LINKDIR}/lib/libEGL.so.1
93 make_link ../../../../../usr/lib/mesa/${DIR64}/libEGL.so.1 \
94 ${LINKDIR}/lib/${DIR64}/libEGL.so.1
96 # Server modules
97 make_link ../../../../usr/lib/mesa/modules/extensions/libglx.so \
98 ${LINKDIR}/server/libglx.so
99 if [[ -d /usr/lib/mesa/modules/extensions/${DIR64} ]] ; then
100 make_link \
101 ../../../../../usr/lib/mesa/modules/extensions/${DIR64}/libglx.so \
102 ${LINKDIR}/server/${DIR64}/libglx.so
105 # Includes
106 make_link ../../../../usr/include/mesa/gl.h ${LINKDIR}/include/gl.h
107 make_link ../../../../usr/include/mesa/glext.h ${LINKDIR}/include/glext.h
108 make_link ../../../../usr/include/mesa/glx.h ${LINKDIR}/include/glx.h
109 make_link ../../../../usr/include/mesa/glxext.h ${LINKDIR}/include/glxext.h
111 return 0