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