1 import os, sys, commands, string
2 from makeversion import get_version
4 OS = commands.getoutput('uname')
9 def build_list(s_prefix, s_string):
10 s_list = Split(s_string)
11 for i in range(len(s_list)):
12 s_list[i] = s_prefix + '/' + s_list[i]
15 # common code ------------------------------------------------------
17 cmdlib_lib = g_env.StaticLibrary(target='libs/cmdlib', source='libs/cmdlib/cmdlib.cpp')
19 xml_env = g_env.Copy()
20 xml_env.Prepend(CPPPATH = 'include')
21 xml_env.Append(CXXFLAGS='`pkg-config glib-2.0 --cflags` `xml2-config --cflags`')
22 xml_src = 'ixml.cpp xmlparser.cpp xmlwriter.cpp xmlelement.cpp xmltextags.cpp'
23 xml_lib = xml_env.StaticLibrary(target='libs/xmllib', source=build_list('libs/xml', xml_src))
25 mathlib_src = 'mathlib.c bbox.c line.c m4x4.c ray.c'
26 mathlib_lib = g_env.StaticLibrary(target='libs/mathlib', source=build_list('libs/mathlib', mathlib_src))
28 md5lib_lib = g_env.StaticLibrary(target='libs/md5lib', source='libs/md5lib/md5lib.c')
30 ddslib_lib = g_env.StaticLibrary(target='libs/ddslib', source='libs/ddslib/ddslib.c')
32 jpeg_env = g_env.Copy()
33 jpeg_env.Prepend(CPPPATH = 'libs/jpeg6')
34 jpeg_src = 'jcomapi.cpp jdcoefct.cpp jdinput.cpp jdpostct.cpp jfdctflt.cpp jpgload.cpp jdapimin.cpp jdcolor.cpp jdmainct.cpp jdsample.cpp jidctflt.cpp jutils.cpp jdapistd.cpp jddctmgr.cpp jdmarker.cpp jdtrans.cpp jmemmgr.cpp jdatasrc.cpp jdhuff.cpp jdmaster.cpp jerror.cpp jmemnobs.cpp'
35 jpeg_lib = jpeg_env.StaticLibrary(target='libs/jpeg6', source=build_list('libs/jpeg6', jpeg_src))
37 l_net_lib = g_env.StaticLibrary(target='libs/l_net', source=['libs/l_net/l_net.c', 'libs/l_net/l_net_berkley.c'])
39 picomodel_src = 'picointernal.c picomodel.c picomodules.c pm_3ds.c pm_ase.c pm_md3.c pm_obj.c\
40 pm_ms3d.c pm_mdc.c pm_fm.c pm_md2.c pm_lwo.c pm_terrain.c lwo/clip.c lwo/envelope.c lwo/list.c lwo/lwio.c\
41 lwo/lwo2.c lwo/lwob.c lwo/pntspols.c lwo/surface.c lwo/vecmath.c lwo/vmap.c'
42 picomodel_lib = g_env.StaticLibrary(target='libs/picomodel', source=build_list('libs/picomodel', picomodel_src))
44 #splines_env = g_env.Copy()
45 #splines_src = build_list('libs/splines', 'math_angles.cpp math_matrix.cpp math_quaternion.cpp math_vector.cpp q_parse.cpp q_shared.cpp splines.cpp util_str.cpp')
46 #splines_env['CPPPATH'].append('include')
47 #splines_lib = splines_env.StaticLibrary(target='libs/splines', source=splines_src)
49 profile_env = g_env.Copy();
50 profile_env['CPPPATH'].append('include')
51 profile_src = 'profile.cpp file.cpp'
52 profile_lib = profile_env.StaticLibrary(target='libs/profile', source=build_list('libs/profile', profile_src))
54 gtkutil_env = g_env.Copy();
55 gtkutil_env['CPPPATH'].append('include')
56 gtkutil_env.useGlib2()
58 gtkutil_env.useGtkGLExt()
86 gtkutil_lib = gtkutil_env.StaticLibrary(target='libs/gtkutil', source=build_list('libs/gtkutil', gtkutil_src))
88 # end static / common libraries ---------------------------------------------------
90 # q3map ---------------------------------------------------------------------------
92 q3map_env = g_env.Copy()
93 q3map_env['CPPPATH'].append('include')
98 q3map_env.usePThread()
99 q3map_env.Prepend(CPPPATH='tools/quake3/common')
114 'q3map2/brush_primit.c',
125 'q3map2/surface_fur.c',
126 'q3map2/surface_meta.c',
127 'q3map2/tjunction.c',
132 'q3map2/light_bounce.c',
133 'q3map2/light_trace.c',
134 'q3map2/light_ydnar.c',
135 'q3map2/lightmaps_ydnar.c',
138 'q3map2/bspfile_abstract.c',
139 'q3map2/bspfile_ibsp.c',
140 'q3map2/bspfile_rbsp.c',
144 'q3map2/path_init.c',
146 'q3map2/surface_extra.c',
147 'q3map2/surface_foliage.c',
148 'q3map2/convert_ase.c',
149 'q3map2/convert_map.c' ]
152 for i in q3map_common_src + q3map_src:
153 q3map_full_src.append('tools/quake3/' + i)
155 q3map_libs = ['mathlib', 'l_net', 'jpeg6', 'picomodel', 'ddslib']
157 q3map_prog = q3map_env.Program(target='q3map2.' + g_cpu, source=q3map_full_src, LIBS=q3map_libs, LIBPATH='libs')
158 q3map_env.Depends(q3map_prog, mathlib_lib)
159 q3map_env.Depends(q3map_prog, l_net_lib)
160 q3map_env.Depends(q3map_prog, jpeg_lib)
161 q3map_env.Depends(q3map_prog, picomodel_lib)
162 q3map_env.Depends(q3map_prog, ddslib_lib)
163 q3map_env.Install(INSTALL, q3map_prog)
165 # end q3map2 ----------------------------------------------------------------------
167 # q3data ---------------------------------------------------------------------------
169 q3data_env = q3map_env.Copy()
171 q3data_common_src = [
196 q3data_full_src = [ ]
197 for i in q3data_common_src + q3data_src:
198 q3data_full_src.append('tools/quake3/' + i)
200 q3data_prog = q3data_env.Program( target = 'q3data.' + g_cpu, source = q3data_full_src, LIBS=['mathlib', 'l_net'], LIBPATH='libs' )
201 q3data_env.Depends(q3data_prog, mathlib_lib)
202 q3data_env.Depends(q3data_prog, l_net_lib)
203 q3data_env.Install( INSTALL, q3data_prog )
205 # end q3data ----------------------------------------------------------------------
207 # q2_tools ---------------------------------------------------------------------------
209 q2_tools_env = g_env.Copy()
210 q2_tools_env['CPPPATH'].append('include')
211 q2_tools_env.useXML2()
212 q2_tools_env.usePThread()
213 q2_tools_env.Prepend(CPPPATH='tools/quake2/common')
215 q2_tools_common_src = [
223 'common/path_init.c',
231 q2_tools_q2map_src = [
254 q2_tools_qdata3_common_src = [
262 'common/path_init.c',
268 q2_tools_qdata3_src = [
277 q2_tools_q2map_full_src = [ ]
278 for i in q2_tools_common_src + q2_tools_q2map_src:
279 q2_tools_q2map_full_src.append('tools/quake2/' + i)
281 q2_tools_qdata3_full_src = [ ]
282 for i in q2_tools_common_src + q2_tools_qdata3_src:
283 q2_tools_qdata3_full_src.append('tools/quake2/' + i)
285 if ( OS != 'Darwin' ):
286 q2_tools_q2map_prog = q2_tools_env.Program(target='quake2_tools/q2map', source=q2_tools_q2map_full_src, LIBS='l_net', LIBPATH='libs')
287 q2_tools_env.Depends(q2_tools_q2map_prog, l_net_lib)
288 q2_tools_env.Install(INSTALL, q2_tools_q2map_prog )
290 q2_tools_qdata3_prog = q2_tools_env.Program(target='quake2_tools/qdata3', source=q2_tools_qdata3_full_src, LIBS='l_net', LIBPATH='libs')
291 q2_tools_env.Depends(q2_tools_qdata3_prog, l_net_lib)
292 q2_tools_env.Install(INSTALL, q2_tools_qdata3_prog )
295 # end q2_tools ----------------------------------------------------------------------
297 # qdata3_heretic2 ---------------------------------------------------------------------------
299 heretic2_tools_env = g_env.Copy()
300 heretic2_tools_env['CPPPATH'].append('include')
301 heretic2_tools_env.useXML2()
302 heretic2_tools_env.usePThread()
303 heretic2_tools_env.Prepend(CPPPATH='tools/quake2/qdata_heretic2')
304 heretic2_tools_env.Prepend(CPPPATH='tools/quake2/qdata_heretic2/qcommon')
305 heretic2_tools_env.Prepend(CPPPATH='tools/quake2/qdata_heretic2/common')
307 heretic2_tools_qdata3_common_src = [
308 'qdata_heretic2/common/bspfile.c',
309 'qdata_heretic2/common/cmdlib.c',
310 'qdata_heretic2/common/inout.c',
311 'qdata_heretic2/common/l3dslib.c',
312 'qdata_heretic2/common/lbmlib.c',
313 'qdata_heretic2/common/mathlib.c',
314 'qdata_heretic2/common/md4.c',
315 'qdata_heretic2/common/path_init.c',
316 'qdata_heretic2/common/qfiles.c',
317 'qdata_heretic2/common/scriplib.c',
318 'qdata_heretic2/common/threads.c',
319 'qdata_heretic2/common/token.c',
320 'qdata_heretic2/common/trilib.c'
323 heretic2_tools_qdata3_qcommon_src = [
324 'qdata_heretic2/qcommon/reference.c',
325 'qdata_heretic2/qcommon/resourcemanager.c',
326 'qdata_heretic2/qcommon/skeletons.c'
329 heretic2_tools_qdata3_src = [
330 'qdata_heretic2/animcomp.c',
331 'qdata_heretic2/book.c',
332 'qdata_heretic2/fmodels.c',
333 'qdata_heretic2/images.c',
334 'qdata_heretic2/jointed.c',
335 'qdata_heretic2/models.c',
336 'qdata_heretic2/pics.c',
337 'qdata_heretic2/qdata.c',
338 'qdata_heretic2/qd_skeletons.c',
339 'qdata_heretic2/sprites.c',
340 'qdata_heretic2/svdcmp.c',
341 'qdata_heretic2/tables.c',
342 'qdata_heretic2/tmix.c',
343 'qdata_heretic2/video.c'
346 heretic2_tools_qdata3_full_src = [ ]
347 for i in heretic2_tools_qdata3_common_src + heretic2_tools_qdata3_qcommon_src + heretic2_tools_qdata3_src:
348 heretic2_tools_qdata3_full_src.append('tools/quake2/' + i)
351 heretic2_tools_env['CCFLAGS'] += '-D_LINUX '
353 if ( OS != 'Darwin' ):
354 heretic2_tools_prog = heretic2_tools_env.Program(target='h2data', source=heretic2_tools_qdata3_full_src, LIBS='l_net', LIBPATH='libs')
355 heretic2_tools_env.Depends(heretic2_tools_prog, l_net_lib)
356 heretic2_tools_env.Install(INSTALL + '/heretic2', heretic2_tools_prog )
358 # end heretic2_tools ----------------------------------------------------------------------
362 # radiant, modules and plugins ----------------------------------------------------
364 module_env = g_env.Copy()
365 module_env['CPPPATH'].append('include')
366 if ( OS == 'Darwin' ):
367 module_env['LINKFLAGS'] += '-dynamiclib -ldl '
369 module_env['LINKFLAGS'] += '-ldl '
370 module_env['LIBPREFIX'] = ''
373 vfspk3_env = module_env.Copy()
374 vfspk3_lst = build_list('plugins/vfspk3', 'vfspk3.cpp vfs.cpp archive.cpp')
375 vfspk3_env.useGlib2()
376 vfspk3_lib = vfspk3_env.SharedLibrarySafe(target='vfspk3', source=vfspk3_lst)
377 vfspk3_env.Install(INSTALL + '/modules', vfspk3_lib)
379 archivepak_env = module_env.Copy()
380 archivepak_lst = build_list('plugins/archivepak', 'plugin.cpp archive.cpp pak.cpp')
381 archivepak_lib = archivepak_env.SharedLibrarySafe(target='archivepak', source=archivepak_lst, LIBS='cmdlib', LIBPATH='libs')
382 archivepak_env.Depends(archivepak_lib, cmdlib_lib)
383 archivepak_env.Install(INSTALL + '/modules', archivepak_lib)
385 archivewad_env = module_env.Copy()
386 archivewad_lst = build_list('plugins/archivewad', 'plugin.cpp archive.cpp wad.cpp')
387 archivewad_lib = archivewad_env.SharedLibrarySafe(target='archivewad', source=archivewad_lst, LIBS='cmdlib', LIBPATH='libs')
388 archivewad_env.Depends(archivewad_lib, cmdlib_lib)
389 archivewad_env.Install(INSTALL + '/modules', archivewad_lib)
391 archivezip_env = module_env.Copy()
392 archivezip_lst = build_list('plugins/archivezip', 'plugin.cpp archive.cpp pkzip.cpp zlibstream.cpp')
393 archivezip_env.useZLib()
394 archivezip_lib = archivezip_env.SharedLibrarySafe(target='archivezip', source=archivezip_lst, LIBS='cmdlib', LIBPATH='libs')
395 archivezip_env.Depends(archivezip_lib, cmdlib_lib)
396 archivezip_env.Install(INSTALL + '/modules', archivezip_lib)
398 shaders_env = module_env.Copy()
399 shaders_lst = build_list('plugins/shaders', 'shaders.cpp plugin.cpp')
400 shaders_env.useGlib2()
401 shaders_lib = shaders_env.SharedLibrarySafe(target='shaders', source=shaders_lst, LIBS='cmdlib', LIBPATH='libs')
402 shaders_env.Depends(shaders_lib, cmdlib_lib)
403 shaders_env.Install(INSTALL + '/modules', shaders_lib)
405 image_env = module_env.Copy()
406 image_lst = build_list('plugins/image', 'bmp.cpp jpeg.cpp image.cpp pcx.cpp tga.cpp dds.cpp')
407 image_lib = image_env.SharedLibrarySafe(target='image', source=image_lst, LIBS=['jpeg6', 'ddslib'], LIBPATH='libs')
408 image_env.Depends(image_lib, jpeg_lib)
409 image_env.Depends(image_lib, ddslib_lib)
410 image_env.Install(INSTALL + '/modules', image_lib)
412 imagehl_lst=build_list('plugins/imagehl', 'imagehl.cpp hlw.cpp mip.cpp sprite.cpp')
413 imagehl_lib = module_env.SharedLibrarySafe(target='imagehl', source=imagehl_lst)
414 module_env.Install(INSTALL + '/modules', imagehl_lib)
416 imageq2_lst = build_list('plugins/imageq2', 'imageq2.cpp wal.cpp wal32.cpp')
417 imageq2_lib = module_env.SharedLibrarySafe(target='imageq2', source=imageq2_lst)
418 module_env.Install(INSTALL + '/modules', imageq2_lib)
420 mapq3_env = module_env.Copy()
421 mapq3_lst=build_list('plugins/mapq3', 'plugin.cpp parse.cpp write.cpp')
422 mapq3_lib = mapq3_env.SharedLibrarySafe(target='mapq3', source=mapq3_lst, LIBS='cmdlib', LIBPATH='libs')
423 mapq3_env.Depends(mapq3_lib, cmdlib_lib)
424 mapq3_env.Install(INSTALL + '/modules', mapq3_lib)
426 imagepng_env = module_env.Copy()
427 imagepng_lst = build_list('plugins/imagepng', 'plugin.cpp')
428 imagepng_env.usePNG()
429 imagepng_lib = imagepng_env.SharedLibrarySafe(target='imagepng', source=imagepng_lst)
430 imagepng_env.Install(INSTALL + '/modules', imagepng_lib)
432 mapxml_env = module_env.Copy()
433 mapxml_lst = build_list('plugins/mapxml', 'plugin.cpp xmlparse.cpp xmlwrite.cpp')
434 mapxml_lib = mapxml_env.SharedLibrarySafe(target='mapxml', source=mapxml_lst)
436 mapxml_env.useGlib2()
437 mapxml_env.Install(INSTALL + '/modules', mapxml_lib)
439 model_env = module_env.Copy()
440 model_lst = build_list('plugins/model', 'plugin.cpp model.cpp')
441 model_lib = model_env.SharedLibrarySafe(target='model', source=model_lst, LIBS=['mathlib', 'picomodel'], LIBPATH='libs')
442 model_env.Depends(model_lib, mathlib_lib)
443 model_env.Depends(model_lib, picomodel_lib)
444 model_env.Install(INSTALL + '/modules', model_lib)
446 md3model_lst=build_list('plugins/md3model', 'plugin.cpp mdl.cpp md3.cpp md2.cpp mdc.cpp mdlimage.cpp md5.cpp')
447 md3model_lib = module_env.SharedLibrarySafe(target='md3model', source=md3model_lst)
448 module_env.Install(INSTALL + '/modules', md3model_lib)
450 entity_lst = build_list('plugins/entity', 'plugin.cpp entity.cpp eclassmodel.cpp generic.cpp group.cpp light.cpp miscmodel.cpp doom3group.cpp skincache.cpp angle.cpp angles.cpp colour.cpp filters.cpp model.cpp namedentity.cpp origin.cpp scale.cpp targetable.cpp rotation.cpp modelskinkey.cpp')
451 entity_lib = module_env.SharedLibrarySafe(target='entity', source=entity_lst)
452 module_env.Install(INSTALL + '/modules', entity_lib)
454 bob_env = module_env.Copy()
455 bob_lst = build_list('contrib/bobtoolz/',
456 'dialogs/dialogs-gtk.cpp bobToolz-GTK.cpp bsploader.cpp cportals.cpp DBobView.cpp \
457 DBrush.cpp DEntity.cpp DEPair.cpp DMap.cpp DPatch.cpp DPlane.cpp DPoint.cpp \
458 DShape.cpp DTrainDrawer.cpp DTreePlanter.cpp DVisDrawer.cpp DWinding.cpp funchandlers-GTK.cpp \
459 lists.cpp misc.cpp ScriptParser.cpp shapes.cpp visfind.cpp')
460 bob_lib = bob_env.SharedLibrarySafe(target='bobtoolz', source=bob_lst, LIBS=['mathlib', 'cmdlib', 'profile'], LIBPATH='libs')
461 bob_env.Depends(bob_lib, mathlib_lib)
462 bob_env.Depends(bob_lib, cmdlib_lib)
463 bob_env.Depends(bob_lib, profile_lib)
466 bob_env.Install(INSTALL + '/plugins', bob_lib)
468 #camera_lst = build_list('contrib/camera',
469 #'camera.cpp dialogs.cpp dialogs_common.cpp funchandlers.cpp listener.cpp misc.cpp renderer.cpp')
470 #camera_lst.append('libs/libsplines.a')
471 #bob_env.SharedLibrarySafe(target='camera', source=camera_lst)
472 #bob_env.Install(INSTALL + '/plugins', 'camera.so')
474 prtview_env = module_env.Copy()
475 prtview_lst = build_list('contrib/prtview', 'AboutDialog.cpp ConfigDialog.cpp LoadPortalFileDialog.cpp portals.cpp prtview.cpp')
476 prtview_env.useGlib2()
477 prtview_env.useGtk2()
478 prtview_lib = prtview_env.SharedLibrarySafe(target='prtview', source=prtview_lst, LIBS='profile', LIBPATH='libs')
479 prtview_env.Depends(prtview_lib, profile_lib)
480 prtview_env.Install(INSTALL + '/plugins', prtview_lib)
483 brushexport_env = module_env.Copy()
484 brushexport_lst = build_list('contrib/brushexport', 'plugin.cpp')
485 brushexport_env.useGlib2()
486 brushexport_env.useGtk2()
487 brushexport_lib = brushexport_env.SharedLibrarySafe(target='brushexport', source=brushexport_lst, LIBPATH='libs')
488 brushexport_env.Install(INSTALL + '/plugins', brushexport_lib)
490 sunplug_env = module_env.Copy()
491 sunplug_lst = build_list('contrib/sunplug', 'sunplug.cpp')
492 sunplug_env.useGlib2()
493 sunplug_env.useGtk2()
494 sunplug_lib = sunplug_env.SharedLibrarySafe(target='sunplug', source=sunplug_lst, LIBPATH='libs')
495 sunplug_env.Install(INSTALL + '/plugins', sunplug_lib)
497 shaderplug_env = module_env.Copy()
498 shaderplug_lst = build_list('contrib/shaderplug', 'shaderplug.cpp')
499 shaderplug_env.useGlib2()
500 shaderplug_env.useGtk2()
501 shaderplug_env.useXML2()
502 shaderplug_lib = shaderplug_env.SharedLibrarySafe(target='shaderplug', source=shaderplug_lst, LIBS='xmllib', LIBPATH='libs')
503 shaderplug_env.Install(INSTALL + '/plugins', shaderplug_lib)
505 #gensurf_lst = build_list('contrib/gtkgensurf',
506 #'bitmap.cpp dec.cpp face.cpp font.cpp gendlgs.cpp genmap.cpp gensurf.cpp heretic.cpp plugin.cpp view.cpp triangle.c')
507 #bob_env.SharedLibrarySafe(target='gensurf', source=gensurf_lst)
508 #bob_env.Install(INSTALL + '/plugins', 'gensurf.so')
510 #bkgrnd2d_list = build_list( 'contrib/bkgrnd2d', 'bkgrnd2d.cpp plugin.cpp dialog.cpp' )
511 #bkgrnd2d_list.append( 'libs/libsynapse.a' )
512 #bkgrnd2d_env = module_env.Copy()
513 #bkgrnd2d_env.useGtk2()
514 #bkgrnd2d_env.SharedLibrarySafe( target='bkgrnd2d', source=bkgrnd2d_list )
515 #bkgrnd2d_env.Install( INSTALL + '/plugins', 'bkgrnd2d.so' )
517 radiant_env = g_env.Copy()
518 radiant_env['CPPPATH'].append('include')
519 radiant_env['LINKFLAGS'] += '-ldl -lGL '
520 if ( OS == 'Darwin' ):
521 radiant_env['CXXFLAGS'] += '-fno-common '
522 radiant_env['CCFLAGS'] += '-fno-common '
523 radiant_env['LINKFLAGS'] += '-lX11 -lGL -lGLU '
524 radiant_env['LIBPREFIX'] = ''
525 radiant_env.useGlib2()
526 radiant_env.useXML2()
527 radiant_env.useGtk2()
528 radiant_env.useGtkGLExt()
552 'entityinspector.cpp',
559 'findtexturedialog.cpp',
583 'preferencedictionary.cpp',
587 'referencecache.cpp',
608 'windowobservers.cpp',
613 for i in range(len(radiant_src)):
614 radiant_src[i] = 'radiant/' + radiant_src[i]
616 radiant_libs = ['mathlib', 'cmdlib', 'l_net', 'profile', 'gtkutil', 'xmllib']
617 radiant_prog = radiant_env.Program(target='radiant.' + g_cpu, source=radiant_src, LIBS=radiant_libs, LIBPATH='libs')
618 radiant_env.Depends(radiant_prog, mathlib_lib)
619 radiant_env.Depends(radiant_prog, cmdlib_lib)
620 radiant_env.Depends(radiant_prog, l_net_lib)
621 radiant_env.Depends(radiant_prog, profile_lib)
622 radiant_env.Depends(radiant_prog, gtkutil_lib)
623 radiant_env.Depends(radiant_prog, xml_lib)
624 radiant_env.Install(INSTALL, radiant_prog)
627 # end setup ---------------------------------------------------------------------------------------