1 import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, tempfile
8 def BuildSetup( self, target = None, source = None, env = None ):
9 brandelf_path = source[0].abspath
10 if ( target[0].path ==
'setup-demo' ):
11 print 'Building demo setup'
13 core_path = source[1].abspath
14 game_path = source[2].abspath
16 print 'Building setup'
18 core_path = source[1].abspath
19 ded_path = source[2].abspath
20 game_path = source[3].abspath
21 d3xp_path = source[4].abspath
25 pat = re.compile(
'.*lib(stdc\+\+|gcc_s).* => (.*) \(.*\)' )
26 for i
in string.split( ldd_output,
'\n' ):
27 if ( pat.match( i ) ):
28 ldd_deps.append( pat.split( i )[ 2 ] )
30 temp_dir = tempfile.mkdtemp( prefix =
'doomsetup' )
32 self.
SimpleCommand(
'cp %s %s/doom.x86' % ( core_path, temp_dir ) )
33 core_path =
'%s/doom.x86' % temp_dir
34 self.
SimpleCommand(
'cp %s %s/gamex86.so' % ( game_path, temp_dir ) )
35 game_path =
'%s/gamex86.so' % temp_dir
38 self.
SimpleCommand( brandelf_path +
' -t Linux ' + core_path )
40 self.
SimpleCommand(
'cp %s %s/doom.x86' % ( core_path, temp_dir ) )
41 core_path =
'%s/doom.x86' % temp_dir
42 self.
SimpleCommand(
'cp %s %s/doomded.x86' % ( ded_path, temp_dir ) )
43 ded_path =
'%s/doomded.x86' % temp_dir
44 self.
SimpleCommand(
'cp %s %s/gamex86-base.so' % ( game_path, temp_dir ) )
45 game_path =
'%s/gamex86-base.so' % temp_dir
46 self.
SimpleCommand(
'cp %s %s/gamex86-d3xp.so' % ( d3xp_path, temp_dir ) )
47 d3xp_path =
'%s/gamex86-d3xp.so' % temp_dir
52 self.
SimpleCommand( brandelf_path +
' -t Linux ' + core_path )
59 base_dirname =
'doom3-linux-%s.%s-demo' % ( main_version, version )
61 base_dirname =
'doom3-linux-%s.%s' % ( main_version, version )
62 if ( os.path.exists( base_dirname ) ):
65 self.
SimpleCommand(
'cp -R sys/linux/setup/image-base/* ' + base_dirname )
67 self.
SimpleCommand(
'cp -R -f sys/linux/setup/image-demo/* ' + base_dirname )
69 self.
SimpleCommand(
'cp -R -f sys/linux/setup/image/* ' + base_dirname )
72 m4_dict = {
'M4_PRODUCT' :
'doom3-demo',
'M4_DESC' :
'DOOM III demo',
'M4_VERSION' :
'%s.%s' % ( main_version, version ) }
74 m4_dict = {
'M4_PRODUCT' :
'doom3',
'M4_DESC' :
'DOOM III',
'M4_VERSION' :
'%s.%s' % ( main_version, version ) }
79 M4_LDD += os.path.basename( i )
80 m4_dict[
'M4_LDD' ] = M4_LDD
81 self.
M4Processing( base_dirname +
'/setup.data/setup.xml.in', m4_dict )
105 if (
not os.path.exists(
'sys/linux/setup/media-demo' ) ):
106 print 'demo media is missing (sys/linux/setup/media-demo)'
109 md5sum = self.
SimpleCommand(
'md5sum sys/linux/setup/media-demo/demo/demo00.pk4' )
110 if ( md5sum !=
'70c2c63ef1190158f1ebd6c255b22d8e sys/linux/setup/media-demo/demo/demo00.pk4' ):
111 print 'demo media has invalid checksum'
113 self.
SimpleCommand(
'cp -R sys/linux/setup/media-demo/* ' + base_dirname )
115 if (
not os.path.exists(
'sys/linux/setup/media' ) ):
116 print 'media is missing (sys/linux/setup/media)'
119 self.
SimpleCommand(
'cp -v sys/linux/setup/media/CHANGES ' + base_dirname )
123 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' )
125 self.
SimpleCommand(
'cp ' + core_path +
' ' + base_dirname +
'/bin/Linux/x86' )
126 if (
not demo_build ):
127 self.
SimpleCommand(
'cp ' + ded_path +
' ' + base_dirname +
'/bin/Linux/x86' )
129 self.
SimpleCommand(
'cp ' + i +
' ' + base_dirname +
'/' + os.path.basename( i ) )
131 if (
not demo_build ):
132 self.
SimpleCommand(
'cp -R punkbuster/setup/pb ' + base_dirname )
133 self.
SimpleCommand(
'cp -Rf punkbuster/setup/linux/pb ' + base_dirname )
134 self.
SimpleCommand(
'cp sys/linux/setup/media/PB_EULA.txt ' + base_dirname +
'/pb' )
136 f = open( base_dirname +
'/version.info',
'w' )
137 f.write( main_version +
'\n' )
141 self.
SimpleCommand(
'cd ' + base_dirname +
'/bin ; ln -s Linux FreeBSD' )
142 self.
SimpleCommand(
'cd ' + base_dirname +
'/setup.data/bin ; ln -s Linux FreeBSD' )
144 self.
SimpleCommand(
'cd ' + base_dirname +
'/bin/Linux ; ln -s x86 amd64' )
145 self.
SimpleCommand(
'cd ' + base_dirname +
'/setup.data/bin/Linux ; ln -s x86 amd64' )
147 self.
SimpleCommand(
'find ' + base_dirname +
' -name \'.svn\' -type d | xargs rm -rf' )
151 target_setup = base_dirname +
'.x86.run'
153 self.
SimpleCommand(
'sys/linux/setup/makeself/makeself.sh ' + base_dirname +
' ' + target_setup +
' \'DOOM III demo\' ./setup.sh' )
155 self.
SimpleCommand(
'sys/linux/setup/makeself/makeself.sh ' + base_dirname +
' ' + target_setup +
' \'DOOM III\' ./setup.sh' )
def ExtractProtocolVersion