Get rid of the scons build system

This only works for linux and cmake works on all platforms.
Hopefully this prevents invalid reports.
This commit is contained in:
dhewg 2012-01-14 14:01:59 +01:00
parent 1a5499e6f5
commit dca4721c8f
8 changed files with 0 additions and 1402 deletions

1
.gitignore vendored
View file

@ -2,4 +2,3 @@ build
*~
.*.swp
*.pyc
neo/site.conf

View file

@ -1,496 +0,0 @@
# -*- mode: python -*-
# DOOM build script
# TTimo <ttimo@idsoftware.com>
# http://scons.sourceforge.net
import sys, os, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, string
import SCons
sys.path.append( 'sys/scons' )
import scons_utils
conf_filename='site.conf'
# choose configuration variables which should be saved between runs
# ( we handle all those as strings )
serialized=['CC', 'CXX', 'X86', 'BUILD', 'IDNET_HOST', 'DEDICATED',
'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS',
'TARGET_CORE', 'TARGET_GAME', 'TARGET_D3XP', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL',
'BUILD_ROOT', 'BUILD_GAMEPAK', 'BASEFLAGS' ]
# global build mode ------------------------------
g_sdk = not os.path.exists( 'sys/scons/SConscript.core' )
# ------------------------------------------------
# help -------------------------------------------
help_string = """
Usage: scons [OPTIONS] [TARGET] [CONFIG]
[OPTIONS] and [TARGET] are covered in command line options, use scons -H
[CONFIG]: KEY="VALUE" [...]
a number of configuration options saved between runs in the """ + conf_filename + """ file
erase """ + conf_filename + """ to start with default settings again
CC (default gcc)
CXX (default g++)
Specify C and C++ compilers (defaults gcc and g++)
ex: CC="gcc-3.3"
You can use ccache and distcc, for instance:
CC="ccache distcc gcc" CXX="ccache distcc g++"
BUILD (default debug)
Use debug-all/debug/release to select build settings
ex: BUILD="release"
debug-all: no optimisations, debugging symbols
debug: -O -g
release: all optimisations, including CPU target etc.
BUILD_ROOT (default 'build')
change the build root directory
TARGET_GAME (default 1)
Build the base game code
TARGET_D3XP (default 1)
Build the d3xp game code
BUILD_GAMEPAK (default 0)
Build a game pak
BASEFLAGS (default '')
Add compile flags
X86 (default 0)
cross compile for x86 (only applicable on x86_64)
NOCONF (default 0, not saved)
ignore site configuration and use defaults + command line only
"""
if ( not g_sdk ):
help_string += """
DEDICATED (default 0)
Control regular / dedicated type of build:
0 - client
1 - dedicated server
2 - both
TARGET_CORE (default 1)
Build the core
TARGET_MONO (default 0)
Build a monolithic binary
TARGET_DEMO (default 0)
Build demo client ( both a core and game, no mono )
NOTE: if you *only* want the demo client, set TARGET_CORE and TARGET_GAME to 0
IDNET_HOST (default to source hardcoded)
Override builtin IDNET_HOST with your own settings
DEBUG_MEMORY (default 0)
Enables memory logging to file
LIBC_MALLOC (default 1)
Toggle idHeap memory / libc malloc usage
When libc malloc is on, memory size statistics are wrong ( no _msize )
ID_NOLANADDRESS (default 0)
Don't recognize any IP as LAN address. This is useful when debugging network
code where LAN / not LAN influences application behaviour
SETUP (default 0, not saved)
build a setup. implies release build
SDK (default 0, not saved)
build an SDK release
NOCURL (default 0)
set to 1 to disable usage of libcurl and http/ftp downloads feature
"""
Help( help_string )
# end help ---------------------------------------
# sanity -----------------------------------------
EnsureSConsVersion( 0, 96 )
# end sanity -------------------------------------
# system detection -------------------------------
# CPU type
g_cpu = ''
uname = commands.getoutput('uname -m')
if uname == 'x86_64':
g_cpu = 'x86_64'
if len(g_cpu) < 1:
exp = re.compile('.*i?86.*')
if exp.match(uname):
g_cpu = 'x86'
if len(g_cpu) < 1:
uname = commands.getoutput('uname -p')
if (uname == 'powerpc'):
g_cpu = 'ppc'
if len(g_cpu) < 1:
g_cpu = 'cpu'
g_os = commands.getoutput('uname -s')
# end system detection ---------------------------
# default settings -------------------------------
CC = 'gcc'
CXX = 'g++'
BUILD = 'debug'
X86 = '0'
DEDICATED = '0'
TARGET_CORE = '1'
TARGET_GAME = '1'
TARGET_D3XP = '1'
TARGET_MONO = '0'
TARGET_DEMO = '0'
IDNET_HOST = ''
DEBUG_MEMORY = '0'
LIBC_MALLOC = '1'
ID_NOLANADDRESS = '0'
BUILD_ROOT = 'build'
SETUP = '0'
SDK = '0'
NOCONF = '0'
NOCURL = '0'
BUILD_GAMEPAK = '0'
BASEFLAGS = ''
# end default settings ---------------------------
# site settings ----------------------------------
if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
site_dict = {}
if (os.path.exists(conf_filename)):
site_file = open(conf_filename, 'r')
p = pickle.Unpickler(site_file)
site_dict = p.load()
print 'Loading build configuration from ' + conf_filename + ':'
for k, v in site_dict.items():
exec_cmd = k + '=\'' + v + '\''
print ' ' + exec_cmd
exec(exec_cmd)
else:
print 'Site settings ignored'
# end site settings ------------------------------
# command line settings --------------------------
for k in ARGUMENTS.keys():
exec_cmd = k + '=\'' + ARGUMENTS[k] + '\''
print 'Command line: ' + exec_cmd
exec( exec_cmd )
# end command line settings ----------------------
# save site configuration ----------------------
if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
for k in serialized:
exec_cmd = 'site_dict[\'' + k + '\'] = ' + k
exec(exec_cmd)
site_file = open(conf_filename, 'w')
p = pickle.Pickler(site_file)
p.dump(site_dict)
site_file.close()
# end save site configuration ------------------
# configuration rules --------------------------
if ( SETUP != '0' ):
DEDICATED = '2'
BUILD = 'release'
if ( g_sdk or SDK != '0' ):
TARGET_CORE = '0'
TARGET_GAME = '1'
TARGET_D3XP = '1'
TARGET_MONO = '0'
TARGET_DEMO = '0'
# end configuration rules ----------------------
# general configuration, target selection --------
# common flags
# BASE + CORE + OPT for engine
# BASE + GAME + OPT for game
# _noopt versions of the environements are built without the OPT
BASECPPFLAGS = [ ]
CORECPPPATH = [ ]
CORELIBPATH = [ ]
CORECPPFLAGS = [ ]
GAMECPPFLAGS = [ ]
BASELINKFLAGS = [ ]
CORELINKFLAGS = [ ]
# for release build, further optimisations that may not work on all files
OPTCPPFLAGS = [ ]
if (g_cpu == 'x86_64' and X86 == '1'):
print('cross compiling for x86')
g_cpu = 'x86'
BASECPPFLAGS.append('-m32')
BASELINKFLAGS.append('-m32')
g_build = '%s/%s-%s' % (BUILD_ROOT, g_cpu, BUILD)
SConsignFile( g_build + '/scons.signatures' )
if ( DEBUG_MEMORY != '0' ):
g_build += '-debugmem'
if ( LIBC_MALLOC != '1' ):
g_build += '-nolibcmalloc'
LINK = CXX
BASECPPFLAGS.extend( BASEFLAGS.split(' ') )
BASECPPFLAGS.append( '-pipe' )
# warn all
BASECPPFLAGS.append( '-Wall' )
BASECPPFLAGS.append( '-Wno-unknown-pragmas' )
# gcc 4.x option only - only export what we mean to from the game SO
BASECPPFLAGS.append( '-fvisibility=hidden' )
if ( "BSD" in g_os ):
BASECPPFLAGS.append( '-I/usr/local/include' )
BASECPPFLAGS.append( '-I/usr/local/include/SDL' )
BASELINKFLAGS.append('-L/usr/local/lib')
else:
BASECPPFLAGS.append( '-I/usr/include/SDL' )
BASECPPFLAGS.append( '-I.' )
if ( g_sdk or SDK != '0' ):
BASECPPFLAGS.append( '-D_D3SDK' )
if ( BUILD == 'debug-all' ):
OPTCPPFLAGS = [ '-g', '-D_DEBUG' ]
elif ( BUILD == 'debug' ):
OPTCPPFLAGS = [ '-g', '-O1', '-D_DEBUG' ]
elif ( BUILD == 'release' ):
# -fomit-frame-pointer: "-O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging."
# on x86 have to set it explicitely
# -finline-functions: implicit at -O3
# -fschedule-insns2: implicit at -O2
# no-unsafe-math-optimizations: that should be on by default really. hit some wonko bugs in physics code because of that
OPTCPPFLAGS = [ '-O3', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ]
if (g_cpu == 'x86'):
OPTCPPFLAGS.append('-march=pentium3')
else:
print 'Unknown build configuration ' + BUILD
sys.exit(0)
if ( DEBUG_MEMORY != '0' ):
BASECPPFLAGS += [ '-DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE' ]
if ( LIBC_MALLOC != '1' ):
BASECPPFLAGS.append( '-DUSE_LIBC_MALLOC=0' )
if ( len( IDNET_HOST ) ):
CORECPPFLAGS.append( '-DIDNET_HOST=\\"%s\\"' % IDNET_HOST)
if ( ID_NOLANADDRESS != '0' ):
CORECPPFLAGS.append( '-DID_NOLANADDRESS' )
# TODO fix these warnings
BASECPPFLAGS.append('-Wno-sign-compare')
BASECPPFLAGS.append('-Wno-switch')
BASECPPFLAGS.append('-Wno-format-security')
# create the build environements
g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH )
scons_utils.SetupUtils( g_base_env )
g_env = g_base_env.Clone()
g_env['CPPFLAGS'] += OPTCPPFLAGS
g_env['CPPFLAGS'] += CORECPPFLAGS
g_env['LINKFLAGS'] += CORELINKFLAGS
g_env_noopt = g_base_env.Clone()
g_env_noopt['CPPFLAGS'] += CORECPPFLAGS
g_game_env = g_base_env.Clone()
g_game_env['CPPFLAGS'] += OPTCPPFLAGS
g_game_env['CPPFLAGS'] += GAMECPPFLAGS
# maintain this dangerous optimization off at all times
g_env.Append( CPPFLAGS = '-fno-strict-aliasing' )
g_env_noopt.Append( CPPFLAGS = '-fno-strict-aliasing' )
g_game_env.Append( CPPFLAGS = '-fno-strict-aliasing' )
# mark the globals
local_dedicated = 0
# 0 for monolithic build
local_gamedll = 1
# carry around rather than using .a, avoids binutils bugs
idlib_objects = []
game_objects = []
local_demo = 0
# curl usage. there is a global toggle flag
local_curl = 0
# if idlib should produce PIC objects ( depending on core or game inclusion )
local_idlibpic = 0
# switch between base game build and d3xp game build
local_d3xp = 0
GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp OPTCPPFLAGS'
# end general configuration ----------------------
# targets ----------------------------------------
Export( 'GLOBALS ' + GLOBALS )
doom = None
doomded = None
game = None
doom_mono = None
doom_demo = None
game_demo = None
# build curl if needed
if ( NOCURL == '0' and ( TARGET_CORE == '1' or TARGET_MONO == '1' ) ):
local_curl = 1
Export( 'GLOBALS ' + GLOBALS )
if ( TARGET_CORE == '1' ):
local_gamedll = 1
local_demo = 0
local_idlibpic = 0
if ( DEDICATED == '0' or DEDICATED == '2' ):
local_dedicated = 0
Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/obj-core', '.', duplicate = 0 )
idlib_objects = SConscript( g_build + '/obj-core/sys/scons/SConscript.idlib' )
Export( 'GLOBALS ' + GLOBALS ) # update idlib_objects
doom = SConscript( g_build + '/obj-core/sys/scons/SConscript.core' )
g_env.Default(doom)
if ( DEDICATED == '1' or DEDICATED == '2' ):
local_dedicated = 1
Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/dedicated', '.', duplicate = 0 )
idlib_objects = SConscript( g_build + '/dedicated/sys/scons/SConscript.idlib' )
Export( 'GLOBALS ' + GLOBALS )
doomded = SConscript( g_build + '/dedicated/sys/scons/SConscript.core' )
g_env.Default(doomded)
if ( TARGET_GAME == '1' or TARGET_D3XP == '1' ):
local_gamedll = 1
local_demo = 0
local_dedicated = 0
local_idlibpic = 1
Export( 'GLOBALS ' + GLOBALS )
dupe = 0
if ( SDK == '1' ):
# building an SDK, use scons for dependencies walking
# clear the build directory to be safe
g_env.PreBuildSDK( [ g_build + '/game', g_build + '/d3xp' ] )
dupe = 1
VariantDir( g_build + '/obj-base', '.', duplicate = dupe )
idlib_objects = SConscript( g_build + '/obj-base/sys/scons/SConscript.idlib' )
if ( TARGET_GAME == '1' ):
local_d3xp = 0
Export( 'GLOBALS ' + GLOBALS )
game = SConscript( g_build + '/obj-base/sys/scons/SConscript.game' )
g_env.Default(game)
if ( BUILD_GAMEPAK == '1' ):
Command( '#game01-base.pk4', [ game, game ], Action( g_env.BuildGamePak ) )
if ( TARGET_D3XP == '1' ):
# uses idlib as compiled for game/
local_d3xp = 1
VariantDir( g_build + '/obj-d3xp', '.', duplicate = dupe )
Export( 'GLOBALS ' + GLOBALS )
d3xp = SConscript( g_build + '/obj-d3xp/sys/scons/SConscript.game' )
g_env.Default(d3xp)
if ( BUILD_GAMEPAK == '1' ):
Command( '#game01-d3xp.pk4', [ d3xp, d3xp ], Action( g_env.BuildGamePak ) )
if ( TARGET_MONO == '1' ):
# NOTE: no D3XP atm. add a TARGET_MONO_D3XP
local_gamedll = 0
local_dedicated = 0
local_demo = 0
local_idlibpic = 0
local_d3xp = 0
Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/mono', '.', duplicate = 0 )
idlib_objects = SConscript( g_build + '/mono/sys/scons/SConscript.idlib' )
game_objects = SConscript( g_build + '/mono/sys/scons/SConscript.game' )
Export( 'GLOBALS ' + GLOBALS )
doom_mono = SConscript( g_build + '/mono/sys/scons/SConscript.core' )
g_env.Default(doom_mono)
if ( TARGET_DEMO == '1' ):
# NOTE: no D3XP atm. add a TARGET_DEMO_D3XP
local_demo = 1
local_dedicated = 0
local_gamedll = 1
local_idlibpic = 0
local_curl = 0
local_d3xp = 0
Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/demo', '.', duplicate = 0 )
idlib_objects = SConscript( g_build + '/demo/sys/scons/SConscript.idlib' )
Export( 'GLOBALS ' + GLOBALS )
doom_demo = SConscript( g_build + '/demo/sys/scons/SConscript.core' )
g_env.Default(doom_demo)
local_idlibpic = 1
Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/demo/game', '.', duplicate = 0 )
idlib_objects = SConscript( g_build + '/demo/game/sys/scons/SConscript.idlib' )
Export( 'GLOBALS ' + GLOBALS )
game_demo = SConscript( g_build + '/demo/game/sys/scons/SConscript.game' )
g_env.Default(doom_demo)
if ( SETUP != '0' ):
brandelf = Program( 'brandelf', 'sys/linux/setup/brandelf.c' )
if ( TARGET_CORE == '1' and TARGET_GAME == '1' and TARGET_D3XP == '1' ):
setup = Command( 'setup', [ brandelf, doom, doomded, game, d3xp ], Action( g_env.BuildSetup ) )
else:
print 'Skipping main setup: TARGET_CORE == 0 or TARGET_GAME == 0'
if ( TARGET_DEMO == '1' ):
setup_demo = Command( 'setup-demo', [ brandelf, doom_demo, game_demo ], Action( g_env.BuildSetup ) )
# if building two setups, make sure JOBS doesn't parallelize them
try:
g_env.Depends( setup_demo, setup )
except:
pass
else:
print 'Skipping demo setup ( TARGET_DEMO == 0 )'
if ( SDK != '0' ):
setup_sdk = Command( 'sdk', [ ], Action( g_env.BuildSDK ) )
g_env.Depends( setup_sdk, [ game, d3xp ] )
# end targets ------------------------------------

