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