blob: 0b4dd7e381eb4262a9887cd7b93d620d3fc6e609 [file] [log] [blame]
José Fonsecac42e6252008-01-31 13:14:35 +09001#######################################################################
José Fonseca33ceb672008-02-18 10:52:44 +00002# SConscript for Mesa
José Fonsecac42e6252008-01-31 13:14:35 +09003
4
5Import('*')
Brian Paulf83af362011-09-28 08:15:22 -06006import filecmp
7import os
8import subprocess
Brian Pauldff36e92012-05-30 10:08:11 -06009from sys import executable as python_cmd
José Fonsecac42e6252008-01-31 13:14:35 +090010
José Fonseca601498a2010-11-01 13:30:22 +000011env = env.Clone()
José Fonsecab9da3792008-02-19 15:07:53 +090012
José Fonseca601498a2010-11-01 13:30:22 +000013env.Append(CPPPATH = [
14 '#/src/mapi',
15 '#/src/glsl',
16 '#/src/mesa',
17])
José Fonseca2105b612009-01-06 16:20:12 +000018
Imre Deak66781252012-09-12 19:46:05 +030019enabled_apis = []
20enabled_apis += ['GL']
Chia-I Wubb770af2011-01-14 17:50:29 +080021
José Fonseca601498a2010-11-01 13:30:22 +000022if env['platform'] == 'windows':
23 env.Append(CPPDEFINES = [
24 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
25 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
José Fonseca601498a2010-11-01 13:30:22 +000026 ])
Chia-I Wubb770af2011-01-14 17:50:29 +080027 if not env['gles']:
28 # prevent _glapi_* from being declared __declspec(dllimport)
29 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
Chia-I Wubb045d32010-11-20 17:47:11 -080030else:
31 env.Append(CPPDEFINES = [
32 'IN_DRI_DRIVER', # enable the remap table (for DRI drivers)
Tapani Pälli91214602012-08-28 14:01:51 +030033 ('HAVE_DLOPEN', '1'),
Chia-I Wubb045d32010-11-20 17:47:11 -080034 ])
José Fonseca5c9c6b02008-06-04 23:56:57 +090035
José Fonseca601498a2010-11-01 13:30:22 +000036#
37# Source files
38#
Michal Krol3371f7e2009-11-25 14:52:21 +010039
José Fonseca601498a2010-11-01 13:30:22 +000040main_sources = [
41 'main/api_arrayelt.c',
42 'main/api_exec.c',
43 'main/api_loopback.c',
José Fonseca601498a2010-11-01 13:30:22 +000044 'main/api_validate.c',
45 'main/accum.c',
46 'main/arbprogram.c',
47 'main/atifragshader.c',
48 'main/attrib.c',
49 'main/arrayobj.c',
50 'main/blend.c',
51 'main/bufferobj.c',
52 'main/buffers.c',
53 'main/clear.c',
54 'main/clip.c',
55 'main/colortab.c',
56 'main/condrender.c',
57 'main/context.c',
58 'main/convolve.c',
59 'main/cpuinfo.c',
60 'main/debug.c',
61 'main/depth.c',
José Fonseca601498a2010-11-01 13:30:22 +000062 'main/dlist.c',
José Fonseca601498a2010-11-01 13:30:22 +000063 'main/drawpix.c',
64 'main/drawtex.c',
65 'main/enable.c',
66 'main/enums.c',
nobled5ab088c2011-05-01 12:47:31 +000067 'main/errors.c',
Vinson Lee5cbc0f02012-11-06 23:16:29 -080068 'main/es1_conversion.c',
José Fonseca601498a2010-11-01 13:30:22 +000069 'main/eval.c',
70 'main/execmem.c',
71 'main/extensions.c',
72 'main/fbobject.c',
73 'main/feedback.c',
Vinson Leedee6eaf2011-03-11 13:32:41 -080074 'main/ff_fragment_shader.cpp',
José Fonseca601498a2010-11-01 13:30:22 +000075 'main/ffvertex_prog.c',
76 'main/fog.c',
77 'main/formats.c',
Brian Paulaa6cb952011-12-03 10:04:18 -070078 'main/format_pack.c',
Brian Paul730952a2011-09-08 20:16:18 -060079 'main/format_unpack.c',
José Fonseca601498a2010-11-01 13:30:22 +000080 'main/framebuffer.c',
José Fonseca601498a2010-11-01 13:30:22 +000081 'main/getstring.c',
Jordan Justen9ad8f432012-06-25 10:52:39 -070082 'main/glformats.c',
José Fonseca601498a2010-11-01 13:30:22 +000083 'main/hash.c',
Eric Anholt35fd61b2012-11-06 23:18:41 -080084 'main/hash_table.c',
José Fonseca601498a2010-11-01 13:30:22 +000085 'main/hint.c',
86 'main/histogram.c',
87 'main/image.c',
88 'main/imports.c',
89 'main/light.c',
90 'main/lines.c',
91 'main/matrix.c',
92 'main/mipmap.c',
93 'main/mm.c',
94 'main/multisample.c',
José Fonseca601498a2010-11-01 13:30:22 +000095 'main/pack.c',
Brian Paulb70610b2011-02-28 18:24:35 -070096 'main/pbo.c',
José Fonseca601498a2010-11-01 13:30:22 +000097 'main/pixel.c',
98 'main/pixelstore.c',
99 'main/pixeltransfer.c',
100 'main/points.c',
101 'main/polygon.c',
102 'main/querymatrix.c',
103 'main/queryobj.c',
104 'main/rastpos.c',
105 'main/readpix.c',
106 'main/remap.c',
107 'main/renderbuffer.c',
Brian Paul34a5d3b2011-04-10 12:48:28 -0600108 'main/samplerobj.c',
José Fonseca601498a2010-11-01 13:30:22 +0000109 'main/scissor.c',
Eric Anholt82c9d982012-12-04 01:03:57 -0800110 'main/set.c',
José Fonseca601498a2010-11-01 13:30:22 +0000111 'main/shaderapi.c',
112 'main/shaderobj.c',
Brian Paul6399b7d2011-10-04 15:59:09 -0600113 'main/shader_query.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000114 'main/shared.c',
115 'main/state.c',
116 'main/stencil.c',
117 'main/syncobj.c',
118 'main/texcompress.c',
Brian Paulc1a9e602012-08-21 20:22:27 -0600119 'main/texcompress_cpal.c',
Vinson Lee93893132011-02-27 23:17:49 -0800120 'main/texcompress_rgtc.c',
José Fonseca601498a2010-11-01 13:30:22 +0000121 'main/texcompress_s3tc.c',
122 'main/texcompress_fxt1.c',
Chia-I Wu51f4d272011-11-28 23:55:31 +0800123 'main/texcompress_etc.c',
José Fonseca601498a2010-11-01 13:30:22 +0000124 'main/texenv.c',
José Fonseca601498a2010-11-01 13:30:22 +0000125 'main/texformat.c',
126 'main/texgen.c',
127 'main/texgetimage.c',
128 'main/teximage.c',
129 'main/texobj.c',
José Fonseca601498a2010-11-01 13:30:22 +0000130 'main/texparam.c',
José Fonseca601498a2010-11-01 13:30:22 +0000131 'main/texstate.c',
Brian Paul29eb2e82011-10-31 10:52:56 -0600132 'main/texstorage.c',
José Fonseca601498a2010-11-01 13:30:22 +0000133 'main/texstore.c',
Marek Olšákd0e805e2011-03-15 16:25:16 +0100134 'main/texturebarrier.c',
José Fonseca601498a2010-11-01 13:30:22 +0000135 'main/transformfeedback.c',
Vinson Lee116b7bb2011-10-18 18:39:11 -0700136 'main/uniform_query.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000137 'main/uniforms.c',
138 'main/varray.c',
139 'main/version.c',
140 'main/viewport.c',
141 'main/vtxfmt.c',
142]
José Fonseca5c9c6b02008-06-04 23:56:57 +0900143
Imre Deak98f880e2012-09-10 08:46:13 +0300144glget_sources = [
145 'main/get.c',
146]
147
José Fonseca601498a2010-11-01 13:30:22 +0000148math_sources = [
149 'math/m_debug_clip.c',
150 'math/m_debug_norm.c',
151 'math/m_debug_xform.c',
152 'math/m_eval.c',
153 'math/m_matrix.c',
154 'math/m_translate.c',
155 'math/m_vector.c',
156 'math/m_xform.c',
157]
158
José Fonseca8e8a56e2011-04-23 12:22:59 +0100159swrast_sources = [
160 'swrast/s_aaline.c',
161 'swrast/s_aatriangle.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100162 'swrast/s_alpha.c',
163 'swrast/s_atifragshader.c',
164 'swrast/s_bitmap.c',
165 'swrast/s_blend.c',
166 'swrast/s_blit.c',
167 'swrast/s_clear.c',
168 'swrast/s_copypix.c',
169 'swrast/s_context.c',
170 'swrast/s_depth.c',
171 'swrast/s_drawpix.c',
172 'swrast/s_feedback.c',
173 'swrast/s_fog.c',
174 'swrast/s_fragprog.c',
175 'swrast/s_lines.c',
176 'swrast/s_logic.c',
177 'swrast/s_masking.c',
178 'swrast/s_points.c',
Brian Paulb85284f2011-12-05 20:40:48 -0700179 'swrast/s_renderbuffer.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100180 'swrast/s_span.c',
181 'swrast/s_stencil.c',
182 'swrast/s_texcombine.c',
Brian Paulbaeefef2011-09-17 14:50:48 -0600183 'swrast/s_texfetch.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100184 'swrast/s_texfilter.c',
Brian Paul755f2e22011-06-13 13:44:35 -0600185 'swrast/s_texrender.c',
Brian Paul6f1846e2011-08-29 11:37:13 -0600186 'swrast/s_texture.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100187 'swrast/s_triangle.c',
188 'swrast/s_zoom.c',
189]
190
191swrast_setup_sources = [
192 'swrast_setup/ss_context.c',
193 'swrast_setup/ss_triangle.c',
194]
195
196tnl_sources = [
197 'tnl/t_context.c',
198 'tnl/t_pipeline.c',
199 'tnl/t_draw.c',
200 'tnl/t_rasterpos.c',
201 'tnl/t_vb_program.c',
202 'tnl/t_vb_render.c',
203 'tnl/t_vb_texgen.c',
204 'tnl/t_vb_texmat.c',
205 'tnl/t_vb_vertex.c',
206 'tnl/t_vb_fog.c',
207 'tnl/t_vb_light.c',
208 'tnl/t_vb_normals.c',
209 'tnl/t_vb_points.c',
210 'tnl/t_vp_build.c',
211 'tnl/t_vertex.c',
212 'tnl/t_vertex_sse.c',
213 'tnl/t_vertex_generic.c',
214]
215
José Fonseca601498a2010-11-01 13:30:22 +0000216vbo_sources = [
217 'vbo/vbo_context.c',
218 'vbo/vbo_exec.c',
219 'vbo/vbo_exec_api.c',
220 'vbo/vbo_exec_array.c',
221 'vbo/vbo_exec_draw.c',
222 'vbo/vbo_exec_eval.c',
Brian Paule6c41592011-11-09 17:22:47 -0700223 'vbo/vbo_noop.c',
Jordan Justenbc8e0f52012-05-07 15:50:21 -0700224 'vbo/vbo_primitive_restart.c',
José Fonseca601498a2010-11-01 13:30:22 +0000225 'vbo/vbo_rebase.c',
226 'vbo/vbo_split.c',
227 'vbo/vbo_split_copy.c',
228 'vbo/vbo_split_inplace.c',
229 'vbo/vbo_save.c',
230 'vbo/vbo_save_api.c',
231 'vbo/vbo_save_draw.c',
232 'vbo/vbo_save_loopback.c',
233]
234
José Fonseca601498a2010-11-01 13:30:22 +0000235statetracker_sources = [
236 'state_tracker/st_atom.c',
Brian Paul4d9f2632012-06-15 09:31:15 -0600237 'state_tracker/st_atom_array.c',
José Fonseca601498a2010-11-01 13:30:22 +0000238 'state_tracker/st_atom_blend.c',
239 'state_tracker/st_atom_clip.c',
240 'state_tracker/st_atom_constbuf.c',
241 'state_tracker/st_atom_depth.c',
242 'state_tracker/st_atom_framebuffer.c',
243 'state_tracker/st_atom_msaa.c',
244 'state_tracker/st_atom_pixeltransfer.c',
245 'state_tracker/st_atom_sampler.c',
246 'state_tracker/st_atom_scissor.c',
247 'state_tracker/st_atom_shader.c',
248 'state_tracker/st_atom_rasterizer.c',
249 'state_tracker/st_atom_stipple.c',
250 'state_tracker/st_atom_texture.c',
251 'state_tracker/st_atom_viewport.c',
José Fonseca601498a2010-11-01 13:30:22 +0000252 'state_tracker/st_cb_bitmap.c',
253 'state_tracker/st_cb_blit.c',
254 'state_tracker/st_cb_bufferobjects.c',
255 'state_tracker/st_cb_clear.c',
256 'state_tracker/st_cb_condrender.c',
257 'state_tracker/st_cb_flush.c',
258 'state_tracker/st_cb_drawpixels.c',
259 'state_tracker/st_cb_drawtex.c',
260 'state_tracker/st_cb_eglimage.c',
261 'state_tracker/st_cb_fbo.c',
262 'state_tracker/st_cb_feedback.c',
263 'state_tracker/st_cb_program.c',
264 'state_tracker/st_cb_queryobj.c',
265 'state_tracker/st_cb_rasterpos.c',
266 'state_tracker/st_cb_readpixels.c',
Marek Olšák5257a6d2011-03-05 20:32:28 +0100267 'state_tracker/st_cb_syncobj.c',
José Fonseca601498a2010-11-01 13:30:22 +0000268 'state_tracker/st_cb_strings.c',
269 'state_tracker/st_cb_texture.c',
Marek Olšákaea4ed42011-03-08 11:32:35 +0100270 'state_tracker/st_cb_texturebarrier.c',
José Fonseca601498a2010-11-01 13:30:22 +0000271 'state_tracker/st_cb_viewport.c',
272 'state_tracker/st_cb_xformfb.c',
273 'state_tracker/st_context.c',
274 'state_tracker/st_debug.c',
275 'state_tracker/st_draw.c',
276 'state_tracker/st_draw_feedback.c',
277 'state_tracker/st_extensions.c',
278 'state_tracker/st_format.c',
Brian Pauld7f2e382011-08-04 15:55:13 -0600279 'state_tracker/st_glsl_to_tgsi.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000280 'state_tracker/st_gen_mipmap.c',
281 'state_tracker/st_manager.c',
282 'state_tracker/st_mesa_to_tgsi.c',
283 'state_tracker/st_program.c',
284 'state_tracker/st_texture.c',
285]
286
Brian Paule78ebbc2012-09-15 09:01:02 -0600287env.Append(YACCFLAGS = '-d -p "_mesa_program_"')
Kenneth Graunke8be58df2011-03-01 15:04:04 -0800288program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
289program_parse = env.CFile('program/program_parse.tab.c',
290 'program/program_parse.y')
José Fonsecadbfbb8c2011-03-03 15:43:18 +0000291
292# Make program/program_parse.tab.h reacheable from the include path
José Fonseca5d0e8be2011-03-03 16:57:38 +0000293env.Append(CPPPATH = [Dir('.').abspath])
José Fonsecadbfbb8c2011-03-03 15:43:18 +0000294
José Fonseca601498a2010-11-01 13:30:22 +0000295program_sources = [
296 'program/arbprogparse.c',
297 'program/hash_table.c',
298 'program/ir_to_mesa.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000299 'program/program.c',
José Fonseca601498a2010-11-01 13:30:22 +0000300 'program/program_parse_extra.c',
301 'program/prog_cache.c',
302 'program/prog_execute.c',
303 'program/prog_instruction.c',
304 'program/prog_noise.c',
305 'program/prog_optimize.c',
Ian Romanick54c48a92011-02-10 15:48:27 -0800306 'program/prog_opt_constant_fold.c',
José Fonseca601498a2010-11-01 13:30:22 +0000307 'program/prog_parameter.c',
308 'program/prog_parameter_layout.c',
309 'program/prog_print.c',
310 'program/prog_statevars.c',
José Fonseca601498a2010-11-01 13:30:22 +0000311 'program/programopt.c',
312 'program/sampler.cpp',
313 'program/symbol_table.c',
Brian Paul6399b7d2011-10-04 15:59:09 -0600314 'program/string_to_uint_map.cpp',
Kenneth Graunke8be58df2011-03-01 15:04:04 -0800315 program_lex,
316 program_parse[0],
José Fonseca601498a2010-11-01 13:30:22 +0000317]
318
José Fonseca8e8a56e2011-04-23 12:22:59 +0100319common_driver_sources = [
320 'drivers/common/driverfuncs.c',
321 'drivers/common/meta.c',
322]
323
José Fonseca601498a2010-11-01 13:30:22 +0000324mesa_sources = (
325 main_sources +
Imre Deak98f880e2012-09-10 08:46:13 +0300326 glget_sources +
José Fonseca601498a2010-11-01 13:30:22 +0000327 math_sources +
328 program_sources +
329 vbo_sources +
José Fonseca8e8a56e2011-04-23 12:22:59 +0100330 tnl_sources +
331 swrast_sources +
332 swrast_setup_sources +
333 common_driver_sources +
José Fonseca601498a2010-11-01 13:30:22 +0000334 statetracker_sources
335)
336
Brian Pauldff36e92012-05-30 10:08:11 -0600337GLAPI = '#src/mapi/glapi/'
338
Chia-I Wubb770af2011-01-14 17:50:29 +0800339if env['gles']:
Chia-I Wubb770af2011-01-14 17:50:29 +0800340
Imre Deak66781252012-09-12 19:46:05 +0300341 enabled_apis += ['ES1', 'ES2']
Chia-I Wubb770af2011-01-14 17:50:29 +0800342
343 # generate GLES sources
Vinson Lee5cbc0f02012-11-06 23:16:29 -0800344 gles_sources = []
Chia-I Wubb770af2011-01-14 17:50:29 +0800345
346 # generate GLES headers
Chia-I Wubb770af2011-01-14 17:50:29 +0800347 gles_headers = []
Chia-I Wubb770af2011-01-14 17:50:29 +0800348
349 env.Depends(gles_sources, gles_headers)
350
351 # gles_sources #include gles_headers with full path
352 env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
353
354 mesa_sources += gles_sources
355
Imre Deak66781252012-09-12 19:46:05 +0300356env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
357
Imre Deak98f880e2012-09-10 08:46:13 +0300358get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis])
359
360get_hash_header = env.CodeGenerate(
361 target = 'main/get_hash.h',
362 script = 'main/get_hash_generator.py',
363 source = GLAPI + 'gen/gl_and_es_API.xml',
364 command = python_cmd + ' $SCRIPT ' + get_hash_gen_opts +
365 ' -f $SOURCE > $TARGET'
366)
367
368env.Depends(glget_sources, get_hash_header)
369
José Fonseca601498a2010-11-01 13:30:22 +0000370#
371# Assembly sources
372#
Vinson Lee9549e552012-09-27 23:21:09 -0700373if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'):
José Fonsecaf9156eb2010-11-01 13:56:16 +0000374 if env['machine'] == 'x86':
375 env.Append(CPPDEFINES = [
376 'USE_X86_ASM',
377 'USE_MMX_ASM',
378 'USE_3DNOW_ASM',
379 'USE_SSE_ASM',
380 ])
381 mesa_sources += [
382 'x86/common_x86.c',
383 'x86/x86_xform.c',
384 'x86/3dnow.c',
385 'x86/sse.c',
386 'x86/common_x86_asm.S',
387 'x86/x86_xform2.S',
388 'x86/x86_xform3.S',
389 'x86/x86_xform4.S',
390 'x86/x86_cliptest.S',
391 'x86/mmx_blend.S',
392 'x86/3dnow_xform1.S',
393 'x86/3dnow_xform2.S',
394 'x86/3dnow_xform3.S',
395 'x86/3dnow_xform4.S',
396 'x86/3dnow_normal.S',
397 'x86/sse_xform1.S',
398 'x86/sse_xform2.S',
399 'x86/sse_xform3.S',
400 'x86/sse_xform4.S',
401 'x86/sse_normal.S',
402 'x86/read_rgba_span_x86.S',
403 ]
404 elif env['machine'] == 'x86_64':
405 env.Append(CPPDEFINES = [
406 'USE_X86_64_ASM',
407 ])
408 mesa_sources += [
409 'x86-64/x86-64.c',
410 'x86-64/xform4.S',
411 ]
José Fonsecaf9156eb2010-11-01 13:56:16 +0000412 elif env['machine'] == 'sparc':
413 mesa_sources += [
414 'sparc/sparc.c',
Jon TURNEY86768902012-07-07 00:53:31 +0100415 'sparc/sparc_clip.S',
José Fonsecaf9156eb2010-11-01 13:56:16 +0000416 'sparc/norm.S',
417 'sparc/xform.S',
418 ]
419 else:
420 pass
José Fonseca601498a2010-11-01 13:30:22 +0000421
José Fonsecaf9156eb2010-11-01 13:56:16 +0000422 # Generate matypes.h
423 if env['machine'] in ('x86', 'x86_64'):
424 # See http://www.scons.org/wiki/UsingCodeGenerators
425 gen_matypes = env.Program(
426 target = 'gen_matypes',
427 source = 'x86/gen_matypes.c',
428 )
429 matypes = env.Command(
430 'matypes.h',
431 gen_matypes,
432 gen_matypes[0].abspath + ' > $TARGET',
433 )
434 # Add the dir containing the generated header (somewhere inside the
435 # build dir) to the include path
436 env.Append(CPPPATH = [matypes[0].dir])
José Fonseca601498a2010-11-01 13:30:22 +0000437
Brian Paul0c245502011-04-05 14:07:41 -0600438
Brian Pauldff36e92012-05-30 10:08:11 -0600439# The enums.c file is generated from the GL/ES API.xml file
440env.CodeGenerate(
441 target = 'main/enums.c',
442 script = GLAPI + 'gen/gl_enums.py',
443 source = GLAPI + 'gen/gl_and_es_API.xml',
444 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
445 )
446
Paul Berry98874ec2012-10-31 10:42:08 -0700447# The api_exec.c file is generated from the GL/ES API.xml file
448env.CodeGenerate(
449 target = 'main/api_exec.c',
450 script = GLAPI + 'gen/gl_genexec.py',
451 source = GLAPI + 'gen/gl_and_es_API.xml',
452 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
453 )
454
Brian Pauldff36e92012-05-30 10:08:11 -0600455# We also depend on the auto-generated GL API headers
456env.Depends(mesa_sources, glapi_headers)
Brian Paulf83af362011-09-28 08:15:22 -0600457
458
459def write_git_sha1_h_file(filename):
460 """Mesa looks for a git_sha1.h file at compile time in order to display
461 the current git hash id in the GL_VERSION string. This function tries
462 to retrieve the git hashid and write the header file. An empty file
463 will be created if anything goes wrong."""
464
465 args = [ 'git', 'log', '-n', '1', '--oneline' ]
466 try:
467 (commit, foo) = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
468 except:
469 # git log command didn't work
470 if not os.path.exists(filename):
471 # create an empty file if none already exists
472 f = open(filename, "w")
473 f.close()
474 return
475
Brian Pauld487cc22011-09-28 09:51:36 -0600476 commit = '#define MESA_GIT_SHA1 "git-%s"\n' % commit[0:7]
Brian Paulf83af362011-09-28 08:15:22 -0600477 tempfile = "git_sha1.h.tmp"
478 f = open(tempfile, "w")
479 f.write(commit)
Vinson Lee622ee082011-04-05 15:32:39 -0700480 f.close()
Brian Paulf83af362011-09-28 08:15:22 -0600481 if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
482 # The filename does not exist or it's different from the new file,
483 # so replace old file with new.
Brian Paule1122872011-09-28 09:04:03 -0600484 if os.path.exists(filename):
485 os.remove(filename)
Brian Paulf83af362011-09-28 08:15:22 -0600486 os.rename(tempfile, filename)
487 return
488
489
490# Create the git_sha1.h header file
491write_git_sha1_h_file("main/git_sha1.h")
Vinson Lee622ee082011-04-05 15:32:39 -0700492# and update CPPPATH so the git_sha1.h header can be found
493env.Append(CPPPATH = ["#" + env['build_dir'] + "/mesa/main"])
Brian Paul0c245502011-04-05 14:07:41 -0600494
495
José Fonseca601498a2010-11-01 13:30:22 +0000496#
497# Libraries
498#
499
500mesa = env.ConvenienceLibrary(
501 target = 'mesa',
502 source = mesa_sources,
503)
504
505env.Alias('mesa', mesa)
506
507Export('mesa')
José Fonseca8e8a56e2011-04-23 12:22:59 +0100508
509SConscript('drivers/SConscript')