doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SDK.py
Go to the documentation of this file.
1 import os, sys
2 
3 import scons_utils
4 
6 
7  def PreBuildSDK( self, build_path ):
8  self.build_path = build_path
9  print 'PreBuildSDK: ' + repr( build_path )
10  for p in build_path:
11  self.SimpleCommand( 'rm -rf ' + p )
12 
13  def Visit( self, arg, dirname, names ):
14  #print 'visit: %s %s' % ( dirname, repr( names ) )
15  for i in names:
16  if ( i[len(i)-2:] == '.h' or i[len(i)-4:] == '.cpp' ):
17  self.file_list.append( os.path.join( dirname, i ) )
18 
19  def BuildSDK( self, target = None, source = None, env = None ):
20  print 'Building SDK release'
21  # extract the file list
22  self.file_list = []
23  for p in self.build_path:
24  os.path.walk( p, self.Visit, None )
25  main_version = self.ExtractEngineVersion()
26  version = self.ExtractBuildVersion()
27  sdk_dirname = 'doom3-linux-%s.%s-sdk' % ( main_version, version )
28  sdk_srcdir = os.path.join( sdk_dirname, 'src' )
29  if ( os.path.exists( sdk_dirname ) ):
30  self.SimpleCommand( 'rm -rf ' + sdk_dirname )
31  self.SimpleCommand( 'mkdir -p ' + sdk_srcdir )
32  for i in self.file_list:
33  # NOTE: same len on all paths game/d3xp. probably breaks for anything else
34  short = i[ len( self.build_path[0] ) + 1: ]
35  target = os.path.join( sdk_srcdir, short )
36  dir = os.path.dirname( target )
37  if ( not os.path.exists( dir ) ):
38  self.SimpleCommand( 'mkdir -p ' + dir )
39  self.SimpleCommand( 'cp ' + i + ' ' + target )
40  # remove a bunch of files from hardcoded list
41  delete = [ 'framework/Compressor.h', 'framework/Console.h', 'framework/DemoChecksum.h', 'framework/DemoFile.h',
42  'framework/EditField.h', 'framework/EventLoop.h', 'framework/KeyInput.h', 'framework/Session.h',
43  'framework/async/AsyncClient.h', 'framework/async/AsyncNetwork.h', 'framework/async/AsyncServer.h',
44  'framework/async/MsgChannel.h', 'framework/async/ServerScan.h',
45  'mssdk', 'punkbuster', 'sys/osx',
46  'tools/comafx/StdAfx.h', 'tools/compilers/compiler_public.h', 'tools/edit_public.h' ]
47  for i in delete:
48  target = os.path.join( sdk_srcdir, i )
49  self.SimpleCommand( 'rm -rf ' + target )
50  # copy files from a hardcoded list
51  force_copy = [ 'SConstruct', 'sys/scons/SConscript.game', 'sys/scons/SConscript.idlib', 'sys/scons/scons_utils.py',
52  'game/Game.def', 'd3xp/Game.def',
53  'idlib/geometry/Surface_Polytope.cpp', 'idlib/hashing/CRC8.cpp', 'idlib/math/Complex.cpp',
54  'idlib/math/Simd_3DNow.cpp', 'idlib/math/Simd_AltiVec.cpp', 'idlib/math/Simd_MMX.cpp', 'idlib/math/Simd_SSE.cpp',
55  'idlib/math/Simd_SSE2.cpp', 'idlib/math/Simd_SSE3.cpp',
56  'MayaImport/exporter.h', 'MayaImport/maya_main.cpp', 'MayaImport/maya_main.h',
57  'MayaImport/mayaimport.def', 'MayaImport/Maya4.5/maya.h', 'MayaImport/maya5.0/maya.h',
58  'MayaImport/Maya6.0/maya.h',
59  'd3xp/EndLevel.cpp', 'd3xp/EndLevel.h'
60  ]
61  for i in force_copy:
62  target = os.path.join( sdk_srcdir, i )
63  dir = os.path.dirname( target )
64  if ( not os.path.exists( dir ) ):
65  self.SimpleCommand( 'mkdir -p ' + dir )
66  self.SimpleCommand( 'cp ' + i + ' ' + target )
67  # copy sdk media
68  if ( not os.path.exists( 'sys/linux/setup/media-sdk' ) ):
69  print 'sdk media is missing (sys/linux/setup/media-sdk)'
70  sys.exit( 1 )
71  self.SimpleCommand( 'cp -R sys/linux/setup/media-sdk/* ' + sdk_dirname )
72  # .zip files are auto-expanded by lokisetup, and there's no disable feature
73  # zip up the maya toplevel stuff
74  self.SimpleCommand( 'cd ' + sdk_dirname + ' && zip MayaSetupStuff.zip MayaImportx86* && rm MayaImportx86*' )
75  # put the setup in
76  self.SimpleCommand( 'cp -R -f sys/linux/setup/image-base/* ' + sdk_dirname )
77  self.SimpleCommand( 'cp -R -f sys/linux/setup/image-sdk/* ' + sdk_dirname )
78  # M4
79  m4_dict = { 'M4_VERSION' : main_version }
80  self.M4Processing( sdk_dirname + '/setup.data/setup.xml.in', m4_dict )
81  # create the FreeBSD symlinks
82  self.SimpleCommand( 'cd ' + sdk_dirname + '/setup.data/bin ; ln -s Linux FreeBSD' )
83  # create amd64 symlinks
84  self.SimpleCommand( 'cd ' + sdk_dirname + '/setup.data/bin/Linux ; ln -s x86 amd64' )
85  # remove .svn entries
86  self.SimpleCommand( 'find ' + sdk_dirname + ' -name \'.svn\' -type d | xargs rm -rf' )
87  # put it together
88  self.SimpleCommand( 'sys/linux/setup/makeself/makeself.sh ' + sdk_dirname + ' ' + sdk_dirname + '.x86.run \'DOOM III SDK\' ./setup.sh' )
89  print 'TODO: do a build check in SDK directory'
def BuildSDK
Definition: SDK.py:19
file_list
Definition: SDK.py:22
def Visit
Definition: SDK.py:13
def PreBuildSDK
Definition: SDK.py:7
Definition: SDK.py:5
build_path
Definition: SDK.py:8