Overhaul of many things.
This commit is contained in:
parent
504d6befd2
commit
fe52823b62
210
AMBuildScript
210
AMBuildScript
@ -1,36 +1,99 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
import sys
|
||||
import ambuild.command as command
|
||||
from ambuild.command import Command
|
||||
from ambuild.command import ShellCommand
|
||||
from ambuild.command import SymlinkCommand
|
||||
|
||||
vboxhack = 0
|
||||
class ExtractDebugInfoCommand(Command):
|
||||
def __init__(self, binary, outfile):
|
||||
Command.__init__(self)
|
||||
self.binary = binary
|
||||
self.outfile = outfile
|
||||
|
||||
def run(self, runner, job):
|
||||
if not self.binary.NeedsRelink(self.outfile):
|
||||
return
|
||||
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
job.AddCommand(ShellCommand('objcopy --only-keep-debug ' + self.outfile + ' ' + self.outfile + '.dbg'))
|
||||
job.AddCommand(ShellCommand('objcopy --strip-debug ' + self.outfile))
|
||||
job.AddCommand(ShellCommand('objcopy --add-gnu-debuglink=' + os.path.basename(self.outfile) + '.dbg ' + self.outfile))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
job.AddCommand(ShellCommand('dsymutil ' + self.outfile))
|
||||
job.AddCommand(ShellCommand('strip -S ' + self.outfile))
|
||||
|
||||
class SM:
|
||||
def __init__(self):
|
||||
self.compiler = Cpp.Compiler()
|
||||
|
||||
#Build SDK info
|
||||
self.possibleSdks = { }
|
||||
self.possibleSdks['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
|
||||
'name': 'EPISODEONE', 'platform': []}
|
||||
self.possibleSdks['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
|
||||
'name': 'ORANGEBOX', 'platform': []}
|
||||
self.possibleSdks['css'] = {'sdk': 'HL2SDKCSS', 'ext': '2.css', 'def': '6',
|
||||
'name': 'CSS', 'platform': ['windows', 'linux', 'darwin']}
|
||||
self.possibleSdks['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '7',
|
||||
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
|
||||
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '8',
|
||||
'name': 'LEFT4DEAD', 'platform': []}
|
||||
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '9',
|
||||
'name': 'LEFT4DEAD2', 'platform': []}
|
||||
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||
'name': 'DARKMESSIAH', 'platform': []}
|
||||
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '10',
|
||||
'name': 'ALIENSWARM', 'platform': []}
|
||||
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
|
||||
'name': 'BLOODYGOODTIME', 'platform': []}
|
||||
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
|
||||
'name': 'EYE', 'platform': []}
|
||||
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '12',
|
||||
'name': 'CSGO', 'platform': []}
|
||||
|
||||
self.sdkInfo = { }
|
||||
self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '4',
|
||||
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
|
||||
|
||||
if AMBuild.mode == 'config':
|
||||
#Detect compilers
|
||||
self.compiler.DetectAll(AMBuild)
|
||||
|
||||
#Detect variables
|
||||
envvars = { 'MMSOURCE18': 'mmsource-1.8',
|
||||
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
|
||||
'SOURCEMOD14': 'sourcemod-1.4'
|
||||
envvars = { 'MMSOURCE19': 'mmsource-1.9',
|
||||
'SOURCEMOD14': 'sourcemod-1.4',
|
||||
'HL2SDKCSS': 'hl2sdk-css',
|
||||
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
|
||||
'HL2SDKL4D': 'hl2sdk-l4d',
|
||||
'HL2SDKL4D2': 'hl2sdk-l4d2',
|
||||
'HL2SDKCSGO': 'hl2sdk-csgo'
|
||||
}
|
||||
|
||||
#Must have a path for each envvar (file a bug if you don't like this)
|
||||
if AMBuild.target['platform'] != 'darwin':
|
||||
envvars['HL2SDK'] = 'hl2sdk'
|
||||
envvars['HL2SDKOB'] = 'hl2sdk-ob'
|
||||
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm'
|
||||
envvars['HL2SDK-SWARM'] = 'hl2sdk-swarm'
|
||||
envvars['HL2SDK-BGT'] = 'hl2sdk-bgt'
|
||||
envvars['HL2SDK-EYE'] = 'hl2sdk-eye'
|
||||
|
||||
# Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary`
|
||||
def findDictByKey(dictionary, key, value):
|
||||
for index in dictionary:
|
||||
elem = dictionary[index]
|
||||
if elem[key] == value:
|
||||
return (elem, index)
|
||||
return None
|
||||
|
||||
for i in envvars:
|
||||
if i in os.environ:
|
||||
path = os.environ[i]
|
||||
if not os.path.isdir(path):
|
||||
raise Exception('Path for {0} was not found: {1}'.format(i, path))
|
||||
elif i.startswith('HL2SDK'):
|
||||
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
|
||||
self.sdkInfo[sdk] = info
|
||||
else:
|
||||
head = os.getcwd()
|
||||
oldhead = None
|
||||
@ -40,10 +103,19 @@ class SM:
|
||||
break
|
||||
oldhead = head
|
||||
head, tail = os.path.split(head)
|
||||
if head == None or head == oldhead:
|
||||
if i.startswith('HL2SDK'):
|
||||
if head != None and head != oldhead:
|
||||
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
|
||||
self.sdkInfo[sdk] = info
|
||||
elif head == None or head == oldhead:
|
||||
raise Exception('Could not find a valid path for {0}'.format(i))
|
||||
AMBuild.cache.CacheVariable(i, path)
|
||||
|
||||
if len(self.sdkInfo) < 1:
|
||||
raise Exception('At least one SDK must be available.')
|
||||
|
||||
AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
|
||||
|
||||
#Set up defines
|
||||
cxx = self.compiler.cxx
|
||||
if isinstance(cxx, Cpp.CompatGCC):
|
||||
@ -61,21 +133,19 @@ class SM:
|
||||
self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wall')
|
||||
# self.compiler.AddToListVar('CFLAGS', '-Werror')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Werror')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wno-uninitialized')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
|
||||
self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
|
||||
self.compiler.AddToListVar('CFLAGS', '-msse')
|
||||
self.compiler.AddToListVar('CFLAGS', '-g3')
|
||||
self.compiler.AddToListVar('CFLAGS', '-m32')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
|
||||
self.compiler.AddToListVar('CFLAGS', '-static-libgcc')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-rtti')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
|
||||
if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 7) or \
|
||||
if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 3) or \
|
||||
(self.vendor == 'clang' and cxx.majorVersion >= 3):
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-Wno-delete-non-virtual-dtor')
|
||||
self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
|
||||
@ -93,7 +163,6 @@ class SM:
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_WARNINGS')
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_NONSTDC_NO_DEPRECATE')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '/EHsc')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '/GR-')
|
||||
self.compiler.AddToListVar('CFLAGS', '/W3')
|
||||
self.compiler.AddToListVar('CFLAGS', '/nologo')
|
||||
self.compiler.AddToListVar('CFLAGS', '/Zi')
|
||||
@ -128,9 +197,7 @@ class SM:
|
||||
if AMBuild.options.debug == '1':
|
||||
self.compiler.AddToListVar('CDEFINES', 'DEBUG')
|
||||
self.compiler.AddToListVar('CDEFINES', '_DEBUG')
|
||||
if self.vendor == 'gcc' or self.vendor == 'clang':
|
||||
self.compiler.AddToListVar('CFLAGS', '-g3')
|
||||
elif self.vendor == 'msvc':
|
||||
if self.vendor == 'msvc':
|
||||
self.compiler.AddToListVar('CFLAGS', '/Od')
|
||||
self.compiler.AddToListVar('CFLAGS', '/RTC1')
|
||||
|
||||
@ -142,6 +209,8 @@ class SM:
|
||||
if self.vendor == 'clang':
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
self.compiler.AddToListVar('CDEFINES', 'OSX')
|
||||
self.compiler.AddToListVar('CDEFINES', '_OSX')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
|
||||
@ -165,19 +234,20 @@ class SM:
|
||||
#Finish up
|
||||
self.compiler.AddToListVar('CDEFINES', 'SOURCEMOD_BUILD')
|
||||
self.compiler.AddToListVar('CDEFINES', 'SM_GENERATED_BUILD')
|
||||
self.compiler.AddToListVar('CINCLUDES', os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
self.compiler.AddToListVar('CINCLUDES',
|
||||
os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
self.compiler.ToConfig(AMBuild, 'compiler')
|
||||
AMBuild.cache.CacheVariable('vendor', self.vendor)
|
||||
self.targetMap = { }
|
||||
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
|
||||
else:
|
||||
self.sdkInfo = AMBuild.cache['sdkInfo']
|
||||
self.compiler.FromConfig(AMBuild, 'compiler')
|
||||
self.targetMap = AMBuild.cache['targetMap']
|
||||
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'extension'))
|
||||
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE18']
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE19']
|
||||
|
||||
def DefaultCompiler(self):
|
||||
return self.compiler.Clone()
|
||||
@ -192,15 +262,6 @@ class SM:
|
||||
if not jobname in AMBuild.args:
|
||||
return False
|
||||
|
||||
def DefaultExtCompiler(self, path):
|
||||
compiler = self.DefaultCompiler()
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path, 'sdk'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'extensions'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
|
||||
return compiler
|
||||
|
||||
def AutoVersion(self, folder, binary):
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
|
||||
@ -211,6 +272,10 @@ class SM:
|
||||
else:
|
||||
return
|
||||
|
||||
def ExtractDebugInfo(self, job, binary):
|
||||
src = os.path.join('..', AMBuild.outputFolder, job.workFolder, binary.binaryFile)
|
||||
job.AddCommand(ExtractDebugInfoCommand(binary, src))
|
||||
|
||||
def PreSetupHL2Job(self, job, builder, sdk):
|
||||
info = self.sdkInfo[sdk]
|
||||
sdkPath = AMBuild.cache[info['sdk']]
|
||||
@ -220,55 +285,51 @@ class SM:
|
||||
else:
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
|
||||
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
|
||||
if sdk in ['ep2v']:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
if sdk == 'ep2v':
|
||||
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
|
||||
for lib in libs:
|
||||
link = os.path.join(workFolder, lib)
|
||||
target = os.path.join(staticLibs, lib)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
if vboxhack == 1:
|
||||
job.AddCommand(command.DirectCommand(['cp', '-f', target, link]))
|
||||
else:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif sdk in ['l4d', 'l4d2']:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif sdk in ['css', 'l4d', 'l4d2', 'csgo']:
|
||||
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']
|
||||
if sdk == 'csgo':
|
||||
libs.append('interfaces_i486.a')
|
||||
for lib in libs:
|
||||
link = os.path.join(workFolder, lib)
|
||||
target = os.path.join(staticLibs, lib)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
if vboxhack == 1:
|
||||
job.AddCommand(command.DirectCommand(['cp', '-f', target, link]))
|
||||
else:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
else:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
libs = ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']
|
||||
for lib in libs:
|
||||
link = os.path.join(workFolder, lib)
|
||||
target = os.path.join(staticLibs, lib)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
if vboxhack == 1:
|
||||
job.AddCommand(command.DirectCommand(['cp', '-f', target, link]))
|
||||
else:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
|
||||
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']
|
||||
if sdk == 'csgo':
|
||||
libs.append('interfaces_i486.a')
|
||||
for lib in libs:
|
||||
link = os.path.join(workFolder, lib)
|
||||
target = os.path.join(staticLibs, lib)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
if vboxhack == 1:
|
||||
job.AddCommand(command.DirectCommand(['cp', '-f', target, link]))
|
||||
else:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||
if sdk == 'swarm':
|
||||
if sdk in ['swarm', 'csgo']:
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
|
||||
@ -278,9 +339,11 @@ class SM:
|
||||
def PostSetupHL2Job(self, job, builder, sdk):
|
||||
if AMBuild.target['platform'] in ['linux', 'darwin']:
|
||||
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
|
||||
if sdk == 'csgo':
|
||||
builder.AddObjectFiles(['interfaces_i486.a'])
|
||||
|
||||
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
|
||||
compiler = self.DefaultExtCompiler(path)
|
||||
compiler = self.DefaultCompiler()
|
||||
|
||||
mms = 'core'
|
||||
if sdk == 'ep1':
|
||||
@ -289,16 +352,16 @@ class SM:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
|
||||
|
||||
info = self.sdkInfo
|
||||
info = self.possibleSdks
|
||||
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
|
||||
|
||||
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
|
||||
['public', 'tier0'], ['public', 'tier1']]
|
||||
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'], ['public', 'tier0'], ['public', 'tier1']]
|
||||
if sdk == 'ep1' or sdk == 'darkm':
|
||||
paths.append(['public', 'dlls'])
|
||||
paths.append(['game_shared'])
|
||||
else:
|
||||
paths.append(['public', 'game', 'server'])
|
||||
paths.append(['public', 'toolframework'])
|
||||
paths.append(['game', 'shared'])
|
||||
paths.append(['common'])
|
||||
|
||||
@ -307,8 +370,11 @@ class SM:
|
||||
|
||||
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
|
||||
|
||||
if sdk == 'swarm' and AMBuild.target['platform'] == 'windows':
|
||||
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
|
||||
if sdk in ['swarm','csgo']:
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
|
||||
else:
|
||||
compiler['CDEFINES'].extend(['COMPILER_GCC', 'POSIX'])
|
||||
|
||||
if sdk == 'ep1':
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
@ -325,10 +391,10 @@ class SM:
|
||||
if not noLink:
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['-lm']
|
||||
if sdk in ['ep2v']:
|
||||
if sdk == 'ep2v':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so']
|
||||
elif sdk in ['l4d', 'l4d2']:
|
||||
elif sdk in ['css', 'l4d', 'l4d2', 'csgo']:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
|
||||
else:
|
||||
@ -345,13 +411,13 @@ globals = {
|
||||
'SM': sm
|
||||
}
|
||||
|
||||
#AMBuild.Include(os.path.join('buildbot', 'Versioning'), globals)
|
||||
AMBuild.Include(os.path.join('buildbot', 'Versioning'), globals)
|
||||
|
||||
FileList = [
|
||||
['extension', 'AMBuilder'],
|
||||
['buildbot', 'PackageScript']
|
||||
['buildbot', 'PackageScript'],
|
||||
['buildbot', 'BreakpadSymbols']
|
||||
]
|
||||
|
||||
for parts in FileList:
|
||||
AMBuild.Include(os.path.join(*parts), globals)
|
||||
|
||||
|
||||
41
buildbot/BreakpadSymbols
Normal file
41
buildbot/BreakpadSymbols
Normal file
@ -0,0 +1,41 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
import urllib.request
|
||||
from ambuild.command import Command
|
||||
from ambuild.command import ShellCommand
|
||||
|
||||
class IterateDebugInfoCommand(Command):
|
||||
def run(self, master, job):
|
||||
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt')
|
||||
for debug_info in pdblog:
|
||||
debug_info = os.path.join(AMBuild.outputFolder, debug_info.strip())
|
||||
job.AddCommand(SymbolCommand(debug_info, symbolServer))
|
||||
pdblog.close()
|
||||
|
||||
class SymbolCommand(ShellCommand):
|
||||
def __init__(self, debugFile, symbolServer):
|
||||
self.serverResponse = None
|
||||
self.symbolServer = symbolServer
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
cmdstring = "dump_syms {0} {1}".format(debugFile, os.path.dirname(debugFile))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
cmdstring = "dump_syms {0}".format(debugFile)
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
cmdstring = "dump_syms.exe {0}".format(debugFile)
|
||||
ShellCommand.__init__(self, cmdstring)
|
||||
def run(self, master, job):
|
||||
ShellCommand.run(self, master, job)
|
||||
if self.stdout != None and len(self.stdout) > 0:
|
||||
request = urllib.request.Request(symbolServer, self.stdout.encode('utf-8'))
|
||||
request.add_header("Content-Type", "text/plain")
|
||||
self.serverResponse = urllib.request.urlopen(request).read().decode('utf-8')
|
||||
def spew(self, runner):
|
||||
if self.stderr != None and len(self.stderr) > 0:
|
||||
runner.PrintOut(self.stderr)
|
||||
if self.serverResponse != None and len(self.serverResponse) > 0:
|
||||
runner.PrintOut(self.serverResponse)
|
||||
|
||||
if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
|
||||
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
|
||||
job = AMBuild.AddJob('breakpad-symbols')
|
||||
job.AddCommand(IterateDebugInfoCommand())
|
||||
@ -86,7 +86,14 @@ bincopies = []
|
||||
def AddNormalLibrary(name, dest):
|
||||
dest = os.path.join('addons', 'sourcemod', dest)
|
||||
bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest))
|
||||
#pdb_list.append(name + '\\' + name + '.pdb')
|
||||
|
||||
# Each platform's version of dump_syms needs the path in a different format.
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
debug_info.append(name + '/' + name + '.so')
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
debug_info.append(name + '/' + name + '.dylib.dSYM')
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
debug_info.append(name + '\\' + name + '.pdb')
|
||||
|
||||
def AddHL2Library(name, dest):
|
||||
for i in SM.sdkInfo:
|
||||
@ -95,15 +102,14 @@ def AddHL2Library(name, dest):
|
||||
continue
|
||||
AddNormalLibrary(name + '.ext.' + sdk['ext'], dest)
|
||||
|
||||
#pdb_list = []
|
||||
debug_info = []
|
||||
|
||||
AddHL2Library('connect', 'extensions')
|
||||
|
||||
job.AddCommandGroup(bincopies)
|
||||
|
||||
#if AMBuild.target['platform'] == 'windows':
|
||||
# pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
|
||||
# for pdb in pdb_list:
|
||||
# pdblog.write(pdb + '\n')
|
||||
# pdblog.close()
|
||||
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
|
||||
for pdb in debug_info:
|
||||
pdblog.write(pdb + '\n')
|
||||
pdblog.close()
|
||||
|
||||
|
||||
55
buildbot/Versioning
Normal file
55
buildbot/Versioning
Normal file
@ -0,0 +1,55 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from ambuild.cache import Cache
|
||||
import ambuild.command as command
|
||||
|
||||
#Quickly try to ascertain the current repository revision
|
||||
def GetVersion():
|
||||
args = ['hg', 'parent', '-R', AMBuild.sourceFolder]
|
||||
p = command.RunDirectCommand(AMBuild, args)
|
||||
m = re.match('changeset:\s+(\d+):(.+)', p.stdoutText)
|
||||
if m == None:
|
||||
raise Exception('Could not determine repository version')
|
||||
return m.groups()
|
||||
|
||||
def PerformReversioning():
|
||||
rev, cset = GetVersion()
|
||||
cacheFile = os.path.join(AMBuild.outputFolder, '.ambuild', 'hgcache')
|
||||
cache = Cache(cacheFile)
|
||||
if os.path.isfile(cacheFile):
|
||||
cache.LoadCache()
|
||||
if cache.HasVariable('cset') and cache['cset'] == cset:
|
||||
return False
|
||||
cache.CacheVariable('cset', cset)
|
||||
|
||||
productFile = open(os.path.join(AMBuild.sourceFolder, 'buildbot', 'product.version'), 'r')
|
||||
productContents = productFile.read()
|
||||
productFile.close()
|
||||
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
|
||||
if m == None:
|
||||
raise Exception('Could not detremine product version')
|
||||
major, minor, release, tag = m.groups()
|
||||
|
||||
incFolder = os.path.join(AMBuild.sourceFolder, 'extension')
|
||||
incFile = open(os.path.join(incFolder, 'version_auto.h'), 'w')
|
||||
incFile.write("""
|
||||
#ifndef _AUTO_VERSION_INFORMATION_H_
|
||||
#define _AUTO_VERSION_INFORMATION_H_
|
||||
|
||||
#define SM_BUILD_TAG \"{0}\"
|
||||
#define SM_BUILD_UNIQUEID \"{1}:{2}\" SM_BUILD_TAG
|
||||
#define SM_VERSION \"{3}.{4}.{5}\"
|
||||
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
|
||||
#define SM_FILE_VERSION {6},{7},{8},0
|
||||
|
||||
#endif /* _AUTO_VERSION_INFORMATION_H_ */
|
||||
|
||||
""".format(tag, rev, cset, major, minor, release, major, minor, release))
|
||||
incFile.close()
|
||||
cache.WriteCache()
|
||||
|
||||
PerformReversioning()
|
||||
|
||||
|
||||
@ -26,17 +26,17 @@ print "Attempting to reconfigure...\n";
|
||||
#update and configure shiz
|
||||
if ($^O eq "linux") {
|
||||
$ENV{'SOURCEMOD14'} = '/home/builds/common/sourcemod-1.4';
|
||||
$ENV{'MMSOURCE18'} = '/home/builds/common/mmsource-1.8';
|
||||
$ENV{'MMSOURCE19'} = '/home/builds/common/mmsource-1.9';
|
||||
|
||||
$ENV{'HL2SDKOBVALVE'} = '/home/builds/common/hl2sdk-ob-valve';
|
||||
} elsif ($^O eq "darwin") {
|
||||
$ENV{'SOURCEMOD14'} = '/Users/builds/slaves/common/sourcemod-1.4';
|
||||
$ENV{'MMSOURCE18'} = '/Users/builds/slaves/common/mmsource-1.8';
|
||||
$ENV{'MMSOURCE19'} = '/Users/builds/slaves/common/mmsource-1.9';
|
||||
|
||||
$ENV{'HL2SDKOBVALVE'} = '/Users/builds/slaves/common/hl2sdk-ob-valve';
|
||||
} else {
|
||||
$ENV{'SOURCEMOD14'} = 'C:/Scripts/common/sourcemod-1.4';
|
||||
$ENV{'MMSOURCE18'} = 'C:/Scripts/common/mmsource-1.8';
|
||||
$ENV{'MMSOURCE19'} = 'C:/Scripts/common/mmsource-1.9';
|
||||
|
||||
#$ENV{'HL2SDKOBVALVE'} = 'H:/hl2sdk-ob-valve';
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
1.1.0
|
||||
1.2.0
|
||||
@ -10,6 +10,14 @@ require 'helpers.pm';
|
||||
|
||||
chdir('../../OUTPUT');
|
||||
|
||||
$ENV{'BREAKPAD_SYMBOL_SERVER'} = 'http://crash.limetech.org/submit-symbols';
|
||||
|
||||
if ($^O eq "linux") {
|
||||
$ENV{'PATH'} .= ':/home/builds/common/';
|
||||
} elsif ($^O eq "darwin") {
|
||||
$ENV{'PATH'} .= ':/Users/builds/slaves/common/';
|
||||
}
|
||||
|
||||
if ($^O eq "linux" || $^O eq "darwin") {
|
||||
system("python3 build.py 2>&1");
|
||||
} else {
|
||||
|
||||
@ -32,7 +32,7 @@ for i in SM.sdkInfo:
|
||||
'sdk/smsdk_ext.cpp'
|
||||
])
|
||||
SM.PostSetupHL2Job(extension, binary, i)
|
||||
#SM.AutoVersion('extension', binary)
|
||||
#SM.ExtractDebugInfo(extension, binary)
|
||||
SM.AutoVersion('extension', binary)
|
||||
SM.ExtractDebugInfo(extension, binary)
|
||||
binary.SendToJob()
|
||||
|
||||
|
||||
@ -157,9 +157,9 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
else if(!twoByte)
|
||||
{
|
||||
if((opcode & 0xC4) == 0x00 ||
|
||||
(opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09) ||
|
||||
((opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09)) ||
|
||||
(opcode & 0xF0) == 0x80 ||
|
||||
(opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02 ||
|
||||
((opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02) ||
|
||||
(opcode & 0xFC) == 0xD0 ||
|
||||
(opcode & 0xF6) == 0xF6)
|
||||
{
|
||||
@ -170,11 +170,11 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D ||
|
||||
if(((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D) ||
|
||||
(opcode & 0xF0) == 0x30 ||
|
||||
opcode == 0x77 ||
|
||||
(opcode & 0xF0) == 0x80 ||
|
||||
(opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02 ||
|
||||
((opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02) ||
|
||||
(opcode & 0xF8) == 0xC8)
|
||||
{
|
||||
// No mod R/M byte
|
||||
@ -250,7 +250,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
(opcode & 0xFE) == 0xD4 || // AAD/AAM
|
||||
(opcode & 0xF8) == 0xE0 || // LOOP/JCXZ
|
||||
opcode == 0xEB ||
|
||||
opcode == 0xF6 && (modRM & 0x30) == 0x00) // TEST
|
||||
(opcode == 0xF6 && (modRM & 0x30) == 0x00)) // TEST
|
||||
{
|
||||
if (dest)
|
||||
*dest++ = *func++;
|
||||
@ -275,7 +275,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
||||
(opcode & 0xFC) == 0xA0 ||
|
||||
(opcode & 0xEE) == 0xA8 ||
|
||||
opcode == 0xC7 ||
|
||||
opcode == 0xF7 && (modRM & 0x30) == 0x00)
|
||||
(opcode == 0xF7 && (modRM & 0x30) == 0x00))
|
||||
{
|
||||
if (dest) {
|
||||
//Fix CALL/JMP offset
|
||||
@ -370,7 +370,7 @@ void* eval_jump(void* src) {
|
||||
else if (addr[0] == OP_JMP_BYTE) {
|
||||
addr = &addr[OP_JMP_BYTE_SIZE] + *(char*)&addr[1];
|
||||
//mangled 32bit jump?
|
||||
if (addr[0] = OP_JMP) {
|
||||
if (addr[0] == OP_JMP) {
|
||||
addr = addr + *(int*)&addr[1];
|
||||
}
|
||||
return addr;
|
||||
|
||||
@ -93,9 +93,9 @@ CBaseServer *g_pBaseServer = NULL;
|
||||
typedef CSteam3Server *(*Steam3ServerFunc)();
|
||||
|
||||
#ifndef WIN32
|
||||
typedef void (*RejectConnectionFunc)(CBaseServer *, const netadr_t &address, int iClientChallenge, char *pchReason);
|
||||
typedef void (*RejectConnectionFunc)(CBaseServer *, const netadr_t &address, int iClientChallenge, const char *pchReason);
|
||||
#else
|
||||
typedef void (__fastcall *RejectConnectionFunc)(CBaseServer *, void *, const netadr_t &address, int iClientChallenge, char *pchReason);
|
||||
typedef void (__fastcall *RejectConnectionFunc)(CBaseServer *, void *, const netadr_t &address, int iClientChallenge, const char *pchReason);
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
@ -116,7 +116,7 @@ CSteam3Server *Steam3Server()
|
||||
return g_pSteam3ServerFunc();
|
||||
}
|
||||
|
||||
void RejectConnection(const netadr_t &address, int iClientChallenge, char *pchReason)
|
||||
void RejectConnection(const netadr_t &address, int iClientChallenge, const char *pchReason)
|
||||
{
|
||||
if (!g_pRejectConnectionFunc || !g_pBaseServer)
|
||||
return;
|
||||
@ -274,7 +274,7 @@ DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient *, netadr_t &, address,
|
||||
return DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
|
||||
}
|
||||
|
||||
DETOUR_DECL_MEMBER3(CBaseServer__RejectConnection, void, netadr_t &, address, int, iClientChallenge, char *, pchReason)
|
||||
DETOUR_DECL_MEMBER3(CBaseServer__RejectConnection, void, netadr_t &, address, int, iClientChallenge, const char *, pchReason)
|
||||
{
|
||||
if (g_bEndAuthSessionOnRejectConnection)
|
||||
{
|
||||
|
||||
@ -34,10 +34,12 @@
|
||||
* @brief Contains macros for configuring basic extension information.
|
||||
*/
|
||||
|
||||
#include "version.h" // SM_FULL_VERSION
|
||||
|
||||
/* Basic information exposed publicly */
|
||||
#define SMEXT_CONF_NAME "Connect"
|
||||
#define SMEXT_CONF_DESCRIPTION ""
|
||||
#define SMEXT_CONF_VERSION "1.1.0"
|
||||
#define SMEXT_CONF_DESCRIPTION "Forward for early connection"
|
||||
#define SMEXT_CONF_VERSION SM_FULL_VERSION
|
||||
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker"
|
||||
#define SMEXT_CONF_URL "http://limetech.org/"
|
||||
#define SMEXT_CONF_LOGTAG "CONNECT"
|
||||
|
||||
27
extension/version.h
Normal file
27
extension/version.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _INCLUDE_VERSION_INFORMATION_H_
|
||||
#define _INCLUDE_VERSION_INFORMATION_H_
|
||||
|
||||
/**
|
||||
* @file Contains version information.
|
||||
* @brief This file will redirect to an autogenerated version if being compiled via
|
||||
* the build scripts.
|
||||
*/
|
||||
|
||||
#if defined SM_GENERATED_BUILD
|
||||
#include "version_auto.h"
|
||||
#else
|
||||
|
||||
#ifndef SM_GENERATED_BUILD
|
||||
#undef BINARY_NAME
|
||||
#define BINARY_NAME "connect.ext.dll\0"
|
||||
#endif
|
||||
|
||||
#define SM_BUILD_TAG "-manual"
|
||||
#define SM_BUILD_UNIQUEID "[MANUAL BUILD]"
|
||||
#define SM_VERSION "1.2.0"
|
||||
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
|
||||
#define SM_FILE_VERSION 1,2,0,0
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE_VERSION_INFORMATION_H_ */
|
||||
45
extension/version.rc
Normal file
45
extension/version.rc
Normal file
@ -0,0 +1,45 @@
|
||||
#include "winres.h"
|
||||
|
||||
#include <version.h>
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif
|
||||
|
||||
#ifndef SM_GENERATED_BUILD
|
||||
#define BINARY_NAME "connect.ext.dll\0"
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION SM_FILE_VERSION
|
||||
PRODUCTVERSION SM_FILE_VERSION
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Connect Extension"
|
||||
VALUE "FileDescription", "SourceMod Connect Extension"
|
||||
VALUE "FileVersion", SM_BUILD_UNIQUEID
|
||||
VALUE "InternalName", "Connect"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2012, Asher Baker"
|
||||
VALUE "OriginalFilename", BINARY_NAME
|
||||
VALUE "ProductName", "Connect Extension"
|
||||
VALUE "ProductVersion", SM_FULL_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 0x04B0
|
||||
END
|
||||
END
|
||||
Loading…
Reference in New Issue
Block a user