AMBuildScript
author Nicholas Hastings <skamonkey@gmail.com>
Wed Jul 31 06:49:21 2013 -0400 (2013-07-31)
changeset 850 3d9258ef9a30
parent 847 966eb4be6316
child 856 4bf3ed73bba4
permissions -rw-r--r--
Split TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5667, r=asherkin).
     1 # vim: set ts=2 sw=2 tw=99 noet ft=python:
     2 import os
     3 import sys
     4 from ambuild.command import SymlinkCommand
     5 
     6 class MMS:
     7 	def __init__(self):
     8 		self.compiler = Cpp.Compiler()
     9 
    10 		#Build SDK info
    11 		self.possibleSdks = { }
    12 		self.possibleSdks['ep1'] =   {'sdk': 'HL2SDK',          'ext': '1.ep1',   'def': '1',
    13 		                         'name': 'EPISODEONE',     'platform': ['windows', 'linux'],
    14 		                         'dir': 'hl2sdk'}
    15 		self.possibleSdks['ep2'] =   {'sdk': 'HL2SDKOB',        'ext': '2.ep2',   'def': '3',
    16 		                         'name': 'ORANGEBOX',      'platform': ['windows', 'linux'],
    17 		                         'dir': 'hl2sdk-ob'}
    18 		self.possibleSdks['css'] =   {'sdk': 'HL2SDKCSS',       'ext': '2.css',   'def': '6',
    19 		                         'name': 'CSS',            'platform': ['windows', 'linux', 'darwin'],
    20 		                         'dir': 'hl2sdk-css'}
    21 		self.possibleSdks['hl2dm'] = {'sdk': 'HL2SDKHL2DM',     'ext': '2.hl2dm', 'def': '7',
    22 		                         'name': 'HL2DM',          'platform': ['windows', 'linux', 'darwin'],
    23 		                         'dir': 'hl2sdk-hl2dm'}
    24 		self.possibleSdks['dods'] =  {'sdk': 'HL2SDKDODS',      'ext': '2.dods',  'def': '8',
    25 		                         'name': 'DODS',           'platform': ['windows', 'linux', 'darwin'],
    26 		                         'dir': 'hl2sdk-dods'}
    27 		self.possibleSdks['tf2'] =   {'sdk': 'HL2SDKTF2',       'ext': '2.tf2',   'def': '9',
    28 		                         'name': 'TF2',            'platform': ['windows', 'linux', 'darwin'],
    29 		                         'dir': 'hl2sdk-tf2'}
    30 		self.possibleSdks['l4d'] =   {'sdk': 'HL2SDKL4D',       'ext': '2.l4d',   'def': '10',
    31 		                         'name': 'LEFT4DEAD',      'platform': ['windows', 'linux', 'darwin'],
    32 		                         'dir': 'hl2sdk-l4d'}
    33 		self.possibleSdks['nd'] =    {'sdk': 'HL2SDKND',        'ext': '2.nd',    'def': '11',
    34 		                         'name': 'NUCLEARDAWN',    'platform': ['windows', 'linux', 'darwin'],
    35 		                         'dir': 'hl2sdk-nd'}
    36 		self.possibleSdks['l4d2'] =  {'sdk': 'HL2SDKL4D2',      'ext': '2.l4d2',  'def': '12',
    37 		                         'name': 'LEFT4DEAD2',     'platform': ['windows', 'linux', 'darwin'],
    38 		                         'dir': 'hl2sdk-l4d2'}
    39 		self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM',    'ext': '2.darkm', 'def': '2',
    40 		                         'name': 'DARKMESSIAH',    'platform': ['windows'],
    41 		                          'dir': 'hl2sdk-darkm'}
    42 		self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM',    'ext': '2.swarm', 'def': '13',
    43 		                         'name': 'ALIENSWARM',     'platform': ['windows'],
    44 		                         'dir': 'hl2sdk-swarm'}
    45 		self.possibleSdks['bgt'] =   {'sdk': 'HL2SDK-BGT',      'ext': '2.bgt',   'def': '4',
    46 		                         'name': 'BLOODYGOODTIME', 'platform': ['windows'],
    47 		                         'dir': 'hl2sdk-bgt'}
    48 		self.possibleSdks['eye'] =   {'sdk': 'HL2SDK-EYE',      'ext': '2.eye',   'def': '5',
    49 		                         'name': 'EYE',            'platform': ['windows'],
    50 		                         'dir': 'hl2sdk-eye'}
    51 		self.possibleSdks['csgo'] =  {'sdk': 'HL2SDKCSGO',     'ext': '2.csgo',   'def': '15',
    52 		                         'name': 'CSGO',           'platform': ['windows', 'linux', 'darwin'],
    53 		                         'dir': 'hl2sdk-csgo'}
    54 		self.possibleSdks['dota'] =  {'sdk': 'HL2SDKDOTA',     'ext': '2.dota',   'def': '16',
    55 		                         'name': 'DOTA',           'platform': ['windows'],
    56 		                         'dir': 'hl2sdk-dota'}
    57 		# self.possibleSdks['portal2'] =  {'sdk': 'HL2SDK-PORTAL2',     'ext': '2.portal2',  'def': '14',
    58 		#                        'name': 'PORTAL2',           'platform': ['windows'],
    59 		#                        'dir': 'hl2sdk-portal2'}
    60 		
    61 		self.sdkInfo = { }
    62 		
    63 		if AMBuild.mode == 'config':
    64 			#Detect compilers
    65 			self.compiler.DetectAll(AMBuild)
    66 
    67 			#Look for SDK directories
    68 			for sdk in self.possibleSdks:
    69 				#Get list of SDKs to build against or 'all' or 'present'
    70 				sdkList = AMBuild.options.sdks.split(',')
    71 				#Build against all supported SDKs?
    72 				useAll = sdkList[0] == 'all'
    73 				#Build against supported SDKs that exist?
    74 				usePresent = sdkList[0] == 'present'
    75 
    76 				info = self.possibleSdks[sdk]
    77 				if AMBuild.target['platform'] in info['platform']:
    78 					env = info['sdk']
    79 					dir = info['dir']
    80 					sdkPath = self.ResolveEnvPath(env, dir)
    81 					if sdkPath == None:
    82 						if useAll or sdk in sdkList:
    83 							raise Exception('Could not find a valid path for {0}'.format(env))
    84 						else:
    85 							continue
    86 					if useAll or usePresent or sdk in sdkList:
    87 						self.sdkInfo[sdk] = info
    88 						AMBuild.cache.CacheVariable(env, sdkPath)
    89 
    90 			if len(self.sdkInfo) < 1:
    91 				raise Exception('At least one SDK must be available.')
    92 				
    93 			AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
    94 
    95 			#Set up defines
    96 			cxx = self.compiler.cxx
    97 			if isinstance(cxx, Cpp.CompatGCC):
    98 				if isinstance(cxx, Cpp.GCC):
    99 					self.vendor = 'gcc'
   100 				elif isinstance(cxx, Cpp.Clang):
   101 					self.vendor = 'clang'
   102 				self.compiler.AddToListVar('CDEFINES', 'stricmp=strcasecmp')
   103 				self.compiler.AddToListVar('CDEFINES', '_stricmp=strcasecmp')
   104 				self.compiler.AddToListVar('CDEFINES', '_snprintf=snprintf')
   105 				self.compiler.AddToListVar('CDEFINES', '_vsnprintf=vsnprintf')
   106 				self.compiler.AddToListVar('CFLAGS', '-pipe')
   107 				self.compiler.AddToListVar('CFLAGS', '-fno-strict-aliasing')
   108 				if (self.vendor == 'gcc' and cxx.majorVersion >= 4) or self.vendor == 'clang':
   109 					self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
   110 					self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
   111 				self.compiler.AddToListVar('CFLAGS', '-Wall')
   112 				self.compiler.AddToListVar('CFLAGS', '-Werror')
   113 				self.compiler.AddToListVar('CFLAGS', '-Wno-uninitialized')
   114 				self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
   115 				self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
   116 				self.compiler.AddToListVar('CFLAGS', '-msse')
   117 				self.compiler.AddToListVar('CFLAGS', '-m32')
   118 				self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
   119 				self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
   120 				self.compiler.AddToListVar('CXXFLAGS', '-fno-rtti')
   121 				self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
   122 				self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
   123 				self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
   124 				if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 7) or \
   125 						(self.vendor == 'clang' and cxx.majorVersion >= 3):
   126 					self.compiler.AddToListVar('CXXFLAGS', '-Wno-delete-non-virtual-dtor')
   127 				self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
   128 				self.compiler.AddToListVar('CDEFINES', 'GNUC')
   129 				if self.vendor == 'gcc':
   130 					self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
   131 			elif isinstance(cxx, Cpp.MSVC):
   132 				self.vendor = 'msvc'
   133 				if AMBuild.options.debug == '1':
   134 					self.compiler.AddToListVar('CFLAGS', '/MTd')
   135 					self.compiler.AddToListVar('POSTLINKFLAGS', '/NODEFAULTLIB:libcmt')
   136 				else:
   137 					self.compiler.AddToListVar('CFLAGS', '/MT')
   138 				self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE')
   139 				self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_WARNINGS')
   140 				self.compiler.AddToListVar('CDEFINES', '_CRT_NONSTDC_NO_DEPRECATE')
   141 				self.compiler.AddToListVar('CXXFLAGS', '/EHsc')
   142 				self.compiler.AddToListVar('CXXFLAGS', '/GR-')
   143 				self.compiler.AddToListVar('CFLAGS', '/W3')
   144 				self.compiler.AddToListVar('CFLAGS', '/nologo')
   145 				self.compiler.AddToListVar('CFLAGS', '/Zi')
   146 				self.compiler.AddToListVar('CXXFLAGS', '/TP')
   147 				self.compiler.AddToListVar('POSTLINKFLAGS', '/DEBUG')
   148 				self.compiler.AddToListVar('POSTLINKFLAGS', '/MACHINE:X86')
   149 				self.compiler.AddToListVar('POSTLINKFLAGS', '/SUBSYSTEM:WINDOWS')
   150 				self.compiler.AddToListVar('POSTLINKFLAGS', 'kernel32.lib')
   151 				self.compiler.AddToListVar('POSTLINKFLAGS', 'user32.lib')
   152 				self.compiler.AddToListVar('POSTLINKFLAGS', 'gdi32.lib')
   153 				self.compiler.AddToListVar('POSTLINKFLAGS', 'winspool.lib')
   154 				self.compiler.AddToListVar('POSTLINKFLAGS', 'comdlg32.lib')
   155 				self.compiler.AddToListVar('POSTLINKFLAGS', 'advapi32.lib')
   156 				self.compiler.AddToListVar('POSTLINKFLAGS', 'shell32.lib')
   157 				self.compiler.AddToListVar('POSTLINKFLAGS', 'ole32.lib')
   158 				self.compiler.AddToListVar('POSTLINKFLAGS', 'oleaut32.lib')
   159 				self.compiler.AddToListVar('POSTLINKFLAGS', 'uuid.lib')
   160 				self.compiler.AddToListVar('POSTLINKFLAGS', 'odbc32.lib')
   161 				self.compiler.AddToListVar('POSTLINKFLAGS', 'odbccp32.lib')
   162 
   163 			#Optimization
   164 			if AMBuild.options.opt == '1':
   165 				self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
   166 				if self.vendor == 'gcc' or self.vendor == 'clang':
   167 					self.compiler.AddToListVar('CFLAGS', '-O3')
   168 				elif self.vendor == 'msvc':
   169 					self.compiler.AddToListVar('CFLAGS', '/Ox')
   170 					self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF')
   171 					self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:REF')
   172 
   173 			#Debugging
   174 			if AMBuild.options.debug == '1':
   175 				self.compiler.AddToListVar('CDEFINES', 'DEBUG')
   176 				self.compiler.AddToListVar('CDEFINES', '_DEBUG')
   177 				if self.vendor == 'gcc' or self.vendor == 'clang':
   178 					self.compiler.AddToListVar('CFLAGS', '-g3')
   179 				elif self.vendor == 'msvc':
   180 					self.compiler.AddToListVar('CFLAGS', '/Od')
   181 					self.compiler.AddToListVar('CFLAGS', '/RTC1')
   182 			
   183 			#This needs to be after our optimization flags which could otherwise disable it.
   184 			if self.vendor == 'msvc':
   185 				# Don't omit frame pointer
   186 				self.compiler.AddToListVar('CFLAGS', '/Oy-')
   187 
   188 			#Platform-specifics
   189 			if AMBuild.target['platform'] == 'linux':
   190 				self.compiler.AddToListVar('CDEFINES', '_LINUX')
   191 				self.compiler.AddToListVar('CDEFINES', 'POSIX')
   192 				if self.vendor == 'gcc':
   193 					self.compiler.AddToListVar('POSTLINKFLAGS', '-static-libgcc')
   194 				if self.vendor == 'clang':
   195 					self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
   196 			elif AMBuild.target['platform'] == 'darwin':
   197 				self.compiler.AddToListVar('CDEFINES', 'OSX')
   198 				self.compiler.AddToListVar('CDEFINES', '_OSX')
   199 				self.compiler.AddToListVar('CDEFINES', 'POSIX')
   200 				self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
   201 				self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
   202 				self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
   203 
   204 				# For OS X dylib versioning
   205 				import re
   206 				productFile = open(os.path.join(AMBuild.sourceFolder, 'product.version'), 'r')
   207 				productContents = productFile.read()
   208 				productFile.close()
   209 				m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
   210 				if m == None:
   211 					self.version = '1.0.0'
   212 				else:
   213 					major, minor, release = m.groups()
   214 					self.version = '{0}.{1}.{2}'.format(major, minor, release)
   215 				AMBuild.cache.CacheVariable('version', self.version)
   216 			elif AMBuild.target['platform'] == 'windows':
   217 				self.compiler.AddToListVar('CDEFINES', 'WIN32')
   218 				self.compiler.AddToListVar('CDEFINES', '_WINDOWS')
   219 
   220 			#Finish up
   221 			self.compiler.AddToListVar('CDEFINES', 'MMS_GENERATED_BUILD')
   222 			self.compiler.AddToListVar('CINCLUDES',
   223 			                           os.path.join(AMBuild.outputFolder, 'includes'))
   224 			self.compiler.ToConfig(AMBuild, 'compiler')
   225 			AMBuild.cache.CacheVariable('vendor', self.vendor)
   226 			self.targetMap = { }
   227 			AMBuild.cache.CacheVariable('targetMap', self.targetMap)
   228 		else:
   229 			self.sdkInfo = AMBuild.cache['sdkInfo']
   230 			self.compiler.FromConfig(AMBuild, 'compiler')
   231 			self.targetMap = AMBuild.cache['targetMap']
   232 
   233 		if AMBuild.target['platform'] == 'windows':
   234 			self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
   235 			self.compiler.AddToListVar('RCINCLUDES',
   236 			                           os.path.join(AMBuild.outputFolder, 'includes'))
   237 
   238 	def DefaultCompiler(self):
   239 		compiler = self.compiler.Clone()
   240 		compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
   241 		return compiler
   242 
   243 	def JobMatters(self, jobname):
   244 		file = sys._getframe().f_code.co_filename
   245 		if AMBuild.mode == 'config':
   246 			self.targetMap[jobname] = file
   247 			return True
   248 		if len(AMBuild.args) == 0:
   249 			return True
   250 		if not jobname in AMBuild.args:
   251 			return False
   252 
   253 	def AutoVersion(self, folder, binary):
   254 		if AMBuild.target['platform'] == 'windows':
   255 			env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'MMS_GENERATED_BUILD']}
   256 			binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
   257 		elif AMBuild.target['platform'] == 'darwin' and isinstance(binary, Cpp.LibraryBuilder):
   258 			binary.compiler['POSTLINKFLAGS'].extend(['-compatibility_version', '1.0.0'])
   259 			binary.compiler['POSTLINKFLAGS'].extend(['-current_version', AMBuild.cache['version']])
   260 		else:
   261 			return
   262 
   263 	def PreSetupHL2Job(self, job, builder, sdk):
   264 		info = self.sdkInfo[sdk]
   265 		sdkPath = AMBuild.cache[info['sdk']]
   266 		if AMBuild.target['platform'] == 'linux':
   267 			if sdk == 'ep1':
   268 				staticLibs = os.path.join(sdkPath, 'linux_sdk')
   269 			else:
   270 				staticLibs = os.path.join(sdkPath, 'lib', 'linux')
   271 			workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
   272 			if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
   273 				libs = ['tier1_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
   274 				for lib in libs:
   275 					link = os.path.join(workFolder, lib)
   276 					target = os.path.join(staticLibs, lib)
   277 					try:
   278 						os.lstat(link)
   279 					except:
   280 						job.AddCommand(SymlinkCommand(link, target))
   281 			elif sdk in ['l4d', 'nd', 'csgo']:
   282 				libs = ['tier1_i486.a', 'libvstdlib.so', 'libtier0.so']
   283 				if sdk == 'csgo':
   284 					libs.insert(0, 'interfaces_i486.a')
   285 				for lib in libs:
   286 					link = os.path.join(workFolder, lib)
   287 					target = os.path.join(staticLibs, lib)
   288 					try:
   289 						os.lstat(link)
   290 					except:
   291 						job.AddCommand(SymlinkCommand(link, target))
   292 			else:
   293 				for i in ['tier1_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
   294 					link = os.path.join(workFolder, i)
   295 					target = os.path.join(staticLibs, i)
   296 					try:
   297 						os.lstat(link)
   298 					except:
   299 						job.AddCommand(SymlinkCommand(link, target))
   300 		elif AMBuild.target['platform'] == 'darwin':
   301 			staticLibs = os.path.join(sdkPath, 'lib', 'mac')
   302 			workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
   303 			libs = ['tier1_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']
   304 			if sdk == 'csgo':
   305 				libs.append('interfaces_i486.a')
   306 			for lib in libs:
   307 				link = os.path.join(workFolder, lib)
   308 				target = os.path.join(staticLibs, lib)
   309 				try:
   310 					os.lstat(link)
   311 				except:
   312 					job.AddCommand(SymlinkCommand(link, target))
   313 		elif AMBuild.target['platform'] == 'windows':
   314 			libs = ['tier0', 'tier1', 'vstdlib']
   315 			if sdk in ['swarm', 'csgo', 'dota']:
   316 				libs.append('interfaces')
   317 			for lib in libs:
   318 				libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
   319 				builder.RebuildIfNewer(libPath)
   320 				builder['POSTLINKFLAGS'].append(libPath)
   321 
   322 	def PostSetupHL2Job(self, job, builder, sdk):
   323 		if AMBuild.target['platform'] in ['linux', 'darwin']:
   324 			builder.AddObjectFiles(['tier1_i486.a'])
   325 			if( sdk in ['csgo', 'dota'] ):
   326 				builder.AddObjectFiles(['interfaces_i486.a'])
   327 
   328 	def DefaultHL2Compiler(self, path, sdk, noLink = False):
   329 		compiler = self.DefaultCompiler()
   330 
   331 		compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path))
   332 		compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path, 'sourcehook'))
   333 		compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'loader'))
   334 
   335 		info = self.possibleSdks
   336 		compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
   337 		
   338 		# We don't build for Portal 2 (yet?, ever?), but using this define in code as 
   339 		# it saves trouble if we ever need to
   340 		compiler['CDEFINES'].append('SE_PORTAL2=14')
   341 
   342 		paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
   343 						 ['public', 'tier0'], ['public', 'tier1']]
   344 		if sdk == 'ep1' or sdk == 'darkm':
   345 			paths.append(['public', 'dlls'])
   346 			paths.append(['game_shared'])
   347 		else:
   348 			paths.append(['public', 'game', 'server'])
   349 			paths.append(['game', 'shared'])
   350 			paths.append(['common'])
   351 
   352 		info = self.sdkInfo[sdk]
   353 		sdkPath = AMBuild.cache[info['sdk']]
   354 
   355 		compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
   356 
   357 		if sdk in ['swarm', 'csgo', 'dota']:
   358 			if AMBuild.target['platform'] == 'windows':
   359 				compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
   360 			else:
   361 				compiler['CDEFINES'].extend(['COMPILER_GCC'])
   362 
   363 		if sdk == 'ep1':
   364 			if AMBuild.target['platform'] == 'linux':
   365 				staticLibs = os.path.join(sdkPath, 'linux_sdk')
   366 		else:
   367 			if AMBuild.target['platform'] == 'linux':
   368 				staticLibs = os.path.join(sdkPath, 'lib', 'linux')
   369 			elif AMBuild.target['platform'] == 'darwin':
   370 				staticLibs = os.path.join(sdkPath, 'lib', 'mac')
   371 
   372 		for i in paths:
   373 			compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
   374 
   375 		if not noLink:
   376 			if AMBuild.target['platform'] == 'linux':
   377 				compiler['POSTLINKFLAGS'][0:0] = ['-lm']
   378 				if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
   379 					compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so']
   380 					compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so']
   381 				elif sdk in ['l4d', 'nd', 'csgo']:
   382 					compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
   383 					compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
   384 				else:
   385 					compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
   386 					compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']				
   387 			elif AMBuild.target['platform'] == 'darwin':
   388 				compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib']
   389 				compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib']
   390 
   391 		return compiler
   392 
   393 	def ResolveEnvPath(self, env, defaultDir):
   394 		if env in os.environ:
   395 			path = os.environ[env]
   396 			if os.path.isdir(path):
   397 				return path
   398 		else:
   399 			head = os.getcwd()
   400 			oldhead = None
   401 			while head != None and head != oldhead:
   402 				path = os.path.join(head, defaultDir)
   403 				if os.path.isdir(path):
   404 					return path
   405 				oldhead = head
   406 				head, tail = os.path.split(head)
   407 		return None
   408 
   409 mms = MMS()
   410 globals = {
   411 	'MMS': mms
   412 }
   413 
   414 AMBuild.Include(os.path.join('support', 'buildbot', 'Versioning'), globals)
   415 
   416 FileList = [
   417 		['loader', 'AMBuilder'],
   418 		['core', 'AMBuilder'],
   419 		['core-legacy', 'AMBuilder'],
   420 		['support', 'buildbot', 'PackageScript']
   421 	]
   422 
   423 for parts in FileList:
   424 	AMBuild.Include(os.path.join(*parts), globals)
   425