mirror of
https://github.com/id-Software/DOOM-3.git
synced 2026-03-20 08:59:56 +01:00
hello world
This commit is contained in:
359
neo/sys/scons/SConscript.core
Normal file
359
neo/sys/scons/SConscript.core
Normal file
@@ -0,0 +1,359 @@
|
||||
# -*- mode: python -*-
|
||||
# DOOM build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import sys, os
|
||||
import scons_utils
|
||||
|
||||
Import( 'GLOBALS' )
|
||||
Import( GLOBALS )
|
||||
|
||||
jpeg_string = ' \
|
||||
jcapimin.c \
|
||||
jccoefct.c \
|
||||
jccolor.c \
|
||||
jcdctmgr.c \
|
||||
jchuff.c \
|
||||
jcinit.c \
|
||||
jcmainct.c \
|
||||
jcmarker.c \
|
||||
jcmaster.c \
|
||||
jcomapi.c \
|
||||
jcparam.c \
|
||||
jcphuff.c \
|
||||
jcprepct.c \
|
||||
jcsample.c \
|
||||
jdapimin.c \
|
||||
jdapistd.c \
|
||||
jdatadst.c \
|
||||
jdatasrc.c \
|
||||
jdcoefct.c \
|
||||
jdcolor.c \
|
||||
jddctmgr.c \
|
||||
jdhuff.c \
|
||||
jdinput.c \
|
||||
jdmainct.c \
|
||||
jdmarker.c \
|
||||
jdmaster.c \
|
||||
jdmerge.c \
|
||||
jdphuff.c \
|
||||
jdpostct.c \
|
||||
jdsample.c \
|
||||
jdtrans.c \
|
||||
jerror.c \
|
||||
jfdctflt.c \
|
||||
jfdctfst.c \
|
||||
jfdctint.c \
|
||||
jidctflt.c \
|
||||
jidctfst.c \
|
||||
jidctint.c \
|
||||
jidctred.c \
|
||||
jmemmgr.c \
|
||||
jmemnobs.c \
|
||||
jquant1.c \
|
||||
jquant2.c \
|
||||
jutils.c'
|
||||
|
||||
jpeg_list = scons_utils.BuildList( 'renderer/jpeg-6', jpeg_string )
|
||||
|
||||
ogg_string = ' \
|
||||
oggsrc/bitwise.c \
|
||||
oggsrc/framing.c \
|
||||
vorbissrc/analysis.c \
|
||||
vorbissrc/bitrate.c \
|
||||
vorbissrc/block.c \
|
||||
vorbissrc/codebook.c \
|
||||
vorbissrc/envelope.c \
|
||||
vorbissrc/floor0.c \
|
||||
vorbissrc/floor1.c \
|
||||
vorbissrc/info.c \
|
||||
vorbissrc/lookup.c \
|
||||
vorbissrc/lpc.c \
|
||||
vorbissrc/lsp.c \
|
||||
vorbissrc/mapping0.c \
|
||||
vorbissrc/mdct.c \
|
||||
vorbissrc/psy.c \
|
||||
vorbissrc/registry.c \
|
||||
vorbissrc/res0.c \
|
||||
vorbissrc/sharedbook.c \
|
||||
vorbissrc/smallft.c \
|
||||
vorbissrc/synthesis.c \
|
||||
vorbissrc/vorbisenc.c \
|
||||
vorbissrc/vorbisfile.c \
|
||||
vorbissrc/windowvb.c'
|
||||
|
||||
ogg_list = scons_utils.BuildList( 'sound/OggVorbis', ogg_string )
|
||||
|
||||
renderer_string = ' \
|
||||
Cinematic.cpp \
|
||||
GuiModel.cpp \
|
||||
Image_files.cpp \
|
||||
Image_init.cpp \
|
||||
Image_load.cpp \
|
||||
Image_process.cpp \
|
||||
Image_program.cpp \
|
||||
Interaction.cpp \
|
||||
Material.cpp \
|
||||
MegaTexture.cpp \
|
||||
Model.cpp \
|
||||
ModelDecal.cpp \
|
||||
ModelManager.cpp \
|
||||
ModelOverlay.cpp \
|
||||
Model_beam.cpp \
|
||||
Model_ase.cpp \
|
||||
Model_liquid.cpp \
|
||||
Model_lwo.cpp \
|
||||
Model_ma.cpp \
|
||||
Model_md3.cpp \
|
||||
Model_md5.cpp \
|
||||
Model_prt.cpp \
|
||||
Model_sprite.cpp \
|
||||
RenderEntity.cpp \
|
||||
RenderSystem.cpp \
|
||||
RenderSystem_init.cpp \
|
||||
RenderWorld.cpp \
|
||||
RenderWorld_demo.cpp \
|
||||
RenderWorld_load.cpp \
|
||||
RenderWorld_portals.cpp \
|
||||
VertexCache.cpp \
|
||||
cg_explicit.cpp \
|
||||
draw_arb.cpp \
|
||||
draw_arb2.cpp \
|
||||
draw_common.cpp \
|
||||
draw_exp_stub.cpp \
|
||||
draw_nv10.cpp \
|
||||
draw_nv20.cpp \
|
||||
draw_r200.cpp \
|
||||
tr_backend.cpp \
|
||||
tr_deform.cpp \
|
||||
tr_font.cpp \
|
||||
tr_guisurf.cpp \
|
||||
tr_light.cpp \
|
||||
tr_lightrun.cpp \
|
||||
tr_main.cpp \
|
||||
tr_orderIndexes.cpp \
|
||||
tr_polytope.cpp \
|
||||
tr_render.cpp \
|
||||
tr_rendertools.cpp \
|
||||
tr_shadowbounds.cpp \
|
||||
tr_stencilshadow.cpp \
|
||||
tr_subview.cpp \
|
||||
tr_trace.cpp \
|
||||
tr_trisurf.cpp \
|
||||
tr_turboshadow.cpp'
|
||||
|
||||
renderer_list = scons_utils.BuildList( 'renderer', renderer_string )
|
||||
|
||||
framework_string = ' \
|
||||
CVarSystem.cpp \
|
||||
CmdSystem.cpp \
|
||||
Common.cpp \
|
||||
Compressor.cpp \
|
||||
Console.cpp \
|
||||
DemoFile.cpp \
|
||||
DeclAF.cpp \
|
||||
DeclEntityDef.cpp \
|
||||
DeclFX.cpp \
|
||||
DeclManager.cpp \
|
||||
DeclParticle.cpp \
|
||||
DeclPDA.cpp \
|
||||
DeclSkin.cpp \
|
||||
DeclTable.cpp \
|
||||
EditField.cpp \
|
||||
EventLoop.cpp \
|
||||
File.cpp \
|
||||
FileSystem.cpp \
|
||||
KeyInput.cpp \
|
||||
Unzip.cpp \
|
||||
UsercmdGen.cpp \
|
||||
Session_menu.cpp \
|
||||
Session.cpp \
|
||||
async/AsyncClient.cpp \
|
||||
async/AsyncNetwork.cpp \
|
||||
async/AsyncServer.cpp \
|
||||
async/MsgChannel.cpp \
|
||||
async/NetworkSystem.cpp \
|
||||
async/ServerScan.cpp'
|
||||
|
||||
framework_list = scons_utils.BuildList( 'framework', framework_string )
|
||||
|
||||
cm_string = ' \
|
||||
CollisionModel_contacts.cpp \
|
||||
CollisionModel_contents.cpp \
|
||||
CollisionModel_debug.cpp \
|
||||
CollisionModel_files.cpp \
|
||||
CollisionModel_load.cpp \
|
||||
CollisionModel_rotate.cpp \
|
||||
CollisionModel_trace.cpp \
|
||||
CollisionModel_translate.cpp'
|
||||
cm_list = scons_utils.BuildList( 'cm', cm_string )
|
||||
|
||||
dmap_string = ' \
|
||||
dmap.cpp \
|
||||
facebsp.cpp \
|
||||
gldraw.cpp \
|
||||
glfile.cpp \
|
||||
leakfile.cpp \
|
||||
map.cpp \
|
||||
optimize.cpp \
|
||||
output.cpp \
|
||||
portals.cpp \
|
||||
shadowopt3.cpp \
|
||||
tritjunction.cpp \
|
||||
tritools.cpp \
|
||||
ubrush.cpp \
|
||||
usurface.cpp'
|
||||
|
||||
dmap_list = scons_utils.BuildList( 'tools/compilers/dmap', dmap_string )
|
||||
|
||||
aas_string = ' \
|
||||
AASBuild.cpp \
|
||||
AASBuild_file.cpp \
|
||||
AASBuild_gravity.cpp \
|
||||
AASBuild_ledge.cpp \
|
||||
AASBuild_merge.cpp \
|
||||
AASCluster.cpp \
|
||||
AASFile.cpp \
|
||||
AASFile_optimize.cpp \
|
||||
AASFile_sample.cpp \
|
||||
AASReach.cpp \
|
||||
AASFileManager.cpp \
|
||||
Brush.cpp \
|
||||
BrushBSP.cpp'
|
||||
|
||||
aas_list = scons_utils.BuildList( 'tools/compilers/aas', aas_string )
|
||||
|
||||
roq_string = ' \
|
||||
NSBitmapImageRep.cpp \
|
||||
codec.cpp \
|
||||
roq.cpp \
|
||||
roqParam.cpp'
|
||||
|
||||
roq_list = scons_utils.BuildList( 'tools/compilers/roqvq', roq_string )
|
||||
|
||||
renderbump_list = [ 'tools/compilers/renderbump/renderbump.cpp' ]
|
||||
|
||||
snd_string = ' \
|
||||
snd_cache.cpp \
|
||||
snd_decoder.cpp \
|
||||
snd_efxfile.cpp \
|
||||
snd_emitter.cpp \
|
||||
snd_shader.cpp \
|
||||
snd_system.cpp \
|
||||
snd_wavefile.cpp \
|
||||
snd_world.cpp'
|
||||
|
||||
snd_list = scons_utils.BuildList( 'sound', snd_string )
|
||||
|
||||
ui_string = ' \
|
||||
BindWindow.cpp \
|
||||
ChoiceWindow.cpp \
|
||||
DeviceContext.cpp \
|
||||
EditWindow.cpp \
|
||||
FieldWindow.cpp \
|
||||
GameBearShootWindow.cpp \
|
||||
GameBustOutWindow.cpp \
|
||||
GameSSDWindow.cpp \
|
||||
GuiScript.cpp \
|
||||
ListGUI.cpp \
|
||||
ListWindow.cpp \
|
||||
MarkerWindow.cpp \
|
||||
RegExp.cpp \
|
||||
RenderWindow.cpp \
|
||||
SimpleWindow.cpp \
|
||||
SliderWindow.cpp \
|
||||
UserInterface.cpp \
|
||||
Window.cpp \
|
||||
Winvar.cpp'
|
||||
|
||||
ui_list = scons_utils.BuildList( 'ui', ui_string )
|
||||
|
||||
sys_string = ' \
|
||||
sys_local.cpp \
|
||||
posix/posix_net.cpp \
|
||||
posix/posix_main.cpp \
|
||||
posix/posix_signal.cpp \
|
||||
posix/posix_threads.cpp \
|
||||
linux/stack.cpp \
|
||||
linux/main.cpp \
|
||||
stub/util_stub.cpp'
|
||||
|
||||
if ( local_dedicated == 0 ):
|
||||
sys_string += ' \
|
||||
linux/glimp.cpp \
|
||||
posix/posix_input.cpp \
|
||||
linux/input.cpp \
|
||||
linux/libXNVCtrl/NVCtrl.c'
|
||||
else:
|
||||
sys_string += ' linux/dedicated.cpp'
|
||||
|
||||
sys_list = scons_utils.BuildList( 'sys', sys_string )
|
||||
|
||||
tools_string = ' \
|
||||
guied/GEWindowWrapper_stub.cpp'
|
||||
|
||||
tools_list = scons_utils.BuildList( 'tools', tools_string )
|
||||
|
||||
core_list = framework_list + jpeg_list + renderer_list + ui_list \
|
||||
+ cm_list + dmap_list + renderbump_list + aas_list + roq_list \
|
||||
+ snd_list + sys_list + tools_list + [ 'TypeInfo/TypeInfoGen.cpp' ]
|
||||
|
||||
for i in range( len( core_list ) ):
|
||||
core_list[ i ] = '../../' + core_list[ i ]
|
||||
|
||||
for i in range( len( ogg_list ) ):
|
||||
ogg_list[ i ] = '../../' + ogg_list[ i ]
|
||||
|
||||
local_env = g_env.Clone()
|
||||
|
||||
if ( local_dedicated == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ 'ID_DEDICATED', 'ID_GL_HARDLINK' ] )
|
||||
# don't enable alsa for a dedicated server binary
|
||||
ALSA = '0'
|
||||
|
||||
if ( local_gamedll == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ '__DOOM_DLL__' ] )
|
||||
|
||||
if ( local_demo == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ 'ID_DEMO_BUILD' ] )
|
||||
|
||||
if ( local_curl == 0 ):
|
||||
local_env.Append( CPPDEFINES = [ 'ID_ENABLE_CURL=0' ] )
|
||||
|
||||
ogg_env = local_env.Clone()
|
||||
ogg_env.Append( CPPPATH = '#sound/OggVorbis/vorbissrc' )
|
||||
libogg = ogg_env.StaticLibrary( 'ogg', ogg_list )
|
||||
|
||||
sound_env = local_env.Clone()
|
||||
sound_env.Append( CPPPATH = '/usr/local/lib/oss/include' )
|
||||
# store a local copy of the include headers as well for holy build
|
||||
sound_env.Append( CPPPATH = '../linux/oss/include' )
|
||||
sound_list = [ '../linux/sound.cpp' ]
|
||||
if ( ALSA != '0' ):
|
||||
sound_list.append( '../../sys/linux/sound_alsa.cpp' )
|
||||
else:
|
||||
sound_env.Append( CPPDEFINES = 'NO_ALSA' )
|
||||
sound_lib = sound_env.StaticLibrary( 'sound', sound_list )
|
||||
|
||||
local_env.Append( LIBS = [ 'pthread', 'dl' ] )
|
||||
if ( local_dedicated == 0 ):
|
||||
local_env.Append( LIBS = [ 'X11', 'Xext', 'Xxf86vm' ] ) # 'Xxf86dga',
|
||||
local_env.Append( LIBPATH = [ '/usr/X11R6/lib' ] )
|
||||
# local_env.Append( LIBS = [ 'openal' ] )
|
||||
|
||||
source_list = core_list
|
||||
source_list += idlib_objects
|
||||
source_list += [ '../../glimp/sys/scons/libglimp.a' ]
|
||||
source_list += libogg
|
||||
source_list += curl_lib
|
||||
source_list += sound_lib
|
||||
source_list += [ '../../openal/stubs.cpp' ]
|
||||
|
||||
source_list += g_env_noopt.StaticObject( '../../tools/compilers/dmap/optimize_gcc.cpp' )
|
||||
|
||||
if ( local_gamedll == 0 ):
|
||||
source_list += game_objects
|
||||
|
||||
d3wm = local_env.Program( target = 'doom', source = source_list )
|
||||
Return( 'd3wm' )
|
||||
41
neo/sys/scons/SConscript.curl
Normal file
41
neo/sys/scons/SConscript.curl
Normal file
@@ -0,0 +1,41 @@
|
||||
# -*- mode: python -*-
|
||||
# DOOM build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import os
|
||||
|
||||
import scons_utils
|
||||
|
||||
Import( 'GLOBALS' )
|
||||
Import( GLOBALS )
|
||||
|
||||
class idBuildCurl( scons_utils.idSetupBase ):
|
||||
|
||||
def Compile( self, target = None, source = None, env = None ):
|
||||
self.TrySimpleCommand( 'cd curl ; make clean' )
|
||||
cmd = 'cd curl ; CC=\'' + env['CC'] + '\' ./configure --enable-shared=no --enable-static=yes --enable-http --enable-ftp --disable-gopher --enable-file --disable-ldap --disable-dict --disable-telnet --disable-manual --enable-libgcc --disable-ipv6 --without-ssl '
|
||||
if ( self.debug ):
|
||||
cmd += '--enable-debug'
|
||||
else:
|
||||
cmd += '--disable-debug'
|
||||
os.system( cmd )
|
||||
os.system( 'cd curl ; make' )
|
||||
if ( self.debug ):
|
||||
os.system( 'cd curl ; mv ./lib/.libs/libcurl.a ./lib/.libs/libcurl-debug.a' )
|
||||
else:
|
||||
os.system( 'cd curl ; mv ./lib/.libs/libcurl.a ./lib/.libs/libcurl-release.a' )
|
||||
return 0
|
||||
|
||||
build = idBuildCurl()
|
||||
if ( local_curl == 1 ):
|
||||
build.debug = 1
|
||||
target_name = '#curl/lib/.libs/libcurl-debug.a'
|
||||
else:
|
||||
build.debug = 0
|
||||
target_name = '#curl/lib/.libs/libcurl-release.a'
|
||||
|
||||
g_env.Command( target_name, None, Action( build.Compile ) )
|
||||
|
||||
curl_libs = [ target_name, '/usr/lib/libz.a' ]
|
||||
Return( 'curl_libs' )
|
||||
111
neo/sys/scons/SConscript.game
Normal file
111
neo/sys/scons/SConscript.game
Normal file
@@ -0,0 +1,111 @@
|
||||
# -*- mode: python -*-
|
||||
# DOOM build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import sys, os
|
||||
import scons_utils
|
||||
|
||||
Import( 'GLOBALS' )
|
||||
Import( GLOBALS )
|
||||
|
||||
game_string = ' \
|
||||
AF.cpp \
|
||||
AFEntity.cpp \
|
||||
Actor.cpp \
|
||||
Camera.cpp \
|
||||
Entity.cpp \
|
||||
BrittleFracture.cpp \
|
||||
Fx.cpp \
|
||||
GameEdit.cpp \
|
||||
Game_local.cpp \
|
||||
Game_network.cpp \
|
||||
Item.cpp \
|
||||
IK.cpp \
|
||||
Light.cpp \
|
||||
Misc.cpp \
|
||||
Mover.cpp \
|
||||
Moveable.cpp \
|
||||
MultiplayerGame.cpp \
|
||||
Player.cpp \
|
||||
PlayerIcon.cpp \
|
||||
PlayerView.cpp \
|
||||
Projectile.cpp \
|
||||
Pvs.cpp \
|
||||
SecurityCamera.cpp \
|
||||
SmokeParticles.cpp \
|
||||
Sound.cpp \
|
||||
Target.cpp \
|
||||
Trigger.cpp \
|
||||
Weapon.cpp \
|
||||
WorldSpawn.cpp \
|
||||
ai/AAS.cpp \
|
||||
ai/AAS_debug.cpp \
|
||||
ai/AAS_pathing.cpp \
|
||||
ai/AAS_routing.cpp \
|
||||
ai/AI.cpp \
|
||||
ai/AI_events.cpp \
|
||||
ai/AI_pathing.cpp \
|
||||
ai/AI_Vagary.cpp \
|
||||
gamesys/DebugGraph.cpp \
|
||||
gamesys/Class.cpp \
|
||||
gamesys/Event.cpp \
|
||||
gamesys/SaveGame.cpp \
|
||||
gamesys/SysCmds.cpp \
|
||||
gamesys/SysCvar.cpp \
|
||||
gamesys/TypeInfo.cpp \
|
||||
anim/Anim.cpp \
|
||||
anim/Anim_Blend.cpp \
|
||||
anim/Anim_Import.cpp \
|
||||
anim/Anim_Testmodel.cpp \
|
||||
script/Script_Compiler.cpp \
|
||||
script/Script_Interpreter.cpp \
|
||||
script/Script_Program.cpp \
|
||||
script/Script_Thread.cpp \
|
||||
physics/Clip.cpp \
|
||||
physics/Force.cpp \
|
||||
physics/Force_Constant.cpp \
|
||||
physics/Force_Drag.cpp \
|
||||
physics/Force_Field.cpp \
|
||||
physics/Force_Spring.cpp \
|
||||
physics/Physics.cpp \
|
||||
physics/Physics_AF.cpp \
|
||||
physics/Physics_Actor.cpp \
|
||||
physics/Physics_Base.cpp \
|
||||
physics/Physics_Monster.cpp \
|
||||
physics/Physics_Parametric.cpp \
|
||||
physics/Physics_Player.cpp \
|
||||
physics/Physics_RigidBody.cpp \
|
||||
physics/Physics_Static.cpp \
|
||||
physics/Physics_StaticMulti.cpp \
|
||||
physics/Push.cpp'
|
||||
|
||||
if ( local_d3xp ):
|
||||
game_string += ' \
|
||||
Grabber.cpp \
|
||||
physics/Force_Grab.cpp'
|
||||
game_list = scons_utils.BuildList( 'd3xp', game_string )
|
||||
else:
|
||||
game_list = scons_utils.BuildList( 'game', game_string )
|
||||
|
||||
for i in range( len( game_list ) ):
|
||||
game_list[ i ] = '../../' + game_list[ i ]
|
||||
|
||||
local_env = g_game_env.Clone()
|
||||
if ( local_d3xp ):
|
||||
local_env.Append( CPPDEFINES = [ '_D3XP', 'CTF' ] )
|
||||
|
||||
if ( local_demo == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ 'ID_DEMO_BUILD' ] )
|
||||
|
||||
if ( local_gamedll == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ 'GAME_DLL' ] )
|
||||
ret = local_env.SharedLibrarySafe( local_env, 'game', game_list + idlib_objects )
|
||||
Return( 'ret' )
|
||||
else:
|
||||
ret_list = []
|
||||
for i in game_list:
|
||||
ret_list += local_env.StaticObject( source = i )
|
||||
Return( 'ret_list' )
|
||||
|
||||
|
||||
101
neo/sys/scons/SConscript.gl
Normal file
101
neo/sys/scons/SConscript.gl
Normal file
@@ -0,0 +1,101 @@
|
||||
# -*- mode: python -*-
|
||||
# DOOM build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
# various GL-related code:
|
||||
# GL logging functions (used on all platforms)
|
||||
# GLimp code (Linux only)
|
||||
# The C code is generated using M4 macros from a description of the GL API
|
||||
# on win32, the logging functions are generated ones and kept in the source
|
||||
# on other platforms, scons generates on the fly at build time
|
||||
|
||||
import time
|
||||
Import('GLOBALS')
|
||||
Import(GLOBALS)
|
||||
|
||||
# NOTE: make sure the .api files are in LF line endings, CRLF isn't working so well
|
||||
def build_logfuncs(env, target, source):
|
||||
import os, sys
|
||||
# search for the module - source repository might make things harder
|
||||
gllog_path = 'sys/gllog'
|
||||
if ( not os.path.exists( gllog_path + '/logfunc.py' ) ):
|
||||
gllog_path = '/var/local/Doom/neo/sys/gllog'
|
||||
sys.path.append( gllog_path )
|
||||
from logfunc import do_logfunc
|
||||
f_out = open('%s' % target[0], 'w')
|
||||
f_out.write('// generated file, do not modify!\n')
|
||||
f_out.write('// ' + time.asctime() + '\n')
|
||||
f_out.write('// see SConscript.gl and sys/gllog/\n\n')
|
||||
|
||||
f_in = open( gllog_path + '/gl.api', 'r')
|
||||
do_logfunc(f_in, f_out)
|
||||
f_in.close()
|
||||
|
||||
f_out.write('\n#ifdef __linux__\n\n')
|
||||
f_in = open( gllog_path + '/glX.api', 'r')
|
||||
do_logfunc(f_in, f_out)
|
||||
f_in.close()
|
||||
f_out.write('\n#endif\n\n')
|
||||
|
||||
f_out.write('\n#ifdef WIN32\n\n')
|
||||
f_in = open( gllog_path + '/wgl.api', 'r')
|
||||
do_logfunc(f_in, f_out)
|
||||
f_in.close()
|
||||
f_out.write('\n#endif\n\n')
|
||||
|
||||
f_out.close()
|
||||
|
||||
print 'Generated %s' % target[0]
|
||||
|
||||
gl_env = g_env.Clone()
|
||||
gl_env.Append( CPPPATH = '#' )
|
||||
gl_env.Append( CPPFLAGS = '-DGLIMP' )
|
||||
|
||||
if ( local_dedicated == 1 ):
|
||||
gl_env.Append( CPPFLAGS = '-DID_DEDICATED' )
|
||||
|
||||
# general M4 builder setup
|
||||
# files we are going to generate from their M4 counterparts
|
||||
|
||||
m4_list = (
|
||||
'../gllog/gl_extensions.cpp',
|
||||
'../linux/glimp_dlopen.cpp',
|
||||
'../linux/glimp_logging.cpp',
|
||||
'../linux/glimp_stub.cpp',
|
||||
'../linux/glimp_local.h' )
|
||||
|
||||
for i_m4 in m4_list:
|
||||
gl_env.M4( i_m4, i_m4 + '.m4' )
|
||||
gl_env.Depends( i_m4, '../gllog/gl_def.m4' )
|
||||
|
||||
# enable if you need to generate again
|
||||
# FIXME: conflicts when several environements are used. move that to seperate script
|
||||
#enforce = gl_env.M4( '#sys/linux/qgl_enforce.h', '../linux/qgl_enforce.h.m4' )
|
||||
#gl_env.Depends( enforce, '../gllog/gl_def.m4' )
|
||||
|
||||
# logging functions, python generated ( that's beyond my m4-fu )
|
||||
|
||||
gl_env.Depends( '../linux/glimp_logging.cpp', '../linux/glimp_logfuncs.cpp' )
|
||||
|
||||
logfuncs = gl_env.Command( '../linux/glimp_logfuncs.cpp', '../gllog/logfunc.py', build_logfuncs )
|
||||
gl_env.Depends( logfuncs, '../gllog/gl_def.m4' )
|
||||
|
||||
sources = []
|
||||
sources.append( '../gllog/gl_extensions.cpp' )
|
||||
|
||||
if ( local_dedicated == 1 ):
|
||||
sources.append( '../linux/glimp_stub.cpp' )
|
||||
else:
|
||||
sources.append( '../linux/glimp_dlopen.cpp' )
|
||||
sources.append( '../linux/glimp_logging.cpp' )
|
||||
|
||||
#if ( DEDICATED != '0' ):
|
||||
# sources.append( '../linux/glimp_stub.cpp' )
|
||||
#
|
||||
#if ( GL_HARDLINK == '0' ):
|
||||
# sources.append( '../linux/glimp_dlopen.cpp' )
|
||||
# sources.append( '../linux/glimp_logging.cpp' )
|
||||
|
||||
lib = gl_env.StaticLibrary( 'glimp', sources )
|
||||
#gl_env.Install( '../..', lib )
|
||||
81
neo/sys/scons/SConscript.idlib
Normal file
81
neo/sys/scons/SConscript.idlib
Normal file
@@ -0,0 +1,81 @@
|
||||
# -*- mode: python -*-
|
||||
# DOOM build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import scons_utils
|
||||
|
||||
Import( 'GLOBALS' )
|
||||
Import( GLOBALS )
|
||||
|
||||
idlib_string = ' \
|
||||
bv/Bounds.cpp \
|
||||
bv/Frustum.cpp \
|
||||
bv/Sphere.cpp \
|
||||
bv/Box.cpp \
|
||||
geometry/DrawVert.cpp \
|
||||
geometry/Winding2D.cpp \
|
||||
geometry/Surface_SweptSpline.cpp \
|
||||
geometry/Winding.cpp \
|
||||
geometry/Surface.cpp \
|
||||
geometry/Surface_Patch.cpp \
|
||||
geometry/TraceModel.cpp \
|
||||
geometry/JointTransform.cpp \
|
||||
hashing/CRC32.cpp \
|
||||
hashing/MD4.cpp \
|
||||
hashing/MD5.cpp \
|
||||
math/Angles.cpp \
|
||||
math/Lcp.cpp \
|
||||
math/Math.cpp \
|
||||
math/Matrix.cpp \
|
||||
math/Ode.cpp \
|
||||
math/Plane.cpp \
|
||||
math/Pluecker.cpp \
|
||||
math/Polynomial.cpp \
|
||||
math/Quat.cpp \
|
||||
math/Rotation.cpp \
|
||||
math/Simd.cpp \
|
||||
math/Simd_Generic.cpp \
|
||||
math/Vector.cpp \
|
||||
BitMsg.cpp \
|
||||
LangDict.cpp \
|
||||
Lexer.cpp \
|
||||
Lib.cpp \
|
||||
containers/HashIndex.cpp \
|
||||
Dict.cpp \
|
||||
Str.cpp \
|
||||
Parser.cpp \
|
||||
MapFile.cpp \
|
||||
CmdArgs.cpp \
|
||||
Token.cpp \
|
||||
Base64.cpp \
|
||||
Timer.cpp \
|
||||
Heap.cpp'
|
||||
|
||||
idlib_list = scons_utils.BuildList( 'idlib', idlib_string )
|
||||
|
||||
for i in range( len( idlib_list ) ):
|
||||
idlib_list[ i ] = '../../' + idlib_list[ i ]
|
||||
|
||||
local_env = g_env.Clone()
|
||||
local_env_noopt = g_env.Clone()
|
||||
|
||||
# max allowed -O1
|
||||
flags = OPTCPPFLAGS
|
||||
try:
|
||||
flags.remove( '-O3' )
|
||||
flags.insert( 0, '-O1' )
|
||||
except:
|
||||
pass
|
||||
local_env_noopt.Append( CPPFLAGS = flags )
|
||||
|
||||
ret_list = []
|
||||
if ( local_idlibpic == 0 ):
|
||||
for f in idlib_list:
|
||||
ret_list += local_env.StaticObject( source = f )
|
||||
ret_list += local_env_noopt.StaticObject( source = [ '../../idlib/bv/Frustum_gcc.cpp' ] )
|
||||
else:
|
||||
for f in idlib_list:
|
||||
ret_list += local_env.SharedObject( source = f )
|
||||
ret_list += local_env_noopt.SharedObject( source = [ '../../idlib/bv/Frustum_gcc.cpp' ] )
|
||||
Return( 'ret_list' )
|
||||
89
neo/sys/scons/SDK.py
Normal file
89
neo/sys/scons/SDK.py
Normal file
@@ -0,0 +1,89 @@
|
||||
import os, sys
|
||||
|
||||
import scons_utils
|
||||
|
||||
class idSDK( scons_utils.idSetupBase ):
|
||||
|
||||
def PreBuildSDK( self, build_path ):
|
||||
self.build_path = build_path
|
||||
print 'PreBuildSDK: ' + repr( build_path )
|
||||
for p in build_path:
|
||||
self.SimpleCommand( 'rm -rf ' + p )
|
||||
|
||||
def Visit( self, arg, dirname, names ):
|
||||
#print 'visit: %s %s' % ( dirname, repr( names ) )
|
||||
for i in names:
|
||||
if ( i[len(i)-2:] == '.h' or i[len(i)-4:] == '.cpp' ):
|
||||
self.file_list.append( os.path.join( dirname, i ) )
|
||||
|
||||
def BuildSDK( self, target = None, source = None, env = None ):
|
||||
print 'Building SDK release'
|
||||
# extract the file list
|
||||
self.file_list = []
|
||||
for p in self.build_path:
|
||||
os.path.walk( p, self.Visit, None )
|
||||
main_version = self.ExtractEngineVersion()
|
||||
version = self.ExtractBuildVersion()
|
||||
sdk_dirname = 'doom3-linux-%s.%s-sdk' % ( main_version, version )
|
||||
sdk_srcdir = os.path.join( sdk_dirname, 'src' )
|
||||
if ( os.path.exists( sdk_dirname ) ):
|
||||
self.SimpleCommand( 'rm -rf ' + sdk_dirname )
|
||||
self.SimpleCommand( 'mkdir -p ' + sdk_srcdir )
|
||||
for i in self.file_list:
|
||||
# NOTE: same len on all paths game/d3xp. probably breaks for anything else
|
||||
short = i[ len( self.build_path[0] ) + 1: ]
|
||||
target = os.path.join( sdk_srcdir, short )
|
||||
dir = os.path.dirname( target )
|
||||
if ( not os.path.exists( dir ) ):
|
||||
self.SimpleCommand( 'mkdir -p ' + dir )
|
||||
self.SimpleCommand( 'cp ' + i + ' ' + target )
|
||||
# remove a bunch of files from hardcoded list
|
||||
delete = [ 'framework/Compressor.h', 'framework/Console.h', 'framework/DemoChecksum.h', 'framework/DemoFile.h',
|
||||
'framework/EditField.h', 'framework/EventLoop.h', 'framework/KeyInput.h', 'framework/Session.h',
|
||||
'framework/async/AsyncClient.h', 'framework/async/AsyncNetwork.h', 'framework/async/AsyncServer.h',
|
||||
'framework/async/MsgChannel.h', 'framework/async/ServerScan.h',
|
||||
'mssdk', 'punkbuster', 'sys/osx',
|
||||
'tools/comafx/StdAfx.h', 'tools/compilers/compiler_public.h', 'tools/edit_public.h' ]
|
||||
for i in delete:
|
||||
target = os.path.join( sdk_srcdir, i )
|
||||
self.SimpleCommand( 'rm -rf ' + target )
|
||||
# copy files from a hardcoded list
|
||||
force_copy = [ 'SConstruct', 'sys/scons/SConscript.game', 'sys/scons/SConscript.idlib', 'sys/scons/scons_utils.py',
|
||||
'game/Game.def', 'd3xp/Game.def',
|
||||
'idlib/geometry/Surface_Polytope.cpp', 'idlib/hashing/CRC8.cpp', 'idlib/math/Complex.cpp',
|
||||
'idlib/math/Simd_3DNow.cpp', 'idlib/math/Simd_AltiVec.cpp', 'idlib/math/Simd_MMX.cpp', 'idlib/math/Simd_SSE.cpp',
|
||||
'idlib/math/Simd_SSE2.cpp', 'idlib/math/Simd_SSE3.cpp',
|
||||
'MayaImport/exporter.h', 'MayaImport/maya_main.cpp', 'MayaImport/maya_main.h',
|
||||
'MayaImport/mayaimport.def', 'MayaImport/Maya4.5/maya.h', 'MayaImport/maya5.0/maya.h',
|
||||
'MayaImport/Maya6.0/maya.h',
|
||||
'd3xp/EndLevel.cpp', 'd3xp/EndLevel.h'
|
||||
]
|
||||
for i in force_copy:
|
||||
target = os.path.join( sdk_srcdir, i )
|
||||
dir = os.path.dirname( target )
|
||||
if ( not os.path.exists( dir ) ):
|
||||
self.SimpleCommand( 'mkdir -p ' + dir )
|
||||
self.SimpleCommand( 'cp ' + i + ' ' + target )
|
||||
# copy sdk media
|
||||
if ( not os.path.exists( 'sys/linux/setup/media-sdk' ) ):
|
||||
print 'sdk media is missing (sys/linux/setup/media-sdk)'
|
||||
sys.exit( 1 )
|
||||
self.SimpleCommand( 'cp -R sys/linux/setup/media-sdk/* ' + sdk_dirname )
|
||||
# .zip files are auto-expanded by lokisetup, and there's no disable feature
|
||||
# zip up the maya toplevel stuff
|
||||
self.SimpleCommand( 'cd ' + sdk_dirname + ' && zip MayaSetupStuff.zip MayaImportx86* && rm MayaImportx86*' )
|
||||
# put the setup in
|
||||
self.SimpleCommand( 'cp -R -f sys/linux/setup/image-base/* ' + sdk_dirname )
|
||||
self.SimpleCommand( 'cp -R -f sys/linux/setup/image-sdk/* ' + sdk_dirname )
|
||||
# M4
|
||||
m4_dict = { 'M4_VERSION' : main_version }
|
||||
self.M4Processing( sdk_dirname + '/setup.data/setup.xml.in', m4_dict )
|
||||
# create the FreeBSD symlinks
|
||||
self.SimpleCommand( 'cd ' + sdk_dirname + '/setup.data/bin ; ln -s Linux FreeBSD' )
|
||||
# create amd64 symlinks
|
||||
self.SimpleCommand( 'cd ' + sdk_dirname + '/setup.data/bin/Linux ; ln -s x86 amd64' )
|
||||
# remove .svn entries
|
||||
self.SimpleCommand( 'find ' + sdk_dirname + ' -name \'.svn\' -type d | xargs rm -rf' )
|
||||
# put it together
|
||||
self.SimpleCommand( 'sys/linux/setup/makeself/makeself.sh ' + sdk_dirname + ' ' + sdk_dirname + '.x86.run \'DOOM III SDK\' ./setup.sh' )
|
||||
print 'TODO: do a build check in SDK directory'
|
||||
160
neo/sys/scons/Setup.py
Normal file
160
neo/sys/scons/Setup.py
Normal file
@@ -0,0 +1,160 @@
|
||||
import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, tempfile
|
||||
|
||||
import scons_utils
|
||||
|
||||
class idSetup( scons_utils.idSetupBase ):
|
||||
|
||||
# do not alter the sources, specially with strip and brandelfing
|
||||
def BuildSetup( self, target = None, source = None, env = None ):
|
||||
brandelf_path = source[0].abspath
|
||||
if ( target[0].path == 'setup-demo' ):
|
||||
print 'Building demo setup'
|
||||
demo_build = True
|
||||
core_path = source[1].abspath
|
||||
game_path = source[2].abspath
|
||||
else:
|
||||
print 'Building setup'
|
||||
demo_build = False
|
||||
core_path = source[1].abspath
|
||||
ded_path = source[2].abspath
|
||||
game_path = source[3].abspath
|
||||
d3xp_path = source[4].abspath
|
||||
# identify dynamic dependencies that we bundle with the binary
|
||||
ldd_deps = []
|
||||
ldd_output = self.SimpleCommand( 'ldd -r ' + core_path )
|
||||
pat = re.compile( '.*lib(stdc\+\+|gcc_s).* => (.*) \(.*\)' )
|
||||
for i in string.split( ldd_output, '\n' ):
|
||||
if ( pat.match( i ) ):
|
||||
ldd_deps.append( pat.split( i )[ 2 ] )
|
||||
# prep the binaries and update the paths
|
||||
temp_dir = tempfile.mkdtemp( prefix = 'doomsetup' )
|
||||
if ( demo_build ):
|
||||
self.SimpleCommand( 'cp %s %s/doom.x86' % ( core_path, temp_dir ) )
|
||||
core_path = '%s/doom.x86' % temp_dir
|
||||
self.SimpleCommand( 'cp %s %s/gamex86.so' % ( game_path, temp_dir ) )
|
||||
game_path = '%s/gamex86.so' % temp_dir
|
||||
self.SimpleCommand( 'strip ' + core_path )
|
||||
self.SimpleCommand( 'strip ' + game_path )
|
||||
self.SimpleCommand( brandelf_path + ' -t Linux ' + core_path )
|
||||
else:
|
||||
self.SimpleCommand( 'cp %s %s/doom.x86' % ( core_path, temp_dir ) )
|
||||
core_path = '%s/doom.x86' % temp_dir
|
||||
self.SimpleCommand( 'cp %s %s/doomded.x86' % ( ded_path, temp_dir ) )
|
||||
ded_path = '%s/doomded.x86' % temp_dir
|
||||
self.SimpleCommand( 'cp %s %s/gamex86-base.so' % ( game_path, temp_dir ) )
|
||||
game_path = '%s/gamex86-base.so' % temp_dir
|
||||
self.SimpleCommand( 'cp %s %s/gamex86-d3xp.so' % ( d3xp_path, temp_dir ) )
|
||||
d3xp_path = '%s/gamex86-d3xp.so' % temp_dir
|
||||
self.SimpleCommand( 'strip ' + core_path )
|
||||
self.SimpleCommand( 'strip ' + ded_path )
|
||||
self.SimpleCommand( 'strip ' + game_path )
|
||||
self.SimpleCommand( 'strip ' + d3xp_path )
|
||||
self.SimpleCommand( brandelf_path + ' -t Linux ' + core_path )
|
||||
self.SimpleCommand( brandelf_path + ' -t Linux ' + ded_path )
|
||||
# main version tag - ENGINE_VERSION in Licensee.h
|
||||
main_version = self.ExtractEngineVersion( )
|
||||
# build number
|
||||
version = self.ExtractBuildVersion( )
|
||||
if ( demo_build ):
|
||||
base_dirname = 'doom3-linux-%s.%s-demo' % ( main_version, version )
|
||||
else:
|
||||
base_dirname = 'doom3-linux-%s.%s' % ( main_version, version )
|
||||
if ( os.path.exists( base_dirname ) ):
|
||||
self.SimpleCommand( 'rm -rf %s' % base_dirname )
|
||||
self.SimpleCommand( 'mkdir %s' % base_dirname )
|
||||
self.SimpleCommand( 'cp -R sys/linux/setup/image-base/* ' + base_dirname )
|
||||
if ( demo_build ):
|
||||
self.SimpleCommand( 'cp -R -f sys/linux/setup/image-demo/* ' + base_dirname )
|
||||
else:
|
||||
self.SimpleCommand( 'cp -R -f sys/linux/setup/image/* ' + base_dirname )
|
||||
# process M4 stuff
|
||||
if ( demo_build ):
|
||||
m4_dict = { 'M4_PRODUCT' : 'doom3-demo', 'M4_DESC' : 'DOOM III demo', 'M4_VERSION' : '%s.%s' % ( main_version, version ) }
|
||||
else:
|
||||
m4_dict = { 'M4_PRODUCT' : 'doom3', 'M4_DESC' : 'DOOM III', 'M4_VERSION' : '%s.%s' % ( main_version, version ) }
|
||||
M4_LDD = ''
|
||||
for i in ldd_deps:
|
||||
if ( len( M4_LDD ) ):
|
||||
M4_LDD += '\n'
|
||||
M4_LDD += os.path.basename( i )
|
||||
m4_dict[ 'M4_LDD' ] = M4_LDD
|
||||
self.M4Processing( base_dirname + '/setup.data/setup.xml.in', m4_dict )
|
||||
# build the game pak
|
||||
if ( demo_build ):
|
||||
# the demo doesn't use a game pak
|
||||
self.SimpleCommand( 'cp ' + game_path + ' ' + base_dirname )
|
||||
else:
|
||||
# comment out this part to stick to game paks already provided in the media tree
|
||||
# print 'zipping together base game01.pk4'
|
||||
# game_zip = zipfile.ZipFile( 'sys/linux/setup/media/base/game01.pk4', 'w', zipfile.ZIP_DEFLATED )
|
||||
# game_zip.write( game_path, 'gamex86.so' )
|
||||
# game_zip.write( 'sys/linux/setup/binary.conf', 'binary.conf' )
|
||||
# game_zip.printdir()
|
||||
# game_zip.close()
|
||||
# print 'zipping together d3xp game01.pk4'
|
||||
# game_zip = zipfile.ZipFile( 'sys/linux/setup/media/d3xp/game01.pk4', 'w', zipfile.ZIP_DEFLATED )
|
||||
# game_zip.write( d3xp_path, 'gamex86.so' )
|
||||
# game_zip.write( 'sys/linux/setup/binary.conf', 'binary.conf' )
|
||||
# game_zip.printdir()
|
||||
# game_zip.close()
|
||||
pass
|
||||
# copy media
|
||||
if ( demo_build ):
|
||||
# we use a different repository path for large binary data
|
||||
# extract or symlink from media-demo
|
||||
if ( not os.path.exists( 'sys/linux/setup/media-demo' ) ):
|
||||
print 'demo media is missing (sys/linux/setup/media-demo)'
|
||||
sys.exit( 1 )
|
||||
# check the md5 of the demo pack to be sure
|
||||
md5sum = self.SimpleCommand( 'md5sum sys/linux/setup/media-demo/demo/demo00.pk4' )
|
||||
if ( md5sum != '70c2c63ef1190158f1ebd6c255b22d8e sys/linux/setup/media-demo/demo/demo00.pk4' ):
|
||||
print 'demo media has invalid checksum'
|
||||
sys.exit( 1 )
|
||||
self.SimpleCommand( 'cp -R sys/linux/setup/media-demo/* ' + base_dirname )
|
||||
else:
|
||||
if ( not os.path.exists( 'sys/linux/setup/media' ) ):
|
||||
print 'media is missing (sys/linux/setup/media)'
|
||||
sys.exit( 1 )
|
||||
# copy the CHANGES file
|
||||
self.SimpleCommand( 'cp -v sys/linux/setup/media/CHANGES ' + base_dirname )
|
||||
# copy out the pk4 files from the main media tree
|
||||
self.SimpleCommand( 'mkdir ' + base_dirname + '/base' )
|
||||
self.SimpleCommand( 'mkdir ' + base_dirname + '/d3xp' )
|
||||
self.SimpleCommand( 'find sys/linux/setup/media/ -name "*.pk4" | grep -v zpak | cut -b 23- | while read i ; do cp -v sys/linux/setup/media/$i ' + base_dirname + '/$i ; done' )
|
||||
# copy
|
||||
self.SimpleCommand( 'cp ' + core_path + ' ' + base_dirname + '/bin/Linux/x86' )
|
||||
if ( not demo_build ):
|
||||
self.SimpleCommand( 'cp ' + ded_path + ' ' + base_dirname + '/bin/Linux/x86' )
|
||||
for i in ldd_deps:
|
||||
self.SimpleCommand( 'cp ' + i + ' ' + base_dirname + '/' + os.path.basename( i ) )
|
||||
# punkbuster
|
||||
if ( not demo_build ):
|
||||
self.SimpleCommand( 'cp -R punkbuster/setup/pb ' + base_dirname )
|
||||
self.SimpleCommand( 'cp -Rf punkbuster/setup/linux/pb ' + base_dirname )
|
||||
self.SimpleCommand( 'cp sys/linux/setup/media/PB_EULA.txt ' + base_dirname + '/pb' )
|
||||
# put a version tag, xqf request
|
||||
f = open( base_dirname + '/version.info', 'w' )
|
||||
f.write( main_version + '\n' )
|
||||
f.write( self.ExtractProtocolVersion() + '\n' )
|
||||
f.close()
|
||||
# create the FreeBSD symlinks
|
||||
self.SimpleCommand( 'cd ' + base_dirname + '/bin ; ln -s Linux FreeBSD' )
|
||||
self.SimpleCommand( 'cd ' + base_dirname + '/setup.data/bin ; ln -s Linux FreeBSD' )
|
||||
# create amd64 symlinks
|
||||
self.SimpleCommand( 'cd ' + base_dirname + '/bin/Linux ; ln -s x86 amd64' )
|
||||
self.SimpleCommand( 'cd ' + base_dirname + '/setup.data/bin/Linux ; ln -s x86 amd64' )
|
||||
# remove .svn entries
|
||||
self.SimpleCommand( 'find ' + base_dirname + ' -name \'.svn\' -type d | xargs rm -rf' )
|
||||
# remove D3XP related stuff until final release
|
||||
#self.SimpleCommand( 'rm -rf ' + base_dirname + '/d3xp/*' )
|
||||
# package it
|
||||
target_setup = base_dirname + '.x86.run'
|
||||
if ( demo_build ):
|
||||
self.SimpleCommand( 'sys/linux/setup/makeself/makeself.sh ' + base_dirname + ' ' + target_setup + ' \'DOOM III demo\' ./setup.sh' )
|
||||
else:
|
||||
self.SimpleCommand( 'sys/linux/setup/makeself/makeself.sh ' + base_dirname + ' ' + target_setup + ' \'DOOM III\' ./setup.sh' )
|
||||
# take out the temp dir
|
||||
self.SimpleCommand( 'rm -rf %s' % temp_dir )
|
||||
# success
|
||||
return None
|
||||
|
||||
186
neo/sys/scons/scons_utils.py
Normal file
186
neo/sys/scons/scons_utils.py
Normal file
@@ -0,0 +1,186 @@
|
||||
# -*- mode: python -*-
|
||||
import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, tempfile
|
||||
import SCons
|
||||
|
||||
# need an Environment and a matching buffered_spawn API .. encapsulate
|
||||
class idBuffering:
|
||||
silent = False
|
||||
|
||||
def buffered_spawn( self, sh, escape, cmd, args, env ):
|
||||
stderr = StringIO.StringIO()
|
||||
stdout = StringIO.StringIO()
|
||||
command_string = ''
|
||||
for i in args:
|
||||
if ( len( command_string ) ):
|
||||
command_string += ' '
|
||||
command_string += i
|
||||
try:
|
||||
retval = self.env['PSPAWN']( sh, escape, cmd, args, env, stdout, stderr )
|
||||
except OSError, x:
|
||||
if x.errno != 10:
|
||||
raise x
|
||||
print 'OSError ignored on command: %s' % command_string
|
||||
retval = 0
|
||||
print command_string
|
||||
if ( retval != 0 or not self.silent ):
|
||||
sys.stdout.write( stdout.getvalue() )
|
||||
sys.stderr.write( stderr.getvalue() )
|
||||
return retval
|
||||
|
||||
class idSetupBase:
|
||||
|
||||
def SimpleCommand( self, cmd ):
|
||||
print cmd
|
||||
ret = commands.getstatusoutput( cmd )
|
||||
if ( len( ret[ 1 ] ) ):
|
||||
sys.stdout.write( ret[ 1 ] )
|
||||
sys.stdout.write( '\n' )
|
||||
if ( ret[ 0 ] != 0 ):
|
||||
raise 'command failed'
|
||||
return ret[ 1 ]
|
||||
|
||||
def TrySimpleCommand( self, cmd ):
|
||||
print cmd
|
||||
ret = commands.getstatusoutput( cmd )
|
||||
sys.stdout.write( ret[ 1 ] )
|
||||
|
||||
def M4Processing( self, file, d ):
|
||||
file_out = file[:-3]
|
||||
cmd = 'm4 '
|
||||
for ( key, val ) in d.items():
|
||||
cmd += '--define=%s="%s" ' % ( key, val )
|
||||
cmd += '%s > %s' % ( file, file_out )
|
||||
self.SimpleCommand( cmd )
|
||||
|
||||
def ExtractProtocolVersion( self ):
|
||||
f = open( 'framework/Licensee.h' )
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
|
||||
major = 'X'
|
||||
p = re.compile( '^#define ASYNC_PROTOCOL_MAJOR\t*(.*)' )
|
||||
for i in l:
|
||||
if ( p.match( i ) ):
|
||||
major = p.match( i ).group(1)
|
||||
break
|
||||
|
||||
f = open( 'framework/async/AsyncNetwork.h' )
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
|
||||
minor = 'X'
|
||||
p = re.compile( '^const int ASYNC_PROTOCOL_MINOR\t*= (.*);' )
|
||||
for i in l:
|
||||
if ( p.match( i ) ):
|
||||
minor = p.match( i ).group(1)
|
||||
break
|
||||
|
||||
return '%s.%s' % ( major, minor )
|
||||
|
||||
def ExtractEngineVersion( self ):
|
||||
f = open( 'framework/Licensee.h' )
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
|
||||
version = 'X'
|
||||
p = re.compile( '^#define.*ENGINE_VERSION\t*"DOOM (.*)"' )
|
||||
for i in l:
|
||||
if ( p.match( i ) ):
|
||||
version = p.match( i ).group(1)
|
||||
break
|
||||
|
||||
return version
|
||||
|
||||
def ExtractBuildVersion( self ):
|
||||
f = open( 'framework/BuildVersion.h' )
|
||||
l = f.readlines()[ 4 ]
|
||||
f.close()
|
||||
pat = re.compile( '.* = (.*);\n' )
|
||||
return pat.split( l )[ 1 ]
|
||||
|
||||
def checkLDD( target, source, env ):
|
||||
file = target[0]
|
||||
if (not os.path.isfile(file.abspath)):
|
||||
print('ERROR: CheckLDD: target %s not found\n' % target[0])
|
||||
Exit(1)
|
||||
( status, output ) = commands.getstatusoutput( 'ldd -r %s' % file )
|
||||
if ( status != 0 ):
|
||||
print 'ERROR: ldd command returned with exit code %d' % ldd_ret
|
||||
os.system( 'rm %s' % target[ 0 ] )
|
||||
sys.exit(1)
|
||||
lines = string.split( output, '\n' )
|
||||
have_undef = 0
|
||||
for i_line in lines:
|
||||
#print repr(i_line)
|
||||
regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)')
|
||||
if ( regex.match(i_line) ):
|
||||
symbol = regex.sub('\\1', i_line)
|
||||
try:
|
||||
env['ALLOWED_SYMBOLS'].index(symbol)
|
||||
except:
|
||||
have_undef = 1
|
||||
if ( have_undef ):
|
||||
print output
|
||||
print "ERROR: undefined symbols"
|
||||
os.system('rm %s' % target[0])
|
||||
sys.exit(1)
|
||||
|
||||
def SharedLibrarySafe( env, target, source ):
|
||||
ret = env.SharedLibrary( target, source )
|
||||
env.AddPostAction( ret, checkLDD )
|
||||
return ret
|
||||
|
||||
def NotImplementedStub( *whatever ):
|
||||
print 'Not Implemented'
|
||||
sys.exit( 1 )
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
class idGamePaks( idSetupBase ):
|
||||
|
||||
def BuildGamePak( self, target = None, source = None, env = None ):
|
||||
# NOTE: ew should have done with zipfile module
|
||||
temp_dir = tempfile.mkdtemp( prefix = 'gamepak' )
|
||||
self.SimpleCommand( 'cp %s %s' % ( source[0].abspath, os.path.join( temp_dir, 'gamex86.so' ) ) )
|
||||
self.SimpleCommand( 'strip %s' % os.path.join( temp_dir, 'gamex86.so' ) )
|
||||
self.SimpleCommand( 'echo 2 > %s' % ( os.path.join( temp_dir, 'binary.conf' ) ) )
|
||||
self.SimpleCommand( 'cd %s ; zip %s gamex86.so binary.conf' % ( temp_dir, os.path.join( temp_dir, target[0].abspath ) ) )
|
||||
self.SimpleCommand( 'rm -r %s' % temp_dir )
|
||||
return None
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
# get a clean error output when running multiple jobs
|
||||
def SetupBufferedOutput( env, silent ):
|
||||
buf = idBuffering()
|
||||
buf.silent = silent
|
||||
buf.env = env
|
||||
env['SPAWN'] = buf.buffered_spawn
|
||||
|
||||
# setup utilities on an environement
|
||||
def SetupUtils( env ):
|
||||
gamepaks = idGamePaks()
|
||||
env.BuildGamePak = gamepaks.BuildGamePak
|
||||
env.SharedLibrarySafe = SharedLibrarySafe
|
||||
try:
|
||||
import SDK
|
||||
sdk = SDK.idSDK()
|
||||
env.PreBuildSDK = sdk.PreBuildSDK
|
||||
env.BuildSDK = sdk.BuildSDK
|
||||
except:
|
||||
print 'SDK.py hookup failed'
|
||||
env.PreBuildSDK = NotImplementedStub
|
||||
env.BuildSDK = NotImplementedStub
|
||||
try:
|
||||
import Setup
|
||||
setup = Setup.idSetup()
|
||||
env.BuildSetup = setup.BuildSetup
|
||||
except:
|
||||
print 'Setup.py hookup failed'
|
||||
env.BuildSetup = NotImplementedStub
|
||||
|
||||
def BuildList( s_prefix, s_string ):
|
||||
s_list = string.split( s_string )
|
||||
for i in range( len( s_list ) ):
|
||||
s_list[ i ] = s_prefix + '/' + s_list[ i ]
|
||||
return s_list
|
||||
Reference in New Issue
Block a user