Permalink
Browse files

Backport AMBuild 2 build scripts.

  • Loading branch information...
dvander committed Nov 20, 2013
1 parent 2bd02e1 commit 8cd35971a5714ce24f4baf0a5dd773f674674c3f
Showing with 496 additions and 733 deletions.
  1. +366 −447 AMBuildScript
  2. +15 −4 configure.py
  3. +18 −29 core-legacy/AMBuilder
  4. +26 −33 core/AMBuilder
  5. +17 −26 loader/AMBuilder
  6. +15 −104 support/buildbot/PackageScript
  7. +33 −57 support/buildbot/Versioning
  8. +5 −28 support/buildbot/bootstrap.pl
  9. +1 −5 support/buildbot/startbuild.pl
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,13 +1,24 @@
# vim: set ts=2 sw=2 tw=99 noet:
# vim: set sts=2 ts=8 sw=2 tw=99 et:
import sys
import ambuild.runner as runner
try:
from ambuild2 import run
except:
try:
import ambuild
sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
except:
sys.stderr.write('AMBuild must be installed to build this project.\n')
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
sys.exit(1)
run = runner.Runner()
run = run.PrepareBuild(sourcePath=sys.path[0])
run.default_build_folder = 'obj-' + run.target_platform
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.options.add_option('-s', '--sdks', default='all', dest='sdks',
help='Build against specified SDKs; valid args are "all", "present", or '
'comma-delimited list of engine names (default: %default)')
run.Configure(sys.path[0])
run.Configure()
View
@@ -1,31 +1,20 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
try:
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()
except KeyError:
pass
if 'ep1' in MMS.sdks:
sdk = MMS.sdks['ep1']
name = 'metamod.' + sdk.ext
binary = MMS.HL2Library(builder, name, sdk)
binary.sources += [
'sourcemm.cpp',
'concommands.cpp',
'oslink.cpp',
'util.cpp',
'CSmmAPI.cpp',
'CPlugin.cpp',
'gamedll_bridge.cpp',
'vsp_bridge.cpp',
'sourcehook/sourcehook.cpp',
]
nodes = builder.Add(binary)
MMS.binaries += [nodes]
View
@@ -1,37 +1,30 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et 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
for sdk_name in MMS.sdks:
sdk = MMS.sdks[sdk_name]
if sdk.name == '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',
'sourcehook/sourcehook_impl_chookidman.cpp',
'sourcehook/sourcehook_impl_chookmaninfo.cpp',
'sourcehook/sourcehook_impl_cproto.cpp',
'sourcehook/sourcehook_impl_cvfnptr.cpp',
'gamedll_bridge.cpp',
'vsp_bridge.cpp'
]
binary.AddSourceFiles('core', files)
MMS.PostSetupHL2Job(extension, binary, i)
MMS.AutoVersion('core', binary)
binary.SendToJob()
name = 'metamod.' + sdk.ext
binary = MMS.HL2Library(builder, name, sdk)
binary.sources += [
'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',
'sourcehook/sourcehook_impl_chookidman.cpp',
'sourcehook/sourcehook_impl_chookmaninfo.cpp',
'sourcehook/sourcehook_impl_cproto.cpp',
'sourcehook/sourcehook_impl_cvfnptr.cpp',
'gamedll_bridge.cpp',
'vsp_bridge.cpp'
]
nodes = builder.Add(binary)
MMS.binaries += [nodes]
View
@@ -1,31 +1,22 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os.path
compiler = MMS.DefaultCompiler()
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'core', 'sourcehook'))
compiler2 = compiler.Clone()
def configure_library(name, linux_defines):
binary = MMS.Library(builder, name)
binary.compiler.cxxincludes += [os.path.join(builder.sourcePath, 'core', 'sourcehook')]
binary.sources += [
'loader.cpp',
'gamedll.cpp',
'serverplugin.cpp',
'utility.cpp',
]
files = [
'loader.cpp',
'gamedll.cpp',
'serverplugin.cpp',
'utility.cpp'
]
if builder.target_platform == 'linux':
binary.compiler.defines += linux_defines
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()
nodes = builder.Add(binary)
MMS.binaries += [nodes]
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()
configure_library('server', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])
if builder.target_platform == 'linux':
configure_library('server_i486', ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"'])
@@ -1,114 +1,25 @@
# 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')
builder.SetBuildFolder('package')
class DestroyPath(Command):
def __init__(self, folder):
Command.__init__(self)
self.folder = folder
addons_folder = builder.AddFolder('addons')
metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
bin_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin'))
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))
#Copy Files
job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'support', 'metamod.vdf'),
os.path.join('addons')))
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)
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod.vdf'), addons_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metaplugins.ini'), metamod_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'README.txt'), metamod_folder)
pdb_list = []
for task in MMS.binaries:
builder.AddCopy(task.binary, bin_folder)
# Copy loader binaries
AddNormalLibrary('server', 'bin')
if AMBuild.target['platform'] == 'linux':
AddNormalLibrary('server_i486', 'bin')
AddHL2Library('metamod', 'bin')
job.AddCommandGroup(bincopies)
if task.debug:
pdb_list.extend(task.debug)
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()
# Generate PDB info.
with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt') as fp:
for line in pdb_list:
fp.write(line.path + '\n')
Oops, something went wrong.

0 comments on commit 8cd3597

Please sign in to comment.