mesa_vendor_select revision 970
98N/A#!/bin/ksh93
98N/A#
967N/A# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
98N/A#
98N/A# Permission is hereby granted, free of charge, to any person obtaining a
919N/A# copy of this software and associated documentation files (the "Software"),
919N/A# to deal in the Software without restriction, including without limitation
919N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A# and/or sell copies of the Software, and to permit persons to whom the
919N/A# Software is furnished to do so, subject to the following conditions:
919N/A#
919N/A# The above copyright notice and this permission notice (including the next
919N/A# paragraph) shall be included in all copies or substantial portions of the
919N/A# Software.
919N/A#
919N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A# DEALINGS IN THE SOFTWARE.
98N/A#
98N/A#
98N/A
98N/ALINKDIR=/var/run/opengl
156N/A
98N/APATH=/usr/bin:/usr/sbin
98N/A
98N/AARCH="$(uname -p)"
691N/A
98N/Acase "${ARCH}" in
98N/A sparc) DIR64="sparcv9" ;;
156N/A i386) DIR64="amd64" ;;
98N/A *) exit 1 ;; # Unknown architecture
98N/Aesac
156N/A
98N/Aif [[ $# -eq 1 ]]; then
851N/A # If this is just a probe, identify ourself and leave.
159N/A if [[ $1 == "identify" ]]; then
764N/A if [[ "${ARCH}" == "i386" ]] ; then
98N/A print "SUNWtext mesa"
98N/A fi
98N/A # Already is the default fallback for all platforms
98N/A return 0
98N/A fi
98N/A # Build links under an alternate root if root=/path is passed
98N/A if [[ "$1" =~ root=.* ]] ; then
98N/A LINKDIR="${1#root=}${LINKDIR}"
199N/A fi
606N/Afi
98N/A
98N/A# Make a directory. $1 is the pathname.
98N/Afunction make_dir {
606N/A if [[ $# != 1 ]]; then
257N/A return
98N/A fi
606N/A if [[ ! -d $1 ]]; then
98N/A mkdir -p $1
98N/A fi
98N/A chmod 755 $1
98N/A}
98N/A
98N/A# Make a file link. $1 is the source path, $2 is the target path
98N/Afunction make_link {
98N/A if [[ $# != 2 ]]; then
98N/A return
98N/A fi
606N/A if [[ -h $2 ]]; then
606N/A rm -f $2
606N/A fi
606N/A ln -sf $1 $2
705N/A}
851N/A
705N/A# Create directories
705N/Amake_dir ${LINKDIR}
705N/Amake_dir ${LINKDIR}/lib
851N/Amake_dir ${LINKDIR}/lib/${DIR64}
851N/Amake_link ${DIR64} ${LINKDIR}/lib/64
851N/Amake_dir ${LINKDIR}/include
705N/Amake_dir ${LINKDIR}/server
705N/A
705N/Aif [[ -d /usr/lib/mesa/modules/extensions/${DIR64} ]] ; then
851N/A make_dir ${LINKDIR}/server/${DIR64}
705N/Afi
851N/A
705N/A# User libraries
705N/Amake_link ../../../../usr/lib/mesa/libGL.so.1 ${LINKDIR}/lib/libGL.so.1
705N/Amake_link ../../../../../usr/lib/mesa/${DIR64}/libGL.so.1 \
606N/A ${LINKDIR}/lib/${DIR64}/libGL.so.1
606N/A
606N/A# Server modules
98N/Amake_link ../../../../usr/lib/mesa/modules/extensions/libglx.so \
606N/A ${LINKDIR}/server/libglx.so
98N/Aif [[ -d /usr/lib/mesa/modules/extensions/${DIR64} ]] ; then
493N/A make_link \
967N/A ../../../../../usr/lib/mesa/modules/extensions/${DIR64}/libglx.so \
98N/A ${LINKDIR}/server/${DIR64}/libglx.so
493N/Afi
493N/A
967N/A# Includes
810N/Amake_link ../../../../usr/include/mesa/gl.h ${LINKDIR}/include/gl.h
810N/Amake_link ../../../../usr/include/mesa/glext.h ${LINKDIR}/include/glext.h
810N/Amake_link ../../../../usr/include/mesa/glx.h ${LINKDIR}/include/glx.h
810N/Amake_link ../../../../usr/include/mesa/glxext.h ${LINKDIR}/include/glxext.h
return 0