2010-05-14 07:34:36 +02:00
|
|
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
|
|
|
import os
|
|
|
|
|
2013-11-18 18:46:46 +01:00
|
|
|
builder.SetBuildFolder('package')
|
2010-05-14 07:34:36 +02:00
|
|
|
|
2023-09-29 04:42:30 +02:00
|
|
|
def deduce_target_sdk(path):
|
2023-10-11 07:17:27 +02:00
|
|
|
for sdk_name in MMS.sdks:
|
|
|
|
sdk = MMS.sdks[sdk_name]
|
|
|
|
if ('metamod.' + sdk['extension']) in path:
|
|
|
|
return sdk
|
|
|
|
return None
|
2023-09-29 04:42:30 +02:00
|
|
|
|
2013-11-18 18:46:46 +01:00
|
|
|
addons_folder = builder.AddFolder('addons')
|
|
|
|
metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
|
|
|
|
bin_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin'))
|
2010-05-14 07:34:36 +02:00
|
|
|
|
2020-08-19 22:34:12 +02:00
|
|
|
for cxx in MMS.all_targets:
|
2023-10-11 07:17:27 +02:00
|
|
|
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'))
|
2017-12-20 08:11:57 +01:00
|
|
|
|
2013-11-18 18:46:46 +01:00
|
|
|
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)
|
2010-05-14 07:34:36 +02:00
|
|
|
|
|
|
|
pdb_list = []
|
2013-11-18 18:46:46 +01:00
|
|
|
for task in MMS.binaries:
|
2023-10-11 07:17:27 +02:00
|
|
|
sdk = deduce_target_sdk(task.binary.path)
|
2023-09-29 04:42:30 +02:00
|
|
|
|
2023-10-11 07:17:27 +02:00
|
|
|
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)
|
2010-05-14 07:34:36 +02:00
|
|
|
|
2023-10-11 07:17:27 +02:00
|
|
|
if task.debug:
|
|
|
|
pdb_list.append(task.debug)
|
2010-05-14 07:34:36 +02:00
|
|
|
|
2013-11-18 18:46:46 +01:00
|
|
|
# Generate PDB info.
|
|
|
|
with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt') as fp:
|
2023-10-11 07:17:27 +02:00
|
|
|
for line in pdb_list:
|
|
|
|
fp.write(line.path + '\n')
|
2010-05-14 07:34:36 +02:00
|
|
|
|