Add PM protocol headers
[xorg-util-modular.git] / symlink-mesa.sh
blob7300301207e549cdd42e97d6aad2461cee0f849d
1 #!/bin/sh
4 # A script that symlinks source files from Mesa to modular
6 # Author: Soren Sandmann (sandmann@redhat.com) (original)
7 # adapted for Mesa by Adam Jackson (ajax@nwnk.net)
10 # Things we would like to do
12 # - Check that all the relevant files exist
13 # - AUTHORS, autogen.sh, configure.ac, ...
14 # - Check that we have actually linked everything
15 # - if a file doesn't need to be linked, then it needs
16 # to be listed as "not-linked"
17 # - Compute diffs between all the files (shouldn't be necessary)
18 # - possibly check that files are listet in Makefile.am's
19 # - Clean target directory of irrelevant files
22 check_destinations () {
23 # don't do anything - we are relying on the side
24 # effect of dst_dir
25 true
28 check_exist() {
29 # Check whether $1 exists
31 if [ ! -e $1 ] ; then
32 error "$1 not found"
36 delete_existing() {
37 # Delete $2
39 rm -f $2
42 link_files() {
43 # Link $1 to $2
45 if [ ! -e $2 ] ; then
46 ln -s $1 $2
50 main() {
51 check_args $1 $2
53 run check_destinations "Creating destination directories"
54 run check_exist "Checking that the source files exist"
55 run delete_existing "Deleting existing files"
56 run link_files "Linking files"
59 ## actual symlinking
61 symlink_mesa_glapi() {
62 src_dir src/mesa/glapi
63 dst_dir xserver/xorg/GL/mesa/glapi
65 action glapi.h
66 action glapioffsets.h
67 action glapitable.h
68 action glapitemp.h
69 action glprocs.h
70 action glthread.h
73 symlink_mesa_main() {
74 src_dir src/mesa/main
75 dst_dir xserver/xorg/GL/mesa/main
77 action accum.c
78 action accum.h
79 action api_arrayelt.c
80 action api_arrayelt.h
81 action api_eval.h
82 action api_loopback.c
83 action api_loopback.h
84 action api_noop.c
85 action api_noop.h
86 action api_validate.c
87 action api_validate.h
88 action attrib.c
89 action attrib.h
90 action blend.c
91 action blend.h
92 action bufferobj.c
93 action bufferobj.h
94 action buffers.c
95 action buffers.h
96 action clip.c
97 action clip.h
98 action colormac.h
99 action colortab.c
100 action colortab.h
101 action config.h
102 action context.c
103 action context.h
104 action convolve.c
105 action convolve.h
106 action dd.h
107 action debug.c
108 action debug.h
109 action depth.c
110 action depth.h
111 action dispatch.c
112 action dlist.c
113 action dlist.h
114 action drawpix.c
115 action drawpix.h
116 action enable.c
117 action enable.h
118 action enums.c
119 action enums.h
120 action eval.c
121 action eval.h
122 action extensions.c
123 action extensions.h
124 action fbobject.c
125 action fbobject.h
126 action feedback.c
127 action feedback.h
128 action fog.c
129 action fog.h
130 action framebuffer.c
131 action framebuffer.h
132 action get.c
133 action get.h
134 action getstring.c
135 action glheader.h
136 action hash.c
137 action hash.h
138 action hint.c
139 action hint.h
140 action histogram.c
141 action histogram.h
142 action image.c
143 action image.h
144 action imports.c
145 action imports.h
146 action light.c
147 action light.h
148 action lines.c
149 action lines.h
150 action macros.h
151 action matrix.c
152 action matrix.h
153 action mtypes.h
154 action occlude.c
155 action occlude.h
156 action pixel.c
157 action pixel.h
158 action points.c
159 action points.h
160 action polygon.c
161 action polygon.h
162 action rastpos.c
163 action rastpos.h
164 action renderbuffer.c
165 action renderbuffer.h
166 action simple_list.h
167 action state.c
168 action state.h
169 action stencil.c
170 action stencil.h
171 action texcompress.c
172 action texcompress.h
173 action texcompress_fxt1.c
174 action texcompress_s3tc.c
175 action texenvprogram.c
176 action texenvprogram.h
177 action texformat.c
178 action texformat.h
179 action texformat_tmp.h
180 action teximage.c
181 action teximage.h
182 action texobj.c
183 action texobj.h
184 action texrender.c
185 action texrender.h
186 action texstate.c
187 action texstate.h
188 action texstore.c
189 action texstore.h
190 action varray.c
191 action varray.h
192 action version.h
193 action vsnprintf.c
194 action vtxfmt.c
195 action vtxfmt.h
196 action vtxfmt_tmp.h
199 symlink_mesa_math() {
200 src_dir src/mesa/math
201 dst_dir xserver/xorg/GL/mesa/math
203 action m_clip_tmp.h
204 action m_copy_tmp.h
205 action m_debug.h
206 action m_debug_clip.c
207 action m_debug_norm.c
208 action m_debug_util.h
209 action m_debug_xform.c
210 action m_dotprod_tmp.h
211 action m_eval.c
212 action m_eval.h
213 action m_matrix.c
214 action m_matrix.h
215 action m_norm_tmp.h
216 action m_trans_tmp.h
217 action m_translate.c
218 action m_translate.h
219 action m_vector.c
220 action m_vector.h
221 action m_xform.c
222 action m_xform.h
223 action m_xform_tmp.h
224 action mathmod.h
227 symlink_mesa_ac() {
228 src_dir src/mesa/array_cache
229 dst_dir xserver/xorg/GL/mesa/array_cache
231 action ac_context.c
232 action ac_context.h
233 action ac_import.c
234 action acache.h
237 symlink_mesa_swrast() {
238 src_dir src/mesa/swrast
239 dst_dir xserver/xorg/GL/mesa/swrast
241 action s_aaline.c
242 action s_aaline.h
243 action s_aalinetemp.h
244 action s_aatriangle.c
245 action s_aatriangle.h
246 action s_aatritemp.h
247 action s_accum.c
248 action s_accum.h
249 action s_alpha.c
250 action s_alpha.h
251 action s_atifragshader.c
252 action s_atifragshader.h
253 action s_bitmap.c
254 action s_blend.c
255 action s_blend.h
256 action s_buffers.c
257 action s_context.c
258 action s_context.h
259 action s_copypix.c
260 action s_depth.c
261 action s_depth.h
262 action s_drawpix.c
263 action s_drawpix.h
264 action s_feedback.c
265 action s_feedback.h
266 action s_fog.c
267 action s_fog.h
268 action s_fragprog_to_c.c
269 action s_imaging.c
270 action s_lines.c
271 action s_lines.h
272 action s_linetemp.h
273 action s_logic.c
274 action s_logic.h
275 action s_masking.c
276 action s_masking.h
277 action s_nvfragprog.c
278 action s_nvfragprog.h
279 action s_pixeltex.c
280 action s_pixeltex.h
281 action s_points.c
282 action s_points.h
283 action s_pointtemp.h
284 action s_readpix.c
285 action s_span.c
286 action s_span.h
287 action s_spantemp.h
288 action s_stencil.c
289 action s_stencil.h
290 action s_tcc.c
291 action s_texstore.c
292 action s_texture.c
293 action s_texture.h
294 action s_triangle.c
295 action s_triangle.h
296 action s_trispan.h
297 action s_tritemp.h
298 action s_zoom.c
299 action s_zoom.h
300 action swrast.h
303 symlink_mesa_ss() {
304 src_dir src/mesa/swrast_setup
305 dst_dir xserver/xorg/GL/mesa/swrast_setup
307 action ss_context.c
308 action ss_context.h
309 action ss_triangle.c
310 action ss_triangle.h
311 action ss_tritmp.h
312 action ss_vb.h
313 action swrast_setup.h
316 symlink_mesa_tnl() {
317 src_dir src/mesa/tnl
318 dst_dir xserver/xorg/GL/mesa/tnl
320 action t_array_api.c
321 action t_array_api.h
322 action t_array_import.c
323 action t_array_import.h
324 action t_context.c
325 action t_context.h
326 action t_pipeline.c
327 action t_pipeline.h
328 action t_save_api.c
329 action t_save_api.h
330 action t_save_loopback.c
331 action t_save_playback.c
332 action t_vb_arbprogram.c
333 action t_vb_arbprogram.h
334 action t_vb_arbprogram_sse.c
335 action t_vb_cliptmp.h
336 action t_vb_cull.c
337 action t_vb_fog.c
338 action t_vb_light.c
339 action t_vb_lighttmp.h
340 action t_vb_normals.c
341 action t_vb_points.c
342 action t_vb_program.c
343 action t_vb_render.c
344 action t_vb_rendertmp.h
345 action t_vb_texgen.c
346 action t_vb_texmat.c
347 action t_vb_vertex.c
348 action t_vertex.c
349 action t_vertex.h
350 action t_vertex_generic.c
351 action t_vertex_sse.c
352 action t_vp_build.c
353 action t_vp_build.h
354 action t_vtx_api.c
355 action t_vtx_api.h
356 action t_vtx_eval.c
357 action t_vtx_exec.c
358 action t_vtx_generic.c
359 action t_vtx_x86.c
360 action tnl.h
363 symlink_mesa_shader() {
364 src_dir src/mesa/shader
365 dst_dir xserver/xorg/GL/mesa/shader
367 action arbfragparse.c
368 action arbfragparse.h
369 action arbprogparse.c
370 action arbprogparse.h
371 action arbprogram.c
372 action arbprogram.h
373 action arbprogram_syn.h
374 action arbvertparse.c
375 action arbvertparse.h
376 action atifragshader.c
377 action atifragshader.h
378 action nvfragparse.c
379 action nvfragparse.h
380 action nvfragprog.h
381 action nvprogram.c
382 action nvprogram.h
383 action nvvertexec.c
384 action nvvertexec.h
385 action nvvertparse.c
386 action nvvertparse.h
387 action nvvertprog.h
388 action program.c
389 action program.h
390 action shaderobjects.c
391 action shaderobjects.h
392 action shaderobjects_3dlabs.c
393 action shaderobjects_3dlabs.h
395 # bit of a hack
396 src_dir src/mesa/shader/grammar
397 action grammar.c
398 action grammar.h
399 action grammar_syn.h
400 action grammar_mesa.c
401 action grammar_mesa.h
403 # more of a hack
404 src_dir src/mesa/shader/slang
405 action slang_compile.h
408 symlink_mesa_x() {
409 src_dir src/mesa/drivers/x11
410 dst_dir xserver/xorg/GL/mesa/X
412 # action glxapi.h
413 action glxheader.h
414 # action realglx.h
415 # action xfonts.h
416 action xm_api.c
417 # action xm_buffer.c ?
418 action xm_dd.c
419 action xm_line.c
420 action xm_span.c
421 action xm_tri.c
422 action xmesaP.h
424 # another hack
425 src_dir src/mesa/drivers/common
426 action driverfuncs.h
429 symlink_mesa_glapi() {
430 src_dir src/mesa/glapi
431 dst_dir xserver/xorg/GL/mesa/glapi
434 symlink_mesa_ppc() {
435 src_dir src/mesa/ppc
436 dst_dir xserver/xorg/GL/mesa/ppc
439 symlink_mesa_sparc() {
440 src_dir src/mesa/sparc
441 dst_dir xserver/xorg/GL/mesa/sparc
444 symlink_mesa_x86() {
445 src_dir src/mesa/x86
446 dst_dir xserver/xorg/GL/mesa/x86
449 symlink_mesa_x8664() {
450 src_dir src/mesa/x86-64
451 dst_dir xserver/xorg/GL/mesa/x86-64
454 symlink_mesa() {
455 symlink_mesa_main
456 symlink_mesa_math
457 symlink_mesa_ac
458 symlink_mesa_swrast
459 symlink_mesa_ss
460 symlink_mesa_tnl
461 symlink_mesa_shader
462 symlink_mesa_x
463 symlink_mesa_glapi
464 symlink_mesa_ppc
465 symlink_mesa_sparc
466 symlink_mesa_x86
467 symlink_mesa_x8664
470 #########
472 # Helper functions
474 #########
476 error() {
477 echo
478 echo \ \ \ error:\ \ \ $1
479 exit
482 # printing out what's going on
483 run_module() {
484 # $1 module
485 # $2 explanation
486 echo -n $EXPLANATION for $1 module ...\
487 symlink_$1
488 echo DONE
491 run() {
492 # $1 what to do
493 # $2 explanation
495 ACTION=$1 EXPLANATION=$2 run_module mesa
498 src_dir() {
499 REAL_SRC_DIR=$SRC_DIR/$1
500 if [ ! -d $REAL_SRC_DIR ] ; then
501 error "Source directory $REAL_SRC_DIR does not exist"
505 dst_dir() {
506 REAL_DST_DIR=$DST_DIR/$1
507 if [ ! -d $REAL_DST_DIR ] ; then
508 mkdir -p $REAL_DST_DIR
512 action() {
513 if [ -z $2 ] ; then
514 $ACTION $REAL_SRC_DIR/$1 $REAL_DST_DIR/$1
515 else
516 $ACTION $REAL_SRC_DIR/$1 $REAL_DST_DIR/$2
520 usage() {
521 echo symlink.sh src-dir dst-dir
522 echo src-dir: the xc directory of the monolithic source tree
523 echo dst-dir: the modular source tree containing proto, app, lib, ...
526 # Check commandline args
527 check_args() {
528 if [ -z $1 ] ; then
529 echo Missing source dir
530 usage
531 exit 1
534 if [ -z $2 ] ; then
535 echo Missing destination dir
536 usage
537 exit 1
540 if [ ! -d $1 ] ; then
541 echo $1 is not a dir
542 usage
543 exit 1
546 if [ ! -d $2 ] ; then
547 echo $2 is not a dir
548 usage
549 exit 1
552 if [ $1 = $2 ] ; then
553 echo source and destination can\'t be the same
554 usage
555 exit 1
558 D=`dirname "$relpath"`
559 B=`basename "$relpath"`
560 abspath="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
562 SRC_DIR=`( cd $1 ; pwd )`
563 DST_DIR=`(cd $2 ; pwd )`
566 main $1 $2