1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-12 00:08:50 +01:00
HLMetaModOfficial/support/buildbot/PackageScript
David Anderson 1aae42c579
Switch to a manifest-based build model. (#131)
Rather than hardcode a bunch of SDK stuff, this is an attempt to move
SDK information to a declarative model. Each SDK gets a manifest, and
the manifests are stored in a shared repository.

Manifests encode stuff like "what platforms does this SDK build on" and
"what link flags do I need on each architecture".

This will hopefully reduce the complexity of the build scripts, since
going forward we only have to add new manifests, rather than figure out
how to attach more gunk into the build logic.
2023-10-10 22:17:27 -07:00

61 lines
2.7 KiB
Python

# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
builder.SetBuildFolder('package')
def deduce_target_sdk(path):
for sdk_name in MMS.sdks:
sdk = MMS.sdks[sdk_name]
if ('metamod.' + sdk['extension']) in path:
return sdk
return None
addons_folder = builder.AddFolder('addons')
metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
bin_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin'))
for cxx in MMS.all_targets:
if cxx.target.arch == 'x86_64':
if cxx.target.platform == 'windows':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'win64'))
bin64_s2_folder = bin64_folder
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_win64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
elif cxx.target.platform == 'linux':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'linux64'))
bin64_s2_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'linuxsteamrt64'))
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_linux64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
elif cxx.target.platform == 'mac':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'osx64'))
bin64_s2_folder = bin64_folder
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_osx64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
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:
sdk = deduce_target_sdk(task.binary.path)
if task.target.arch == 'x86_64':
# libserver check is a hack to make sure that binary ends up in the correct folder
# as s2 folders differ to s1 layout
if 'libserver' in task.binary.path or (sdk is not None and sdk.get('source2', False)):
builder.AddCopy(task.binary, bin64_s2_folder)
else:
builder.AddCopy(task.binary, bin64_folder)
else:
builder.AddCopy(task.binary, bin_folder)
if task.debug:
pdb_list.append(task.debug)
# 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')