Lines 134-139
set_new_implementation() {
Link Here
|
134 |
local gl_implem=${1} |
134 |
local gl_implem=${1} |
135 |
local avail_implems=$(get_implementations) |
135 |
local avail_implems=$(get_implementations) |
136 |
local libdir |
136 |
local libdir |
|
|
137 |
local gl_dir |
137 |
local gl_local |
138 |
local gl_local |
138 |
local moduledir |
139 |
local moduledir |
139 |
|
140 |
|
Lines 145-210
set_new_implementation() {
Link Here
|
145 |
fi |
146 |
fi |
146 |
|
147 |
|
147 |
echo -n "Switching to ${gl_implem} OpenGL interface..." |
148 |
echo -n "Switching to ${gl_implem} OpenGL interface..." |
148 |
if [[ -f ${ENV_FILE} ]] ; then |
149 |
if [[ -f ${ENV_FILE} ]] ; then |
149 |
rm -f "${ENV_FILE}" || die -q "Failed to remove ${ENV_FILE}" |
150 |
rm -f "${ENV_FILE}" || die -q "Failed to remove ${ENV_FILE}" |
150 |
fi |
151 |
fi |
151 |
|
152 |
|
152 |
for libdir in $(list_libdirs); do |
153 |
for libdir in $(list_libdirs); do |
153 |
# Set libdir correctly to EROOT |
154 |
# Set libdir correctly to EROOT |
154 |
[[ ${ROOT} != / ]] && libdir=${libdir//${ROOT}} |
155 |
[[ ${ROOT} != / ]] && libdir=${libdir//${ROOT}} |
155 |
|
156 |
|
156 |
# First make sure we have an opengl directory and this |
157 |
# First make sure we have an opengl directory and this |
157 |
# is a real lib dir, not a symlink |
158 |
# is a real lib dir, not a symlink |
158 |
[[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue |
159 |
[[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue |
159 |
|
160 |
|
160 |
# Set moduledir |
161 |
# Set moduledir |
161 |
# only xorg module is used now can change to case when we add other |
162 |
# only xorg module is used now can change to case when we add other |
162 |
# implementations. |
163 |
# implementations. |
163 |
moduledir="xorg/modules" |
164 |
moduledir="xorg/modules" |
164 |
|
165 |
|
165 |
# Check if opengl implementation directory exists and |
166 |
# Check if opengl implementation directory exists and |
166 |
# use xorg-x11 as fallback (mesa) |
167 |
# use xorg-x11 as fallback (mesa) |
167 |
# If even mesa is not around then simply die |
168 |
# If even mesa is not around then simply die |
168 |
if [[ -d "${PREFIX}/${libdir}/opengl/${gl_implem}" ]] ; then |
169 |
if [[ -d "${PREFIX}/${libdir}/opengl/${gl_implem}" ]] ; then |
169 |
gl_local="${gl_implem}" |
170 |
gl_local="${gl_implem}" |
170 |
else |
171 |
gl_dir="${libdir}" |
171 |
if [[ -d "${PREFIX}/${libdir}/opengl/xorg-x11" ]]; then |
172 |
else |
172 |
gl_local="xorg-x11" |
173 |
if [[ -d "${PREFIX}/${libdir}/opengl/xorg-x11" ]]; then |
173 |
else |
174 |
gl_local="xorg-x11" |
174 |
# bail out, no implementation around |
175 |
gl_dir="${libdir}" |
175 |
die -q "No proper ${gl_implem} or xorg-x11 opengl implementation found" |
|
|
176 |
fi |
177 |
fi |
176 |
fi |
|
|
177 |
fi |
178 |
done |
179 |
|
180 |
if [[ ! -n "${gl_dir}" ]] ; then |
181 |
# bail out, no implementation around |
182 |
die -q "No proper ${gl_implem} or xorg-x11 opengl implementation found" |
183 |
fi |
184 |
|
185 |
setup_lib_symlinks \ |
186 |
"${PREFIX}/${gl_dir}/opengl/${gl_local}/lib" \ |
187 |
"${DST_PREFIX}/${gl_dir}" |
188 |
|
189 |
# check if the implementation has TLS libs around |
190 |
# and install those if around |
191 |
[[ -e ${PREFIX}/${gl_dir}/opengl/${gl_local}/lib/tls ]] && \ |
192 |
setup_lib_symlinks \ |
193 |
"${PREFIX}/${gl_dir}/opengl/${gl_local}/lib/tls" \ |
194 |
"${DST_PREFIX}/${gl_dir}/tls" |
195 |
|
196 |
setup_extensions_symlinks \ |
197 |
"${PREFIX}/${gl_dir}/opengl/${gl_local}/extensions" \ |
198 |
"${DST_PREFIX}/${gl_dir}/${moduledir}/extensions" |
199 |
|
200 |
setup_includes_symlinks \ |
201 |
"${DST_PREFIX}/include/GL" \ |
202 |
"${PREFIX}/${gl_dir}/opengl/${gl_implem}/include/" \ |
203 |
"${PREFIX}/${gl_dir}/opengl/global/include/" \ |
204 |
"${PREFIX}/${gl_dir}/opengl/xorg-x11/include/" |
178 |
|
205 |
|
179 |
setup_lib_symlinks \ |
206 |
# Setup the $LDPATH |
180 |
"${PREFIX}/${libdir}/opengl/${gl_local}/lib" \ |
207 |
ldpath="${ldpath:+${ldpath}:}${PREFIX}/${gl_dir}/opengl/${gl_local}/lib" |
181 |
"${DST_PREFIX}/${libdir}" |
|
|
182 |
|
183 |
# check if the implementation has TLS libs around |
184 |
# and install those if around |
185 |
[[ -e ${PREFIX}/${libdir}/opengl/${gl_local}/lib/tls ]] && \ |
186 |
setup_lib_symlinks \ |
187 |
"${PREFIX}/${libdir}/opengl/${gl_local}/lib/tls" \ |
188 |
"${DST_PREFIX}/${libdir}/tls" |
189 |
|
190 |
setup_extensions_symlinks \ |
191 |
"${PREFIX}/${libdir}/opengl/${gl_local}/extensions" \ |
192 |
"${DST_PREFIX}/${libdir}/${moduledir}/extensions" |
193 |
|
194 |
setup_includes_symlinks \ |
195 |
"${DST_PREFIX}/include/GL" \ |
196 |
"${PREFIX}/${libdir}/opengl/${gl_implem}/include/" \ |
197 |
"${PREFIX}/${libdir}/opengl/global/include/" \ |
198 |
"${PREFIX}/${libdir}/opengl/xorg-x11/include/" |
199 |
|
200 |
# Setup the $LDPATH |
201 |
ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib" |
202 |
done |
203 |
|
208 |
|
204 |
store_config ${ENV_FILE} LDPATH "${ldpath}" |
209 |
store_config ${ENV_FILE} LDPATH "${ldpath}" |
205 |
store_config ${ENV_FILE} OPENGL_PROFILE "${gl_implem}" |
210 |
store_config ${ENV_FILE} OPENGL_PROFILE "${gl_implem}" |
206 |
|
211 |
|
207 |
do_action env update &> /dev/null |
212 |
do_action env update &> /dev/null |
208 |
|
213 |
|
209 |
echo " done" |
214 |
echo " done" |
210 |
} |
215 |
} |