View file

@ -1,271 +0,0 @@
# -*- mode: python -*-
# DOOM build script
# TTimo <ttimo@idsoftware.com>
# http://scons.sourceforge.net
import sys, os
import scons_utils
Import( 'GLOBALS' )
Import( GLOBALS )
renderer_string = ' \
jpeg_memory_src.cpp \
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 \
draw_arb.cpp \
draw_arb2.cpp \
draw_common.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 \
cpu.cpp \
threads.cpp \
posix/posix_net.cpp \
posix/posix_main.cpp \
posix/posix_signal.cpp \
linux/main.cpp \
stub/util_stub.cpp'
if ( local_dedicated == 0 ):
sys_string += ' \
glimp.cpp \
events.cpp'
else:
sys_string += ' \
stub/stub_gl.cpp \
stub/openal_stub.cpp \
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 + renderer_list + ui_list \
+ cm_list + dmap_list + renderbump_list + aas_list + roq_list \
+ snd_list + sys_list + tools_list
for i in range( len( core_list ) ):
core_list[ i ] = '../../' + core_list[ i ]
local_env = g_env.Clone()
if ( local_dedicated == 1 ):
local_env.Append( CPPDEFINES = [ 'ID_DEDICATED' ] )
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' ] )
local_env.Append( LIBS = [ 'SDL', 'SDLmain', 'jpeg', 'vorbisfile' ] )
if ( local_dedicated == 0 ):
local_env.Append( LIBS = [ 'GL' ] )
if (g_os == "Linux"):
local_env.Append( LIBS = [ 'dl' ] )
if ( local_curl == 1 ):
local_env.Append( LIBS = [ 'curl', 'z' ] )
if ( local_dedicated == 0 ):
local_env.Append( LIBS = [ 'openal' ] )
source_list = core_list
source_list += idlib_objects
if ( local_gamedll == 0 ):
source_list += game_objects
basename = 'doom'
if ( local_dedicated == 1 ):
basename += 'ded'
elif ( local_gamedll == 0 ):
basename += '-mon'
if ( local_demo == 1 ):
basename += '-demo'
d3wm = local_env.Program( target = '%s/%s.%s' % (g_build, basename, g_cpu), source = source_list )
Return( 'd3wm' )

