From 73e2daec56c7beff014d567840f999ca571f262b Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Fri, 14 May 2010 00:34:36 -0500 Subject: [PATCH] Converted build system to AMBuild (bug 4403, r=dvander). --HG-- rename : support/pushbuild.txt => pushbuild.txt --- AMBuildScript | 303 +++++++++++++++++++++++++ configure.py | 10 + core-legacy/AMBuilder | 29 +++ core-legacy/version.h | 12 - core-legacy/version.rc | 4 +- core-legacy/version.tpl | 12 - core/AMBuilder | 33 +++ core/version.h | 12 - core/version.rc | 4 +- core/version.tpl | 12 - loader/AMBuilder | 31 +++ loader/version.h | 12 - loader/version.rc | 4 +- loader/version.tpl | 12 - modules.versions | 19 -- product.version | 2 +- public/metamod_version.h | 44 ++++ support/pushbuild.txt => pushbuild.txt | 0 support/buildbot/PackageScript | 112 +++++++++ support/buildbot/Versioning | 57 +++++ support/buildbot/bootstrap.pl | 71 +++++- support/buildbot/build_type | 1 + support/buildbot/helpers.pm | 11 + support/buildbot/package.pl | 7 +- support/buildbot/startbuild.pl | 180 +-------------- support/buildbot/symstore.pl | 38 ++-- support/versionchanger.pl | 140 ------------ 27 files changed, 740 insertions(+), 432 deletions(-) create mode 100644 AMBuildScript create mode 100644 configure.py create mode 100644 core-legacy/AMBuilder delete mode 100644 core-legacy/version.h delete mode 100644 core-legacy/version.tpl create mode 100644 core/AMBuilder delete mode 100644 core/version.h delete mode 100644 core/version.tpl create mode 100644 loader/AMBuilder delete mode 100644 loader/version.h delete mode 100644 loader/version.tpl delete mode 100644 modules.versions create mode 100644 public/metamod_version.h rename support/pushbuild.txt => pushbuild.txt (100%) create mode 100644 support/buildbot/PackageScript create mode 100644 support/buildbot/Versioning create mode 100644 support/buildbot/build_type delete mode 100755 support/versionchanger.pl diff --git a/AMBuildScript b/AMBuildScript new file mode 100644 index 0000000..0ade4c8 --- /dev/null +++ b/AMBuildScript @@ -0,0 +1,303 @@ +# vim: set ts=2 sw=2 tw=99 noet ft=python: +import os +import sys +from ambuild.command import SymlinkCommand + +class MMS: + def __init__(self): + self.compiler = Cpp.Compiler() + + #Build SDK info + self.sdkInfo = { } + self.sdkInfo['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1', + 'name': 'EPISODEONE', 'platform': ['windows', 'linux']} + self.sdkInfo['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3', + 'name': 'ORANGEBOX', 'platform': ['windows', 'linux']} + self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '4', + 'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']} + self.sdkInfo['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '5', + 'name': 'LEFT4DEAD', 'platform': ['windows', 'linux']} + self.sdkInfo['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '6', + 'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux']} + self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2', + 'name': 'DARKMESSIAH', 'platform': ['windows']} + + if AMBuild.mode == 'config': + #Detect compilers + self.compiler.DetectAll(AMBuild) + + #Detect variables + envvars = {} + if AMBuild.target['platform'] != 'darwin': + envvars['HL2SDK'] = 'hl2sdk' + envvars['HL2SDKOB'] = 'hl2sdk-ob' + envvars['HL2SDKL4D'] = 'hl2sdk-l4d' + envvars['HL2SDKL4D2'] = 'hl2sdk-l4d2' + + envvars['HL2SDKOBVALVE'] = 'hl2sdk-ob-valve' + + #Dark Messiah is Windows-only + if AMBuild.target['platform'] == 'windows': + envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm' + + #Must have a path for each envvar (file a bug if you don't like this) + 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)) + else: + head = os.getcwd() + oldhead = None + while head != None and head != oldhead: + path = os.path.join(head, envvars[i]) + if os.path.isdir(path): + break + oldhead = head + head, tail = os.path.split(head) + if head == None or head == oldhead: + raise Exception('Could not find a valid path for {0}'.format(i)) + AMBuild.cache.CacheVariable(i, path) + + #Set up defines + cxx = self.compiler.cxx + if isinstance(cxx, Cpp.GCC): + self.vendor = 'gcc' + self.compiler.AddToListVar('CDEFINES', 'stricmp=strcasecmp') + self.compiler.AddToListVar('CDEFINES', '_stricmp=strcasecmp') + self.compiler.AddToListVar('CDEFINES', '_snprintf=snprintf') + self.compiler.AddToListVar('CDEFINES', '_vsnprintf=vsnprintf') + self.compiler.AddToListVar('CFLAGS', '-pipe') + self.compiler.AddToListVar('CFLAGS', '-fno-strict-aliasing') + if cxx.majorVersion >= 4: + 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', '-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', '-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('CDEFINES', 'HAVE_STDINT_H') + elif isinstance(cxx, Cpp.MSVC): + self.vendor = 'msvc' + if AMBuild.options.debug == '1': + self.compiler.AddToListVar('CFLAGS', '/MTd') + else: + self.compiler.AddToListVar('CFLAGS', '/MT') + self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE') + 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') + self.compiler.AddToListVar('CXXFLAGS', '/TP') + self.compiler.AddToListVar('POSTLINKFLAGS', '/DEBUG') + self.compiler.AddToListVar('POSTLINKFLAGS', '/MACHINE:X86') + self.compiler.AddToListVar('POSTLINKFLAGS', '/SUBSYSTEM:WINDOWS') + self.compiler.AddToListVar('POSTLINKFLAGS', 'kernel32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'user32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'gdi32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'winspool.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'comdlg32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'advapi32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'shell32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'ole32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'oleaut32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'uuid.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'odbc32.lib') + self.compiler.AddToListVar('POSTLINKFLAGS', 'odbccp32.lib') + + #Optimization + if AMBuild.options.opt == '1': + self.compiler.AddToListVar('CDEFINES', 'NDEBUG') + if self.vendor == 'gcc': + self.compiler.AddToListVar('CFLAGS', '-O3') + elif self.vendor == 'msvc': + self.compiler.AddToListVar('CFLAGS', '/Ot') + self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF') + + #Debugging + if AMBuild.options.debug == '1': + self.compiler.AddToListVar('CDEFINES', 'DEBUG') + self.compiler.AddToListVar('CDEFINES', '_DEBUG') + if self.vendor == 'gcc': + self.compiler.AddToListVar('CFLAGS', '-g3') + elif self.vendor == 'msvc': + self.compiler.AddToListVar('CFLAGS', '/Od') + self.compiler.AddToListVar('CFLAGS', '/RTC1') + + #Platform-specifics + if AMBuild.target['platform'] == 'linux': + self.compiler.AddToListVar('CDEFINES', '_LINUX') + elif AMBuild.target['platform'] == 'darwin': + self.compiler.AddToListVar('CFLAGS', ['-isysroot', + '/Developer/SDKs/MacOSX10.5.sdk']) + self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5') + self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386']) + self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++') + elif AMBuild.target['platform'] == 'windows': + self.compiler.AddToListVar('CDEFINES', 'WIN32') + self.compiler.AddToListVar('CDEFINES', '_WINDOWS') + + #Finish up + self.compiler.AddToListVar('CDEFINES', 'MMS_GENERATED_BUILD') + 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.compiler.FromConfig(AMBuild, 'compiler') + self.targetMap = AMBuild.cache['targetMap'] + + if AMBuild.target['platform'] == 'windows': + self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public')) + self.compiler.AddToListVar('RCINCLUDES', + os.path.join(AMBuild.outputFolder, 'includes')) + + def DefaultCompiler(self): + compiler = self.compiler.Clone() + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public')) + return compiler + + def JobMatters(self, jobname): + file = sys._getframe().f_code.co_filename + if AMBuild.mode == 'config': + self.targetMap[jobname] = file + return True + if len(AMBuild.args) == 0: + return True + if not jobname in AMBuild.args: + return False + + def AutoVersion(self, folder, binary): + if AMBuild.target['platform'] != 'windows': + return + env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'MMS_GENERATED_BUILD']} + binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env) + + def PreSetupHL2Job(self, job, builder, sdk): + info = self.sdkInfo[sdk] + sdkPath = AMBuild.cache[info['sdk']] + if AMBuild.target['platform'] == 'linux': + if sdk == 'ep1': + staticLibs = os.path.join(sdkPath, 'linux_sdk') + else: + staticLibs = os.path.join(sdkPath, 'lib', 'linux') + workFolder = os.path.join(AMBuild.outputFolder, job.workFolder) + if sdk == 'ep2v' or sdk == 'l4d2': + for i in ['tier1_i486.a', 'libvstdlib.so', 'libtier0.so']: + link = os.path.join(workFolder, i) + target = os.path.join(staticLibs, i) + try: + os.lstat(link) + except: + job.AddCommand(SymlinkCommand(link, target)) + else: + for i in ['tier1_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']: + link = os.path.join(workFolder, i) + target = os.path.join(staticLibs, i) + try: + os.lstat(link) + except: + 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', 'libvstdlib.dylib', 'libtier0.dylib']: + link = os.path.join(workFolder, i) + target = os.path.join(staticLibs, i) + try: + os.lstat(link) + except: + job.AddCommand(SymlinkCommand(link, target)) + elif AMBuild.target['platform'] == 'windows': + for lib in ['tier0', 'tier1', 'vstdlib']: + libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib' + builder.RebuildIfNewer(libPath) + builder['POSTLINKFLAGS'].append(libPath) + + def PostSetupHL2Job(self, job, builder, sdk): + if AMBuild.target['platform'] in ['linux', 'darwin']: + builder.AddObjectFiles(['tier1_i486.a']) + + def DefaultHL2Compiler(self, path, sdk, noLink = False): + compiler = self.DefaultCompiler() + + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path)) + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path, 'sourcehook')) + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'loader')) + + info = self.sdkInfo + 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']] + if sdk == 'ep1' or sdk == 'darkm': + paths.append(['public', 'dlls']) + paths.append(['game_shared']) + else: + paths.append(['public', 'game', 'server']) + paths.append(['game', 'shared']) + paths.append(['common']) + + info = self.sdkInfo[sdk] + sdkPath = AMBuild.cache[info['sdk']] + + compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def']) + + if sdk == 'ep1': + if AMBuild.target['platform'] == 'linux': + staticLibs = os.path.join(sdkPath, 'linux_sdk') + else: + if AMBuild.target['platform'] == 'linux': + staticLibs = os.path.join(sdkPath, 'lib', 'linux') + elif AMBuild.target['platform'] == 'darwin': + staticLibs = os.path.join(sdkPath, 'lib', 'mac') + + for i in paths: + compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i)) + + if not noLink: + if AMBuild.target['platform'] == 'linux': + compiler['POSTLINKFLAGS'][0:0] = ['-lm'] + if sdk == 'ep2v' or sdk == 'l4d2': + compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so'] + compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so'] + else: + compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so'] + compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so'] + elif AMBuild.target['platform'] == 'darwin': + compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib'] + compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib'] + + return compiler + +mms = MMS() +globals = { + 'MMS': mms +} + +AMBuild.Include(os.path.join('support', 'buildbot', 'Versioning'), globals) + +FileList = [ + ['loader', 'AMBuilder'], + ['core', 'AMBuilder'], + ['core-legacy', 'AMBuilder'], + ['support', 'buildbot', 'PackageScript'] + ] + +for parts in FileList: + AMBuild.Include(os.path.join(*parts), globals) + diff --git a/configure.py b/configure.py new file mode 100644 index 0000000..f0f2aa0 --- /dev/null +++ b/configure.py @@ -0,0 +1,10 @@ +# vim: set ts=2 sw=2 tw=99 noet: +import sys +import ambuild.runner as runner + +run = runner.Runner() +run.options.add_option('--enable-debug', action='store_const', const='1', dest='debug', + help='Enable debugging symbols') +run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt', + help='Enable optimization') +run.Configure(sys.path[0]) diff --git a/core-legacy/AMBuilder b/core-legacy/AMBuilder new file mode 100644 index 0000000..46121f9 --- /dev/null +++ b/core-legacy/AMBuilder @@ -0,0 +1,29 @@ +# vim: set ts=2 sw=2 tw=99 noet ft=python: +import os + +sdk = MMS.sdkInfo['ep1'] + +if AMBuild.target['platform'] in sdk['platform']: + compiler = MMS.DefaultHL2Compiler('core-legacy', 'ep1') + + name = 'metamod.' + sdk['ext'] + + extension = AMBuild.AddJob(name) + binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler) + MMS.PreSetupHL2Job(extension, binary, 'ep1') + files = [ + 'sourcemm.cpp', + 'concommands.cpp', + 'oslink.cpp', + 'util.cpp', + 'CSmmAPI.cpp', + 'CPlugin.cpp', + 'gamedll_bridge.cpp', + 'vsp_bridge.cpp', + 'sourcehook/sourcehook.cpp' + ] + binary.AddSourceFiles('core-legacy', files) + MMS.PostSetupHL2Job(extension, binary, 'ep1') + MMS.AutoVersion('core-legacy', binary) + binary.SendToJob() + diff --git a/core-legacy/version.h b/core-legacy/version.h deleted file mode 100644 index 348c4cd..0000000 --- a/core-legacy/version.h +++ /dev/null @@ -1,12 +0,0 @@ -/** This file is autogenerated by build scripts */ - -#ifndef _INCLUDE_MMS_VERSION_H_ -#define _INCLUDE_MMS_VERSION_H_ - -#define MMS_BUILD_STRING "" -#define MMS_BUILD_UNIQUEID "693:985ad6dcc269" MMS_BUILD_STRING -#define MMS_FULL_VERSION "1.9.0" MMS_BUILD_STRING -#define MMS_FILE_VERSION 1,9,0,0 - -#endif //_INCLUDE_MMS_VERSION_H_ - diff --git a/core-legacy/version.rc b/core-legacy/version.rc index eaab10a..ce93a16 100755 --- a/core-legacy/version.rc +++ b/core-legacy/version.rc @@ -7,7 +7,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "winres.h" -#include "version.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -47,7 +47,7 @@ BEGIN VALUE "FileDescription", "Metamod: Source" VALUE "FileVersion", MMS_FULL_VERSION VALUE "InternalName", "mmsource" - VALUE "LegalCopyright", "Copyright (c) 2004-2008, Metamod: Source Development Team" + VALUE "LegalCopyright", "Copyright (c) 2004-2010, Metamod: Source Development Team" VALUE "OriginalFilename", BINARY_NAME VALUE "ProductName", "Metamod:Source" VALUE "ProductVersion", MMS_FULL_VERSION diff --git a/core-legacy/version.tpl b/core-legacy/version.tpl deleted file mode 100644 index e06da56..0000000 --- a/core-legacy/version.tpl +++ /dev/null @@ -1,12 +0,0 @@ -/** This file is autogenerated by build scripts */ - -#ifndef _INCLUDE_MMS_VERSION_H_ -#define _INCLUDE_MMS_VERSION_H_ - -#define MMS_BUILD_STRING "$BUILD_STRING$" -#define MMS_BUILD_UNIQUEID "$BUILD_ID$" MMS_BUILD_STRING -#define MMS_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING -#define MMS_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0 - -#endif //_INCLUDE_MMS_VERSION_H_ - diff --git a/core/AMBuilder b/core/AMBuilder new file mode 100644 index 0000000..471cecc --- /dev/null +++ b/core/AMBuilder @@ -0,0 +1,33 @@ +# vim: set ts=2 sw=2 tw=99 noet ft=python: +import os + +for i in MMS.sdkInfo: + sdk = MMS.sdkInfo[i] + if AMBuild.target['platform'] not in sdk['platform'] or i == 'ep1': + continue + + name = 'metamod.' + sdk['ext'] + + compiler = MMS.DefaultHL2Compiler('core', i) + + extension = AMBuild.AddJob(name) + binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler) + MMS.PreSetupHL2Job(extension, binary, i) + files = [ + 'metamod.cpp', + 'metamod_console.cpp', + 'metamod_oslink.cpp', + 'metamod_plugins.cpp', + 'metamod_util.cpp', + 'provider/console.cpp', + 'provider/provider_ep2.cpp', + 'sourcehook/sourcehook.cpp', + 'sourcehook/sourcehook_hookmangen.cpp', + 'gamedll_bridge.cpp', + 'vsp_bridge.cpp' + ] + binary.AddSourceFiles('core', files) + MMS.PostSetupHL2Job(extension, binary, i) + MMS.AutoVersion('core', binary) + binary.SendToJob() + diff --git a/core/version.h b/core/version.h deleted file mode 100644 index 348c4cd..0000000 --- a/core/version.h +++ /dev/null @@ -1,12 +0,0 @@ -/** This file is autogenerated by build scripts */ - -#ifndef _INCLUDE_MMS_VERSION_H_ -#define _INCLUDE_MMS_VERSION_H_ - -#define MMS_BUILD_STRING "" -#define MMS_BUILD_UNIQUEID "693:985ad6dcc269" MMS_BUILD_STRING -#define MMS_FULL_VERSION "1.9.0" MMS_BUILD_STRING -#define MMS_FILE_VERSION 1,9,0,0 - -#endif //_INCLUDE_MMS_VERSION_H_ - diff --git a/core/version.rc b/core/version.rc index e36eb14..2e4420e 100755 --- a/core/version.rc +++ b/core/version.rc @@ -7,7 +7,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "winres.h" -#include "version.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -47,7 +47,7 @@ BEGIN VALUE "FileDescription", "Metamod: Source" VALUE "FileVersion", MMS_FULL_VERSION VALUE "InternalName", "mmsource" - VALUE "LegalCopyright", "Copyright (c) 2004-2008, Metamod: Source Development Team" + VALUE "LegalCopyright", "Copyright (c) 2004-2010, Metamod: Source Development Team" VALUE "OriginalFilename", BINARY_NAME VALUE "ProductName", "Metamod:Source" VALUE "ProductVersion", MMS_FULL_VERSION diff --git a/core/version.tpl b/core/version.tpl deleted file mode 100644 index e06da56..0000000 --- a/core/version.tpl +++ /dev/null @@ -1,12 +0,0 @@ -/** This file is autogenerated by build scripts */ - -#ifndef _INCLUDE_MMS_VERSION_H_ -#define _INCLUDE_MMS_VERSION_H_ - -#define MMS_BUILD_STRING "$BUILD_STRING$" -#define MMS_BUILD_UNIQUEID "$BUILD_ID$" MMS_BUILD_STRING -#define MMS_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING -#define MMS_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0 - -#endif //_INCLUDE_MMS_VERSION_H_ - diff --git a/loader/AMBuilder b/loader/AMBuilder new file mode 100644 index 0000000..9cc337e --- /dev/null +++ b/loader/AMBuilder @@ -0,0 +1,31 @@ +# vim: set ts=2 sw=2 tw=99 noet ft=python: +import os.path + +compiler = MMS.DefaultCompiler() +compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'core', 'sourcehook')) +compiler2 = compiler.Clone() + +files = [ + 'loader.cpp', + 'gamedll.cpp', + 'serverplugin.cpp', + 'utility.cpp' + ] + +name = 'server' +loader = AMBuild.AddJob(name) +binary = Cpp.LibraryBuilder(name, AMBuild, loader, compiler) +if AMBuild.target['platform'] == 'linux': + compiler['CDEFINES'].extend(['LIB_PREFIX=\"lib\"', 'LIB_SUFFIX=\".so\"']) +binary.AddSourceFiles('loader', files) +MMS.AutoVersion('loader', binary) +binary.SendToJob() + +if AMBuild.target['platform'] == 'linux': + name = 'server_i486' + loader = AMBuild.AddJob(name) + binary = Cpp.LibraryBuilder(name, AMBuild, loader, compiler2) + compiler2['CDEFINES'].extend(['LIB_PREFIX=\"\"', 'LIB_SUFFIX=\"_i486.so\"']) + binary.AddSourceFiles('loader', files) + MMS.AutoVersion('loader', binary) + binary.SendToJob() diff --git a/loader/version.h b/loader/version.h deleted file mode 100644 index 348c4cd..0000000 --- a/loader/version.h +++ /dev/null @@ -1,12 +0,0 @@ -/** This file is autogenerated by build scripts */ - -#ifndef _INCLUDE_MMS_VERSION_H_ -#define _INCLUDE_MMS_VERSION_H_ - -#define MMS_BUILD_STRING "" -#define MMS_BUILD_UNIQUEID "693:985ad6dcc269" MMS_BUILD_STRING -#define MMS_FULL_VERSION "1.9.0" MMS_BUILD_STRING -#define MMS_FILE_VERSION 1,9,0,0 - -#endif //_INCLUDE_MMS_VERSION_H_ - diff --git a/loader/version.rc b/loader/version.rc index f31dfbc..edd1931 100644 --- a/loader/version.rc +++ b/loader/version.rc @@ -7,7 +7,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "winres.h" -#include "version.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -47,7 +47,7 @@ BEGIN VALUE "FileDescription", "Metamod: Source Loader" VALUE "FileVersion", MMS_FULL_VERSION VALUE "InternalName", "mmsource" - VALUE "LegalCopyright", "Copyright (c) 2004-2008, Metamod: Source Development Team" + VALUE "LegalCopyright", "Copyright (c) 2004-2010, Metamod: Source Development Team" VALUE "OriginalFilename", BINARY_NAME VALUE "ProductName", "Metamod:Source Loader" VALUE "ProductVersion", MMS_FULL_VERSION diff --git a/loader/version.tpl b/loader/version.tpl deleted file mode 100644 index e06da56..0000000 --- a/loader/version.tpl +++ /dev/null @@ -1,12 +0,0 @@ -/** This file is autogenerated by build scripts */ - -#ifndef _INCLUDE_MMS_VERSION_H_ -#define _INCLUDE_MMS_VERSION_H_ - -#define MMS_BUILD_STRING "$BUILD_STRING$" -#define MMS_BUILD_UNIQUEID "$BUILD_ID$" MMS_BUILD_STRING -#define MMS_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING -#define MMS_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0 - -#endif //_INCLUDE_MMS_VERSION_H_ - diff --git a/modules.versions b/modules.versions deleted file mode 100644 index e752dac..0000000 --- a/modules.versions +++ /dev/null @@ -1,19 +0,0 @@ -[PRODUCT] -major = 1 -minor = 9 -revision = 0 - -[core] -folder = core -in = version.tpl -out = version.h - -[core-legacy] -folder = core-legacy -in = version.tpl -out = version.h - -[loader] -folder = loader -in = version.tpl -out = version.h diff --git a/product.version b/product.version index f8e233b..b57588e 100644 --- a/product.version +++ b/product.version @@ -1 +1 @@ -1.9.0 +1.9.0-dev diff --git a/public/metamod_version.h b/public/metamod_version.h new file mode 100644 index 0000000..0957c96 --- /dev/null +++ b/public/metamod_version.h @@ -0,0 +1,44 @@ +/** + * vim: set ts=4 sw=4 tw=99 noet : + * ====================================================== + * Metamod:Source + * Copyright (C) 2004-2010 AlliedModders LLC and authors. + * All rights reserved. + * ====================================================== + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from + * the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in a + * product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef _INCLUDE_METAMOD_VERSION_INFORMATION_H_ +#define _INCLUDE_METAMOD_VERSION_INFORMATION_H_ + +/** + * @file Contains Metamod version information. + * @brief This file will redirect to an autogenerated version if being compiled via + * the build scripts. + */ + +#if defined MMS_GENERATED_BUILD +#include +#else +#define MMS_BUILD_STRING "-pdev" +#define MMS_BUILD_UNIQUEID "701:46ea970e0eb6" MMS_BUILD_STRING +#define MMS_FULL_VERSION "1.9.0" MMS_BUILD_STRING +#define MMS_FILE_VERSION 1,9,0,0 +#endif + +#endif /* _INCLUDE_METAMOD_VERSION_INFORMATION_H_ */ diff --git a/support/pushbuild.txt b/pushbuild.txt similarity index 100% rename from support/pushbuild.txt rename to pushbuild.txt diff --git a/support/buildbot/PackageScript b/support/buildbot/PackageScript new file mode 100644 index 0000000..7f35d19 --- /dev/null +++ b/support/buildbot/PackageScript @@ -0,0 +1,112 @@ +# vim: set ts=2 sw=2 tw=99 noet ft=python: +import os +import shutil +import ambuild.osutil as osutil +from ambuild.command import Command + +job = AMBuild.AddJob('package') + +class DestroyPath(Command): + def __init__(self, folder): + Command.__init__(self) + self.folder = folder + + def destroy(self, path): + entries = os.listdir(path) + for entry in entries: + newpath = os.path.join(path, entry) + if os.path.isdir(newpath): + self.destroy(newpath) + os.rmdir(newpath) + elif os.path.isfile(newpath): + os.remove(newpath) + + def run(self, runner, job): + runner.PrintOut('rm -rf {0}/*'.format(self.folder)) + self.destroy(self.folder) + +class CreateFolders(Command): + def __init__(self, folders): + Command.__init__(self) + self.folders = folders + + def run(self, runner, job): + for folder in self.folders: + path = os.path.join(*folder) + runner.PrintOut('mkdir {0}'.format(path)) + os.makedirs(path) + +#Shallow folder copy +class CopyFolder(Command): + def __init__(self, fromList, toList, excludes = []): + Command.__init__(self) + self.fromPath = os.path.join(AMBuild.sourceFolder, *fromList) + self.toPath = os.path.join(*toList) + self.excludes = excludes + + def run(self, runner, job): + entries = os.listdir(self.fromPath) + for entry in entries: + if entry in self.excludes: + continue + path = os.path.join(self.fromPath, entry) + if not os.path.isfile(path): + continue + runner.PrintOut('copy {0} to {1}'.format(path, self.toPath)) + shutil.copy(path, self.toPath) + +#Single file copy +class CopyFile(Command): + def __init__(self, fromFile, toPath): + Command.__init__(self) + self.fromFile = fromFile + self.toPath = toPath + + def run(self, runner, job): + runner.PrintOut('copy {0} to {1}'.format(self.fromFile, self.toPath)) + shutil.copy(self.fromFile, self.toPath) + + +folders = [['addons', 'metamod', 'bin']] + +#Setup +job.AddCommand(DestroyPath(os.path.join(AMBuild.outputFolder, 'package'))) +job.AddCommand(CreateFolders(folders)) + +#Copiy Files +job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'support', 'metaplugins.ini'), + os.path.join('addons', 'metamod'))) +job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'support', 'README.txt'), + os.path.join('addons', 'metamod'))) + +bincopies = [] + +def AddNormalLibrary(name, dest): + dest = os.path.join('addons', 'metamod', dest) + bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest)) + pdb_list.append(name + '\\' + name + '.pdb') + +def AddHL2Library(name, dest): + for i in MMS.sdkInfo: + sdk = MMS.sdkInfo[i] + if AMBuild.target['platform'] not in sdk['platform']: + continue + AddNormalLibrary(name + '.' + sdk['ext'], dest) + +pdb_list = [] + +# Copy loader binaries +AddNormalLibrary('server', 'bin') +if AMBuild.target['platform'] == 'linux': + AddNormalLibrary('server_i486', 'bin') + +AddHL2Library('metamod', 'bin') + +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() + diff --git a/support/buildbot/Versioning b/support/buildbot/Versioning new file mode 100644 index 0000000..843ad16 --- /dev/null +++ b/support/buildbot/Versioning @@ -0,0 +1,57 @@ +# 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, '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.outputFolder, 'includes') + if not os.path.isdir(incFolder): + os.makedirs(incFolder) + incFile = open(os.path.join(incFolder, 'metamod_version_auto.h'), 'w') + incFile.write(""" +#ifndef _METAMOD_AUTO_VERSION_INFORMATION_H_ +#define _METAMOD_AUTO_VERSION_INFORMATION_H_ + +#define MMS_BUILD_STRING \"{0}\" +#define MMS_BUILD_UNIQUEID \"{1}:{2}\" MMS_BUILD_STRING +#define MMS_FULL_VERSION \"{3}.{4}.{5}\" MMS_BUILD_STRING +#define MMS_FILE_VERSION {6},{7},{8},0 + +#endif /* _METAMOD_AUTO_VERSION_INFORMATION_H_ */ + +""".format(tag, rev, cset, major, minor, release, major, minor, release)) + incFile.close() + + cache.WriteCache() + +PerformReversioning() + + diff --git a/support/buildbot/bootstrap.pl b/support/buildbot/bootstrap.pl index 0bf7eff..87f699b 100755 --- a/support/buildbot/bootstrap.pl +++ b/support/buildbot/bootstrap.pl @@ -1,24 +1,75 @@ #!/usr/bin/perl +# vim: set ts=2 sw=2 tw=99 noet: use strict; use Cwd; use File::Basename; +use File::Path; my ($myself, $path) = fileparse($0); chdir($path); require 'helpers.pm'; -#Go to main source dir -chdir(Build::PathFormat('../..')); +#Go back above build dir +chdir(Build::PathFormat('../../..')); -#Do the annoying revision bumping. -#Linux needs some help here. -if ($^O eq "linux") -{ - Build::Command("flip -u modules.versions"); - Build::Command("flip -u support/versionchanger.pl"); - Build::Command("chmod +x support/versionchanger.pl"); +#Get the source path. +our ($root) = getcwd(); + +my $reconf = 0; + +#Create output folder if it doesn't exist. +if (!(-d 'OUTPUT')) { + $reconf = 1; +} else { + if (-f 'OUTPUT/sentinel') { + my @s = stat('OUTPUT/sentinel'); + my $mtime = $s[9]; + my @files = ('build/pushbuild.txt', 'build/AMBuildScript', 'build/product.version'); + my ($i); + for ($i = 0; $i <= $#files; $i++) { + if (IsNewer($files[$i], $mtime)) { + $reconf = 1; + last; + } + } + } else { + $reconf = 1; + } } -Build::Command(Build::PathFormat('support/versionchanger.pl') . ' --buildstring="-dev"'); + +if ($reconf) { + rmtree('OUTPUT'); + mkdir('OUTPUT') or die("Failed to create output folder: $!\n"); + chdir('OUTPUT'); + my ($result); + print "Attempting to reconfigure...\n"; + if ($^O eq "linux") { + $result = `CC=gcc-4.1 CXX=gcc-4.1 python3.1 ../build/configure.py --enable-optimize`; + } elsif ($^O eq "darwin") { + $result = `CC=gcc-4.2 CXX=gcc-4.2 python3.1 ../build/configure.py --enable-optimize`; + } else { + $result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`; + } + print "$result\n"; + if ($? != 0) { + die('Could not configure!'); + } + open(FILE, '>sentinel'); + print FILE "this is nothing.\n"; + close(FILE); +} + +sub IsNewer +{ + my ($file, $time) = (@_); + + my @s = stat($file); + my $mtime = $s[9]; + return $mtime > $time; +} + +exit(0); + diff --git a/support/buildbot/build_type b/support/buildbot/build_type new file mode 100644 index 0000000..38f8e88 --- /dev/null +++ b/support/buildbot/build_type @@ -0,0 +1 @@ +dev diff --git a/support/buildbot/helpers.pm b/support/buildbot/helpers.pm index 704a7b1..c30bbd5 100644 --- a/support/buildbot/helpers.pm +++ b/support/buildbot/helpers.pm @@ -142,4 +142,15 @@ sub SVN_Add chdir($dir); } +sub GetBuildType +{ + my ($file)=(@_); + my ($type); + open(TYPE, $file) or die("Could not open file: $!\n"); + $type = ; + close(TYPE); + chomp $type; + return $type; +} + return 1; diff --git a/support/buildbot/package.pl b/support/buildbot/package.pl index 46a3426..284c1cc 100755 --- a/support/buildbot/package.pl +++ b/support/buildbot/package.pl @@ -27,12 +27,13 @@ chdir($path); require 'helpers.pm'; #Switch to the output folder. -chdir(Build::PathFormat('../../OUTPUT')); +chdir(Build::PathFormat('../../../OUTPUT/package')); my ($version); -$version = Build::ProductVersion(Build::PathFormat('../product.version')); -$version .= '-hg' . Build::HgRevNum('..'); +$version = Build::ProductVersion(Build::PathFormat('../../build/product.version')); +$version =~ s/-dev//g; +$version .= '-hg' . Build::HgRevNum('../../build'); # Append OS to package version if ($^O eq "darwin") diff --git a/support/buildbot/startbuild.pl b/support/buildbot/startbuild.pl index 9f0da5c..e612606 100755 --- a/support/buildbot/startbuild.pl +++ b/support/buildbot/startbuild.pl @@ -1,183 +1,27 @@ #!/usr/bin/perl +# vim: set ts=2 sw=2 tw=99 noet: use File::Basename; -our (@LIBRARIES); my ($myself, $path) = fileparse($0); chdir($path); require 'helpers.pm'; -#Get to top of source tree -chdir('..'); -chdir('..'); +chdir('../../../OUTPUT'); -# Folder .vcproj Engine Binary Suffix type Platform -Build('loader', 'mm_loader', '', 'server', 'full', 'both'); -Build('loader', 'mm_loader', 'Left4Dead2', 'server', '', 'linux'); -Build('core-legacy', 'mm_core-legacy', '', 'metamod.1.ep1', '', 'both'); -Build('core', 'mm_core', 'OrangeBox', 'metamod.2.ep2', '', 'both'); -Build('core', 'mm_core', 'OrangeBoxValve', 'metamod.2.ep2v', '', 'both'); -Build('core', 'mm_core', 'Left4Dead', 'metamod.2.l4d', '', 'both'); -Build('core', 'mm_core', 'Left4Dead2', 'metamod.2.l4d2', '', 'both'); -Build('core', 'mm_core', 'DarkMessiah', 'metamod.2.darkm', '', 'windows'); - -#Structure our output folder -mkdir('OUTPUT'); -mkdir(Build::PathFormat('OUTPUT/addons')); -mkdir(Build::PathFormat('OUTPUT/addons/metamod')); -mkdir(Build::PathFormat('OUTPUT/addons/metamod/bin')); - -my ($i); -for ($i = 0; $i <= $#LIBRARIES; $i++) -{ - my $library = $LIBRARIES[$i]; - Copy($library, Build::PathFormat('OUTPUT/addons/metamod/bin')); -} -Copy(Build::PathFormat('support/metaplugins.ini'), - Build::PathFormat('OUTPUT/addons/metamod')); -Copy(Build::PathFormat('support/README.txt'), - Build::PathFormat('OUTPUT/addons/metamod')); - -sub Copy -{ - my ($a, $b) = (@_); - - die "Could not copy $a to $b!\n" if (!Build::Copy($a, $b)); +if ($^O eq "linux" || $^O eq "darwin") { + system("python3.1 build.py 2>&1"); +} else { + system("C:\\Python31\\python.exe build.py 2>&1"); } -sub Build +if ($? != 0) { - my ($srcdir, $vcproj, $objdir, $binary, $suffix, $platform) = (@_); - - if ($^O eq "linux") - { - if ($platform eq "windows") - { - return; - } - - if ($suffix eq 'full') - { - $binary .= '_i486.so'; - } - else - { - $binary .= '.so'; - } - - BuildLinux($srcdir, $objdir, $binary); - } - else - { - if ($platform eq "linux") - { - return; - } - - $binary .= '.dll'; - BuildWindows($srcdir, $vcproj, $objdir, $binary); - } -} - -sub BuildWindows -{ - my ($srcdir, $vcproj, $build, $binary) = (@_); - my ($dir, $file, $param, $vcbuilder, $cmd); - - $dir = getcwd(); - chdir("$srcdir\\msvc9"); - - $param = "Release"; - if ($build eq "OrangeBox") - { - $param = "Release - Orange Box"; - } - if ($build eq "OrangeBoxValve") - { - $param = "Release - Orange Box Valve"; - } - elsif ($build eq "Left4Dead") - { - $param = "Release - Left 4 Dead"; - } - elsif ($build eq "Left4Dead2") - { - $param = "Release - Left 4 Dead 2"; - } - elsif ($build eq "DarkMessiah") - { - $param = "Release - Dark Messiah"; - } - - print "Clean building $srcdir...\n"; - $vcbuilder = $ENV{'VC9BUILDER'}; - $cmd = "\"$vcbuilder\" /rebuild \"$vcproj.vcproj\" \"$param\""; - print "$cmd\n"; - system($cmd); - CheckFailure(); - - $file = "$param\\$binary"; - - die "Output library not found: $file\n" if (!-f $file); - - chdir($dir); - - push(@LIBRARIES, "$srcdir\\msvc9\\$file"); -} - -sub BuildLinux -{ - my ($srcdir, $build, $binary) = (@_); - my ($dir, $file, $param); - - $dir = getcwd(); - chdir($srcdir); - - $param = ""; - $file = "Release"; - if ($build eq "OrangeBox") - { - $param = "ENGINE=orangebox"; - $file .= '.orangebox'; - } - if ($build eq "OrangeBoxValve") - { - $param = "ENGINE=orangeboxvalve"; - $file .= '.orangeboxvalve'; - } - elsif ($build eq "Left4Dead") - { - $param = "ENGINE=left4dead"; - $file .= '.left4dead'; - } - elsif ($build eq "Left4Dead2") - { - $param = "ENGINE=left4dead2"; - $file .= '.left4dead2'; - } - $file .= '/' . $binary; - - print "Cleaning $srcdir...\n"; - system("make $param clean"); - CheckFailure(); - - print "Building $srcdir for $binary...\n"; - print "$param\n"; - system("make $param"); - CheckFailure(); - - die "Output library not found: $file\n" if (!-f $file); - - chdir($dir); - - push(@LIBRARIES, $srcdir . '/' . $file); -} - -sub CheckFailure -{ - die "Build failed: $!\n" if $? == -1; - die "Build died :(\n" if $^O eq "linux" and $? & 127; - die "Build failed with exit code: " . ($? >> 8) . "\n" if ($? >> 8 != 0); + die "Build failed: $!\n"; +} +else +{ + exit(0); } diff --git a/support/buildbot/symstore.pl b/support/buildbot/symstore.pl index eb4e6cf..6f75049 100755 --- a/support/buildbot/symstore.pl +++ b/support/buildbot/symstore.pl @@ -12,21 +12,39 @@ chdir('..'); our $SSH = 'ssh -i ../../mmspvkey'; +open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n"; + #Sync us up with the main symbol store rsync('sourcemm@alliedmods.net:~/public_html/symbols/', '..\\..\\symstore'); #Get version info my ($version); $version = Build::ProductVersion(Build::PathFormat('product.version')); +$version =~ s/-dev//g; $version .= '-hg' . Build::HgRevNum('.'); -symstore("loader\\msvc9\\server.*", $version); -symstore("core-legacy\\msvc9\\Release\\metamod.1.ep1.*", $version); -symstore("core\\msvc9\\Release - Dark Messiah\\metamod.2.darkm.*", $version); -symstore("core\\msvc9\\Release - Orange Box\\metamod.2.ep2.*", $version); -symstore("core\\msvc9\\Release - Orange Box Valve\\metamod.2.ep2v.*", $version); -symstore("core\\msvc9\\Release - Left 4 Dead\\metamod.2.l4d.*", $version); -symstore("core\\msvc9\\Release - Left 4 Dead 2\\metamod.2.l4d2.*", $version); +my ($build_type); +$build_type = Build::GetBuildType(Build::PathFormat('support/buildbot/build_type')); + +if ($build_type eq "dev") +{ + $build_type = "buildbot"; +} +elsif ($build_type eq "rel") +{ + $build_type = "release"; +} + +my ($line); +while () +{ + $line = $_; + $line =~ s/\.pdb/\*/; + chomp $line; + Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s ..\\..\\symstore /t \"Metamod:Source\" /v \"$version\" /c \"$build_type\""); +} + +close(PDBLOG); #Lowercase DLLs. Sigh. my (@files); @@ -53,12 +71,6 @@ for ($i = 0; $i <= $#files; $i++) #Now that we're done, rsync back. rsync('../../symstore/', 'sourcemm@alliedmods.net:~/public_html/symbols'); -sub symstore -{ - my ($line, $version) = (@_); - Build::Command("symstore add /r /f \"$line\" /s ..\\..\\symstore /t \"Metamod:Source\" /v \"$version\" /c \"buildbot\""); -} - sub rsync { my ($from, $to) = (@_); diff --git a/support/versionchanger.pl b/support/versionchanger.pl deleted file mode 100755 index ce5f6f6..0000000 --- a/support/versionchanger.pl +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/perl - -our %arguments = -( - 'config' => 'modules.versions', - 'major' => '1', - 'minor' => '0', - 'revision' => '0', - 'build' => undef, - 'path' => '', - 'buildstring' => '', -); - -my $arg; -foreach $arg (@ARGV) -{ - $arg =~ s/--//; - @arg = split(/=/, $arg); - $arguments{$arg[0]} = $arg[1]; -} - -#Set up path info -if ($arguments{'path'} ne "") -{ - if (!(-d $arguments{'path'})) - { - die "Unable to find path: " . $arguments{'path'} ."\n"; - } - chdir($arguments{'path'}); -} - -if (!open(CONFIG, $arguments{'config'})) -{ - die "Unable to open config file for reading: " . $arguments{'config'} . "\n"; -} - -our %modules; -my $cur_module = undef; -my $line; -while () -{ - chomp; - $line = $_; - if ($line =~ /^\[([^\]]+)\]$/) - { - $cur_module = $1; - next; - } - if (!$cur_module) - { - next; - } - if ($line =~ /^([^=]+) = (.+)$/) - { - $modules{$cur_module}{$1} = $2; - } -} - -close(CONFIG); - -#Copy global configuration options... -if (exists($modules{'PRODUCT'})) -{ - if (exists($modules{'PRODUCT'}{'major'})) - { - $arguments{'major'} = $modules{'PRODUCT'}{'major'}; - } - if (exists($modules{'PRODUCT'}{'minor'})) - { - $arguments{'minor'} = $modules{'PRODUCT'}{'minor'}; - } - if (exists($modules{'PRODUCT'}{'revision'})) - { - $arguments{'revision'} = $modules{'PRODUCT'}{'revision'}; - } -} - -#Get the global SVN revision if we have none -my $rev; -if ($arguments{'build'} == undef) -{ - my ($text); - $text = `hg identif -n -i`; - chomp $text; - $text =~ s/\+//g; - my ($id,$num) = split(/ /, $text); - $rev = "$num:$id"; -} -else -{ - $rev = int($arguments{'build'}); -} - -my $major = $arguments{'major'}; -my $minor = $arguments{'minor'}; -my $revision = $arguments{'revision'}; -my $buildstr = $arguments{'buildstring'}; - -#Go through everything now -my $mod_i; -while ( ($cur_module, $mod_i) = each(%modules) ) -{ - #Skip the magic one - if ($cur_module eq "PRODUCT") - { - next; - } - #Prepare path - my %mod = %{$mod_i}; - my $infile = $mod{'in'}; - my $outfile = $mod{'out'}; - if ($mod{'folder'}) - { - if (!(-d $mod{'folder'})) - { - die "Folder " . $mod{'folder'} . " not found.\n"; - } - $infile = $mod{'folder'} . '/' . $infile; - $outfile = $mod{'folder'} . '/' . $outfile; - } - if (!(-f $infile)) - { - die "File $infile is not a file.\n"; - } - #Start rewriting - open(INFILE, $infile) or die "Could not open file for reading: $infile\n"; - open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n"; - while () - { - s/\$PMAJOR\$/$major/g; - s/\$PMINOR\$/$minor/g; - s/\$PREVISION\$/$revision/g; - s/\$BUILD_ID\$/$rev/g; - s/\$BUILD_STRING\$/$buildstr/g; - print OUTFILE $_; - } - close(OUTFILE); - close(INFILE); -} -