40N/A#!/bin/ksh93
40N/A#
40N/A# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
40N/A#
943N/A# Permission is hereby granted, free of charge, to any person obtaining a
40N/A# copy of this software and associated documentation files (the "Software"),
40N/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.
919N/A#
919N/A#
40N/A
40N/ALINKDIR=/system/volatile/opengl
40N/A
70N/APATH=/usr/bin:/usr/sbin
493N/A
40N/AARCH="$(uname -p)"
40N/A
999N/Acase "${ARCH}" in
40N/A sparc) DIR64="sparcv9" ;;
911N/A i386) DIR64="amd64" ;;
999N/A *) exit 1 ;; # Unknown architecture
999N/Aesac
911N/A
40N/Aif [[ $# -eq 1 ]]; then
40N/A # If this is just a probe, identify ourself and leave.
40N/A if [[ $1 == "identify" ]]; then
40N/A if [[ "${ARCH}" == "i386" ]] ; then
40N/A print "SUNWtext mesa"
40N/A fi
40N/A # Already is the default fallback for all platforms
40N/A return 0
493N/A fi
947N/A # Build links under an alternate root if root=/path is passed
947N/A if [[ "$1" =~ root=.* ]] ; then
969N/A LINKDIR="${1#root=}${LINKDIR}"
40N/A fi
40N/Afi
493N/A
40N/A# Make a directory. $1 is the pathname.
920N/Afunction make_dir {
920N/A if [[ $# != 1 ]]; then
40N/A return
70N/A fi
70N/A if [[ ! -d $1 ]]; then
40N/A mkdir -p $1
970N/A fi
970N/A chmod 755 $1
970N/A}
70N/A
# Make a file link. $1 is the source path, $2 is the target path
function make_link {
if [[ $# != 2 ]]; then
return
fi
if [[ -h $2 ]]; then
rm -f $2
fi
ln -sf $1 $2
}
# Create directories
make_dir ${LINKDIR}
make_dir ${LINKDIR}/lib
make_dir ${LINKDIR}/lib/${DIR64}
make_link ${DIR64} ${LINKDIR}/lib/64
make_dir ${LINKDIR}/include
make_dir ${LINKDIR}/server
if [[ -d /usr/lib/mesa/modules/extensions/${DIR64} ]] ; then
make_dir ${LINKDIR}/server/${DIR64}
fi
# User libraries
make_link ../../../../usr/lib/mesa/libGL.so.1 ${LINKDIR}/lib/libGL.so.1
make_link ../../../../../usr/lib/mesa/${DIR64}/libGL.so.1 \
${LINKDIR}/lib/${DIR64}/libGL.so.1
# Server modules
make_link ../../../../usr/lib/mesa/modules/extensions/libglx.so \
${LINKDIR}/server/libglx.so
if [[ -d /usr/lib/mesa/modules/extensions/${DIR64} ]] ; then
make_link \
../../../../../usr/lib/mesa/modules/extensions/${DIR64}/libglx.so \
${LINKDIR}/server/${DIR64}/libglx.so
fi
# Includes
make_link ../../../../usr/include/mesa/gl.h ${LINKDIR}/include/gl.h
make_link ../../../../usr/include/mesa/glext.h ${LINKDIR}/include/glext.h
make_link ../../../../usr/include/mesa/glx.h ${LINKDIR}/include/glx.h
make_link ../../../../usr/include/mesa/glxext.h ${LINKDIR}/include/glxext.h
return 0