View file

@ -1,115 +0,0 @@
# -*- 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_name = 'd3xp'
game_list = scons_utils.BuildList( 'd3xp', game_string )
else:
game_name = 'base'
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' ] )
local_env.Append( CPPFLAGS = [ '-Id3xp' ] )
else:
local_env.Append( CPPFLAGS = [ '-Igame' ] )
if ( local_demo == 1 ):
local_env.Append( CPPDEFINES = [ 'ID_DEMO_BUILD' ] )
if ( local_gamedll == 1 ):
local_env.Append( CPPDEFINES = [ 'GAME_DLL' ] )
ret = local_env.SharedLibrary( '%s/game%s-%s.so' % (g_build, g_cpu, game_name), game_list + idlib_objects, SHLIBPREFIX='' )
Return( 'ret' )
else:
ret_list = []
for i in game_list:
ret_list += local_env.StaticObject( source = i )
Return( 'ret_list' )

View file

@ -1,85 +0,0 @@
# -*- 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/Simd_AltiVec.cpp \
math/Simd_MMX.cpp \
math/Simd_3DNow.cpp \
math/Simd_SSE.cpp \
math/Simd_SSE2.cpp \
math/Simd_SSE3.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 )
else:
for f in idlib_list:
ret_list += local_env.SharedObject( source = f )
Return( 'ret_list' )

View file

@ -1,89 +0,0 @@
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'

View file

@ -1,159 +0,0 @@
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

View file

@ -1,186 +0,0 @@
# -*- 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, SHLIBPREFIX='' )
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