1 #!/bin/ksh |
1 #!/bin/ksh93 |
2 # |
2 # |
3 # Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
3 # Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
|
4 # Use is subject to license terms. |
4 # |
5 # |
5 # Permission is hereby granted, free of charge, to any person obtaining a |
6 # Permission is hereby granted, free of charge, to any person obtaining a |
6 # copy of this software and associated documentation files (the |
7 # copy of this software and associated documentation files (the |
7 # "Software"), to deal in the Software without restriction, including |
8 # "Software"), to deal in the Software without restriction, including |
8 # without limitation the rights to use, copy, modify, merge, publish, |
9 # without limitation the rights to use, copy, modify, merge, publish, |
25 # Except as contained in this notice, the name of a copyright holder |
26 # Except as contained in this notice, the name of a copyright holder |
26 # shall not be used in advertising or otherwise to promote the sale, use |
27 # shall not be used in advertising or otherwise to promote the sale, use |
27 # or other dealings in this Software without prior written authorization |
28 # or other dealings in this Software without prior written authorization |
28 # of the copyright holder. |
29 # of the copyright holder. |
29 # |
30 # |
30 # ident "@(#)mesa_vendor_select 1.2 07/09/04 SMI" |
31 # ident "@(#)mesa_vendor_select 1.3 09/12/05 SMI" |
31 # |
32 # |
32 |
33 |
33 LINKDIR=/var/run/opengl |
34 LINKDIR=/var/run/opengl |
34 |
35 |
35 PATH=/usr/bin:/usr/sbin:/usr/openwin/bin:/usr/X11/bin |
36 PATH=/usr/bin:/usr/sbin |
36 |
37 |
37 # |
38 ARCH="$(uname -p)" |
38 # No support for SPARC, yet |
|
39 # |
|
40 if [ `uname -p` = "sparc" ]; then |
|
41 return 0 |
|
42 fi |
|
43 |
39 |
44 MYIDENTITY="SUNWtext mesa" |
40 case "${ARCH}" in |
|
41 sparc) DIR64="sparcv9" ;; |
|
42 i386) DIR64="amd64" ;; |
|
43 *) exit 1 ;; # Unknown architecture |
|
44 esac |
45 |
45 |
46 # If this is just a probe, identify ourself and leave. |
46 # If this is just a probe, identify ourself and leave. |
47 if [ $# -eq 1 ]; then |
47 if [[ $# -eq 1 ]]; then |
48 if [ $1 = "identify" ]; then |
48 if [[ $1 = "identify" ]]; then |
49 echo $MYIDENTITY |
49 if [[ "${ARCH}" == "i386" ]] ; then |
|
50 print "SUNWtext mesa" |
|
51 fi |
|
52 # Already is the default fallback for all platforms |
50 return 0 |
53 return 0 |
51 fi |
54 fi |
52 fi |
55 fi |
53 |
56 |
54 # Make a directory link. $1 is the pathname. |
57 # Make a directory. $1 is the pathname. |
55 make_dir_link() { |
58 function make_dir { |
56 if [ $# != 1 ]; then |
59 if [[ $# != 1 ]]; then |
57 return |
60 return |
58 fi |
61 fi |
59 if [ ! -d $1 ]; then |
62 if [[ ! -d $1 ]]; then |
60 mkdir -p $1 |
63 mkdir -p $1 |
61 fi |
64 fi |
62 chmod 755 $1 |
65 chmod 755 $1 |
63 } |
66 } |
64 |
67 |
65 dir_init() { |
|
66 make_dir_link $LINKDIR |
|
67 make_dir_link $LINKDIR/lib |
|
68 make_dir_link $LINKDIR/lib/amd64 |
|
69 make_dir_link $LINKDIR/include |
|
70 make_dir_link $LINKDIR/server |
|
71 make_dir_link $LINKDIR/server/amd64 |
|
72 } |
|
73 |
|
74 # Make a file link. $1 is the source path, $2 is the target path |
68 # Make a file link. $1 is the source path, $2 is the target path |
75 make_file_link() { |
69 function make_link { |
76 if [ $# != 2 ]; then |
70 if [[ $# != 2 ]]; then |
77 return |
71 return |
78 fi |
72 fi |
79 if [ -h $2 ]; then |
73 if [[ -h $2 ]]; then |
80 rm -f $2 |
74 rm -f $2 |
81 fi |
75 fi |
82 ln -sf $1 $2 |
76 ln -sf $1 $2 |
83 } |
77 } |
84 |
78 |
85 dir_init |
79 # Create directories |
|
80 make_dir ${LINKDIR} |
|
81 make_dir ${LINKDIR}/lib |
|
82 make_dir ${LINKDIR}/lib/${DIR64} |
|
83 make_link ${DIR64} ${LINKDIR}/lib/64 |
|
84 make_dir ${LINKDIR}/include |
|
85 make_dir ${LINKDIR}/server |
|
86 |
|
87 if [[ -d /usr/lib/xorg/modules/extensions/mesa/${DIR64} ]] ; then |
|
88 make_dir ${LINKDIR}/server/${DIR64} |
|
89 make_link ${DIR64} ${LINKDIR}/server/64 |
|
90 fi |
86 |
91 |
87 # User libraries |
92 # User libraries |
88 make_file_link /usr/X11/lib/mesa/libGL.so.1 $LINKDIR/lib/libGL.so.1 |
93 make_link /usr/lib/mesa/libGL.so.1 ${LINKDIR}/lib/libGL.so.1 |
89 make_file_link /usr/X11/lib/mesa/amd64/libGL.so.1 $LINKDIR/lib/amd64/libGL.so.1 |
94 make_link /usr/lib/mesa/${DIR64}/libGL.so.1 ${LINKDIR}/lib/${DIR64}/libGL.so.1 |
90 |
95 |
91 # Server libraries |
96 # Server libraries |
92 make_file_link /usr/X11/lib/modules/extensions/mesa/libglx.so $LINKDIR/server/libglx.so |
97 make_link /usr/lib/xorg/modules/extensions/mesa/libglx.so ${LINKDIR}/server/libglx.so |
93 make_file_link /usr/X11/lib/modules/extensions/mesa/amd64/libglx.so $LINKDIR/server/amd64/libglx.so |
98 if [[ -d /usr/lib/xorg/modules/extensions/mesa/${DIR64} ]] ; then |
|
99 make_link /usr/lib/xorg/modules/extensions/mesa/${DIR64}/libglx.so ${LINKDIR}/server/${DIR64}/libglx.so |
|
100 fi |
94 |
101 |
95 # Includes |
102 # Includes |
96 make_file_link /usr/X11/include/mesa/gl.h $LINKDIR/include/gl.h |
103 make_link /usr/include/mesa/gl.h ${LINKDIR}/include/gl.h |
97 make_file_link /usr/X11/include/mesa/glext.h $LINKDIR/include/glext.h |
104 make_link /usr/include/mesa/glext.h ${LINKDIR}/include/glext.h |
98 make_file_link /usr/X11/include/mesa/glx.h $LINKDIR/include/glx.h |
105 make_link /usr/include/mesa/glx.h ${LINKDIR}/include/glx.h |
99 make_file_link /usr/X11/include/mesa/glxext.h $LINKDIR/include/glxext.h |
106 make_link /usr/include/mesa/glxext.h ${LINKDIR}/include/glxext.h |
100 |
107 |
101 return 0 |
108 return 0 |