1 |
Author: scarabeus |
2 |
Date: 2009-10-31 20:14:57 +0000 (Sat, 31 Oct 2009) |
3 |
New Revision: 696 |
4 |
|
5 |
Modified: |
6 |
trunk/extern/modules/opengl.eselect |
7 |
Log: |
8 |
Update eselect-opengl to version 1.0.9 |
9 |
Changes: |
10 |
* support for prefix on mac by default |
11 |
* separated functions for better readability |
12 |
* removed duplicated code |
13 |
* .la files are no longer being shipped. |
14 |
|
15 |
|
16 |
Modified: trunk/extern/modules/opengl.eselect |
17 |
=================================================================== |
18 |
--- trunk/extern/modules/opengl.eselect 2009-10-23 16:41:34 UTC (rev 695) |
19 |
+++ trunk/extern/modules/opengl.eselect 2009-10-31 20:14:57 UTC (rev 696) |
20 |
@@ -3,6 +3,7 @@ |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
# $Id$ |
23 |
# Author: Martin Schlemmer <azarah@g.o> |
24 |
+# Further modifications by Tomáš Chvátal <scarabeus@g.o> |
25 |
# Further modifications by Donnie Berkholz <dberkholz@g.o> |
26 |
# Further modifications based off submissions to bug #54984 <cyfred@g.o> |
27 |
# Further modifications by Jeremy Huddleston <eradicator@g.o> |
28 |
@@ -12,10 +13,10 @@ |
29 |
|
30 |
# Eselect data |
31 |
DESCRIPTION="Manage the OpenGL implementation used by your system" |
32 |
-MAINTAINER="x11-drivers@g.o" |
33 |
+MAINTAINER="x11@g.o" |
34 |
SVN_DATE='$Date$' |
35 |
VERSION=$(svn_date_to_version "${SVN_DATE}" ) |
36 |
-EBUILD_VERSION="1.0.8" |
37 |
+EBUILD_VERSION="1.0.9" |
38 |
|
39 |
# Our data |
40 |
ENV_FILE="${ROOT}/etc/env.d/03opengl" |
41 |
@@ -23,17 +24,22 @@ |
42 |
DST_PREFIX="${ROOT}/usr" |
43 |
USE_PROFILE_HEADERS="no" |
44 |
|
45 |
+# 1: source |
46 |
+# 2: target dir |
47 |
relpath() { |
48 |
- local src=$2 |
49 |
- local dst=$1 |
50 |
- local curpath="." |
51 |
- |
52 |
- while [ "${dst#${src}}" == "${dst}" ]; do |
53 |
- curpath=${curpath}/.. |
54 |
- src=$(readlink -f ${src}/${curpath}) |
55 |
+ local ret |
56 |
+ local src=$1 |
57 |
+ local dst=$2 |
58 |
+ local curpathfinal="." |
59 |
+ |
60 |
+ while [ "${src#${dst}}" == "${src}" ]; do |
61 |
+ curpathfinal=${curpathfinal}/.. |
62 |
+ curpath="./.." |
63 |
+ dst=$(readlink -f ${dst}/${curpath}) |
64 |
done |
65 |
+ ret="${curpathfinal}${src#${dst}}" |
66 |
|
67 |
- echo ${curpath}${dst#${src}} |
68 |
+ echo ${ret} |
69 |
} |
70 |
|
71 |
get_current_implementation() { |
72 |
@@ -66,36 +72,92 @@ |
73 |
echo ${ret} |
74 |
} |
75 |
|
76 |
+# 1: file |
77 |
+# 2: workdir |
78 |
+upgrade_file() { |
79 |
+ local file=$1 |
80 |
+ local workdir=$2 |
81 |
+ linkfile=$(relpath ${file} ${workdir}) |
82 |
+ |
83 |
+ [[ -f ${linkfile} ]] || continue |
84 |
+ if [[ -f $(basename "${file}") || ( -L $(basename "${file}") && ! -e $(basename "${file}") ) ]] ; then |
85 |
+ rm -f "$(basename "${file}")" || die -q "Failed to delete ${workdir}/$(basename ${file})" |
86 |
+ fi |
87 |
+ |
88 |
+ ln -s "${linkfile}" || die -q "Failed to create symlink ${workdir}/$(basename ${file})" |
89 |
+} |
90 |
+ |
91 |
setup_lib_symlinks() { |
92 |
local profile_libdir=${1} |
93 |
- local libdir=${2} |
94 |
+ local target=${2} |
95 |
local file |
96 |
local linkfile |
97 |
|
98 |
- mkdir -p "${libdir}" || die "Failed to create ${libdir}" |
99 |
+ mkdir -p "${target}" || die "Failed to create ${target}" |
100 |
|
101 |
- pushd "${libdir}" &> /dev/null |
102 |
- # First remove old symlinks |
103 |
- for file in libGL{,core}.{a,so,la} ; do |
104 |
+ pushd "${target}" &> /dev/null |
105 |
+ # Note that lafiles are removed here and never enabled again |
106 |
+ for file in libGL{,core}.{la} ; do |
107 |
rm -f "${file}" || die -q "Failed to delete ${file}" |
108 |
done |
109 |
|
110 |
# Note that we don't do .so*, just .so on purpose. The |
111 |
# loader knows to look in the profile dir, and the |
112 |
# linked just needs the .so |
113 |
- for file in ${profile_libdir}/libGL{,core}.{so,a,la}; do |
114 |
- linkfile=$(relpath ${file} ${libdir}) |
115 |
+ for file in ${profile_libdir}/libGL{,core}.{so,dylib,a}; do |
116 |
+ $(upgrade_file ${file} ${target}) |
117 |
+ done |
118 |
+ popd &> /dev/null |
119 |
+} |
120 |
|
121 |
- [[ -f ${file} ]] || continue |
122 |
- if [[ -f $(basename "${file}") ]] ; then |
123 |
- rm -f "$(basename "${file}")" || die -q "Failed to delete ${libdir}/$(basename "${file}")" |
124 |
+setup_extensions_symlinks() { |
125 |
+ local src=$1 |
126 |
+ local target=$2 |
127 |
+ if [[ -e ${src} ]] ; then |
128 |
+ mkdir -p "${target}" || die "Failed to create ${target}" |
129 |
+ pushd "${target}" &> /dev/null |
130 |
+ # First remove old cruft symlinks |
131 |
+ for file in lib{wfb,glx,dri,dri2}.{a,dylib,so}; do |
132 |
+ rm -f "${file}" || die -q "Failed to delete ${targetdir}/${file}" |
133 |
+ done |
134 |
+ |
135 |
+ # regenerate symlinks |
136 |
+ for file in ${src}/*.{so,dylib,a}; do |
137 |
+ upgrade_file "${file}" "${target}" |
138 |
+ done |
139 |
+ popd &> /dev/null |
140 |
+ fi |
141 |
+} |
142 |
+ |
143 |
+setup_includes_symlinks() { |
144 |
+ target=$1 |
145 |
+ includes_folder=$2 |
146 |
+ globalincludes_folder=$3 |
147 |
+ x11includes_folder=$4 |
148 |
+ |
149 |
+ mkdir -p "${target}" || die "Failed to create ${DST_PREFIX}/include/GL" |
150 |
+ pushd "${target}" &> /dev/null |
151 |
+ for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do |
152 |
+ # IMPORTANT |
153 |
+ # It is preferable currently to use the standard glext.h file |
154 |
+ # however if an OpenGL provider must use a self produced glext.h |
155 |
+ # then it should be installed to ${gl_implem}/include and the user |
156 |
+ # can add the --impl-headers option to select it. |
157 |
+ |
158 |
+ if [[ "${USE_PROFILE_HEADERS}" == "yes" ]] ; then |
159 |
+ # Check the profile first. |
160 |
+ if [[ -e ${includes_folder}/${file} ]] ; then |
161 |
+ upgrade_file "${includes_folder}/${file}" "${target}" |
162 |
+ continue |
163 |
+ fi |
164 |
fi |
165 |
|
166 |
- # Fix libtool archives (#48297) |
167 |
- if [[ ${file%.la} != ${file} ]] ; then |
168 |
- sed "s:${profile_libdir}:${libdir}:g" "${file}" > "$(basename "${file}")" || die -q "Failed to create ${libdir}/$(basename "${file}")" |
169 |
- else |
170 |
- ln -s "${linkfile}" || die -q "Failed to create ${libdir}/$(basename "${file}")" |
171 |
+ if [[ -e ${globalincludes_folder}/${file} ]] ; then |
172 |
+ upgrade_file "${globalincludes_folder}/${file}" "${target}" |
173 |
+ elif [[ -e ${includes_folder}/${file} ]] ; then |
174 |
+ upgrade_file "${includes_folder}/${file}" "${target}" |
175 |
+ elif [[ -e ${x11includes_folder}/${file} ]] ; then |
176 |
+ upgrade_file "${x11includes_folder}/${file}" "${target}" |
177 |
fi |
178 |
done |
179 |
popd &> /dev/null |
180 |
@@ -109,7 +171,7 @@ |
181 |
umask 022 |
182 |
|
183 |
if ! has ${gl_implem} ${avail_implems}; then |
184 |
- die -q "Invalid profile selected." |
185 |
+ die -q "Invalid opengl implementation selected." |
186 |
fi |
187 |
|
188 |
echo -n "Switching to ${gl_implem} OpenGL interface..." |
189 |
@@ -144,75 +206,10 @@ |
190 |
else |
191 |
moduledir="modules" |
192 |
fi |
193 |
+ setup_extensions_symlinks "${PREFIX}/${libdir}/opengl/${gl_local}/extensions" "${DST_PREFIX}/${libdir}/${moduledir}/extensions" |
194 |
|
195 |
- if [[ -e ${PREFIX}/${libdir}/opengl/${gl_local}/extensions ]] ; then |
196 |
- mkdir -p "${DST_PREFIX}/${libdir}/${moduledir}/extensions" || die "Failed to create ${DST_PREFIX}/${libdir}/${moduledir}/extensions" |
197 |
- pushd "${DST_PREFIX}/${libdir}/${moduledir}/extensions" &> /dev/null |
198 |
- # First remove old symlinks |
199 |
- for file in lib{wfb,glx,dri,dri2}.{a,so,la}; do |
200 |
- rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/${file}" |
201 |
- done |
202 |
+ setup_includes_symlinks "${DST_PREFIX}/include/GL" "${PREFIX}/${libdir}/opengl/${gl_implem}/include/" "${PREFIX}/${libdir}/opengl/global/include/" "${PREFIX}/${libdir}/opengl/xorg-x11/include/" |
203 |
|
204 |
- for file in ${PREFIX}/${libdir}/opengl/${gl_local}/extensions/*.{so,a,la}; do |
205 |
- [[ -f ${file} ]] || continue |
206 |
- if [[ -f $(basename "${file}") ]] ; then |
207 |
- rm -f "$(basename "${file}")" || die -q "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/$(basename "${file}")" |
208 |
- fi |
209 |
- |
210 |
- # Fix libtool archives (#48297) |
211 |
- if [[ ${file%.la} != ${file} ]] ; then |
212 |
- sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${libdir}:g" "${file}" > "$(basename "${file}")" || die -q "Failed to create ${DST_PREFIX}/${libdir}/${moduledir}/extensions/$(basename "${file}")" |
213 |
- else |
214 |
- ln -s "${file}" || die -q "Failed to create ${libdir}/$(basename "${file}")" |
215 |
- fi |
216 |
- done |
217 |
- popd &> /dev/null |
218 |
- fi |
219 |
- |
220 |
- # Setup the includes |
221 |
- mkdir -p "${DST_PREFIX}/include/GL" || die "Failed to create ${DST_PREFIX}/include/GL" |
222 |
- pushd "${DST_PREFIX}/include/GL" &> /dev/null |
223 |
- for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do |
224 |
- # IMPORTANT |
225 |
- # It is preferable currently to use the standard glext.h file |
226 |
- # however if an OpenGL provider must use a self produced glext.h |
227 |
- # then it should be installed to ${gl_implem}/include and the user |
228 |
- # can add the --impl-headers option to select it. |
229 |
- |
230 |
- if [[ "${USE_PROFILE_HEADERS}" == "yes" ]] ; then |
231 |
- # Check the profile first. |
232 |
- if [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then |
233 |
- if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then |
234 |
- rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" |
235 |
- fi |
236 |
- |
237 |
- ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" |
238 |
- continue |
239 |
- fi |
240 |
- fi |
241 |
- |
242 |
- if [[ -e ${PREFIX}/${libdir}/opengl/global/include/${file} ]] ; then |
243 |
- if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then |
244 |
- rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" |
245 |
- fi |
246 |
- |
247 |
- ln -s ${PREFIX}/${libdir}/opengl/global/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" |
248 |
- elif [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then |
249 |
- if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then |
250 |
- rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" |
251 |
- fi |
252 |
- |
253 |
- ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" |
254 |
- elif [[ -e ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} ]] ; then |
255 |
- if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then |
256 |
- rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" |
257 |
- fi |
258 |
- |
259 |
- ln -s ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" |
260 |
- fi |
261 |
- done |
262 |
- popd &> /dev/null |
263 |
- |
264 |
# Setup the $LDPATH |
265 |
ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib" |
266 |
|
267 |
@@ -277,14 +274,6 @@ |
268 |
echo "--prefix=<val> : Set the source prefix (default: /usr)" |
269 |
echo "--dst-prefix=<val> : Set the destination prefix (default: /usr)" |
270 |
echo "--impl-headers : Override global headers with ones provided by this profile" |
271 |
-# write_list_start "Extra options for 'set' action:" |
272 |
-# write_kv_list_entry "<target>" "The profile to activate." |
273 |
-# write_kv_list_entry "--use-old" "If an implementation is already set, use that one." |
274 |
-# write_kv_list_entry "--prefix=<val>" "Set the source prefix (default: /usr)" |
275 |
-# write_kv_list_entry "--dst-prefix=<val>" "Set the destination prefix (default: /usr)" |
276 |
-# write_kv_list_entry "--impl-headers" "Use headers provided by this implementation to" |
277 |
-# write_kv_list_entry "" "override golbal ones provided by opengl-update." |
278 |
-# write_kv_list_entry "" "This was default in <opengl-update-2.2" |
279 |
} |
280 |
|
281 |
do_set() { |